From aea3b07f7840f70e2c551f1b3b7352d32a785f69 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 4 Oct 2015 22:02:13 +0100 Subject: [PATCH] Latest set --- .../openlp/android2/activities/SettingsActivity.java | 3 +-- .../org/openlp/android2/common/OpenLPHttpClient.java | 2 +- .../openlp/android2/fragments/LiveListFragment.java | 10 +++++++++- .../android2/fragments/ServiceListFragment.java | 12 ++++++++++-- app/src/main/res/values/defaultValues.xml | 1 + app/src/main/res/values/keyStrings.xml | 1 + app/src/main/res/values/strings.xml | 4 +++- app/src/main/res/xml/pref_general.xml | 6 ++++++ app/src/main/res/xml/pref_headers.xml | 2 +- 9 files changed, 33 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/org/openlp/android2/activities/SettingsActivity.java b/app/src/main/java/org/openlp/android2/activities/SettingsActivity.java index a078c91..427c03d 100644 --- a/app/src/main/java/org/openlp/android2/activities/SettingsActivity.java +++ b/app/src/main/java/org/openlp/android2/activities/SettingsActivity.java @@ -167,8 +167,7 @@ public class SettingsActivity extends PreferenceActivity { // Set the listener to watch for value changes. preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener); - // Trigger the listener immediately with the preference's - // current value. + // Trigger the listener immediately with the preference's current value. sBindPreferenceSummaryToValueListener.onPreferenceChange(preference, PreferenceManager .getDefaultSharedPreferences(preference.getContext()) diff --git a/app/src/main/java/org/openlp/android2/common/OpenLPHttpClient.java b/app/src/main/java/org/openlp/android2/common/OpenLPHttpClient.java index 5a5d566..e1384a4 100644 --- a/app/src/main/java/org/openlp/android2/common/OpenLPHttpClient.java +++ b/app/src/main/java/org/openlp/android2/common/OpenLPHttpClient.java @@ -85,7 +85,7 @@ public class OpenLPHttpClient { public String getBaseUrl(){ SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); - useSSL =sharedPrefs.getBoolean(context.getString(R.string.key_ssl_use), false); + useSSL = sharedPrefs.getBoolean(context.getString(R.string.key_ssl_use), false); String host = sharedPrefs.getString(context.getString(R.string.key_host), context.getString(R.string.host_default_value)); String port = sharedPrefs.getString(context.getString(R.string.key_port), "4316"); diff --git a/app/src/main/java/org/openlp/android2/fragments/LiveListFragment.java b/app/src/main/java/org/openlp/android2/fragments/LiveListFragment.java index 20e9eff..3717a68 100644 --- a/app/src/main/java/org/openlp/android2/fragments/LiveListFragment.java +++ b/app/src/main/java/org/openlp/android2/fragments/LiveListFragment.java @@ -23,6 +23,7 @@ import android.graphics.Color; import android.graphics.Typeface; import android.os.Bundle; import android.content.SharedPreferences; +import android.preference.PreferenceManager; import android.text.Html; import android.util.Log; import android.util.TypedValue; @@ -139,7 +140,14 @@ public class LiveListFragment extends OpenLPFragment { } }; setListAdapter(adapter); - //getListView().setSelection(selected - 1); + + SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); + Boolean autoscroll = + sharedPrefs.getBoolean(context.getString(R.string.key_auto_scroll), false); + + if (autoscroll){ + getListView().setSelection(selected - 1); + } Log.i(LOG_TAG, "populate_display - exit"); } diff --git a/app/src/main/java/org/openlp/android2/fragments/ServiceListFragment.java b/app/src/main/java/org/openlp/android2/fragments/ServiceListFragment.java index 2766905..c72ed7a 100644 --- a/app/src/main/java/org/openlp/android2/fragments/ServiceListFragment.java +++ b/app/src/main/java/org/openlp/android2/fragments/ServiceListFragment.java @@ -24,6 +24,7 @@ import android.content.SharedPreferences; import android.graphics.Color; import android.graphics.Typeface; import android.os.Bundle; +import android.preference.PreferenceManager; import android.util.Log; import android.util.TypedValue; import android.view.LayoutInflater; @@ -44,6 +45,7 @@ import org.openlp.android2.common.OpenLPHttpClient; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Map; public class ServiceListFragment extends OpenLPFragment { @@ -167,11 +169,17 @@ public class ServiceListFragment extends OpenLPFragment { text1.setTypeface(null, Typeface.NORMAL); } return view; - } }; setListAdapter(adapter); - //getListView().setSelection(selected - 1); + + SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); + Boolean autoscroll = + sharedPrefs.getBoolean(context.getString(R.string.key_auto_scroll), false); + + if (autoscroll){ + getListView().setSelection(selected - 1); + } Log.i(LOG_TAG, "populate_display - exit"); } diff --git a/app/src/main/res/values/defaultValues.xml b/app/src/main/res/values/defaultValues.xml index 546fd92..98d878b 100644 --- a/app/src/main/res/values/defaultValues.xml +++ b/app/src/main/res/values/defaultValues.xml @@ -8,4 +8,5 @@ 3000 14 + diff --git a/app/src/main/res/values/keyStrings.xml b/app/src/main/res/values/keyStrings.xml index f8ff4ac..578fe53 100644 --- a/app/src/main/res/values/keyStrings.xml +++ b/app/src/main/res/values/keyStrings.xml @@ -1,4 +1,5 @@ + key_auto_scroll key_enable_custom_timeout key_connection_timeout key_text_size diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a0fb281..4f2428e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -28,11 +28,14 @@ Set Custom Timeout Select the required display Display Desktop background + Allow the selected item to sctoll to the centre of the list Show Live display + Display Setting Display Black only Display Theme only Enable Custom Timeouts Enter Alert Text + Allow displays to auto center Home Unauthorised Access, please enter valid username and password Live List @@ -44,7 +47,6 @@ Process Service List Stage View - Display Text Size Select display text size Change the Service text size Settings diff --git a/app/src/main/res/xml/pref_general.xml b/app/src/main/res/xml/pref_general.xml index d6eac61..5ffe891 100644 --- a/app/src/main/res/xml/pref_general.xml +++ b/app/src/main/res/xml/pref_general.xml @@ -8,4 +8,10 @@ android:summary="@string/text_size_summary" android:title="@string/text_size" /> + + diff --git a/app/src/main/res/xml/pref_headers.xml b/app/src/main/res/xml/pref_headers.xml index 6f57afb..d0c4461 100644 --- a/app/src/main/res/xml/pref_headers.xml +++ b/app/src/main/res/xml/pref_headers.xml @@ -4,7 +4,7 @@
+ android:title="@string/display_settings" />