Skip to content

Commit

Permalink
- Added additional download preferences.
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
micwallace committed Jan 5, 2017
1 parent 8d2c6f1 commit c3daeaa
Show file tree
Hide file tree
Showing 17 changed files with 205 additions and 180 deletions.
4 changes: 3 additions & 1 deletion reddinator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -24,6 +24,7 @@ android {
minSdkVersion 11
targetSdkVersion 25
return
vectorDrawables.useSupportLibrary = true
}
signingConfigs {
debug {
Expand Down Expand Up @@ -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'
}
7 changes: 7 additions & 0 deletions reddinator/reddinator-reddinator.iml
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,18 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/de.cketti.library.changelog/ckchangelog/1.2.2/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/net.rdrei.android.dirchooser/library/3.2/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
Expand Down
Binary file modified reddinator/reddinator-release.apk
Binary file not shown.
47 changes: 14 additions & 33 deletions reddinator/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="au.com.wallaceit.reddinator"
android:versionCode="60"
android:versionName="3.21.0">
android:versionCode="61"
android:versionName="3.21.1">

<uses-permission android:name="android.permission.INTERNET" />
<!-- Needed by some activity_webview HTML5 video implementations (Bug report received for Android 4.1) -->
Expand All @@ -19,7 +19,6 @@
android:label="@string/app_name"
android:theme="@style/AppTheme"
tools:replace="android:theme">

<activity
android:name=".activity.MainActivity"
android:configChanges="orientation|screenSize"
Expand All @@ -41,21 +40,17 @@
android:scheme="https" />
</intent-filter>
</activity>

<activity
android:name=".activity.PrefsActivity"
android:label="@string/preferences" />

<activity
android:name=".activity.ThemesActivity"
android:configChanges="orientation|screenSize"
android:label="@string/title_activity_themes" />

<activity
android:name=".activity.ThemeEditorActivity"
android:configChanges="orientation|screenSize"
android:label="@string/title_activity_theme_editor" />

<activity
android:name=".activity.SubredditSelectActivity"
android:configChanges="orientation|screenSize"
Expand All @@ -64,12 +59,10 @@
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>

<activity
android:name=".activity.ViewAllSubredditsActivity"
android:configChanges="orientation|screenSize"
android:label="@string/subreddits" />

<activity
android:name=".activity.ViewRedditActivity"
android:configChanges="orientation|screenSize"
Expand All @@ -84,35 +77,29 @@
</intent-filter>
-->
</activity>

<activity
android:name=".activity.WebViewActivity"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
android:windowSoftInputMode="adjustResize" />

<activity
android:name=".activity.AccountActivity"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
android:windowSoftInputMode="adjustResize" />

<activity
android:name=".activity.MessagesActivity"
android:configChanges="orientation|screenSize"
android:label="@string/messages"
android:windowSoftInputMode="adjustResize" />

<activity
android:name=".activity.ComposeMessageActivity"
android:configChanges="orientation|screenSize"
android:label="@string/send_message" />

<activity
android:name=".activity.SearchActivity"
android:configChanges="orientation|screenSize"
android:label="@string/search" />

<activity
android:name=".activity.SubmitActivity"
android:configChanges="orientation|screenSize"
Expand All @@ -126,7 +113,6 @@
<data android:mimeType="text/plain" />
</intent-filter>
</activity>

<activity
android:name=".activity.OAuthView"
android:configChanges="orientation|screenSize"
Expand All @@ -143,46 +129,45 @@

<receiver
android:name=".service.WidgetProvider"
android:label="@string/list_widget"
android:enabled="true">
android:enabled="true"
android:label="@string/list_widget">
<intent-filter>
<action android:name="au.com.wallaceit.redinator.WidgetCommon.ITEM_CLICK" />
<action android:name="au.com.wallaceit.redinator.WidgetCommon.APPWIDGET_AUTO_UPDATE" />
<action android:name="au.com.wallaceit.redinator.WidgetCommon.APPWIDGET_UPDATE_FEED" />
<action android:name="wallaceit.redinator.action.APPWIDGET_ITEM_CLICK" />
<action android:name="wallaceit.redinator.action.APPWIDGET_AUTO_UPDATE" />
<action android:name="wallaceit.redinator.action.APPWIDGET_UPDATE_FEED" />
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="android.appwidget.action.APPWIDGET_UPDATE_OPTIONS" />
<action android:name="android.appwidget.action.APPWIDGET_ENABLED" />
<action android:name="android.appwidget.action.APPWIDGET_DELETED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>

<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/app_widget_provider_info" />
</receiver>

<receiver
android:name=".service.StackWidgetProvider"
android:label="@string/stack_widget"
android:enabled="true">
android:enabled="true"
android:label="@string/stack_widget">
<intent-filter>
<action android:name="au.com.wallaceit.redinator.WidgetCommon.ITEM_CLICK" />
<action android:name="au.com.wallaceit.redinator.WidgetCommon.APPWIDGET_AUTO_UPDATE" />
<action android:name="au.com.wallaceit.redinator.WidgetCommon.APPWIDGET_UPDATE_FEED" />
<action android:name="wallaceit.redinator.action.APPWIDGET_ITEM_CLICK" />
<action android:name="wallaceit.redinator.action.APPWIDGET_AUTO_UPDATE" />
<action android:name="wallaceit.redinator.action.APPWIDGET_UPDATE_FEED" />
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="android.appwidget.action.APPWIDGET_UPDATE_OPTIONS" />
<action android:name="android.appwidget.action.APPWIDGET_ENABLED" />
<action android:name="android.appwidget.action.APPWIDGET_DELETED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>

<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/app_widget_stack_provider_info" />
</receiver>

<receiver
android:name=".service.MailCheckReceiver"
android:enabled="true" />

<receiver
android:name=".service.BootReceiver"
android:enabled="true">
Expand All @@ -201,20 +186,17 @@
android:noHistory="true"
android:taskAffinity=".FeedItemDialogActivity"
android:theme="@style/TransparentActivity" />

<activity
android:name=".activity.ViewImageDialogActivity"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
android:theme="@style/TransparentActivity" />

<activity
android:name=".activity.CommentsContextDialogActivity"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
android:theme="@style/TransparentActivity"
android:windowSoftInputMode="adjustResize">

<!--
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.VIEW" />
Expand All @@ -224,7 +206,6 @@
</intent-filter>
-->
</activity>

<activity
android:name=".activity.WidgetMenuDialogActivity"
android:configChanges="orientation|screenSize"
Expand Down
4 changes: 1 addition & 3 deletions reddinator/src/main/assets/js/comments.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// set article from document hash
var articleId = document.location.hash.substring(1);
var baseId;
var username;
var subAuthor;
var isArchived = false;
Expand All @@ -19,7 +18,6 @@ function populateComments(author, archived, json){
var data = JSON.parse(json);
$("#loading_view").hide();
$("#base").show();
baseId = data[0].data.parent_id;
recursivePopulate(data);
}

Expand Down Expand Up @@ -234,7 +232,7 @@ function appendComment(parentId, commentData, prepend){
}
flag.show();
}
if (parentId.indexOf(baseId)!==-1){
if (parentId.indexOf("t3_")!==-1){
if (prepend){
commentElem.prependTo("#base");
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@

import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.widget.Toast;

import java.util.Date;

public class PrefsActivity extends PreferenceActivity {
private PrefsFragment fragment;
Expand Down Expand Up @@ -52,4 +57,13 @@ public boolean onOptionsItemSelected(MenuItem item) {
}
return true;
}

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)){
Toast.makeText(this, "Last widget refresh: " + new Date(PreferenceManager.getDefaultSharedPreferences(this).getLong("last_auto_refresh", 0)).toString(), Toast.LENGTH_LONG).show();
return true;
}
return super.onKeyDown(keyCode, event);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ private void saveSettingsAndFinish() {
// check if refresh rate has changed and update if needed
if (!mRefreshrate.equals(mSharedPreferences.getString(getString(R.string.refresh_rate_pref), "43200000"))) {
//System.out.println("Refresh preference changed, updating alarm");
WidgetCommon.setUpdateSchedule(getActivity(), false);
WidgetCommon.setUpdateSchedule(getActivity());
}
// check if background mail check interval has changed
if (!mMailRefresh.equals(mSharedPreferences.getString(getString(R.string.background_mail_pref), "43200000"))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ public void onReceive(Context context, Intent intent) {
// set mail check alarm
MailCheckReceiver.setAlarm(context);
// set widget update alarm if widgets enabled
WidgetCommon.setUpdateSchedule(context, false);
WidgetCommon.setUpdateSchedule(context);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ public static void updateAppWidgets(Context context, AppWidgetManager appWidgetM

// REFRESH BUTTON
Intent refreshIntent = new Intent(context, StackWidgetProvider.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)));
PendingIntent refreshPendingIntent = PendingIntent.getBroadcast(context, 0, refreshIntent, PendingIntent.FLAG_UPDATE_CURRENT);

// ITEM CLICK
Intent clickIntent = new Intent(context, StackWidgetProvider.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);
Expand Down Expand Up @@ -145,22 +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)) {
// get widget id
int widgetId = intent.getExtras().getInt(AppWidgetManager.EXTRA_APPWIDGET_ID);
// show loader and update data
WidgetCommon.showLoaderAndUpdate(context, widgetId, false);
}

if (action.equals(WidgetCommon.APPWIDGET_AUTO_UPDATE)) {
AppWidgetManager mgr = AppWidgetManager.getInstance(context);
int[] appWidgetIds = mgr.getAppWidgetIds(new ComponentName(context, StackWidgetProvider.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, StackWidgetProvider.class));
Expand Down
Loading

0 comments on commit c3daeaa

Please sign in to comment.