diff --git a/reddinator/build.gradle b/reddinator/build.gradle
index ef3bfc8..d6c9da6 100644
--- a/reddinator/build.gradle
+++ b/reddinator/build.gradle
@@ -14,7 +14,7 @@ repositories {
maven { url "http://dl.bintray.com/populov/maven" }
maven { url 'http://guardian.github.com/maven/repo-releases' }
mavenCentral()
- jcenter({url "http://jcenter.bintray.com/"})
+ jcenter({ url "http://jcenter.bintray.com/" })
}
android {
@@ -24,6 +24,7 @@ android {
minSdkVersion 11
targetSdkVersion 25
return
+ vectorDrawables.useSupportLibrary = true
}
signingConfigs {
debug {
@@ -59,4 +60,5 @@ dependencies {
compile 'com.sothree.slidinguppanel:library:3.3.1'
compile 'com.gu:option:1.3'
compile 'net.rdrei.android.dirchooser:library:3.2@aar'
+ compile 'com.android.support:support-vector-drawable:25.1.0'
}
diff --git a/reddinator/reddinator-reddinator.iml b/reddinator/reddinator-reddinator.iml
index c03dbc7..20ceb1b 100644
--- a/reddinator/reddinator-reddinator.iml
+++ b/reddinator/reddinator-reddinator.iml
@@ -102,11 +102,18 @@
+
+
+
+
+
+
+
diff --git a/reddinator/reddinator-release.apk b/reddinator/reddinator-release.apk
index c26503a..6be5031 100644
Binary files a/reddinator/reddinator-release.apk and b/reddinator/reddinator-release.apk differ
diff --git a/reddinator/src/main/AndroidManifest.xml b/reddinator/src/main/AndroidManifest.xml
index 3121904..e4e60ad 100644
--- a/reddinator/src/main/AndroidManifest.xml
+++ b/reddinator/src/main/AndroidManifest.xml
@@ -2,8 +2,8 @@
+ android:versionCode="61"
+ android:versionName="3.21.1">
@@ -19,7 +19,6 @@
android:label="@string/app_name"
android:theme="@style/AppTheme"
tools:replace="android:theme">
-
-
-
-
-
-
-
-->
-
-
-
-
-
-
-
+ android:enabled="true"
+ android:label="@string/list_widget">
-
-
-
+
+
+
+
-
+ android:enabled="true"
+ android:label="@string/stack_widget">
-
-
-
+
+
+
+
-
-
@@ -201,20 +186,17 @@
android:noHistory="true"
android:taskAffinity=".FeedItemDialogActivity"
android:theme="@style/TransparentActivity" />
-
-
-
-
0) {
- alarmManager.setRepeating(AlarmManager.RTC, System.currentTimeMillis() + refreshRate, refreshRate, updateIntent);
- return;
- }
+ // If there are no widgets for the provider class, or refresh is disabled, cancel the alarm
+ if (ids.length > 0 && refreshRate > 0) {
+ long next = prefs.getLong("last_auto_refresh", 0) + refreshRate;
+ next = (next < System.currentTimeMillis() ? (System.currentTimeMillis()) : next);
+ alarmManager.setRepeating(AlarmManager.RTC, next, refreshRate, updateIntent);
+ return;
}
+
alarmManager.cancel(updateIntent); // auto update disabled or all widgets removed
}
diff --git a/reddinator/src/main/java/au/com/wallaceit/reddinator/service/WidgetProvider.java b/reddinator/src/main/java/au/com/wallaceit/reddinator/service/WidgetProvider.java
index d45c862..2d81800 100644
--- a/reddinator/src/main/java/au/com/wallaceit/reddinator/service/WidgetProvider.java
+++ b/reddinator/src/main/java/au/com/wallaceit/reddinator/service/WidgetProvider.java
@@ -79,7 +79,7 @@ public static void updateAppWidgets(Context context, AppWidgetManager appWidgetM
// REFRESH BUTTON
Intent refreshIntent = new Intent(context, WidgetProvider.class);
- refreshIntent.setAction(WidgetCommon.APPWIDGET_UPDATE_FEED);
+ refreshIntent.setAction(WidgetCommon.ACTION_UPDATE_FEED);
refreshIntent.setPackage(context.getPackageName());
refreshIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
refreshIntent.setData(Uri.parse(refreshIntent.toUri(Intent.URI_INTENT_SCHEME)));
@@ -87,7 +87,7 @@ public static void updateAppWidgets(Context context, AppWidgetManager appWidgetM
// ITEM CLICK
Intent clickIntent = new Intent(context, WidgetProvider.class);
- clickIntent.setAction(WidgetCommon.ITEM_CLICK);
+ clickIntent.setAction(WidgetCommon.ACTION_ITEM_CLICK);
clickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
clickIntent.setData(Uri.parse(clickIntent.toUri(Intent.URI_INTENT_SCHEME)));
PendingIntent clickPendingIntent = PendingIntent.getBroadcast(context, 0, clickIntent, PendingIntent.FLAG_UPDATE_CURRENT);
@@ -145,21 +145,6 @@ public static void updateAppWidgets(Context context, AppWidgetManager appWidgetM
public void onReceive(@NonNull Context context, @NonNull Intent intent) {
String action = intent.getAction();
- if (action.equals(WidgetCommon.APPWIDGET_UPDATE_FEED)) {
- // show loader and update data
- int widgetid = intent.getExtras().getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, -1);
- WidgetCommon.showLoaderAndUpdate(context, widgetid, false);
- }
-
- if (action.equals(WidgetCommon.APPWIDGET_AUTO_UPDATE)) {
- AppWidgetManager mgr = AppWidgetManager.getInstance(context);
- int[] appWidgetIds = mgr.getAppWidgetIds(new ComponentName(context, WidgetProvider.class));
- // perform full update, just to refresh views
- onUpdate(context, mgr, appWidgetIds);
- // show loader and update data
- WidgetCommon.updateAllWidgets(context, appWidgetIds);
- }
-
if (action.equals(Intent.ACTION_MY_PACKAGE_REPLACED)) {
AppWidgetManager mgr2 = AppWidgetManager.getInstance(context);
int[] appWidgetIds = mgr2.getAppWidgetIds(new ComponentName(context, WidgetProvider.class));
diff --git a/reddinator/src/main/java/au/com/wallaceit/reddinator/service/WidgetProviderBase.java b/reddinator/src/main/java/au/com/wallaceit/reddinator/service/WidgetProviderBase.java
index 08b323d..45bac2b 100644
--- a/reddinator/src/main/java/au/com/wallaceit/reddinator/service/WidgetProviderBase.java
+++ b/reddinator/src/main/java/au/com/wallaceit/reddinator/service/WidgetProviderBase.java
@@ -63,7 +63,7 @@ public void onDeleted(Context context, int[] appWidgetIds) {
@Override
public void onDisabled(Context context) {
// cancel the alarm for automatic updates
- WidgetCommon.setUpdateSchedule(context, WidgetProviderBase.class, true);
+ WidgetCommon.setUpdateSchedule(context);
//System.out.println("onDisabled();");
super.onDisabled(context);
}
@@ -71,7 +71,7 @@ public void onDisabled(Context context) {
@Override
public void onEnabled(Context context) {
// set the pending intent for automatic update
- WidgetCommon.setUpdateSchedule(context, WidgetProviderBase.class, false);
+ WidgetCommon.setUpdateSchedule(context);
// System.out.println("onEnabled();");
super.onEnabled(context);
}
@@ -80,84 +80,102 @@ public void onEnabled(Context context) {
public void onReceive(@NonNull Context context, @NonNull Intent intent) {
String action = intent.getAction();
- if (action.equals(WidgetCommon.ITEM_CLICK)) {
+ switch (action) {
+ case WidgetCommon.ACTION_UPDATE_FEED:
+ // get widget id
+ int widgetId = intent.getExtras().getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, -1);
+ // show loader and update data
+ WidgetCommon.showLoaderAndUpdate(context, widgetId, false);
+ break;
+ case WidgetCommon.ACTION_ITEM_CLICK:
- int widgetid = intent.getExtras().getInt(AppWidgetManager.EXTRA_APPWIDGET_ID);
- // check if its the load more button being clicked
- String redditId = intent.getExtras().getString(Reddinator.ITEM_ID);
- if (redditId!=null && redditId.equals("0")) {
- // LOAD MORE FEED ITEM CLICKED
- //System.out.println("loading more feed items...");
- WidgetCommon.showLoaderAndUpdate(context, widgetid, true);
- } else {
- int clickMode = intent.getExtras().getInt(WidgetCommon.ITEM_CLICK_MODE);
- switch (clickMode) {
- // NORMAL FEED ITEM CLICK
- case WidgetCommon.ITEM_CLICK_OPEN:
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
- String clickPrefString = prefs.getString(context.getString(R.string.on_click_pref), "1");
- int clickPref = Integer.valueOf(clickPrefString);
- switch (clickPref) {
- case 1:
- // open in the reddinator view
- Intent clickIntent1 = new Intent(context, ViewRedditActivity.class);
- clickIntent1.putExtras(intent.getExtras());
- clickIntent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- clickIntent1.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
- context.startActivity(clickIntent1);
- break;
- case 2:
- // open link in browser
- String url = intent.getStringExtra(Reddinator.ITEM_URL);
- Intent clickIntent2 = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
- clickIntent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- context.startActivity(clickIntent2);
- break;
- case 3:
- // open reddit comments page in browser
- String permalink = intent.getStringExtra(Reddinator.ITEM_PERMALINK);
- Intent clickIntent3 = new Intent(Intent.ACTION_VIEW, Uri.parse(Reddinator.REDDIT_BASE_URL + permalink));
- clickIntent3.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- context.startActivity(clickIntent3);
- break;
- }
- break;
- // upvote
- case WidgetCommon.ITEM_CLICK_UPVOTE:
- new WidgetVoteTask(
- context,
- widgetid,
- 1,
- intent.getIntExtra(Reddinator.ITEM_FEED_POSITION, -1),
- intent.getStringExtra(Reddinator.ITEM_ID)
- ).execute();
- break;
- // downvote
- case WidgetCommon.ITEM_CLICK_DOWNVOTE:
- new WidgetVoteTask(
- context,
- widgetid,
- -1,
- intent.getIntExtra(Reddinator.ITEM_FEED_POSITION, -1),
- intent.getStringExtra(Reddinator.ITEM_ID)
- ).execute();
- break;
- // post options
- case WidgetCommon.ITEM_CLICK_OPTIONS:
- Intent ointent = new Intent(context, FeedItemDialogActivity.class);
- ointent.putExtras(intent.getExtras());
- ointent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
- context.startActivity(ointent);
- break;
- // open image view
- case WidgetCommon.ITEM_CLICK_IMAGE:
- Intent imageintent = new Intent(context, ViewImageDialogActivity.class);
- imageintent.putExtras(intent.getExtras());
- imageintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
- context.startActivity(imageintent);
- break;
+ int widgetid = intent.getExtras().getInt(AppWidgetManager.EXTRA_APPWIDGET_ID);
+ // check if its the load more button being clicked
+ String redditId = intent.getExtras().getString(Reddinator.ITEM_ID);
+ if (redditId != null && redditId.equals("0")) {
+ // LOAD MORE FEED ITEM CLICKED
+ //System.out.println("loading more feed items...");
+ WidgetCommon.showLoaderAndUpdate(context, widgetid, true);
+ } else {
+ int clickMode = intent.getExtras().getInt(WidgetCommon.ITEM_CLICK_MODE);
+ switch (clickMode) {
+ // NORMAL FEED ITEM CLICK
+ case WidgetCommon.ITEM_CLICK_OPEN:
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+ String clickPrefString = prefs.getString(context.getString(R.string.on_click_pref), "1");
+ int clickPref = Integer.valueOf(clickPrefString);
+ switch (clickPref) {
+ case 1:
+ // open in the reddinator view
+ Intent clickIntent1 = new Intent(context, ViewRedditActivity.class);
+ clickIntent1.putExtras(intent.getExtras());
+ clickIntent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ clickIntent1.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
+ context.startActivity(clickIntent1);
+ break;
+ case 2:
+ // open link in browser
+ String url = intent.getStringExtra(Reddinator.ITEM_URL);
+ Intent clickIntent2 = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
+ clickIntent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ context.startActivity(clickIntent2);
+ break;
+ case 3:
+ // open reddit comments page in browser
+ String permalink = intent.getStringExtra(Reddinator.ITEM_PERMALINK);
+ Intent clickIntent3 = new Intent(Intent.ACTION_VIEW, Uri.parse(Reddinator.REDDIT_BASE_URL + permalink));
+ clickIntent3.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ context.startActivity(clickIntent3);
+ break;
+ }
+ break;
+ // upvote
+ case WidgetCommon.ITEM_CLICK_UPVOTE:
+ new WidgetVoteTask(
+ context,
+ widgetid,
+ 1,
+ intent.getIntExtra(Reddinator.ITEM_FEED_POSITION, -1),
+ intent.getStringExtra(Reddinator.ITEM_ID)
+ ).execute();
+ break;
+ // downvote
+ case WidgetCommon.ITEM_CLICK_DOWNVOTE:
+ new WidgetVoteTask(
+ context,
+ widgetid,
+ -1,
+ intent.getIntExtra(Reddinator.ITEM_FEED_POSITION, -1),
+ intent.getStringExtra(Reddinator.ITEM_ID)
+ ).execute();
+ break;
+ // post options
+ case WidgetCommon.ITEM_CLICK_OPTIONS:
+ Intent ointent = new Intent(context, FeedItemDialogActivity.class);
+ ointent.putExtras(intent.getExtras());
+ ointent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
+ context.startActivity(ointent);
+ break;
+ // open image view
+ case WidgetCommon.ITEM_CLICK_IMAGE:
+ Intent imageintent = new Intent(context, ViewImageDialogActivity.class);
+ imageintent.putExtras(intent.getExtras());
+ imageintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
+ context.startActivity(imageintent);
+ break;
+ }
}
- }
+ break;
+ case WidgetCommon.ACTION_AUTO_UPDATE:
+ //AppWidgetManager mgr = AppWidgetManager.getInstance(context);
+ //int[] appWidgetIds = mgr.getAppWidgetIds(new ComponentName(context, WidgetProvider.class));
+ System.out.println("WIDGET AUTO UPDATE!!!");
+ // perform full update, just to refresh views
+ //onUpdate(context, mgr, appWidgetIds);
+ // show loader and update data
+ WidgetCommon.updateAllWidgets(context);
+ PreferenceManager.getDefaultSharedPreferences(context).edit().putLong("last_auto_refresh", System.currentTimeMillis()).apply();
+ break;
}
//System.out.println("broadcast received: " + action);
diff --git a/reddinator/src/main/java/au/com/wallaceit/reddinator/ui/RWebView.java b/reddinator/src/main/java/au/com/wallaceit/reddinator/ui/RWebView.java
index 3b10208..f99aeef 100644
--- a/reddinator/src/main/java/au/com/wallaceit/reddinator/ui/RWebView.java
+++ b/reddinator/src/main/java/au/com/wallaceit/reddinator/ui/RWebView.java
@@ -192,14 +192,19 @@ private void doFileDownload(String url, String downloadLocation){
DownloadManager mgr = (DownloadManager) getContext().getSystemService(Context.DOWNLOAD_SERVICE);
Uri downloadUri = Uri.parse(url);
String filename = appendImageExtensionIfNeeded(downloadUri.getLastPathSegment());
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
+
DownloadManager.Request request = new DownloadManager.Request(downloadUri);
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE)
- .setAllowedOverRoaming(false)
- .setTitle(filename)
- .setDescription("Reddinator image download")
- .setVisibleInDownloadsUi(true)
- .setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED)
- .setDestinationInExternalPublicDir(downloadLocation.replace(Environment.getExternalStorageDirectory().getAbsolutePath(), ""), filename);
+ .setAllowedOverRoaming(false)
+ .setTitle(filename)
+ .setDescription("Reddinator download")
+ .setVisibleInDownloadsUi(prefs.getBoolean("download_nativeui", true))
+ .setDestinationInExternalPublicDir(downloadLocation.replace(Environment.getExternalStorageDirectory().getAbsolutePath(), ""), filename);
+
+ if (prefs.getBoolean("download_notify_complete", true))
+ request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
+
mgr.enqueue(request);
}
diff --git a/reddinator/src/main/res/values-es/strings.xml b/reddinator/src/main/res/values-es/strings.xml
index 52dd6e7..7056424 100644
--- a/reddinator/src/main/res/values-es/strings.xml
+++ b/reddinator/src/main/res/values-es/strings.xml
@@ -329,4 +329,8 @@
Sincronizar datos
Refrescar subreddits, multis y filtros
Actualización del filtro
+ Mostrar completado en la aplicación \"descargas\"
+ Mostrar Descargas
+ Mostrar notificación para las descargas completadas
+ Notificación completada
\ No newline at end of file
diff --git a/reddinator/src/main/res/values/strings.xml b/reddinator/src/main/res/values/strings.xml
index e248a6b..69d7fca 100644
--- a/reddinator/src/main/res/values/strings.xml
+++ b/reddinator/src/main/res/values/strings.xml
@@ -388,4 +388,8 @@
Sync Data
Subscribed
+ Show In Downloads
+ Show completed in the \"downloads\" app
+ Completed Notification
+ Show notification for completed downloads
\ No newline at end of file
diff --git a/reddinator/src/main/res/xml/changelog_master.xml b/reddinator/src/main/res/xml/changelog_master.xml
index 9b46b3d..123b904 100644
--- a/reddinator/src/main/res/xml/changelog_master.xml
+++ b/reddinator/src/main/res/xml/changelog_master.xml
@@ -1,5 +1,11 @@
+
+ Added additional download preferences.
+ Fixed issue with auto refresh alarm manager cancelling.
+ Utility; volume down on preference screen shows last widget auto-refresh time.
+ Fixed bug causing first comment posted in an empty thread not to show.
+
Added integration with reddits new /r/all filter.
Added background sync of subs, multis & filters. Triggered daily when subreddit selection activity is opened.
diff --git a/reddinator/src/main/res/xml/preferences.xml b/reddinator/src/main/res/xml/preferences.xml
index 3eb7773..29bce6a 100644
--- a/reddinator/src/main/res/xml/preferences.xml
+++ b/reddinator/src/main/res/xml/preferences.xml
@@ -177,7 +177,17 @@
android:dialogTitle="@string/reddit_content_font_pref_title" />
-
+
+
+