[Libreoffice-commits] core.git: android/source

brainbreaker gautamprajapati06 at gmail.com
Wed Jun 21 14:27:09 UTC 2017


 android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java |   11 +++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit eeb65fabd4c94e1ce69996890a4fb9badc11e778
Author: brainbreaker <gautamprajapati06 at gmail.com>
Date:   Thu Apr 27 19:06:43 2017 +0530

    Listen for changes in editing preference settings
    
    This commit gives the ability to listen for changes in
    editing preference settings to LibreOfficeMainActivity.
    This makes sure that value of mIsExperimentalMode
    boolean is correct in any condition.
    
    Change-Id: Ie2a931e63fad30262ad2f870b6c06f707db96618
    Reviewed-on: https://gerrit.libreoffice.org/37033
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
index b653c437c644..b4f8dc77f60b 100755
--- a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -52,7 +52,7 @@ import java.util.List;
 /**
  * Main activity of the LibreOffice App. It is started in the UI thread.
  */
-public class LibreOfficeMainActivity extends AppCompatActivity {
+public class LibreOfficeMainActivity extends AppCompatActivity implements SettingsListenerModel.OnSettingsPreferenceChangedListener {
 
     private static final String LOGTAG = "LibreOfficeMainActivity";
     private static final String DEFAULT_DOC_PATH = "/assets/example.odt";
@@ -109,6 +109,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
         Log.w(LOGTAG, "onCreate..");
         super.onCreate(savedInstanceState);
 
+        SettingsListenerModel.getInstance().setListener(this);
         SharedPreferences sPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
         mIsExperimentalMode = sPrefs.getBoolean(ENABLE_EXPERIMENTAL_PREFS_KEY, false);
 
@@ -667,6 +668,14 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
         return !isDrawerOpen && !isDrawerLocked;
     }
 
+    @Override
+    public void settingsPreferenceChanged(SharedPreferences sharedPreferences, String key) {
+        if (key.matches(ENABLE_EXPERIMENTAL_PREFS_KEY)) {
+            Log.d(LOGTAG, "Editing Preference Changed");
+            mIsExperimentalMode = sharedPreferences.getBoolean(ENABLE_EXPERIMENTAL_PREFS_KEY, false);
+        }
+    }
+
     private class DocumentPartClickListener implements android.widget.AdapterView.OnItemClickListener {
         @Override
         public void onItemClick(AdapterView<?> parent, View view, int position, long id) {


More information about the Libreoffice-commits mailing list