summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiroslav Mazel <mazelm@gmail.com>2016-09-15 19:47:14 +0200
committerjan iversen <jani@documentfoundation.org>2016-10-14 06:36:37 +0000
commitec09281f06558903a959518e4013bc78a551bfaa (patch)
tree35771655d75be85e4d409355d9a37dc9b073ecf1
parente15a59963c744e7494fe2a1e7db5bc42f196ffa6 (diff)
Toolbar background shared with the tab bar, as per the Material HIG
Change-Id: I914ed8b192544fbfb8502d94b9a21a46a9ba7595 Reviewed-on: https://gerrit.libreoffice.org/28935 Reviewed-by: jan iversen <jani@documentfoundation.org> Tested-by: jan iversen <jani@documentfoundation.org>
-rw-r--r--android/sdremote/mobile/src/main/AndroidManifest.xml3
-rw-r--r--android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/activity/ComputersActivity.java13
-rw-r--r--android/sdremote/mobile/src/main/res/layout/activity_computers.xml32
-rw-r--r--android/sdremote/mobile/src/main/res/values/styles.xml8
4 files changed, 33 insertions, 23 deletions
diff --git a/android/sdremote/mobile/src/main/AndroidManifest.xml b/android/sdremote/mobile/src/main/AndroidManifest.xml
index 52f6c98..825febf 100644
--- a/android/sdremote/mobile/src/main/AndroidManifest.xml
+++ b/android/sdremote/mobile/src/main/AndroidManifest.xml
@@ -38,7 +38,8 @@
android:theme="@style/Theme.ImpressRemote">
<activity
- android:name=".activity.ComputersActivity">
+ android:name=".activity.ComputersActivity"
+ android:theme="@style/Theme.ImpressRemote.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
diff --git a/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/activity/ComputersActivity.java b/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/activity/ComputersActivity.java
index a8e194a..a519d97 100644
--- a/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/activity/ComputersActivity.java
+++ b/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/activity/ComputersActivity.java
@@ -18,9 +18,11 @@ import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
+import android.view.Window;
import android.view.animation.AnimationUtils;
import org.libreoffice.impressremote.adapter.ComputersPagerAdapter;
@@ -43,17 +45,16 @@ public class ComputersActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle aSavedInstanceState) {
super.onCreate(aSavedInstanceState);
-
+
setContentView(R.layout.activity_computers);
- ActionBar aActionBar = getSupportActionBar();
+ Toolbar toolbar = (Toolbar) findViewById(R.id.computers_toolbar);
+ setSupportActionBar(toolbar);
// Looks hacky but it seems to be the best way to set activity’s title
// different to application’s label. The other way is setting title
// to intents filter but it shows wrong label for recent apps screen then.
- assert aActionBar != null;
- aActionBar.setTitle(R.string.title_computers);
- aActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME,
- ActionBar.DISPLAY_SHOW_HOME|ActionBar.DISPLAY_HOME_AS_UP);
+ assert toolbar != null;
+ toolbar.setTitle(R.string.title_computers);
computersPagerAdapter.addFragment(Type.BLUETOOTH);
computersPagerAdapter.addFragment(Type.WIFI);
diff --git a/android/sdremote/mobile/src/main/res/layout/activity_computers.xml b/android/sdremote/mobile/src/main/res/layout/activity_computers.xml
index 4845009..870a0f2 100644
--- a/android/sdremote/mobile/src/main/res/layout/activity_computers.xml
+++ b/android/sdremote/mobile/src/main/res/layout/activity_computers.xml
@@ -6,34 +6,40 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:compat="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".activity.ComputersActivity"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
+ android:layout_height="match_parent">
+
+ <android.support.design.widget.AppBarLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <android.support.v7.widget.Toolbar
+ android:id="@+id/computers_toolbar"
+ android:layout_width="match_parent"
+ android:layout_height="?attr/actionBarSize"
+ android:background="?attr/colorPrimary"
+ android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
+ />
<android.support.design.widget.TabLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:compat="http://schemas.android.com/apk/res-auto"
android:id="@+id/pager_computers_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?actionBarTabBarStyle"
compat:tabMode="fixed" />
- <android.support.design.widget.CoordinatorLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/main_content"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
+ </android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager_computers"
android:layout_width="match_parent"
- android:layout_height="match_parent"/>
+ android:layout_height="match_parent"
+ compat:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<android.support.design.widget.FloatingActionButton
xmlns:android="http://schemas.android.com/apk/res/android"
@@ -56,6 +62,4 @@
compat:srcCompat="@drawable/ic_bluetooth_searching_black_24dp"
android:visibility="invisible"/>
- </android.support.design.widget.CoordinatorLayout>
-
-</LinearLayout> \ No newline at end of file
+</android.support.design.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/android/sdremote/mobile/src/main/res/values/styles.xml b/android/sdremote/mobile/src/main/res/values/styles.xml
index d06f3fe..651b467 100644
--- a/android/sdremote/mobile/src/main/res/values/styles.xml
+++ b/android/sdremote/mobile/src/main/res/values/styles.xml
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
+<?xml version="1.0" encoding="utf-8"?><!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
@@ -21,6 +20,11 @@
<item name="android:drawableTint" tools:targetApi="23">@android:color/white</item>
</style>
+ <style name="Theme.ImpressRemote.NoActionBar" parent="Theme.ImpressRemote">
+ <item name="windowActionBar">false</item>
+ <item name="windowNoTitle">true</item>
+ </style>
+
<style name="ab_style" parent="Widget.AppCompat.Light.ActionBar.Solid">
<item name="displayOptions">showTitle|homeAsUp|useLogo</item>
<item name="logo">@drawable/ic_logo_padding</item>