Back to project page Sharinger.
The source code is released under:
Apache License
If you think the Android project Sharinger listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package mobi.tarantio.tools.sharinger.app; /*from ww w. j a va 2 s . c o m*/ import android.content.pm.ResolveInfo; import java.util.ArrayList; import java.util.List; /** * ?????? ???????? ???????? ???? ???? * Created by kolipass on 15.06.14. */ public class ShareIntentListBuilder { private CheckDecorator checkDecorator = new CheckNonExported(new CheckSharingerPackage(null)); public ShareIntentListBuilder() { CheckDecorator checkDecorator = new CheckNonExported(new CheckSharingerPackage(null)); } /** * ???????????? ?? ???????. ????? ????? ?? ??????????? ???????????? ????????? * * @param checkDecorator */ public ShareIntentListBuilder(CheckDecorator checkDecorator) { this.checkDecorator = checkDecorator; } public List<ResolveInfo> build(List<ResolveInfo> activities) { List<ResolveInfo> resolveInfos = new ArrayList<ResolveInfo>(); for (ResolveInfo info : activities) { if (checkDecorator == null || checkDecorator.check(info)) { resolveInfos.add(info); } } return resolveInfos; } interface Checker { public boolean check(ResolveInfo info); } abstract class CheckDecorator implements Checker { protected Checker decorator; protected CheckDecorator(Checker decorator) { this.decorator = decorator; } public boolean check(ResolveInfo info) { return info != null && (decorator == null || decorator.check(info)); } } /** * ??????, ??? ???????????? ?? ???????????????? ???????? */ class CheckNonExported extends CheckDecorator { protected CheckNonExported(Checker decorator) { super(decorator); } @Override public boolean check(ResolveInfo info) { return super.check(info) && info.activityInfo.exported; } } /** * ??????, ??? ???????????? ????? ???????? Sharinger'? */ class CheckSharingerPackage extends CheckDecorator { protected CheckSharingerPackage(Checker decorator) { super(decorator); } @Override public boolean check(ResolveInfo info) { return super.check(info) && !info.activityInfo.packageName.contains("sharinger"); } } }