diff options
author | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2016-05-14 02:26:23 +0200 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2016-05-14 02:26:23 +0200 |
commit | 702396fe479fedf4d8e2b1c6456cefe80b5d4d12 (patch) | |
tree | abf58887bee8d658cde147482886f99601b1d25d | |
parent | 5ebb069067fa321c8af596dffef9d83917a42e1b (diff) |
fix material design on v23 by adding drawableTint
save/cancel iconds were't rendered in correct color on v23 devices,
since it applies different tint to drawables.
support library 23.4.0 adds back support for vector drawables using
indirection, so define icons in xml again using said indirection.
Also merge themes.xml and styles.xml into one file as suggested by
https://gerrit.libreoffice.org/#/c/24066/
Change-Id: I50753f55158972232610559eb56b4040e09a3720
10 files changed, 54 insertions, 96 deletions
diff --git a/android/sdremote/build.gradle b/android/sdremote/build.gradle index a214f1e..5f915b4 100644 --- a/android/sdremote/build.gradle +++ b/android/sdremote/build.gradle @@ -4,7 +4,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.0.0' + classpath 'com.android.tools.build:gradle:2.1.0' } } diff --git a/android/sdremote/mobile/build.gradle b/android/sdremote/mobile/build.gradle index cd0403c..30b11a4 100644 --- a/android/sdremote/mobile/build.gradle +++ b/android/sdremote/mobile/build.gradle @@ -22,8 +22,8 @@ android { dependencies { // both pull in support-v4 and appcompat-v7 already - compile 'com.android.support:preference-v7:23.3.0' - compile 'com.android.support:design:23.3.0' + compile 'com.android.support:preference-v7:23.4.0' + compile 'com.android.support:design:23.4.0' fullCompile 'com.google.android.gms:play-services-wearable:8.4.0' fullWearApp project(':wear') } diff --git a/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/activity/ComputerCreationActivity.java b/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/activity/ComputerCreationActivity.java index 6f06db7..22df468 100644 --- a/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/activity/ComputerCreationActivity.java +++ b/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/activity/ComputerCreationActivity.java @@ -15,6 +15,7 @@ import android.support.design.widget.TextInputLayout; import android.support.graphics.drawable.VectorDrawableCompat; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; +import android.support.v7.app.AppCompatDelegate; import android.text.TextUtils; import android.util.Patterns; import android.view.KeyEvent; @@ -30,6 +31,8 @@ public class ComputerCreationActivity extends AppCompatActivity implements View. @Override protected void onCreate(Bundle aSavedInstanceState) { super.onCreate(aSavedInstanceState); + // enable use of vector drawables via indirection e.g. through layer drawables + AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); setContentView(R.layout.activity_computer_creation); // action bar setup and listeners ActionBar aActionBar = getSupportActionBar(); @@ -41,19 +44,6 @@ public class ComputerCreationActivity extends AppCompatActivity implements View. aActionBarView.findViewById(R.id.button_save).setOnClickListener(this); // input field getNameEdit().setOnEditorActionListener(this); - - // workaround for bug in appcompat lib - reading vector from resource won't work in 23.3.0 - // even when using indirection using a LayerDrawable or similar - TextView tCancel = (TextView) aActionBarView.findViewById(R.id.button_cancel_tv); - tCancel.setCompoundDrawablesWithIntrinsicBounds( - VectorDrawableCompat.create( - this.getResources(), R.drawable.ic_clear_black_24dp, this.getTheme()), - null, null, null); - TextView tSave = (TextView) aActionBarView.findViewById(R.id.button_save_tv); - tSave.setCompoundDrawablesWithIntrinsicBounds( - VectorDrawableCompat.create( - this.getResources(),R.drawable.ic_done_black_24dp, this.getTheme()), - null, null, null); } @Override diff --git a/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/activity/SlideShowActivity.java b/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/activity/SlideShowActivity.java index 0a753f4..a1ef8b4 100644 --- a/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/activity/SlideShowActivity.java +++ b/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/activity/SlideShowActivity.java @@ -62,7 +62,6 @@ public class SlideShowActivity extends AppCompatActivity implements ServiceConne mMode = loadMode(aSavedInstanceState); - setUpHomeButton(); setUpFragment(); setUpKeepingScreenOn(); @@ -80,9 +79,6 @@ public class SlideShowActivity extends AppCompatActivity implements ServiceConne return (Mode) aSavedInstanceState.getSerializable(SavedStates.Keys.MODE); } - private void setUpHomeButton() { - getSupportActionBar().setHomeButtonEnabled(true); - } private void setUpFragment() { Fragments.Operator.replaceAnimated(this, buildFragment()); diff --git a/android/sdremote/mobile/src/main/res/drawable/ic_clear_layer_wrap.xml b/android/sdremote/mobile/src/main/res/drawable/ic_clear_layer_wrap.xml new file mode 100644 index 0000000..df49d8a --- /dev/null +++ b/android/sdremote/mobile/src/main/res/drawable/ic_clear_layer_wrap.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:drawable="@drawable/ic_clear_black_24dp"/> +</layer-list>
\ No newline at end of file diff --git a/android/sdremote/mobile/src/main/res/drawable/ic_done_layer_wrap.xml b/android/sdremote/mobile/src/main/res/drawable/ic_done_layer_wrap.xml new file mode 100644 index 0000000..6348239 --- /dev/null +++ b/android/sdremote/mobile/src/main/res/drawable/ic_done_layer_wrap.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:drawable="@drawable/ic_done_black_24dp"/> +</layer-list>
\ No newline at end of file diff --git a/android/sdremote/mobile/src/main/res/layout/action_bar_computer_creation.xml b/android/sdremote/mobile/src/main/res/layout/action_bar_computer_creation.xml index 9035e0f..4d347eb 100644 --- a/android/sdremote/mobile/src/main/res/layout/action_bar_computer_creation.xml +++ b/android/sdremote/mobile/src/main/res/layout/action_bar_computer_creation.xml @@ -5,21 +5,14 @@ * This Source Code Form is subject to the terms of the Mozilla Public * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> <android.support.v7.widget.LinearLayoutCompat xmlns:compat="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" + tools:context=".activity.ComputerCreationActivity" + tools:background="@color/primary" + tools:layout_height="?actionBarSize" android:orientation="horizontal" compat:divider="?attr/dividerVertical" compat:showDividers="middle" @@ -39,7 +32,8 @@ style="?actionBarTabTextStyle" android:id="@+id/button_cancel_tv" android:text="@string/button_cancel" - tools:drawableLeft="@drawable/ic_clear_black_24dp" + android:drawableLeft="@drawable/ic_clear_layer_wrap" + android:drawableStart="@drawable/ic_clear_layer_wrap" android:drawablePadding="@dimen/padding_action_bar_button_drawable" android:gravity="center_vertical" android:layout_gravity="center" @@ -59,7 +53,8 @@ style="?actionBarTabTextStyle" android:id="@+id/button_save_tv" android:text="@string/button_save" - tools:drawableLeft="@drawable/ic_done_black_24dp" + android:drawableLeft="@drawable/ic_done_layer_wrap" + android:drawableStart="@drawable/ic_done_layer_wrap" android:drawablePadding="@dimen/padding_action_bar_button_drawable" android:gravity="center_vertical" android:layout_gravity="center" 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 7568c08..4845009 100644 --- a/android/sdremote/mobile/src/main/res/layout/activity_computers.xml +++ b/android/sdremote/mobile/src/main/res/layout/activity_computers.xml @@ -5,20 +5,11 @@ * This Source Code Form is subject to the terms of the Mozilla Public * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout 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"> @@ -29,7 +20,7 @@ android:id="@+id/pager_computers_tabs" android:layout_width="match_parent" android:layout_height="wrap_content" - style="@style/Theme.ImpressRemote.ActionBar.Tab" + style="?actionBarTabBarStyle" compat:tabMode="fixed" /> <android.support.design.widget.CoordinatorLayout diff --git a/android/sdremote/mobile/src/main/res/values/styles.xml b/android/sdremote/mobile/src/main/res/values/styles.xml index 1dc33bc..d06f3fe 100644 --- a/android/sdremote/mobile/src/main/res/values/styles.xml +++ b/android/sdremote/mobile/src/main/res/values/styles.xml @@ -5,24 +5,43 @@ * This Source Code Form is subject to the terms of the Mozilla Public * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> <resources xmlns:tools="http://schemas.android.com/tools"> + <style name="Theme.ImpressRemote" parent="Theme.AppCompat.Light.DarkActionBar"> + <item name="actionBarStyle">@style/ab_style</item> + <item name="actionBarTabBarStyle">@style/ab_tabBar</item> + <item name="actionBarTabTextStyle">@style/ab_tabText</item> + <item name="preferenceTheme">@style/PreferenceThemeOverlay</item> + <item name="colorPrimary">@color/primary</item> + <item name="colorPrimaryDark">@color/primary_dark</item> + <item name="colorAccent">@color/accent</item> + <item name="android:tint">@android:color/white</item> + <!-- used for action_bar_computer_creation TextView drawable --> + <item name="android:drawableTint" tools:targetApi="23">@android:color/white</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> + </style> + + <style name="ab_tabBar" parent="Widget.AppCompat.ActionBar.TabBar"> + <item name="android:background">@color/primary</item> + <item name="tabTextColor">?android:textColorSecondaryInverse</item> + <item name="tabSelectedTextColor">?android:textColorPrimaryInverse</item> + </style> + + <style name="ab_tabText" parent="Widget.AppCompat.ActionBar.TabText"> + <item name="android:textColor">@android:color/white</item> + </style> + <style name="SectionHeader"> <item name="android:textAllCaps" tools:targetApi="14">true</item> <item name="android:textStyle">bold</item> <item name="android:textColor">@color/accent</item> <item name="android:drawableBottom">@drawable/underline_header</item> + <item name="android:drawableTint" tools:targetApi="23">@color/accent</item> <item name="android:drawablePadding">@dimen/padding_header_underline</item> <item name="android:paddingLeft">@dimen/padding_header</item> <item name="android:paddingRight">@dimen/padding_header</item> diff --git a/android/sdremote/mobile/src/main/res/values/themes.xml b/android/sdremote/mobile/src/main/res/values/themes.xml deleted file mode 100644 index e7638c4..0000000 --- a/android/sdremote/mobile/src/main/res/values/themes.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?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 - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . ---> -<resources> - - <style name="Theme.ImpressRemote" parent="Theme.AppCompat.Light.DarkActionBar"> - <item name="actionBarStyle">@style/Theme.ImpressRemote.ActionBar</item> - <item name="preferenceTheme">@style/PreferenceThemeOverlay</item> - <item name="colorPrimary">@color/primary</item> - <item name="colorPrimaryDark">@color/primary_dark</item> - <item name="colorAccent">@color/accent</item> - <item name="android:tint">@android:color/white</item> - </style> - - <style name="Theme.ImpressRemote.ActionBar" parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse"> - <item name="displayOptions">showTitle|homeAsUp|useLogo</item> - <item name="logo">@drawable/ic_logo_padding</item> - </style> - - <style name="Theme.ImpressRemote.ActionBar.Tab" parent="Widget.Design.TabLayout"> - <item name="android:background">@color/primary</item> - <item name="tabTextColor">?android:textColorSecondaryInverse</item> - <item name="tabSelectedTextColor">?android:textColorPrimaryInverse</item> - </style> - -</resources>
\ No newline at end of file |