Refresh on widget tap

This commit is contained in:
M66B 2019-08-12 15:18:35 +02:00
parent 59b79bac2b
commit 68acb278a3
3 changed files with 11 additions and 5 deletions

View File

@ -84,11 +84,10 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack
@Override
protected void onExecuted(Bundle args, Boolean hasAccounts) {
if (hasAccounts) {
startActivity(new Intent(ActivityMain.this, ActivityView.class));
if (ACTION_REFRESH.equals(getIntent().getAction()))
ServiceSynchronize.process(ActivityMain.this, true);
else
ServiceSynchronize.watchdog(ActivityMain.this);
Intent view = new Intent(ActivityMain.this, ActivityView.class);
view.putExtra("refresh", true);
startActivity(view);
ServiceSynchronize.watchdog(ActivityMain.this);
ServiceSend.watchdog(ActivityMain.this);
} else
startActivity(new Intent(ActivityMain.this, ActivitySetup.class));

View File

@ -473,6 +473,12 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
private void checkIntent() {
Intent intent = getIntent();
if (intent.getBooleanExtra("refresh", false)) {
intent.removeExtra("refresh");
setIntent(intent);
ServiceSynchronize.process(this, true);
}
String action = intent.getAction();
Log.i("View intent=" + intent + " action=" + action);
if (action != null) {

View File

@ -55,6 +55,7 @@ public class Widget extends AppWidgetProvider {
private static void update(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds, int count) {
Intent view = new Intent(context, ActivityView.class);
view.setAction("unified");
view.putExtra("refresh", true);
view.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pi = PendingIntent.getActivity(context, ActivityView.REQUEST_UNIFIED, view, PendingIntent.FLAG_UPDATE_CURRENT);