Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2fb5474

Browse filesBrowse files
author
Blankj
committed
see 03/28 log
1 parent 258c50d commit 2fb5474
Copy full SHA for 2fb5474

2 files changed

+10-7Lines changed: 10 additions & 7 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎utilcode/src/main/java/com/blankj/utilcode/util/ActivityUtils.java‎

Copy file name to clipboardExpand all lines: utilcode/src/main/java/com/blankj/utilcode/util/ActivityUtils.java
+10-1Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.blankj.utilcode.util;
22

33
import android.app.Activity;
4+
import android.content.ComponentName;
45
import android.content.Intent;
56
import android.content.pm.PackageManager;
67
import android.content.pm.ResolveInfo;
@@ -60,7 +61,7 @@ public static void launchActivity(String packageName, String className) {
6061
* @param bundle bundle
6162
*/
6263
public static void launchActivity(String packageName, String className, Bundle bundle) {
63-
Utils.getContext().startActivity(IntentUtils.getComponentIntent(packageName, className, bundle));
64+
Utils.getContext().startActivity(getComponentIntent(packageName, className, bundle));
6465
}
6566

6667
/**
@@ -116,4 +117,12 @@ public static Activity getTopActivity() {
116117
}
117118
return null;
118119
}
120+
121+
private static Intent getComponentIntent(String packageName, String className, Bundle bundle) {
122+
Intent intent = new Intent(Intent.ACTION_VIEW);
123+
if (bundle != null) intent.putExtras(bundle);
124+
ComponentName cn = new ComponentName(packageName, className);
125+
intent.setComponent(cn);
126+
return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
127+
}
119128
}
Collapse file

‎utilcode/src/main/java/com/blankj/utilcode/util/Utils.java‎

Copy file name to clipboardExpand all lines: utilcode/src/main/java/com/blankj/utilcode/util/Utils.java
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
public final class Utils {
1414

1515
private static Context context;
16-
private static SPUtils spUtils;
1716

1817
private Utils() {
1918
throw new UnsupportedOperationException("u can't instantiate me...");
@@ -26,7 +25,6 @@ private Utils() {
2625
*/
2726
public static void init(Context context) {
2827
Utils.context = context.getApplicationContext();
29-
spUtils = new SPUtils("utilcode");
3028
}
3129

3230
/**
@@ -38,8 +36,4 @@ public static Context getContext() {
3836
if (context != null) return context;
3937
throw new NullPointerException("u should init first");
4038
}
41-
42-
public static SPUtils getSpUtils() {
43-
return spUtils;
44-
}
4539
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.