()
| 49 | public void onUpdate(final Context context, final AppWidgetManager appWidgetManager, final int[] appWidgetIds) { |
| 50 | executor.submit(new Runnable() { |
| 51 | @Override |
| 52 | public void run() { |
| 53 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); |
| 54 | boolean unseen_ignored = prefs.getBoolean("unseen_ignored", false); |
| 55 | |
| 56 | DB db = DB.getInstance(context); |
| 57 | NumberFormat nf = NumberFormat.getIntegerInstance(); |
| 58 | int colorWidgetForeground = context.getResources().getColor(R.color.colorWidgetForeground); |
| 59 | |
| 60 | for (int appWidgetId : appWidgetIds) { |
| 61 | String name = prefs.getString("widget." + appWidgetId + ".name", null); |
| 62 | long account = prefs.getLong("widget." + appWidgetId + ".account", -1L); |
| 63 | long folder = prefs.getLong("widget." + appWidgetId + ".folder", -1L); |
| 64 | boolean daynight = prefs.getBoolean("widget." + appWidgetId + ".daynight", false); |
| 65 | boolean semi = prefs.getBoolean("widget." + appWidgetId + ".semi", true); |
| 66 | int background = prefs.getInt("widget." + appWidgetId + ".background", Color.TRANSPARENT); |
| 67 | int foreground = prefs.getInt("widget." + appWidgetId + ".foreground", Color.TRANSPARENT); |
| 68 | int layout = prefs.getInt("widget." + appWidgetId + ".layout", 0); |
| 69 | boolean top = prefs.getBoolean("widget." + appWidgetId + ".top", false); |
| 70 | int size = prefs.getInt("widget." + appWidgetId + ".text_size", -1); |
| 71 | boolean standalone = prefs.getBoolean("widget." + appWidgetId + ".standalone", false); |
| 72 | int version = prefs.getInt("widget." + appWidgetId + ".version", 0); |
| 73 | |
| 74 | if (version <= 1550) |
| 75 | semi = true; // Legacy |
| 76 | |
| 77 | List<EntityFolder> folders = null; |
| 78 | if (folder < 0) |
| 79 | folders = db.folder().getNotifyingFolders(account); |
| 80 | else { |
| 81 | EntityFolder f = db.folder().getFolder(folder); |
| 82 | if (f != null) |
| 83 | folders = Arrays.asList(f); |
| 84 | } |
| 85 | if (folders == null) |
| 86 | folders = new ArrayList<>(); |
| 87 | |
| 88 | PendingIntent pi; |
| 89 | if (folders.size() == 1) { |
| 90 | Intent view = new Intent(context, ActivityView.class); |
| 91 | view.setAction("folder:" + folders.get(0).id); |
| 92 | view.putExtra("account", account); |
| 93 | view.putExtra("type", folders.get(0).type); |
| 94 | view.putExtra("standalone", standalone); |
| 95 | view.putExtra("refresh", true); |
| 96 | view.putExtra("version", version); |
| 97 | view.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); |
| 98 | pi = PendingIntentCompat.getActivity( |
| 99 | context, appWidgetId, view, PendingIntent.FLAG_UPDATE_CURRENT); |
| 100 | } else { |
| 101 | if (account < 0) { |
| 102 | Intent view = new Intent(context, ActivityView.class); |
| 103 | view.setAction("unified"); |
| 104 | view.putExtra("standalone", standalone); |
| 105 | view.putExtra("refresh", true); |
| 106 | view.putExtra("version", version); |
| 107 | view.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); |
| 108 | pi = PendingIntentCompat.getActivity( |
nothing calls this directly
no test coverage detected