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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Oct 6 07:27:53 UTC 2018


 android/source/res/values/arrays.xml                                                   |   22 +++++-----
 android/source/res/values/strings.xml                                                  |   14 ++++++
 android/source/res/xml/libreoffice_preferences.xml                                     |   14 +++---
 android/source/src/java/org/libreoffice/FormattingController.java                      |    8 +--
 android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java                   |   20 ++++-----
 android/source/src/java/org/libreoffice/UNOCommandsController.java                     |    2 
 android/source/src/java/org/libreoffice/storage/external/DirectoryBrowserFragment.java |    2 
 7 files changed, 49 insertions(+), 33 deletions(-)

New commits:
commit 897b393ee516f1d731996ac9058edb828d1f8caf
Author:     Mert Tumer <merttumer at outlook.com>
AuthorDate: Tue Sep 18 15:56:39 2018 +0300
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Sat Oct 6 09:27:33 2018 +0200

    Extract hardcoded strings to string resource file on Android Viewer
    
    Change-Id: Ie2276ac162062e7365c9605f98fe03e5011ba6cb
    Signed-off-by: Mert Tumer <merttumer at outlook.com>
    Reviewed-on: https://gerrit.libreoffice.org/60688
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
    Tested-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/android/source/res/values/arrays.xml b/android/source/res/values/arrays.xml
index 671424bfd13b..f2326764aa76 100644
--- a/android/source/res/values/arrays.xml
+++ b/android/source/res/values/arrays.xml
@@ -30,19 +30,19 @@
         <item >1</item>
     </string-array>
     <string-array name="FilterTypeNames">
-        <item>Everything</item>
-        <item>Documents</item>
-        <item>Spreadsheets</item>
-        <item>Presentations</item>
-        <item>Drawings</item>
+        <item>@string/filter_everything</item>
+        <item>@string/filter_documents</item>
+        <item>@string/filter_spreadsheets</item>
+        <item>@string/filter_presentations</item>
+        <item>@string/filter_drawings</item>
     </string-array>
     <string-array name="SortModeNames">
-        <item >A-Z</item>
-        <item >Z-A</item>
-        <item >Oldest First</item>
-        <item >Newest First</item>
-        <item >Largest First</item>
-        <item >Smallest First</item>
+        <item >@string/sort_az</item>
+        <item >@string/sort_za</item>
+        <item >@string/sort_oldest</item>
+        <item >@string/sort_newest</item>
+        <item >@string/sort_largest</item>
+        <item >@string/sort_smallest</item>
     </string-array>
 
 
diff --git a/android/source/res/values/strings.xml b/android/source/res/values/strings.xml
index 17e52316bdb4..457d10b40af8 100644
--- a/android/source/res/values/strings.xml
+++ b/android/source/res/values/strings.xml
@@ -211,4 +211,18 @@
     <string name="UNO_commands_string_parent_value_hint">Parent Value</string>
     <string name="action_exportToPDF">Export To PDF</string>
     <string name="action_print">Print</string>
+    <string name="tabhost_character">Character</string>
+    <string name="tabhost_paragraph">Paragraph</string>
+    <string name="tabhost_insert">Insert</string>
+    <string name="tabhost_style">Style</string>
+    <string name="alert_ok">OK</string>
+    <string name="alert_cancel">Cancel</string>
+    <string name="unable_to_go_further">Unable to go further.</string>
+    <string name="current_uno_command">Current UNO command</string>
+    <string name="pref_sort_summary">Select how to order files: A-Z, by size or by date.</string>
+    <string name="pref_viewmode_summary">View files as a grid or in a list.</string>
+    <string name="pref_file_explorer_title">File explorer layout</string>
+    <string name="pref_sort_title">File Order</string>
+    <string name="pref_filter_title">Default File Filter</string>
+    <string name="pref_filter_summary">Set which file filter should be used by default.</string>
 </resources>
diff --git a/android/source/res/xml/libreoffice_preferences.xml b/android/source/res/xml/libreoffice_preferences.xml
index 2b3d9dde2f57..3bc04d769278 100644
--- a/android/source/res/xml/libreoffice_preferences.xml
+++ b/android/source/res/xml/libreoffice_preferences.xml
@@ -4,22 +4,24 @@
         android:title="@string/pref_category_explorer"
         android:key="PREF_CATEGORY_EXPLORER">
         <ListPreference
-            android:title="Default File Filter"
-            android:summary="Set which file filter should be used by default."
+            android:title="@string/pref_filter_title"
+            android:summary="@string/pref_filter_summary"
             android:entries="@array/FilterTypeNames"
             android:entryValues="@array/FilterTypeStringValues"
             android:key="FILTER_MODE"/>
         <ListPreference
-            android:summary="Select how to order files: A-Z, by size or by date."
+            android:summary="@string/pref_sort_summary"
             android:key="SORT_MODE"
-            android:title="File Order" android:entries="@array/SortModeNames" android:entryValues="@array/SortModeStringValues"/>
+            android:title="@string/pref_sort_title"
+            android:entries="@array/SortModeNames"
+            android:entryValues="@array/SortModeStringValues"/>
         <ListPreference
             android:entries="@array/ViewModeNames"
             android:entryValues="@array/ViewModeStringValues"
             android:defaultValue="@integer/grid_view_integer"
-            android:title="File explorer layout"
+            android:title="@string/pref_file_explorer_title"
             android:key="EXPLORER_VIEW_TYPE"
-            android:summary="View files as a grid or in a list." />
+            android:summary="@string/pref_viewmode_summary" />
         <CheckBoxPreference
             android:title="@string/pref_show_hidden_files"
             android:key="ENABLE_SHOW_HIDDEN_FILES"
diff --git a/android/source/src/java/org/libreoffice/FormattingController.java b/android/source/src/java/org/libreoffice/FormattingController.java
index 7fe538c0e555..691c3d06513f 100644
--- a/android/source/src/java/org/libreoffice/FormattingController.java
+++ b/android/source/src/java/org/libreoffice/FormattingController.java
@@ -279,8 +279,8 @@ class FormattingController implements View.OnClickListener {
         npColNegative.setOnClickListener(negativeButtonClickListener);
 
         insertTableBuilder.setView(numberPicker);
-        insertTableBuilder.setNeutralButton("Cancel", null);
-        insertTableBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
+        insertTableBuilder.setNeutralButton(R.string.alert_cancel, null);
+        insertTableBuilder.setPositiveButton(R.string.alert_ok, new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
 
@@ -346,7 +346,7 @@ class FormattingController implements View.OnClickListener {
     private void deleteTable() {
         AlertDialog.Builder deleteBuilder = new AlertDialog.Builder(mContext);
         deleteBuilder.setTitle(R.string.select_delete_options);
-        deleteBuilder.setNeutralButton("Cancel",null);
+        deleteBuilder.setNeutralButton(R.string.alert_cancel,null);
         final int[] selectedItem = new int[1];
         deleteBuilder.setSingleChoiceItems(mContext.getResources().getStringArray(R.array.deleterowcolumns), -1, new DialogInterface.OnClickListener() {
             @Override
@@ -354,7 +354,7 @@ class FormattingController implements View.OnClickListener {
                 selectedItem[0] = which;
             }
         });
-        deleteBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
+        deleteBuilder.setPositiveButton(R.string.alert_ok, new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
                 switch (selectedItem[0]){
diff --git a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
index b3e00fc40840..20135beb1084 100644
--- a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -232,24 +232,24 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
         TabHost host = findViewById(R.id.toolbarTabHost);
         host.setup();
 
-        TabHost.TabSpec spec = host.newTabSpec("Character");
+        TabHost.TabSpec spec = host.newTabSpec(getString(R.string.tabhost_character));
         spec.setContent(R.id.tab_character);
-        spec.setIndicator("Character");
+        spec.setIndicator(getString(R.string.tabhost_character));
         host.addTab(spec);
 
-        spec = host.newTabSpec("Paragraph");
+        spec = host.newTabSpec(getString(R.string.tabhost_paragraph));
         spec.setContent(R.id.tab_paragraph);
-        spec.setIndicator("Paragraph");
+        spec.setIndicator(getString(R.string.tabhost_paragraph));
         host.addTab(spec);
 
-        spec = host.newTabSpec("Insert");
+        spec = host.newTabSpec(getString(R.string.tabhost_insert));
         spec.setContent(R.id.tab_insert);
-        spec.setIndicator("Insert");
+        spec.setIndicator(getString(R.string.tabhost_insert));
         host.addTab(spec);
 
-        spec = host.newTabSpec("Style");
+        spec = host.newTabSpec(getString(R.string.tabhost_style));
         spec.setContent(R.id.tab_style);
-        spec.setIndicator("Style");
+        spec.setIndicator(getString(R.string.tabhost_style));
         host.addTab(spec);
 
         LinearLayout bottomToolbarLayout = findViewById(R.id.toolbar_bottom);
@@ -753,13 +753,13 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
         input.setInputType(InputType.TYPE_CLASS_TEXT);
         builder.setView(input);
 
-        builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
+        builder.setPositiveButton(R.string.alert_ok, new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
                 mTileProvider.renamePart( input.getText().toString());
             }
         });
-        builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
+        builder.setNegativeButton(R.string.alert_cancel, new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
                 dialog.cancel();
diff --git a/android/source/src/java/org/libreoffice/UNOCommandsController.java b/android/source/src/java/org/libreoffice/UNOCommandsController.java
index e61d3266ac1c..9453b3bd07b7 100644
--- a/android/source/src/java/org/libreoffice/UNOCommandsController.java
+++ b/android/source/src/java/org/libreoffice/UNOCommandsController.java
@@ -63,7 +63,7 @@ class UNOCommandsController implements View.OnClickListener {
     private void showCommandDialog() {
         try {
             AlertDialog dialog = new AlertDialog.Builder(mActivity)
-                    .setTitle("Current UNO command")
+                    .setTitle(R.string.current_uno_command)
                     .setMessage(mRootJSON.toString(2))
                     .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                         public void onClick(DialogInterface dialog, int which) {
diff --git a/android/source/src/java/org/libreoffice/storage/external/DirectoryBrowserFragment.java b/android/source/src/java/org/libreoffice/storage/external/DirectoryBrowserFragment.java
index cf71691cce2a..18165650a617 100644
--- a/android/source/src/java/org/libreoffice/storage/external/DirectoryBrowserFragment.java
+++ b/android/source/src/java/org/libreoffice/storage/external/DirectoryBrowserFragment.java
@@ -124,7 +124,7 @@ public class DirectoryBrowserFragment extends Fragment {
 
     private void changeDirectory(File destination) {
         if(destination == null) {
-            Toast.makeText(getActivity(), "Unable to go further.", Toast.LENGTH_SHORT)
+            Toast.makeText(getActivity(), R.string.unable_to_go_further, Toast.LENGTH_SHORT)
                     .show();
         } else {
             Fragment fragment = DirectoryBrowserFragment.newInstance(destination.toURI().toString());


More information about the Libreoffice-commits mailing list