mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-23 11:21:29 +00:00
Merge branch 'master' of github.com:syncthing/syncthing-android
This commit is contained in:
commit
eb10eaae9d
19 changed files with 29 additions and 70 deletions
|
@ -10,6 +10,7 @@ import android.preference.EditTextPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
import android.support.v4.preference.PreferenceFragment;
|
import android.support.v4.preference.PreferenceFragment;
|
||||||
|
import android.text.InputType;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
|
@ -56,8 +57,6 @@ public class FolderSettingsFragment extends PreferenceFragment
|
||||||
|
|
||||||
private Preference mDirectory;
|
private Preference mDirectory;
|
||||||
|
|
||||||
private EditTextPreference mRescanInterval;
|
|
||||||
|
|
||||||
private CheckBoxPreference mFolderMaster;
|
private CheckBoxPreference mFolderMaster;
|
||||||
|
|
||||||
private PreferenceScreen mDevices;
|
private PreferenceScreen mDevices;
|
||||||
|
@ -87,8 +86,6 @@ public class FolderSettingsFragment extends PreferenceFragment
|
||||||
mFolderId.setOnPreferenceChangeListener(this);
|
mFolderId.setOnPreferenceChangeListener(this);
|
||||||
mDirectory = findPreference("directory");
|
mDirectory = findPreference("directory");
|
||||||
mDirectory.setOnPreferenceClickListener(this);
|
mDirectory.setOnPreferenceClickListener(this);
|
||||||
mRescanInterval = (EditTextPreference) findPreference("rescan_interval");
|
|
||||||
mRescanInterval.setOnPreferenceChangeListener(this);
|
|
||||||
mFolderMaster = (CheckBoxPreference) findPreference("folder_master");
|
mFolderMaster = (CheckBoxPreference) findPreference("folder_master");
|
||||||
mFolderMaster.setOnPreferenceChangeListener(this);
|
mFolderMaster.setOnPreferenceChangeListener(this);
|
||||||
mDevices = (PreferenceScreen) findPreference("devices");
|
mDevices = (PreferenceScreen) findPreference("devices");
|
||||||
|
@ -106,7 +103,7 @@ public class FolderSettingsFragment extends PreferenceFragment
|
||||||
mFolder = new RestApi.Folder();
|
mFolder = new RestApi.Folder();
|
||||||
mFolder.ID = "";
|
mFolder.ID = "";
|
||||||
mFolder.Path = "";
|
mFolder.Path = "";
|
||||||
mFolder.RescanIntervalS = 0;
|
mFolder.RescanIntervalS = 259200; // Scan every 3 days (in case inotify dropped some changes)
|
||||||
mFolder.DeviceIds = new ArrayList<>();
|
mFolder.DeviceIds = new ArrayList<>();
|
||||||
mFolder.Versioning = new RestApi.Versioning();
|
mFolder.Versioning = new RestApi.Versioning();
|
||||||
}
|
}
|
||||||
|
@ -156,8 +153,6 @@ public class FolderSettingsFragment extends PreferenceFragment
|
||||||
mFolderId.setText(mFolder.ID);
|
mFolderId.setText(mFolder.ID);
|
||||||
mFolderId.setSummary(mFolder.ID);
|
mFolderId.setSummary(mFolder.ID);
|
||||||
mDirectory.setSummary(mFolder.Path);
|
mDirectory.setSummary(mFolder.Path);
|
||||||
mRescanInterval.setText(Integer.toString(mFolder.RescanIntervalS));
|
|
||||||
mRescanInterval.setSummary(Integer.toString(mFolder.RescanIntervalS));
|
|
||||||
mFolderMaster.setChecked(mFolder.ReadOnly);
|
mFolderMaster.setChecked(mFolder.ReadOnly);
|
||||||
List<RestApi.Device> devicesList = mSyncthingService.getApi().getDevices(false);
|
List<RestApi.Device> devicesList = mSyncthingService.getApi().getDevices(false);
|
||||||
for (RestApi.Device n : devicesList) {
|
for (RestApi.Device n : devicesList) {
|
||||||
|
@ -241,6 +236,15 @@ public class FolderSettingsFragment extends PreferenceFragment
|
||||||
public boolean onPreferenceChange(Preference preference, Object o) {
|
public boolean onPreferenceChange(Preference preference, Object o) {
|
||||||
if (preference instanceof EditTextPreference) {
|
if (preference instanceof EditTextPreference) {
|
||||||
EditTextPreference pref = (EditTextPreference) preference;
|
EditTextPreference pref = (EditTextPreference) preference;
|
||||||
|
if ((pref.getEditText().getInputType() & InputType.TYPE_CLASS_NUMBER) > 0) {
|
||||||
|
try {
|
||||||
|
o = Integer.parseInt((String) o);
|
||||||
|
o = o.toString();
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
Log.w(TAG, "Invalid number: " + o);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
pref.setSummary((String) o);
|
pref.setSummary((String) o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,11 +256,6 @@ public class FolderSettingsFragment extends PreferenceFragment
|
||||||
mFolder.Path = (String) o;
|
mFolder.Path = (String) o;
|
||||||
folderUpdated();
|
folderUpdated();
|
||||||
return true;
|
return true;
|
||||||
} else if (preference.equals(mRescanInterval)) {
|
|
||||||
mFolder.RescanIntervalS = Integer.parseInt((String) o);
|
|
||||||
mRescanInterval.setSummary((String) o);
|
|
||||||
folderUpdated();
|
|
||||||
return true;
|
|
||||||
} else if (preference.equals(mFolderMaster)) {
|
} else if (preference.equals(mFolderMaster)) {
|
||||||
mFolder.ReadOnly = (Boolean) o;
|
mFolder.ReadOnly = (Boolean) o;
|
||||||
folderUpdated();
|
folderUpdated();
|
||||||
|
@ -291,10 +290,14 @@ public class FolderSettingsFragment extends PreferenceFragment
|
||||||
folderUpdated();
|
folderUpdated();
|
||||||
return true;
|
return true;
|
||||||
} else if (preference.equals(mVersioningKeep)) {
|
} else if (preference.equals(mVersioningKeep)) {
|
||||||
((RestApi.SimpleVersioning) mFolder.Versioning)
|
try {
|
||||||
.setParams(Integer.parseInt((String) o));
|
((RestApi.SimpleVersioning) mFolder.Versioning)
|
||||||
folderUpdated();
|
.setParams(Integer.parseInt((String) o));
|
||||||
return true;
|
folderUpdated();
|
||||||
|
return true;
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
Log.w(TAG, "Invalid versioning option: "+ o);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -172,10 +172,17 @@ public class SettingsFragment extends PreferenceFragment
|
||||||
public boolean onPreferenceChange(Preference preference, Object o) {
|
public boolean onPreferenceChange(Preference preference, Object o) {
|
||||||
// Convert new value to integer if input type is number.
|
// Convert new value to integer if input type is number.
|
||||||
if (preference instanceof EditTextPreference) {
|
if (preference instanceof EditTextPreference) {
|
||||||
EditTextPreference etp = (EditTextPreference) preference;
|
EditTextPreference pref = (EditTextPreference) preference;
|
||||||
if (etp.getEditText().getInputType() == InputType.TYPE_CLASS_NUMBER) {
|
if ((pref.getEditText().getInputType() & InputType.TYPE_CLASS_NUMBER) > 0) {
|
||||||
o = Integer.parseInt((String) o);
|
try {
|
||||||
|
o = Integer.parseInt((String) o);
|
||||||
|
o = o.toString();
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
Log.w(TAG, "Invalid number: " + o);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
pref.setSummary((String) o);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preference.equals(mSyncOnlyCharging) || preference.equals(mSyncOnlyWifi)) {
|
if (preference.equals(mSyncOnlyCharging) || preference.equals(mSyncOnlyWifi)) {
|
||||||
|
@ -216,14 +223,6 @@ public class SettingsFragment extends PreferenceFragment
|
||||||
((SyncthingActivity) getActivity()).getApi().requireRestart(getActivity());
|
((SyncthingActivity) getActivity()).getApi().requireRestart(getActivity());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the preference value as summary.
|
|
||||||
if (preference instanceof EditTextPreference) {
|
|
||||||
String value = (o instanceof String)
|
|
||||||
? (String) o
|
|
||||||
: Integer.toString((Integer) o);
|
|
||||||
preference.setSummary(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,8 +52,6 @@
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="directory">Adresář</string>
|
<string name="directory">Adresář</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="rescan_interval">Interval opakování skenování</string>
|
|
||||||
<!--Setting title-->
|
|
||||||
<string name="folder_master">Master adresář</string>
|
<string name="folder_master">Master adresář</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="devices">Přístroje</string>
|
<string name="devices">Přístroje</string>
|
||||||
|
|
|
@ -52,8 +52,6 @@
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="directory">Verzeichnis</string>
|
<string name="directory">Verzeichnis</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="rescan_interval">Suchintervall</string>
|
|
||||||
<!--Setting title-->
|
|
||||||
<string name="folder_master">Originalverzeichnis</string>
|
<string name="folder_master">Originalverzeichnis</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="devices">Geräte</string>
|
<string name="devices">Geräte</string>
|
||||||
|
|
|
@ -51,8 +51,6 @@
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="directory">Directorio</string>
|
<string name="directory">Directorio</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="rescan_interval">Intervalo de Reescanéo</string>
|
|
||||||
<!--Setting title-->
|
|
||||||
<string name="folder_master">Carpeta Maestra</string>
|
<string name="folder_master">Carpeta Maestra</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="devices">Dispositivos</string>
|
<string name="devices">Dispositivos</string>
|
||||||
|
|
|
@ -52,8 +52,6 @@
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="directory">Dossier</string>
|
<string name="directory">Dossier</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="rescan_interval">Intervalle d\'analyse</string>
|
|
||||||
<!--Setting title-->
|
|
||||||
<string name="folder_master">Dossier maitre</string>
|
<string name="folder_master">Dossier maitre</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="devices">Machines</string>
|
<string name="devices">Machines</string>
|
||||||
|
|
|
@ -50,8 +50,6 @@
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="directory">Cartella</string>
|
<string name="directory">Cartella</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="rescan_interval">Intervallo Scansione</string>
|
|
||||||
<!--Setting title-->
|
|
||||||
<string name="folder_master">Cartella Principale</string>
|
<string name="folder_master">Cartella Principale</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="devices">Dispositivi</string>
|
<string name="devices">Dispositivi</string>
|
||||||
|
|
|
@ -52,8 +52,6 @@
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="directory">ディレクトリー</string>
|
<string name="directory">ディレクトリー</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="rescan_interval">再スキャン間隔</string>
|
|
||||||
<!--Setting title-->
|
|
||||||
<string name="folder_master">フォルダーマスター</string>
|
<string name="folder_master">フォルダーマスター</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="devices">デバイス</string>
|
<string name="devices">デバイス</string>
|
||||||
|
|
|
@ -52,8 +52,6 @@
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="directory">Map</string>
|
<string name="directory">Map</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="rescan_interval">Herscanningstussenpose</string>
|
|
||||||
<!--Setting title-->
|
|
||||||
<string name="folder_master">Maphoofd</string>
|
<string name="folder_master">Maphoofd</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="devices">Apparaten</string>
|
<string name="devices">Apparaten</string>
|
||||||
|
|
|
@ -51,8 +51,6 @@
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="directory">Katalog</string>
|
<string name="directory">Katalog</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="rescan_interval">Czas między skanowaniem</string>
|
|
||||||
<!--Setting title-->
|
|
||||||
<string name="folder_master">Folder nadrzędny</string>
|
<string name="folder_master">Folder nadrzędny</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="devices">Urządzenia</string>
|
<string name="devices">Urządzenia</string>
|
||||||
|
|
|
@ -52,8 +52,6 @@
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="directory">Pasta</string>
|
<string name="directory">Pasta</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="rescan_interval">Intervalo entre verificações</string>
|
|
||||||
<!--Setting title-->
|
|
||||||
<string name="folder_master">Pasta Mestre</string>
|
<string name="folder_master">Pasta Mestre</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="devices">Dispositivos</string>
|
<string name="devices">Dispositivos</string>
|
||||||
|
|
|
@ -52,8 +52,6 @@
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="directory">Pasta</string>
|
<string name="directory">Pasta</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="rescan_interval">Intervalo entre verificações</string>
|
|
||||||
<!--Setting title-->
|
|
||||||
<string name="folder_master">Pasta Mestre</string>
|
<string name="folder_master">Pasta Mestre</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="devices">Dispositivos</string>
|
<string name="devices">Dispositivos</string>
|
||||||
|
|
|
@ -51,8 +51,6 @@
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="directory">Папка</string>
|
<string name="directory">Папка</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="rescan_interval">Интервал Сканирования</string>
|
|
||||||
<!--Setting title-->
|
|
||||||
<string name="folder_master">Главная папка</string>
|
<string name="folder_master">Главная папка</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="devices">Устройства</string>
|
<string name="devices">Устройства</string>
|
||||||
|
|
|
@ -52,8 +52,6 @@
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="directory">Dizin</string>
|
<string name="directory">Dizin</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="rescan_interval">Yeniden Tarama Aralığı</string>
|
|
||||||
<!--Setting title-->
|
|
||||||
<string name="folder_master">Ana Klasör</string>
|
<string name="folder_master">Ana Klasör</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="devices">Cihazlar</string>
|
<string name="devices">Cihazlar</string>
|
||||||
|
|
|
@ -52,8 +52,6 @@
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="directory">目录</string>
|
<string name="directory">目录</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="rescan_interval">扫描间隔</string>
|
|
||||||
<!--Setting title-->
|
|
||||||
<string name="folder_master">主文件夹</string>
|
<string name="folder_master">主文件夹</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="devices">设备</string>
|
<string name="devices">设备</string>
|
||||||
|
|
|
@ -51,8 +51,6 @@
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="directory">資料夾</string>
|
<string name="directory">資料夾</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="rescan_interval">重新掃描間隔</string>
|
|
||||||
<!--Setting title-->
|
|
||||||
<string name="folder_master">主資料夾</string>
|
<string name="folder_master">主資料夾</string>
|
||||||
<!--Setting title-->
|
<!--Setting title-->
|
||||||
<string name="devices">裝置</string>
|
<string name="devices">裝置</string>
|
||||||
|
|
|
@ -89,9 +89,6 @@
|
||||||
<!-- Setting title -->
|
<!-- Setting title -->
|
||||||
<string name="directory">Directory</string>
|
<string name="directory">Directory</string>
|
||||||
|
|
||||||
<!-- Setting title -->
|
|
||||||
<string name="rescan_interval">Rescan Interval</string>
|
|
||||||
|
|
||||||
<!-- Setting title -->
|
<!-- Setting title -->
|
||||||
<string name="folder_master">Folder Master</string>
|
<string name="folder_master">Folder Master</string>
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,6 @@
|
||||||
android:key="directory"
|
android:key="directory"
|
||||||
android:title="@string/directory" />
|
android:title="@string/directory" />
|
||||||
|
|
||||||
<EditTextPreference
|
|
||||||
android:persistent="false"
|
|
||||||
android:key="rescan_interval"
|
|
||||||
android:title="@string/rescan_interval"
|
|
||||||
android:inputType="numberDecimal" />
|
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:key="folder_master"
|
android:key="folder_master"
|
||||||
|
|
|
@ -15,12 +15,6 @@
|
||||||
android:enabled="false"
|
android:enabled="false"
|
||||||
style="?android:preferenceInformationStyle" />
|
style="?android:preferenceInformationStyle" />
|
||||||
|
|
||||||
<EditTextPreference
|
|
||||||
android:persistent="false"
|
|
||||||
android:key="rescan_interval"
|
|
||||||
android:title="@string/rescan_interval"
|
|
||||||
android:inputType="numberDecimal" />
|
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:key="folder_master"
|
android:key="folder_master"
|
||||||
|
|
Loading…
Reference in a new issue