include gpodnet last sync report on Sync pref summary

This commit is contained in:
Domingos Lopes 2016-07-17 14:10:58 -04:00
parent cf035bc748
commit 91f12080ef
3 changed files with 14 additions and 24 deletions

View File

@ -91,7 +91,6 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc
public static final String PREF_GPODNET_LOGOUT = "pref_gpodnet_logout";
public static final String PREF_GPODNET_HOSTNAME = "pref_gpodnet_hostname";
public static final String PREF_GPODNET_NOTIFICATIONS = "pref_gpodnet_notifications";
public static final String PREF_GPODNET_SYNC_REPORT = "pref_gpodnet_sync_report";
public static final String PREF_EXPANDED_NOTIFICATION = "prefExpandNotify";
public static final String PREF_PROXY = "prefProxy";
public static final String PREF_KNOWN_ISSUES = "prefKnownIssues";
@ -510,24 +509,20 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc
}
private void updateLastGpodnetSyncReport(boolean successful, long lastTime) {
Preference syncReport = ui.findPreference(PREF_GPODNET_SYNC_REPORT);
Preference sync = ui.findPreference(PREF_GPODNET_SYNC);
if (lastTime != 0) {
syncReport.setTitle(ui.getActivity().getString(R.string.pref_gpodnet_last_sync_title,
ui.getActivity().getString(successful ?
R.string.gpodnetsync_pref_report_successful :
R.string.gpodnetsync_pref_report_failed)));
syncReport.setSummary(DateUtils.getRelativeDateTimeString(
ui.getActivity(),
lastTime,
DateUtils.MINUTE_IN_MILLIS,
DateUtils.WEEK_IN_MILLIS,
DateUtils.FORMAT_SHOW_TIME));
syncReport.setEnabled(true);
sync.setSummary(ui.getActivity().getString(R.string.pref_gpodnet_sync_sum) + "\n" +
ui.getActivity().getString(R.string.pref_gpodnet_sync_sum_last_sync_line,
ui.getActivity().getString(successful ?
R.string.gpodnetsync_pref_report_successful :
R.string.gpodnetsync_pref_report_failed),
DateUtils.getRelativeDateTimeString(ui.getActivity(),
lastTime,
DateUtils.MINUTE_IN_MILLIS,
DateUtils.WEEK_IN_MILLIS,
DateUtils.FORMAT_SHOW_TIME)));
} else {
syncReport.setTitle(ui.getActivity().getString(R.string.pref_gpodnet_last_sync_title,
ui.getActivity().getString(R.string.gpodnetsync_pref_report_undetermined)));
syncReport.setSummary(null);
syncReport.setEnabled(false);
sync.setSummary(ui.getActivity().getString(R.string.pref_gpodnet_sync_sum));
}
}

View File

@ -249,10 +249,6 @@
android:key="pref_gpodnet_sync"
android:title="@string/pref_gpodnet_sync_title"
android:summary="@string/pref_gpodnet_sync_sum"/>
<Preference android:key="pref_gpodnet_sync_report"
android:title="@string/pref_gpodnet_last_sync_title"
android:enabled="false"
android:shouldDisableView="true"/>
<Preference
android:key="pref_gpodnet_logout"
android:title="@string/pref_gpodnet_logout_title"/>

View File

@ -365,12 +365,12 @@
<string name="pref_gpodnet_setlogin_information_title">Change login information</string>
<string name="pref_gpodnet_setlogin_information_sum">Change the login information for your gpodder.net account.</string>
<string name="pref_gpodnet_sync_title">Sync now</string>
<string name="pref_gpodnet_sync_sum">Sync subscriptions and episode states with gpodder.net</string>
<string name="pref_gpodnet_sync_sum">Sync subscriptions and episode states with gpodder.net.</string>
<string name="pref_gpodnet_sync_sum_last_sync_line">Last sync attempt: %1$s (%2$s)</string>
<string name="pref_gpodnet_sync_started">Sync started</string>
<string name="pref_gpodnet_login_status"><![CDATA[Logged in as <i>%1$s</i> with device <i>%2$s</i>]]></string>
<string name="pref_gpodnet_notifications_title">Show sync error notifications</string>
<string name="pref_gpodnet_notifications_sum">This setting does not apply to authentication errors.</string>
<string name="pref_gpodnet_last_sync_title">Last sync attempt: %1$s</string>
<string name="pref_playback_speed_title">Playback Speeds</string>
<string name="pref_playback_speed_sum">Customize the speeds available for variable speed audio playback</string>
<string name="pref_fast_forward">Fast forward time</string>
@ -507,7 +507,6 @@
<string name="gpodnetsync_error_descr">An error occurred during syncing:\u0020</string>
<string name="gpodnetsync_pref_report_successful">Successful</string>
<string name="gpodnetsync_pref_report_failed">Failed</string>
<string name="gpodnetsync_pref_report_undetermined">Never</string>
<!-- Directory chooser -->
<string name="selected_folder_label">Selected folder:</string>