Kaydet (Commit) 6310fa8a authored tarafından aleksandar-stefanovic's avatar aleksandar-stefanovic Kaydeden (comit) Aleksandar Stefanović

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/33306Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarAleksandar Stefanović <theonewithideas@gmail.com>
üst 39ced315
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/LibreOfficeTheme"
android:debuggable="true" android:debuggable="true"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:largeHeap="false"> android:largeHeap="false">
...@@ -21,8 +22,7 @@ ...@@ -21,8 +22,7 @@
<activity <activity
android:name=".LibreOfficeMainActivity" android:name=".LibreOfficeMainActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:configChanges="orientation|keyboard|keyboardHidden|screenLayout|uiMode|screenSize|smallestScreenSize" android:configChanges="orientation|keyboard|keyboardHidden|screenLayout|uiMode|screenSize|smallestScreenSize" >
android:theme="@style/LibreOfficeTheme">
<!-- android:windowSoftInputMode="adjustResize" --> <!-- android:windowSoftInputMode="adjustResize" -->
<intent-filter> <intent-filter>
...@@ -98,8 +98,7 @@ ...@@ -98,8 +98,7 @@
<!-- Document Browser Activity --> <!-- Document Browser Activity -->
<activity android:name="org.libreoffice.ui.LibreOfficeUIActivity" <activity android:name="org.libreoffice.ui.LibreOfficeUIActivity"
android:label="@string/app_name" android:label="@string/app_name" >
android:theme="@style/BrowserTheme">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
...@@ -114,13 +113,11 @@ ...@@ -114,13 +113,11 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".storage.external.BrowserSelectorActivity" <activity android:name=".storage.external.BrowserSelectorActivity" >
android:theme="@style/LibreOfficeTheme">
</activity> </activity>
<activity android:name=".storage.external.DirectoryBrowserActivity" <activity android:name=".storage.external.DirectoryBrowserActivity"
android:label="@string/directory_browser_label" android:label="@string/directory_browser_label"
android:theme="@style/LibreOfficeTheme"
android:windowSoftInputMode="stateHidden"> android:windowSoftInputMode="stateHidden">
</activity> </activity>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout <android.support.v4.widget.DrawerLayout android:id="@+id/drawer_layout"
android:id="@+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:background="#fff" android:background="#fff"
tools:context=".LibreOfficeMainActivity"> tools:context=".LibreOfficeMainActivity" >
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="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"/> <include layout="@layout/toolbar_bottom"/>
......
...@@ -3,10 +3,6 @@ ...@@ -3,10 +3,6 @@
<style name="LibreOfficeTheme" parent="LibreOfficeTheme.Base"/> <style name="LibreOfficeTheme" parent="LibreOfficeTheme.Base"/>
<style name="LibreOfficeTheme.Base" parent="Theme.AppCompat.Light.NoActionBar"> <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>
<style name="ListItemText"> <style name="ListItemText">
......
...@@ -116,10 +116,9 @@ public class LibreOfficeMainActivity extends AppCompatActivity { ...@@ -116,10 +116,9 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
Toolbar toolbarTop = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbarTop = (Toolbar) findViewById(R.id.toolbar);
hideBottomToolbar(); hideBottomToolbar();
mToolbarController = new ToolbarController(this, getSupportActionBar(), toolbarTop); mToolbarController = new ToolbarController(this, toolbarTop);
mFormattingController = new FormattingController(this); mFormattingController = new FormattingController(this);
toolbarTop.setNavigationOnClickListener(new View.OnClickListener() { toolbarTop.setNavigationOnClickListener(new View.OnClickListener() {
@Override @Override
...@@ -154,6 +153,9 @@ public class LibreOfficeMainActivity extends AppCompatActivity { ...@@ -154,6 +153,9 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
mInputFile = new File(DEFAULT_DOC_PATH); mInputFile = new File(DEFAULT_DOC_PATH);
} }
toolbarTop.setTitle(mInputFile.getName());
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
if (mDocumentPartViewListAdapter == null) { if (mDocumentPartViewListAdapter == null) {
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
*/ */
package org.libreoffice; package org.libreoffice;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.util.Log; import android.util.Log;
import android.view.Menu; import android.view.Menu;
...@@ -22,13 +21,11 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener { ...@@ -22,13 +21,11 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
private static final String LOGTAG = ToolbarController.class.getSimpleName(); private static final String LOGTAG = ToolbarController.class.getSimpleName();
private final Toolbar mToolbarTop; private final Toolbar mToolbarTop;
private final ActionBar mActionBar; private final LibreOfficeMainActivity mContext;
private LibreOfficeMainActivity mContext; private final Menu mMainMenu;
private Menu mMainMenu;
public ToolbarController(LibreOfficeMainActivity context, ActionBar actionBar, Toolbar toolbarTop) { public ToolbarController(LibreOfficeMainActivity context, Toolbar toolbarTop) {
mToolbarTop = toolbarTop; mToolbarTop = toolbarTop;
mActionBar = actionBar;
mContext = context; mContext = context;
mToolbarTop.inflateMenu(R.menu.main); mToolbarTop.inflateMenu(R.menu.main);
...@@ -38,7 +35,7 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener { ...@@ -38,7 +35,7 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
mMainMenu = mToolbarTop.getMenu(); 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() { LOKitShell.getMainHandler().post(new Runnable() {
public void run() { public void run() {
MenuItem menuItem = mMainMenu.findItem(menuItemId); MenuItem menuItem = mMainMenu.findItem(menuItemId);
...@@ -64,7 +61,6 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener { ...@@ -64,7 +61,6 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
public void run() { public void run() {
mMainMenu.setGroupVisible(R.id.group_edit_actions, true); mMainMenu.setGroupVisible(R.id.group_edit_actions, true);
mToolbarTop.setNavigationIcon(R.drawable.ic_check); mToolbarTop.setNavigationIcon(R.drawable.ic_check);
mToolbarTop.setTitle(null);
mToolbarTop.setLogo(null); mToolbarTop.setLogo(null);
} }
...@@ -84,7 +80,6 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener { ...@@ -84,7 +80,6 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
public void run() { public void run() {
mMainMenu.setGroupVisible(R.id.group_edit_actions, false); mMainMenu.setGroupVisible(R.id.group_edit_actions, false);
mToolbarTop.setNavigationIcon(R.drawable.lo_icon); mToolbarTop.setNavigationIcon(R.drawable.lo_icon);
mToolbarTop.setTitle(null);
mToolbarTop.setLogo(null); mToolbarTop.setLogo(null);
} }
}); });
...@@ -124,13 +119,12 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener { ...@@ -124,13 +119,12 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
return false; return false;
} }
public void setupToolbars() { void setupToolbars() {
LibreOfficeMainActivity activity = mContext; if (mContext.usesTemporaryFile()) {
if (activity.usesTemporaryFile()) {
disableMenuItem(R.id.action_save, true); 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());
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment