1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-25 22:01:16 +00:00

Show toast when trying to access nodes screen in repo settings if no nodes exist.

This commit is contained in:
Felix Ableitner 2014-06-30 02:19:58 +02:00
parent 0a4121e6cf
commit 52f84e0ec0
2 changed files with 9 additions and 0 deletions

View file

@ -99,6 +99,7 @@ public class RepoSettingsActivity extends PreferenceActivity
mRepoMaster = (CheckBoxPreference) findPreference("repo_master"); mRepoMaster = (CheckBoxPreference) findPreference("repo_master");
mRepoMaster.setOnPreferenceChangeListener(this); mRepoMaster.setOnPreferenceChangeListener(this);
mNodes = (PreferenceScreen) findPreference("nodes"); mNodes = (PreferenceScreen) findPreference("nodes");
mNodes.setOnPreferenceClickListener(this);
mVersioning = (CheckBoxPreference) findPreference("versioning"); mVersioning = (CheckBoxPreference) findPreference("versioning");
mVersioning.setOnPreferenceChangeListener(this); mVersioning.setOnPreferenceChangeListener(this);
mVersioningKeep = (EditTextPreference) findPreference("versioning_keep"); mVersioningKeep = (EditTextPreference) findPreference("versioning_keep");
@ -278,6 +279,9 @@ public class RepoSettingsActivity extends PreferenceActivity
: Environment.getExternalStorageDirectory().getAbsolutePath()); : Environment.getExternalStorageDirectory().getAbsolutePath());
startActivityForResult(intent, DIRECTORY_REQUEST_CODE); startActivityForResult(intent, DIRECTORY_REQUEST_CODE);
} }
else if (preference.equals(mNodes) && mSyncthingService.getApi().getNodes().isEmpty()) {
Toast.makeText(this, R.string.no_nodes, Toast.LENGTH_SHORT).show();
}
else if (preference.equals(mDelete)) { else if (preference.equals(mDelete)) {
new AlertDialog.Builder(this) new AlertDialog.Builder(this)
.setMessage(R.string.delete_repo_confirm) .setMessage(R.string.delete_repo_confirm)

View file

@ -100,6 +100,8 @@
<!-- Setting title --> <!-- Setting title -->
<string name="keep_versions">Keep Versions</string> <string name="keep_versions">Keep Versions</string>
<!-- Setting title -->
<string name="delete_repo">Delete Repository</string> <string name="delete_repo">Delete Repository</string>
<!-- Title for RepoSettingsActivity in create mode --> <!-- Title for RepoSettingsActivity in create mode -->
@ -120,6 +122,9 @@
<!-- Toast shown when trying to create a repository with an empty path --> <!-- Toast shown when trying to create a repository with an empty path -->
<string name="repo_path_required">The repository path must not be empty</string> <string name="repo_path_required">The repository path must not be empty</string>
<!-- Toast shown when selecting 'nodes' if no nodes have been added -->
<string name="no_nodes">Please connect a node first.</string>
<!-- NodeSettingsActivity --> <!-- NodeSettingsActivity -->