From 256f03abf4cf7d81a97cb3fdfae52490e74a9513 Mon Sep 17 00:00:00 2001 From: Yaroslav Berezanskyi Date: Mon, 17 Aug 2015 18:49:40 +0300 Subject: [PATCH] When Full client mode- preference with Json-RPC server becomes disabled --- .../java/io/syng/activity/BaseActivity.java | 1 + .../java/io/syng/activity/SettingsActivity.java | 9 +++++---- app/src/main/res/values/strings_settings.xml | 17 ++++++++++------- app/src/main/res/xml/pref_general.xml | 17 ++++++++--------- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/io/syng/activity/BaseActivity.java b/app/src/main/java/io/syng/activity/BaseActivity.java index 0745a78..891bffd 100644 --- a/app/src/main/java/io/syng/activity/BaseActivity.java +++ b/app/src/main/java/io/syng/activity/BaseActivity.java @@ -588,4 +588,5 @@ public abstract class BaseActivity extends AppCompatActivity implements populateProfiles(); Glide.with(this).load(PrefsUtil.getBackgroundResourceId(ProfileManager.getCurrentProfile().getId())).into(mHeaderImageView); } + } \ No newline at end of file diff --git a/app/src/main/java/io/syng/activity/SettingsActivity.java b/app/src/main/java/io/syng/activity/SettingsActivity.java index 56b2d4f..f7f1481 100644 --- a/app/src/main/java/io/syng/activity/SettingsActivity.java +++ b/app/src/main/java/io/syng/activity/SettingsActivity.java @@ -109,10 +109,11 @@ public class SettingsActivity extends PreferenceActivity { int index = listPreference.findIndexOfValue(stringValue); // Set the summary to reflect the new value. - preference.setSummary( - index >= 0 - ? listPreference.getEntries()[index] - : null); + preference.setSummary(index >= 0 ? listPreference.getEntries()[index] : null); + + Preference jsonRPC = findPreference(getString(R.string.pref_json_rpc_server_key)); + jsonRPC.setEnabled(!stringValue.equals(getString(R.string.pref_running_mode_full_value))); + } else if (key.equals(getString(R.string.pref_json_rpc_server_key))) { preference.setSummary("Current server address is " + stringValue); } else { diff --git a/app/src/main/res/values/strings_settings.xml b/app/src/main/res/values/strings_settings.xml index cc6b5bb..44e0651 100644 --- a/app/src/main/res/values/strings_settings.xml +++ b/app/src/main/res/values/strings_settings.xml @@ -17,16 +17,19 @@ Running Mode + Full Client + Light Client + 1 + 2 + - Full Client - Light Client - Json RPC Client + @string/pref_running_mode_full_name + @string/pref_running_mode_light_name - 1 - 2 - 3 + @string/pref_running_mode_full_value + @string/pref_running_mode_light_value @@ -55,7 +58,7 @@ rpc0.syng.io:8545 pref_json_rpc_server_key JSON-RPC server address - runningMode + running_mode diff --git a/app/src/main/res/xml/pref_general.xml b/app/src/main/res/xml/pref_general.xml index f852de1..02d01ee 100644 --- a/app/src/main/res/xml/pref_general.xml +++ b/app/src/main/res/xml/pref_general.xml @@ -1,6 +1,14 @@ + + - -