android/source/AndroidManifest.xml | 11 +---- android/source/res/layout/activity_main.xml | 16 +++++-- android/source/res/values/themes.xml | 4 - android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java | 6 +- android/source/src/java/org/libreoffice/ToolbarController.java | 22 +++------- 5 files changed, 28 insertions(+), 31 deletions(-)
New commits: commit 6310fa8a70db81334b710b06377e20b4ecb378da Author: aleksandar-stefanovic <theonewithid...@gmail.com> Date: Thu Jan 19 12:06:30 2017 +0100 Replaced empty spinner with the document title Replaced empty spinner with the document title in the Main (viewer) activity. Had to edit the themes to not disable title, and edit the manifest to make the desired activities use that theme. If the theme is set in the "application" tag, it will apply the theme globablly. Also cleaned up and tightened the ToolbarController. Change-Id: I5099860787b5f84d01c98c5e53ade519c2f89cc4 Reviewed-on: https://gerrit.libreoffice.org/33306 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Aleksandar Stefanović <theonewithid...@gmail.com> diff --git a/android/source/AndroidManifest.xml b/android/source/AndroidManifest.xml index 55b71f6..7e35208 100644 --- a/android/source/AndroidManifest.xml +++ b/android/source/AndroidManifest.xml @@ -13,6 +13,7 @@ android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" + android:theme="@style/LibreOfficeTheme" android:debuggable="true" android:hardwareAccelerated="true" android:largeHeap="false"> @@ -21,8 +22,7 @@ <activity android:name=".LibreOfficeMainActivity" android:label="@string/app_name" - android:configChanges="orientation|keyboard|keyboardHidden|screenLayout|uiMode|screenSize|smallestScreenSize" - android:theme="@style/LibreOfficeTheme"> + android:configChanges="orientation|keyboard|keyboardHidden|screenLayout|uiMode|screenSize|smallestScreenSize" > <!-- android:windowSoftInputMode="adjustResize" --> <intent-filter> @@ -98,8 +98,7 @@ <!-- Document Browser Activity --> <activity android:name="org.libreoffice.ui.LibreOfficeUIActivity" - android:label="@string/app_name" - android:theme="@style/BrowserTheme"> + android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> @@ -114,13 +113,11 @@ </intent-filter> </activity> - <activity android:name=".storage.external.BrowserSelectorActivity" - android:theme="@style/LibreOfficeTheme"> + <activity android:name=".storage.external.BrowserSelectorActivity" > </activity> <activity android:name=".storage.external.DirectoryBrowserActivity" android:label="@string/directory_browser_label" - android:theme="@style/LibreOfficeTheme" android:windowSoftInputMode="stateHidden"> </activity> diff --git a/android/source/res/layout/activity_main.xml b/android/source/res/layout/activity_main.xml index 625422e..923ed56 100644 --- a/android/source/res/layout/activity_main.xml +++ b/android/source/res/layout/activity_main.xml @@ -1,18 +1,26 @@ <?xml version="1.0" encoding="utf-8"?> -<android.support.v4.widget.DrawerLayout - android:id="@+id/drawer_layout" +<android.support.v4.widget.DrawerLayout android:id="@+id/drawer_layout" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" + xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#fff" - tools:context=".LibreOfficeMainActivity"> + tools:context=".LibreOfficeMainActivity" > <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> - <include layout="@layout/toolbar"/> + <android.support.v7.widget.Toolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:elevation="3dp" + android:background="@color/toolbar_background" + app:theme="@style/LibreOfficeTheme.Toolbar" + tools:theme="@style/LibreOfficeTheme.Toolbar" + app:popupTheme="@style/LibreOfficeTheme" /> <include layout="@layout/toolbar_bottom"/> diff --git a/android/source/res/values/themes.xml b/android/source/res/values/themes.xml index 3c89209..e5287a8 100644 --- a/android/source/res/values/themes.xml +++ b/android/source/res/values/themes.xml @@ -3,10 +3,6 @@ <style name="LibreOfficeTheme" parent="LibreOfficeTheme.Base"/> <style name="LibreOfficeTheme.Base" parent="Theme.AppCompat.Light.NoActionBar"> - <item name="android:windowNoTitle">true</item> - </style> - - <style name="BrowserTheme" parent="Theme.AppCompat.Light.NoActionBar"> </style> <style name="ListItemText"> diff --git a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java index 2e1a4dd..93e041c 100755 --- a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java +++ b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java @@ -116,10 +116,9 @@ public class LibreOfficeMainActivity extends AppCompatActivity { setContentView(R.layout.activity_main); Toolbar toolbarTop = (Toolbar) findViewById(R.id.toolbar); - hideBottomToolbar(); - mToolbarController = new ToolbarController(this, getSupportActionBar(), toolbarTop); + mToolbarController = new ToolbarController(this, toolbarTop); mFormattingController = new FormattingController(this); toolbarTop.setNavigationOnClickListener(new View.OnClickListener() { @Override @@ -154,6 +153,9 @@ public class LibreOfficeMainActivity extends AppCompatActivity { mInputFile = new File(DEFAULT_DOC_PATH); } + toolbarTop.setTitle(mInputFile.getName()); + + mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); if (mDocumentPartViewListAdapter == null) { diff --git a/android/source/src/java/org/libreoffice/ToolbarController.java b/android/source/src/java/org/libreoffice/ToolbarController.java index 0ebe72b..e4a55dd 100644 --- a/android/source/src/java/org/libreoffice/ToolbarController.java +++ b/android/source/src/java/org/libreoffice/ToolbarController.java @@ -8,7 +8,6 @@ */ package org.libreoffice; -import android.support.v7.app.ActionBar; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Menu; @@ -22,13 +21,11 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener { private static final String LOGTAG = ToolbarController.class.getSimpleName(); private final Toolbar mToolbarTop; - private final ActionBar mActionBar; - private LibreOfficeMainActivity mContext; - private Menu mMainMenu; + private final LibreOfficeMainActivity mContext; + private final Menu mMainMenu; - public ToolbarController(LibreOfficeMainActivity context, ActionBar actionBar, Toolbar toolbarTop) { + public ToolbarController(LibreOfficeMainActivity context, Toolbar toolbarTop) { mToolbarTop = toolbarTop; - mActionBar = actionBar; mContext = context; mToolbarTop.inflateMenu(R.menu.main); @@ -38,7 +35,7 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener { mMainMenu = mToolbarTop.getMenu(); } - public void disableMenuItem(final int menuItemId, final boolean disabled) { + private void disableMenuItem(final int menuItemId, final boolean disabled) { LOKitShell.getMainHandler().post(new Runnable() { public void run() { MenuItem menuItem = mMainMenu.findItem(menuItemId); @@ -64,7 +61,6 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener { public void run() { mMainMenu.setGroupVisible(R.id.group_edit_actions, true); mToolbarTop.setNavigationIcon(R.drawable.ic_check); - mToolbarTop.setTitle(null); mToolbarTop.setLogo(null); } @@ -84,7 +80,6 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener { public void run() { mMainMenu.setGroupVisible(R.id.group_edit_actions, false); mToolbarTop.setNavigationIcon(R.drawable.lo_icon); - mToolbarTop.setTitle(null); mToolbarTop.setLogo(null); } }); @@ -124,13 +119,12 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener { return false; } - public void setupToolbars() { - LibreOfficeMainActivity activity = mContext; - if (activity.usesTemporaryFile()) { + void setupToolbars() { + if (mContext.usesTemporaryFile()) { disableMenuItem(R.id.action_save, true); - Toast.makeText(activity, activity.getString(R.string.temp_file_saving_disabled), Toast.LENGTH_LONG).show(); + Toast.makeText(mContext, mContext.getString(R.string.temp_file_saving_disabled), Toast.LENGTH_LONG).show(); } - mMainMenu.findItem(R.id.action_parts).setVisible(activity.isDrawerEnabled()); + mMainMenu.findItem(R.id.action_parts).setVisible(mContext.isDrawerEnabled()); } }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits