Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
KingsMentor committed Nov 1, 2016
1 parent 0125ffe commit 95baa37
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
* Created by zone2 on 10/2/16.
*/

public class MergeIntent {
public class MergeIntent extends ManipUtils {

public static List<ResolveIntent> mergeIntents(Context context, Intent... intents) {

PackageManager packageManager = context.getPackageManager();


List<ResolveIntent> resolveIntents = new ArrayList<>();
for (Intent intent : intents) {
List<ResolveInfo> listCam = packageManager.queryIntentActivities(intent, 0);
Expand All @@ -29,4 +30,24 @@ public static List<ResolveIntent> mergeIntents(Context context, Intent... intent
}
return resolveIntents;
}

public static List<ResolveIntent> distinctMerge(Context context, Intent... intents) {

PackageManager packageManager = context.getPackageManager();


ArrayList<String> intentsNameLog = new ArrayList<>();
List<ResolveIntent> resolveIntents = new ArrayList<>();
for (Intent intent : intents) {
List<ResolveInfo> listCam = packageManager.queryIntentActivities(intent, 0);
for (ResolveInfo res : listCam) {
if (!intentsNameLog.contains(getPackageName(res))) {
intentsNameLog.add(getPackageName(res));
resolveIntents.add(new ResolveIntent(res, intent));
}
}
}
intentsNameLog.clear();
return resolveIntents;
}
}

0 comments on commit 95baa37

Please sign in to comment.