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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Nov 13 14:28:20 UTC 2018


 android/source/build.gradle                                          |   11 +++++++++-
 android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java |    8 +++----
 android/source/src/java/org/libreoffice/SettingsActivity.java        |    3 ++
 3 files changed, 17 insertions(+), 5 deletions(-)

New commits:
commit c40014e75f5d1e5649f0b8416addd72982073d37
Author:     Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
AuthorDate: Thu Oct 25 15:45:59 2018 +0200
Commit:     Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
CommitDate: Tue Nov 13 15:27:57 2018 +0100

    android: lock away editing mode in separate build flavor
    
    Change-Id: I767cc1d512345aa20570001033ddb4d882e3ca35
    Reviewed-on: https://gerrit.libreoffice.org/62362
    Tested-by: Jenkins
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/android/source/build.gradle b/android/source/build.gradle
index 2fa5dda5b817..e1358684b05a 100644
--- a/android/source/build.gradle
+++ b/android/source/build.gradle
@@ -58,6 +58,7 @@ android {
         // the configuration data that might be stripped or not
         fullUI.assets.srcDirs 'assets_fullUI'
         strippedUI.assets.srcDirs 'assets_strippedUI'
+        strippedUIEditing.assets.srcDirs 'assets_strippedUI'
     }
     defaultConfig {
         minSdkVersion 14
@@ -80,7 +81,15 @@ android {
 
     flavorDimensions "default"
     productFlavors {
-        strippedUI.dimension "default"
+        strippedUI {
+            dimension "default"
+            buildConfigField 'boolean', 'ALLOW_EDITING', 'false'
+        }
+        strippedUIEditing {
+            dimension "default"
+            buildConfigField 'boolean', 'ALLOW_EDITING', 'true'
+            versionNameSuffix "-editing"
+        }
         fullUI.dimension "default"
     }
 }
diff --git a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
index 5472ac903de1..063c75bf2158 100644
--- a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -136,8 +136,6 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
         super.onCreate(savedInstanceState);
 
         SettingsListenerModel.getInstance().setListener(this);
-        SharedPreferences sPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
-        mIsExperimentalMode = sPrefs.getBoolean(ENABLE_EXPERIMENTAL_PREFS_KEY, false);
         updatePreferences();
 
         setContentView(R.layout.activity_main);
@@ -265,8 +263,10 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
 
     private void updatePreferences() {
         SharedPreferences sPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
-        mIsExperimentalMode = sPrefs.getBoolean(ENABLE_EXPERIMENTAL_PREFS_KEY, false);
-        mIsDeveloperMode = sPrefs.getBoolean(ENABLE_DEVELOPER_PREFS_KEY, false);
+        mIsExperimentalMode = BuildConfig.ALLOW_EDITING
+                && sPrefs.getBoolean(ENABLE_EXPERIMENTAL_PREFS_KEY, false);
+        mIsDeveloperMode = mIsExperimentalMode
+                && sPrefs.getBoolean(ENABLE_DEVELOPER_PREFS_KEY, false);
         if (sPrefs.getInt(ASSETS_EXTRACTED_PREFS_KEY, 0) != BuildConfig.VERSION_CODE) {
             if(copyFromAssets(getAssets(), "unpack", getApplicationInfo().dataDir)) {
                 sPrefs.edit().putInt(ASSETS_EXTRACTED_PREFS_KEY, BuildConfig.VERSION_CODE).apply();
diff --git a/android/source/src/java/org/libreoffice/SettingsActivity.java b/android/source/src/java/org/libreoffice/SettingsActivity.java
index de5f388c7c25..73ada55b9380 100644
--- a/android/source/src/java/org/libreoffice/SettingsActivity.java
+++ b/android/source/src/java/org/libreoffice/SettingsActivity.java
@@ -29,6 +29,9 @@ public class SettingsActivity extends Activity {
         public void onCreate(Bundle savedInstanceState) {
             super.onCreate(savedInstanceState);
             addPreferencesFromResource(R.xml.libreoffice_preferences);
+            if(!BuildConfig.ALLOW_EDITING) {
+                getPreferenceScreen().removePreference(findPreference("PREF_CATEGORY_GENERAL"));
+            }
         }
 
         @Override


More information about the Libreoffice-commits mailing list