diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-03-09 18:29:52 +0900 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-16 09:37:59 +0100 |
commit | 4cf34bf205ee1c5048061ca045c894452b40cd4a (patch) | |
tree | 9b612629308244a43b10587d53645ba1c46833de /android | |
parent | bdd8a68c7b1bfd78915d222d113709fd468903ec (diff) |
android: actually use the new toolbar in the application
Change-Id: I221ece32967289104612309faee5d22209a64b25
Diffstat (limited to 'android')
3 files changed, 47 insertions, 18 deletions
diff --git a/android/experimental/LOAndroid3/res/layout/activity_main.xml b/android/experimental/LOAndroid3/res/layout/activity_main.xml index e9a946f6b9dd..63695e584279 100644 --- a/android/experimental/LOAndroid3/res/layout/activity_main.xml +++ b/android/experimental/LOAndroid3/res/layout/activity_main.xml @@ -6,26 +6,34 @@ android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#fff" - tools:context=".MainActivity"> + tools:context=".LibreOfficeMainActivity"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> - <RelativeLayout - android:id="@+id/gecko_layout" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:layout_weight="1"> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> - <org.mozilla.gecko.gfx.LayerView - android:id="@+id/layer_view" - android:layout_width="fill_parent" - android:layout_height="fill_parent"/> + <include layout="@layout/toolbar"/> - <include layout="@layout/text_selection_handles"/> + <RelativeLayout + android:id="@+id/gecko_layout" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> - </RelativeLayout> + <org.mozilla.gecko.gfx.LayerView + android:id="@+id/layer_view" + android:layout_width="match_parent" + android:layout_height="match_parent"/> + + <include layout="@layout/text_selection_handles"/> + + </RelativeLayout> + </LinearLayout> <RelativeLayout android:id="@+id/loadingPanel" diff --git a/android/experimental/LOAndroid3/res/layout/toolbar.xml b/android/experimental/LOAndroid3/res/layout/toolbar.xml new file mode 100644 index 000000000000..d8faa51b4034 --- /dev/null +++ b/android/experimental/LOAndroid3/res/layout/toolbar.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> + +<android.support.v7.widget.Toolbar + android:id="@+id/toolbar" + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:elevation="3dp"> + +</android.support.v7.widget.Toolbar> diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java index 2f2eada5f757..cd69c1d6b016 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java @@ -1,6 +1,5 @@ package org.libreoffice; -import android.app.Activity; import android.app.AlertDialog; import android.content.ContentResolver; import android.content.Context; @@ -8,6 +7,9 @@ import android.content.DialogInterface; import android.os.Bundle; import android.os.Handler; import android.support.v4.widget.DrawerLayout; +import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.ActionBarDrawerToggle; +import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Menu; import android.view.MenuItem; @@ -31,7 +33,7 @@ import java.io.OutputStream; import java.util.ArrayList; import java.util.List; -public class LibreOfficeMainActivity extends Activity { +public class LibreOfficeMainActivity extends ActionBarActivity { private static final String LOGTAG = "LibreOfficeMainActivity"; private static final String DEFAULT_DOC_PATH = "/assets/example.odt"; @@ -44,7 +46,6 @@ public class LibreOfficeMainActivity extends Activity { public Handler mMainHandler; private DrawerLayout mDrawerLayout; - private RelativeLayout mGeckoLayout; private ListView mDrawerList; private List<DocumentPartView> mDocumentPartView = new ArrayList<DocumentPartView>(); private DocumentPartViewListAdapter mDocumentPartViewListAdapter; @@ -53,6 +54,7 @@ public class LibreOfficeMainActivity extends Activity { private TextCursorLayer mTextCursorLayer; private File mTempFile = null; private LOAbout mAbout; + public LibreOfficeMainActivity() { mAbout = new LOAbout(this, false); } @@ -116,10 +118,19 @@ public class LibreOfficeMainActivity extends Activity { setContentView(R.layout.activity_main); - getActionBar().setDisplayHomeAsUpEnabled(false); - getActionBar().setHomeButtonEnabled(false); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + getSupportActionBar().setHomeAsUpIndicator(R.drawable.lo_icon); + + //getSupportActionBar().setHomeAsUpIndicator(); + + toolbar.setNavigationOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + onBackPressed(); + } + }); - mGeckoLayout = (RelativeLayout) findViewById(R.id.gecko_layout); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); if (mDocumentPartViewListAdapter == null) { |