From 52f84e0ec04773c55e7ddb5ebb3def5851f7cc10 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Mon, 30 Jun 2014 02:19:58 +0200 Subject: [PATCH] Show toast when trying to access nodes screen in repo settings if no nodes exist. --- .../nutomic/syncthingandroid/gui/RepoSettingsActivity.java | 4 ++++ src/main/res/values/strings.xml | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/main/java/com/nutomic/syncthingandroid/gui/RepoSettingsActivity.java b/src/main/java/com/nutomic/syncthingandroid/gui/RepoSettingsActivity.java index 252343e5..0211968e 100644 --- a/src/main/java/com/nutomic/syncthingandroid/gui/RepoSettingsActivity.java +++ b/src/main/java/com/nutomic/syncthingandroid/gui/RepoSettingsActivity.java @@ -99,6 +99,7 @@ public class RepoSettingsActivity extends PreferenceActivity mRepoMaster = (CheckBoxPreference) findPreference("repo_master"); mRepoMaster.setOnPreferenceChangeListener(this); mNodes = (PreferenceScreen) findPreference("nodes"); + mNodes.setOnPreferenceClickListener(this); mVersioning = (CheckBoxPreference) findPreference("versioning"); mVersioning.setOnPreferenceChangeListener(this); mVersioningKeep = (EditTextPreference) findPreference("versioning_keep"); @@ -278,6 +279,9 @@ public class RepoSettingsActivity extends PreferenceActivity : Environment.getExternalStorageDirectory().getAbsolutePath()); 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)) { new AlertDialog.Builder(this) .setMessage(R.string.delete_repo_confirm) diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index f26383da..9e4036f1 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -100,6 +100,8 @@ Keep Versions + + Delete Repository @@ -120,6 +122,9 @@ The repository path must not be empty + + Please connect a node first. +