Merge pull request #925 from danners/develop

Download Report: introduce setting to disable
This commit is contained in:
Martin Fietz 2015-06-21 23:55:22 +02:00
commit e977b5fa54
4 changed files with 27 additions and 1 deletions

View File

@ -25,6 +25,12 @@
android:key="prefPersistNotify" android:key="prefPersistNotify"
android:summary="@string/pref_persistNotify_sum" android:summary="@string/pref_persistNotify_sum"
android:title="@string/pref_persistNotify_title"/> android:title="@string/pref_persistNotify_title"/>
<CheckBoxPreference
android:defaultValue="true"
android:enabled="true"
android:key="prefShowDownloadReport"
android:summary="@string/pref_showDownloadReport_sum"
android:title="@string/pref_showDownloadReport_title"/>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/queue_label"> <PreferenceCategory android:title="@string/queue_label">

View File

@ -44,6 +44,7 @@ public class UserPreferences implements
public static final String PREF_HIDDEN_DRAWER_ITEMS = "prefHiddenDrawerItems"; public static final String PREF_HIDDEN_DRAWER_ITEMS = "prefHiddenDrawerItems";
public static final String PREF_EXPANDED_NOTIFICATION = "prefExpandNotify"; public static final String PREF_EXPANDED_NOTIFICATION = "prefExpandNotify";
public static final String PREF_PERSISTENT_NOTIFICATION = "prefPersistNotify"; public static final String PREF_PERSISTENT_NOTIFICATION = "prefPersistNotify";
public static final String PREF_SHOW_DOWNLOAD_REPORT = "prefShowDownloadReport";
// Queue // Queue
public static final String PREF_QUEUE_ADD_TO_FRONT = "prefQueueAddToFront"; public static final String PREF_QUEUE_ADD_TO_FRONT = "prefQueueAddToFront";
@ -94,6 +95,7 @@ public class UserPreferences implements
private List<String> hiddenDrawerItems; private List<String> hiddenDrawerItems;
private int notifyPriority; private int notifyPriority;
private boolean persistNotify; private boolean persistNotify;
private boolean showDownloadReport;
// Queue // Queue
private boolean enqueueAtFront; private boolean enqueueAtFront;
@ -164,6 +166,7 @@ public class UserPreferences implements
} }
hiddenDrawerItems = Arrays.asList(StringUtils.split(sp.getString(PREF_HIDDEN_DRAWER_ITEMS, ""), ',')); hiddenDrawerItems = Arrays.asList(StringUtils.split(sp.getString(PREF_HIDDEN_DRAWER_ITEMS, ""), ','));
persistNotify = sp.getBoolean(PREF_PERSISTENT_NOTIFICATION, false); persistNotify = sp.getBoolean(PREF_PERSISTENT_NOTIFICATION, false);
showDownloadReport = sp.getBoolean(PREF_SHOW_DOWNLOAD_REPORT, true);
// Queue // Queue
enqueueAtFront = sp.getBoolean(PREF_QUEUE_ADD_TO_FRONT, false); enqueueAtFront = sp.getBoolean(PREF_QUEUE_ADD_TO_FRONT, false);
@ -307,6 +310,16 @@ public class UserPreferences implements
return instance.persistNotify; return instance.persistNotify;
} }
/**
* Returns true if download reports are shown
*
* @return {@code true} if download reports are shown, {@code false} otherwise
*/
public static boolean showDownloadReport() {
instanceAvailable();
return instance.showDownloadReport;
}
/** /**
* Returns {@code true} if new queue elements are added to the front * Returns {@code true} if new queue elements are added to the front
* *
@ -463,6 +476,9 @@ public class UserPreferences implements
case PREF_PERSISTENT_NOTIFICATION: case PREF_PERSISTENT_NOTIFICATION:
persistNotify = sp.getBoolean(PREF_PERSISTENT_NOTIFICATION, false); persistNotify = sp.getBoolean(PREF_PERSISTENT_NOTIFICATION, false);
break; break;
case PREF_SHOW_DOWNLOAD_REPORT:
showDownloadReport = sp.getBoolean(PREF_SHOW_DOWNLOAD_REPORT, true);
break;
// Queue // Queue
case PREF_QUEUE_ADD_TO_FRONT: case PREF_QUEUE_ADD_TO_FRONT:
enqueueAtFront = sp.getBoolean(PREF_QUEUE_ADD_TO_FRONT, false); enqueueAtFront = sp.getBoolean(PREF_QUEUE_ADD_TO_FRONT, false);

View File

@ -309,7 +309,8 @@ public class DownloadService extends Service {
Log.d(TAG, "Service shutting down"); Log.d(TAG, "Service shutting down");
isRunning = false; isRunning = false;
if (ClientConfig.downloadServiceCallbacks.shouldCreateReport()) { if (ClientConfig.downloadServiceCallbacks.shouldCreateReport() &&
UserPreferences.showDownloadReport()) {
updateReport(); updateReport();
} }

View File

@ -307,6 +307,9 @@
<string name="pref_expandNotify_sum">Always expand the notification to show playback buttons.</string> <string name="pref_expandNotify_sum">Always expand the notification to show playback buttons.</string>
<string name="pref_persistNotify_title">Persistent Playback Controls</string> <string name="pref_persistNotify_title">Persistent Playback Controls</string>
<string name="pref_persistNotify_sum">Keep notification and lockscreen controls when playback is paused.</string> <string name="pref_persistNotify_sum">Keep notification and lockscreen controls when playback is paused.</string>
<string name="pref_showDownloadReport_title">Show Download Report</string>
<string name="pref_showDownloadReport_sum">If downloads fail, generate a report that shows the details of the failure.</string>
<string name="pref_expand_notify_unsupport_toast">Android versions before 4.1 do not support expanded notifications.</string> <string name="pref_expand_notify_unsupport_toast">Android versions before 4.1 do not support expanded notifications.</string>
<string name="pref_queueAddToFront_sum">Add new episodes to the front of the queue.</string> <string name="pref_queueAddToFront_sum">Add new episodes to the front of the queue.</string>
<string name="pref_queueAddToFront_title">Enqueue at Front</string> <string name="pref_queueAddToFront_title">Enqueue at Front</string>