use of android.content.pm.ResolveInfo in project c-geo by just-radovan.
the class cgBase method isIntentAvailable.
public static boolean isIntentAvailable(Context context, Intent intent) {
final PackageManager packageManager = context.getPackageManager();
final List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
return (list.size() > 0);
}
use of android.content.pm.ResolveInfo in project k-9 by k9mail.
the class Accounts method onImport.
private void onImport() {
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("*/*");
PackageManager packageManager = getPackageManager();
List<ResolveInfo> infos = packageManager.queryIntentActivities(i, 0);
if (infos.size() > 0) {
startActivityForResult(Intent.createChooser(i, null), ACTIVITY_REQUEST_PICK_SETTINGS_FILE);
} else {
showDialog(DIALOG_NO_FILE_MANAGER);
}
}
use of android.content.pm.ResolveInfo in project superCleanMaster by joyoyao.
the class BootStartUtils method fetchAutoApps.
public static List<AutoStartInfo> fetchAutoApps(Context mContext) {
PackageManager pm = mContext.getPackageManager();
Intent intent = new Intent(Intent.ACTION_BOOT_COMPLETED);
List<ResolveInfo> resolveInfoList = pm.queryBroadcastReceivers(intent, PackageManager.GET_DISABLED_COMPONENTS);
List<AutoStartInfo> appList = new ArrayList<AutoStartInfo>();
String appName = null;
String packageReceiver = null;
Drawable icon = null;
boolean isSystem = false;
boolean isenable = true;
if (resolveInfoList.size() > 0) {
appName = resolveInfoList.get(0).loadLabel(pm).toString();
packageReceiver = resolveInfoList.get(0).activityInfo.packageName + "/" + resolveInfoList.get(0).activityInfo.name;
icon = resolveInfoList.get(0).loadIcon(pm);
ComponentName mComponentName1 = new ComponentName(resolveInfoList.get(0).activityInfo.packageName, resolveInfoList.get(0).activityInfo.name);
if (pm.getComponentEnabledSetting(mComponentName1) == 2) {
isenable = false;
} else {
isenable = true;
}
if ((resolveInfoList.get(0).activityInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
isSystem = true;
} else {
isSystem = false;
}
for (int i = 1; i < resolveInfoList.size(); i++) {
AutoStartInfo mAutoStartInfo = new AutoStartInfo();
if (appName.equals(resolveInfoList.get(i).loadLabel(pm).toString())) {
packageReceiver = packageReceiver + ";" + resolveInfoList.get(i).activityInfo.packageName + "/" + resolveInfoList.get(i).activityInfo.name;
} else {
mAutoStartInfo.setLabel(appName);
mAutoStartInfo.setSystem(isSystem);
mAutoStartInfo.setEnable(isenable);
mAutoStartInfo.setIcon(icon);
mAutoStartInfo.setPackageReceiver(packageReceiver);
appList.add(mAutoStartInfo);
appName = resolveInfoList.get(i).loadLabel(pm).toString();
packageReceiver = resolveInfoList.get(i).activityInfo.packageName + "/" + resolveInfoList.get(i).activityInfo.name;
icon = resolveInfoList.get(i).loadIcon(pm);
ComponentName mComponentName2 = new ComponentName(resolveInfoList.get(i).activityInfo.packageName, resolveInfoList.get(i).activityInfo.name);
if (pm.getComponentEnabledSetting(mComponentName2) == 2) {
isenable = false;
} else {
isenable = true;
}
if ((resolveInfoList.get(i).activityInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
isSystem = true;
} else {
isSystem = false;
}
}
}
AutoStartInfo mAutoStartInfo = new AutoStartInfo();
mAutoStartInfo.setLabel(appName);
mAutoStartInfo.setSystem(isSystem);
mAutoStartInfo.setEnable(isenable);
mAutoStartInfo.setIcon(icon);
mAutoStartInfo.setPackageReceiver(packageReceiver);
appList.add(mAutoStartInfo);
}
return appList;
}
use of android.content.pm.ResolveInfo in project Android by hmkcode.
the class MainActivity method hasDefualtCameraApp.
// method to check you have Camera Apps
private boolean hasDefualtCameraApp(String action) {
final PackageManager packageManager = getPackageManager();
final Intent intent = new Intent(action);
List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
return list.size() > 0;
}
use of android.content.pm.ResolveInfo in project LollipopShowcase by mikepenz.
the class DetailActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
mCoordinatorLayout = (CoordinatorLayout) findViewById(R.id.container);
mRowContainer = (LinearLayout) findViewById(R.id.row_container);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle("");
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// Handle Back Navigation :D
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DetailActivity.this.onBackPressed();
}
});
// Fab Button
FloatingActionButton floatingActionButton = (FloatingActionButton) findViewById(R.id.fab_normal);
floatingActionButton.setImageDrawable(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_file_upload).color(Color.WHITE).actionBar());
floatingActionButton.setOnClickListener(fabClickListener);
for (int i = 1; i < mRowContainer.getChildCount(); i++) {
View rowView = mRowContainer.getChildAt(i);
rowView.animate().setStartDelay(100 + i * SCALE_DELAY).scaleX(1).scaleY(1);
}
ComponentName componentName = null;
if (savedInstanceState != null) {
componentName = savedInstanceState.getParcelable("appInfo");
} else if (getIntent() != null && getIntent().getExtras() != null) {
componentName = (ComponentName) getIntent().getExtras().get("appInfo");
}
if (componentName != null) {
Intent intent = new Intent();
intent.setComponent(componentName);
ResolveInfo app = getPackageManager().resolveActivity(intent, 0);
mAppInfo = new AppInfo(this, app);
}
if (mAppInfo != null) {
//toolbar.setLogo(mAppInfo.getIcon());
toolbar.setTitle(mAppInfo.getName());
View view = mRowContainer.findViewById(R.id.row_name);
fillRow(view, "Application Name", mAppInfo.getName());
((ImageView) view.findViewById(R.id.appIcon)).setImageDrawable(mAppInfo.getIcon());
view = mRowContainer.findViewById(R.id.row_package_name);
fillRow(view, "Package Name", mAppInfo.getPackageName());
view = mRowContainer.findViewById(R.id.row_activity);
fillRow(view, "Activity", mAppInfo.getActivityName());
view = mRowContainer.findViewById(R.id.row_component_info);
fillRow(view, "ComponentInfo", mAppInfo.getComponentInfo());
view = mRowContainer.findViewById(R.id.row_version);
fillRow(view, "Version", mAppInfo.getVersionName() + " (" + mAppInfo.getVersionCode() + ")");
view = mRowContainer.findViewById(R.id.row_moments);
fillRow(view, "Moments", "First installed: " + new Date(mAppInfo.getFirstInstallTime()) + "\nLast updated: " + new Date(mAppInfo.getLastUpdateTime()));
}
}
Aggregations