@Override public BadgerInfo handleBadger(Intent intent) { BadgerInfo info = new BadgerInfo(); String componentName = intent.getStringExtra(getComponentKey()); ComponentName component = ComponentName.unflattenFromString(componentName); if (component != null) { info.packageName = component.getPackageName(); info.className = component.getClassName(); info.badgerCount = intent.getIntExtra(getCountKey(), 0); return info; } return null; }
ComponentName cn=ComponentName.unflattenFromString(assistant);
ComponentName cn=ComponentName.unflattenFromString(cnFlat);
ComponentName cn=ComponentName.unflattenFromString(cnFlat);
private synchronized void loadSubscriptions() { subscribers = new HashMap<>(); Set<String> serializedSubscriptions = sharedPrefs.getStringSet(PREF_SUBSCRIPTIONS, null); if (serializedSubscriptions != null) { for (String serializedSubscription : serializedSubscriptions) { String[] arr = serializedSubscription.split("\\|", 2); ComponentName subscriber = ComponentName.unflattenFromString(arr[0]); String token = arr[1]; subscribers.put(subscriber, token); } } }
private static ComponentName applyRedirect (ComponentName original) { if (COMPONENT_REDIRECT == null || !COMPONENT_REDIRECT.containsKey(original.flattenToString())) return original; return ComponentName.unflattenFromString(COMPONENT_REDIRECT.get(original.flattenToString())); }
private boolean isNotificationListenerSettingEnabled() { if (getContext() == null) return false; String notificationEnabled = Settings.Secure.getString(getContext().getContentResolver(), "enabled_notification_listeners"); if (TextUtils.isEmpty(notificationEnabled)) return false; for (String name : notificationEnabled.split(":")) { ComponentName cn = ComponentName.unflattenFromString(name); if (cn != null) { if (TextUtils.equals(getContext().getPackageName(), cn.getPackageName())) { return true; } } } return false; }
/** * Creates a new instance. * * @param activityName The activity component name flattened to string. * @param time The time the activity was chosen. * @param weight The weight of the record. */ public HistoricalRecord(String activityName, long time, float weight) { this(ComponentName.unflattenFromString(activityName), time, weight); }
/** * Creates a new instance. * * @param activityName The activity component name flattened to string. * @param time The time the activity was chosen. * @param weight The weight of the record. */ public HistoricalRecord(String activityName, long time, float weight) { this(ComponentName.unflattenFromString(activityName), time, weight); }
public ComponentName getWidgetComponentName() { if (this.mResources == null || TextUtils.isEmpty(this.mPackageName)) { return null; } int nameResId = this.mResources.getIdentifier("partner_widget_provider_component_name", "string", this.mPackageName); if (nameResId != 0) { return ComponentName.unflattenFromString(this.mResources.getString(nameResId)); } return null; }
public static ComponentName getWidgetComponentName(Context ctx) { String name = PreferenceManager.getDefaultSharedPreferences(ctx).getString("widget_component_name", null); if (TextUtils.isEmpty(name)) { return null; } return ComponentName.unflattenFromString(name); }
public ComponentName getWidgetComponentName() { if (this.mResources == null || TextUtils.isEmpty(this.mPackageName)) { return null; } int nameResId = this.mResources.getIdentifier("partner_widget_provider_component_name", "string", this.mPackageName); if (nameResId != 0) { return ComponentName.unflattenFromString(this.mResources.getString(nameResId)); } return null; }
public static ComponentName getWidgetComponentName(Context ctx) { String name = PreferenceManager.getDefaultSharedPreferences(ctx).getString("widget_component_name", null); if (TextUtils.isEmpty(name)) { return null; } return ComponentName.unflattenFromString(name); }
public static Intent getNotificationPreferencesIntent() { String settingsAct = "com.amazon.tv.notificationcenter/com.amazon.tv.notificationcenter.settings.NotificationSettingsActivity"; Intent intent = new Intent(); intent.setPackage("com.amazon.tv.notificationcenter"); intent.setComponent(ComponentName.unflattenFromString(settingsAct)); intent.setFlags(32768); // KNOWN KEY: com.amazon.device.settings..PACKAGE_NAME // intent.putExtra("com.amazon.device.settings..PACKAGE_NAME", packageName); return intent; }
public static Intent getNotificationCenterIntent() { String settingsAct = "com.amazon.tv.notificationcenter/com.amazon.tv.notificationcenter.NotificationCenterActivity"; Intent intent = new Intent(); intent.setPackage("com.amazon.tv.notificationcenter"); intent.setComponent(ComponentName.unflattenFromString(settingsAct)); intent.setFlags(32768); return intent; }
public Badger(Context context) { prefs = context.getSharedPreferences("badges", Context.MODE_PRIVATE); for (String cname: prefs.getAll().keySet()) { unreadCount.put(ComponentName.unflattenFromString(cname), (prefs.getInt(cname, 0))); } }
@Override public BadgerInfo handleBadger(Intent intent) { BadgerInfo info = new BadgerInfo(); String componentName = intent.getStringExtra(getComponentKey()); ComponentName component = ComponentName.unflattenFromString(componentName); if (component != null) { info.packageName = component.getPackageName(); info.className = component.getClassName(); info.badgerCount = intent.getIntExtra(getCountKey(), 0); return info; } return null; }
@Override public BadgerInfo handleBadger(Intent intent) { BadgerInfo info = new BadgerInfo(); String componentName = intent.getStringExtra(getComponentKey()); ComponentName component = ComponentName.unflattenFromString(componentName); if (component != null) { info.packageName = component.getPackageName(); info.className = component.getClassName(); info.badgerCount = intent.getIntExtra(getCountKey(), 0); return info; } return null; }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) { final Uri resultUri = UCrop.getOutput(data); Intent intent = getIntent(); intent.putExtra(Intent.EXTRA_STREAM, resultUri); intent.setComponent(ComponentName.unflattenFromString("com.snapchat.android/.LandingPageActivity")); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); finish(); } else if (resultCode == UCrop.RESULT_ERROR) { final Throwable cropError = UCrop.getError(data); cropError.printStackTrace(); } }
@Override public void run() { IconHelper ih = new IconHelper(mContext); for (AppsRowItem task : appTasks) { ComponentName componentName = ComponentName.unflattenFromString(task.getPackageName() + "/" + task.getClassName()); ih.cachedIconHelper(componentName); } Tools.updateWidget(mContext); // TODO: Should create new method specifically for this with preference final SharedPreferences prefs2 = prefs.prefsGet(); boolean toggleBool = prefs2.getBoolean(TOGGLE_PREFERENCE, TOGGLE_DEFAULT); if (toggleBool) myService.execute(SERVICE_CREATE_NOTIFICATIONS); } };