diff options
author | Roman Romanov <rromanov@65gb.net> | 2017-04-19 15:13:25 +0300 |
---|---|---|
committer | Roman Romanov <rromanov@65gb.net> | 2017-04-25 13:56:42 +0300 |
commit | 052e3fa8e4fe536dbe7b1a25ac67c9a17ff731e0 (patch) | |
tree | e68e11da75a632e0420625f998a5a71bd8c7b501 /android | |
parent | 4c11e311481c9318d5a45d65682bf5f97145369b (diff) |
[android] Review fixesMAPSME-49-settings-refactoring
Diffstat (limited to 'android')
-rw-r--r-- | android/src/com/mapswithme/maps/settings/SettingsPrefsFragment.java | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/android/src/com/mapswithme/maps/settings/SettingsPrefsFragment.java b/android/src/com/mapswithme/maps/settings/SettingsPrefsFragment.java index c2a966cfc6..0b67d7d03d 100644 --- a/android/src/com/mapswithme/maps/settings/SettingsPrefsFragment.java +++ b/android/src/com/mapswithme/maps/settings/SettingsPrefsFragment.java @@ -279,26 +279,7 @@ public class SettingsPrefsFragment extends BaseXmlSettingsFragment mPrefLanguages = (ListPreference) findPreference(getString(R.string.pref_tts_language)); mLangInfo = findPreference(getString(R.string.pref_tts_info)); mLangInfoLink = findPreference(getString(R.string.pref_tts_info_link)); - if (mLangInfoLink != null) - { - Spannable link = new SpannableString(getString(R.string.prefs_languages_information_off_link)); - link.setSpan(new ForegroundColorSpan(ContextCompat.getColor(getContext(), - UiUtils.getStyledResourceId(getContext(), R.attr.colorAccent))), - 0, link.length(), 0); - mLangInfoLink.setSummary(link); - mLangInfoLink.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() - { - @Override - public boolean onPreferenceClick(Preference preference) - { - final Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setData(Uri.parse(TTS_INFO_LINK)); - getContext().startActivity(intent); - return false; - } - }); - mPreferenceScreen.removePreference(mLangInfoLink); - } + initLangInfoLink(); updateStoragePrefs(); initStoragePrefCallbacks(); initMeasureUnitsPrefsCallbacks(); @@ -369,6 +350,30 @@ public class SettingsPrefsFragment extends BaseXmlSettingsFragment return super.onPreferenceTreeClick(preference); } + private void initLangInfoLink() + { + if (mLangInfoLink != null) + { + Spannable link = new SpannableString(getString(R.string.prefs_languages_information_off_link)); + link.setSpan(new ForegroundColorSpan(ContextCompat.getColor(getContext(), + UiUtils.getStyledResourceId(getContext(), R.attr.colorAccent))), + 0, link.length(), 0); + mLangInfoLink.setSummary(link); + mLangInfoLink.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() + { + @Override + public boolean onPreferenceClick(Preference preference) + { + final Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse(TTS_INFO_LINK)); + getContext().startActivity(intent); + return false; + } + }); + mPreferenceScreen.removePreference(mLangInfoLink); + } + } + private void initSimplifiedTrafficColorsPrefsCallbacks() { final TwoStatePreference prefSimplifiedColors = (TwoStatePreference)findPreference( |