From 3a653a15d18d75aa6c1a26f0fcfdbc19948d7877 Mon Sep 17 00:00:00 2001 From: Kala30 Date: Fri, 29 Jun 2018 15:50:27 -0700 Subject: [PATCH] Fixed update interval? --- .../main/java/com/cogentworks/overwidget/MainActivity.java | 2 +- .../main/java/com/cogentworks/overwidget/ProfileAdapter.java | 3 ++- app/src/main/java/layout/OverWidgetProvider.java | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/cogentworks/overwidget/MainActivity.java b/app/src/main/java/com/cogentworks/overwidget/MainActivity.java index 056e7c6..05af51d 100644 --- a/app/src/main/java/com/cogentworks/overwidget/MainActivity.java +++ b/app/src/main/java/com/cogentworks/overwidget/MainActivity.java @@ -46,7 +46,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_main); //Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); //setSupportActionBar(toolbar); - + // Set swipe to refresh behavior final MainActivity activityContext = this; diff --git a/app/src/main/java/com/cogentworks/overwidget/ProfileAdapter.java b/app/src/main/java/com/cogentworks/overwidget/ProfileAdapter.java index 814173b..d9b51c0 100644 --- a/app/src/main/java/com/cogentworks/overwidget/ProfileAdapter.java +++ b/app/src/main/java/com/cogentworks/overwidget/ProfileAdapter.java @@ -53,7 +53,8 @@ public View getView(int position, View convertView, ViewGroup parent) { tag.setText("#" + parts[1]); } - gamesWon.setText(profile.gamesWon + " games won"); + if(Integer.parseInt(profile.gamesWon) > 0) + gamesWon.setText(profile.gamesWon + " games won"); level.setText("Lvl " + (Integer.parseInt(profile.Prestige)*100 + Integer.parseInt(profile.Level))); if (!profile.Tier.equals("") && !profile.Tier.equals("nullrank")) { diff --git a/app/src/main/java/layout/OverWidgetProvider.java b/app/src/main/java/layout/OverWidgetProvider.java index c018ed0..4269a25 100644 --- a/app/src/main/java/layout/OverWidgetProvider.java +++ b/app/src/main/java/layout/OverWidgetProvider.java @@ -45,7 +45,7 @@ public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] a updateInterval = profile.getUpdateInterval(); Log.d(TAG, "(" + appWidgetId + ") Update Interval: " + updateInterval); - PendingIntent pi = PendingIntent.getBroadcast(context, appWidgetId, intent, 0); + PendingIntent pi = PendingIntent.getBroadcast(context, appWidgetId, intent, PendingIntent.FLAG_UPDATE_CURRENT); assert alarmManager != null; alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME, System.currentTimeMillis(), updateInterval, pi); @@ -124,7 +124,7 @@ public void onReceive(Context context, Intent intent) { // Normal - if (intent.getAction().equals(SYNC_CLICKED)) + //if (intent.getAction().equals(SYNC_CLICKED)) WidgetUtils.setLoadingLayout(context, appWidgetId, AppWidgetManager.getInstance(context)); Intent serviceIntent = new Intent(intent);