List of usage examples for android.content ComponentName getPackageName
public @NonNull String getPackageName()
From source file:com.cognizant.trumobi.PersonaLauncher.java
private void updateCounters(View view, String packageName, int counter, int color, int updateCounterFor) { Object tag = view.getTag();//from ww w.ja v a 2 s.c om //PersonaLog.d("personalauncher","------- view is ---- "+ view.toString()); if (tag != null) //PersonaLog.d("personalauncher","------- tag is ---- "+ tag.toString()); if (tag instanceof PersonaApplicationInfo) { PersonaApplicationInfo info = (PersonaApplicationInfo) tag; // We need to check for ACTION_MAIN otherwise getComponent() might // return null for some shortcuts (for instance, for shortcuts to // web pages.) final Intent intent = info.intent; final ComponentName name = intent.getComponent(); // PersonaLog.d("Personalauncher","name " + name.flattenToString()); //Badge switch (updateCounterFor) { case UPDATE_COUNTERS_FOR_DIALER: if (name.flattenToString().contains("DialerParentActivity")) { //BADGE - below lines from if loop below added since that if loop fails if (view instanceof PersonaCounterImageView) ((PersonaCounterImageView) view).setCounter(counter, color); // else if view.invalidate(); sModel.updateCounterDesktopItem(info, counter, color); //BADGE ends } break; case UPDATE_COUNTERS_FOR_MESSENGER: if (name.flattenToString().contains("SmsListdisplay")) { //BADGE - below lines from if loop below added since that if loop fails if (view instanceof PersonaCounterImageView) ((PersonaCounterImageView) view).setCounter(counter, color); // else if view.invalidate(); sModel.updateCounterDesktopItem(info, counter, color); //BADGE ends } break; } if ((info.itemType == PersonaLauncherSettings.Favorites.ITEM_TYPE_APPLICATION || info.itemType == PersonaLauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) && Intent.ACTION_MAIN.equals(intent.getAction()) && name != null && packageName.equals(name.getPackageName())) { if (view instanceof PersonaCounterImageView) ((PersonaCounterImageView) view).setCounter(counter, color); // else if view.invalidate(); sModel.updateCounterDesktopItem(info, counter, color); } } else { //PersonaLog.d("personalauncher","------ tag is not an instance of personaApplicationInfo-----"); //if(tag != null) // PersonaLog.d("personalauncher","------- tag not an instance of personaapplicationinfo ---- "+ tag.toString()); } }