1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-12-24 11:51:30 +00:00

Changed wifi/power preference names to be easier to understand.

This commit is contained in:
Felix Ableitner 2014-09-15 18:21:45 +03:00
parent a9f9ef4ff1
commit 4886bbe0d1
4 changed files with 19 additions and 18 deletions

View file

@ -25,9 +25,9 @@ public class SettingsFragment extends PreferenceFragment
private static final String SYNCTHING_VERSION_KEY = "syncthing_version"; private static final String SYNCTHING_VERSION_KEY = "syncthing_version";
private CheckBoxPreference mStopNotCharging; private CheckBoxPreference mSyncOnlyCharging;
private CheckBoxPreference mStopMobileData; private CheckBoxPreference mSyncOnlyWifi;
private Preference mVersion; private Preference mVersion;
@ -65,7 +65,7 @@ public class SettingsFragment extends PreferenceFragment
/** /**
* Applies the given value to the preference. * Applies the given value to the preference.
* <p/> *
* If pref is an EditTextPreference, setText is used and the value shown as summary. If pref is * If pref is an EditTextPreference, setText is used and the value shown as summary. If pref is
* a CheckBoxPreference, setChecked is used (by parsing value as Boolean). * a CheckBoxPreference, setChecked is used (by parsing value as Boolean).
*/ */
@ -81,7 +81,7 @@ public class SettingsFragment extends PreferenceFragment
/** /**
* Loads layout, sets version from Rest API. * Loads layout, sets version from Rest API.
* <p/> *
* Manual target API as we manually check if ActionBar is available (for ActionBar back button). * Manual target API as we manually check if ActionBar is available (for ActionBar back button).
*/ */
@Override @Override
@ -92,10 +92,11 @@ public class SettingsFragment extends PreferenceFragment
addPreferencesFromResource(R.xml.app_settings); addPreferencesFromResource(R.xml.app_settings);
PreferenceScreen screen = getPreferenceScreen(); PreferenceScreen screen = getPreferenceScreen();
mStopNotCharging = (CheckBoxPreference) findPreference("stop_sync_on_mobile_data"); mSyncOnlyCharging = (CheckBoxPreference)
mStopNotCharging.setOnPreferenceChangeListener(this); findPreference(SyncthingService.PREF_SYNC_ONLY_CHARGING);
mStopMobileData = (CheckBoxPreference) findPreference("stop_sync_while_not_charging"); mSyncOnlyCharging.setOnPreferenceChangeListener(this);
mStopMobileData.setOnPreferenceChangeListener(this); mSyncOnlyWifi = (CheckBoxPreference) findPreference(SyncthingService.PREF_SYNC_ONLY_WIFI);
mSyncOnlyWifi.setOnPreferenceChangeListener(this);
mVersion = screen.findPreference(SYNCTHING_VERSION_KEY); mVersion = screen.findPreference(SYNCTHING_VERSION_KEY);
mOptionsScreen = (PreferenceScreen) screen.findPreference(SYNCTHING_OPTIONS_KEY); mOptionsScreen = (PreferenceScreen) screen.findPreference(SYNCTHING_OPTIONS_KEY);
mGuiScreen = (PreferenceScreen) screen.findPreference(SYNCTHING_GUI_KEY); mGuiScreen = (PreferenceScreen) screen.findPreference(SYNCTHING_GUI_KEY);
@ -136,7 +137,7 @@ public class SettingsFragment extends PreferenceFragment
} }
} }
if (preference.equals(mStopNotCharging) || preference.equals(mStopMobileData)) { if (preference.equals(mSyncOnlyCharging) || preference.equals(mSyncOnlyWifi)) {
mSyncthingService.updateState(); mSyncthingService.updateState();
} else if (mOptionsScreen.findPreference(preference.getKey()) != null) { } else if (mOptionsScreen.findPreference(preference.getKey()) != null) {
mSyncthingService.getApi().setValue(RestApi.TYPE_OPTIONS, preference.getKey(), o, mSyncthingService.getApi().setValue(RestApi.TYPE_OPTIONS, preference.getKey(), o,

View file

@ -54,9 +54,9 @@ public class SyncthingService extends Service {
*/ */
public static final String BINARY_NAME = "lib/libsyncthing.so"; public static final String BINARY_NAME = "lib/libsyncthing.so";
public static final String PREF_SYNC_ONLY_WIFI = "stop_sync_on_mobile_data"; public static final String PREF_SYNC_ONLY_WIFI = "sync_only_wifi";
public static final String PREF_SYNC_ONLY_CHARGING = "stop_sync_while_not_charging"; public static final String PREF_SYNC_ONLY_CHARGING = "sync_only_charging";
private ConfigXml mConfig; private ConfigXml mConfig;

View file

@ -190,9 +190,9 @@ Please report any problems you encounter via Github.</string>
<!-- Activity title --> <!-- Activity title -->
<string name="settings_title">Settings</string> <string name="settings_title">Settings</string>
<string name="stop_sync_while_not_charging">Stop sync when not charging</string> <string name="sync_only_charging">Sync only when charging</string>
<string name="stop_sync_on_mobile_data">Stop sync on mobile data</string> <string name="sync_only_wifi">Sync only on wifi</string>
<!-- Settings item that opens issue tracker --> <!-- Settings item that opens issue tracker -->
<string name="report_issue_title">Report Issue</string> <string name="report_issue_title">Report Issue</string>
@ -223,10 +223,10 @@ Please report any problems you encounter via Github.</string>
<!-- SyncthingService --> <!-- SyncthingService -->
<!-- Title of the dialog shown when the syncthing binary returns an error --> <!-- Title of the dialog shown when the syncthing binary returns an error -->
<string name="binary_crashed_title">Syncthing Binary Crashed</string> <string name="binary_crashed_title">Syncthing Binary Crashed</string>
<!-- Message of the dialog shown when the syncthing binary returns an error --> <!-- Message of the dialog shown when the syncthing binary returns an error -->
<string name="binary_crashed_message">The syncthing binary has exited with error code %1$d.\n\n <string name="binary_crashed_message">The syncthing binary has exited with error code %1$d.\n\n
If this error persists, try reinstalling the app and restarting your device.\n\n</string> If this error persists, try reinstalling the app and restarting your device.\n\n</string>

View file

@ -2,13 +2,13 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<CheckBoxPreference <CheckBoxPreference
android:key="stop_sync_while_not_charging" android:key="sync_only_charging"
android:title="@string/stop_sync_while_not_charging" android:title="@string/sync_only_charging"
android:defaultValue="true" /> android:defaultValue="true" />
<CheckBoxPreference <CheckBoxPreference
android:key="stop_sync_on_mobile_data" android:key="sync_only_wifi"
android:title="@string/stop_sync_on_mobile_data" android:title="@string/sync_only_wifi"
android:defaultValue="true" /> android:defaultValue="true" />
<PreferenceScreen <PreferenceScreen