public void searchNotifications() { List<Entity> searchs = DataFramework.getInstance().getEntityList("search"); for (int i = 0; i < searchs.size(); i++) { if (searchs.get(i).getInt("notifications") == 1 && !PreferenceUtils.getStatusWorkApp(context)) { EntitySearch es = new EntitySearch(searchs.get(i).getId()); if (type != OnAlarmReceiver.ALARM_ONLY_OTHERS) { InfoSaveTweets info = es.saveTweets(context, true, -1); if (info.getNewMessages() > 0 && searchs.get(i).getInt("notifications_bar") == 1) { showSearchNotifications = true; } } int count = es.getValueNewCount(); totalSearchesAWD += count; if (searchs.get(i).getInt("notifications_bar") == 1) { SearchNotifications sn = new SearchNotifications(); sn.setTotal(count); sn.setName(searchs.get(i).getString("name")); mSearchNotifications.add(sn); } } } }
public void writeADWLauncher() { if (!PreferenceUtils.getStatusWorkApp(context)) { boolean noread_adw = preferences.getBoolean("prf_no_read_adw", true); if (noread_adw) { IntegrationADW.createPreferences(context); IntegrationADW.verifyPreferences(); String color = ""; int number = 0; for (int i = 1; i <= 4; i++) { String pref = IntegrationADW.getPreference(i); if (pref.equals(IntegrationADWAdapter.PREFERENCES_SEARCH)) { int mTotalSumSearches = 0; for (SearchNotifications s : mSearchNotifications) { mTotalSumSearches += s.getTotal(); } if (mTotalSumSearches > 0) { color = IntegrationADW.getColor(IntegrationADWAdapter.PREFERENCES_SEARCH); number = mTotalSumSearches; i = 4; Log.d( Utils.TAG_ALARM, number + " nuevos en busqueda. Enviando a ADWLauncher a paquete " + Utils.packageName + " y color " + color); } } if (pref.equals(IntegrationADWAdapter.PREFERENCES_TIMELINE)) { if (totalTimelineADW > 0) { color = IntegrationADW.getColor(IntegrationADWAdapter.PREFERENCES_TIMELINE); number = totalTimelineADW; i = 4; Log.d( Utils.TAG_ALARM, number + " nuevos en timeline. Enviando a ADWLauncher a paquete " + Utils.packageName + " y color " + color); } } if (pref.equals(IntegrationADWAdapter.PREFERENCES_MENTIONS)) { if (totalMentionsADW > 0) { color = IntegrationADW.getColor(IntegrationADWAdapter.PREFERENCES_MENTIONS); number = totalMentionsADW; i = 4; Log.d( Utils.TAG_ALARM, number + " nuevos en menciones. Enviando a ADWLauncher a paquete " + Utils.packageName + " y color " + color); } } if (pref.equals(IntegrationADWAdapter.PREFERENCES_DIRECTS)) { if (totalDMsAWD > 0) { color = IntegrationADW.getColor(IntegrationADWAdapter.PREFERENCES_DIRECTS); number = totalDMsAWD; i = 4; Log.d( Utils.TAG_ALARM, number + " nuevos en directos. Enviando a ADWLauncher a paquete " + Utils.packageName + " y color " + color); } } } if (number > 0) { Intent intent = new Intent(); intent.setAction("org.adw.launcher.counter.SEND"); intent.putExtra("PNAME", Utils.packageName); intent.putExtra("COUNT", number); if (!color.equals("")) intent.putExtra("COLOR", Color.parseColor(color)); context.sendBroadcast(intent); } } } }