Update layout for App info page.
- Move the app link buttons to the right
- Move the footer buttons to the top below the header
- Rename the app header details title, summary, and icon views.
Bug: 34977561
Test: make RunSettingsRoboTests
Change-Id: Id0cfc2b73b4e5cbbc1a58e497da52560892b69c8
diff --git a/res/drawable/button_bg_transparent.xml b/res/drawable/button_bg_transparent.xml
deleted file mode 100644
index d9c6fc8..0000000
--- a/res/drawable/button_bg_transparent.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 The Android Open Source Project
-
- Licensed 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
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<inset xmlns:android="http://schemas.android.com/apk/res/android"
- android:insetLeft="4dp"
- android:insetTop="6dp"
- android:insetRight="4dp"
- android:insetBottom="6dp">
- <ripple android:color="?android:attr/colorControlHighlight">
- <item android:id="@android:id/mask">
- <shape android:shape="rectangle">
- <corners android:radius="2dp"/>
- <solid android:color="@android:color/white"/>
- </shape>
- </item>
- <item>
- <shape android:shape="rectangle">
- <solid android:color="#00ffffff"/>
- <!--make button border solid color, nontransparent-->
- <stroke android:color="?android:attr/colorAccent" android:width="1dp"/>
- <corners android:radius="2dp"/>
- </shape>
- </item>
- </ripple>
-</inset>
\ No newline at end of file
diff --git a/res/layout/app_details.xml b/res/layout/app_details.xml
index 3088865..263ce05 100644
--- a/res/layout/app_details.xml
+++ b/res/layout/app_details.xml
@@ -29,15 +29,13 @@
android:paddingBottom="24dp" >
<!-- App snippet with buttons -->
- <LinearLayout
+ <RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingStart="8dp"
- android:paddingEnd="8dp"
- android:orientation="horizontal">
+ android:paddingStart="8dp">
<ImageView
- android:id="@android:id/icon"
+ android:id="@+id/app_detail_icon"
android:layout_width="80dp"
android:layout_height="80dp"
android:scaleType="fitXY"
@@ -47,12 +45,13 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_toEndOf="@id/app_detail_icon"
android:paddingStart="24dp"
android:paddingEnd="24dp"
android:orientation="vertical">
<TextView
- android:id="@android:id/title"
+ android:id="@+id/app_detail_title"
style="@style/TextAppearance.EntityHeaderTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -62,7 +61,7 @@
android:paddingTop="8dp"/>
<TextView
- android:id="@android:id/summary"
+ android:id="@+id/app_detail_summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
@@ -73,7 +72,33 @@
</LinearLayout>
- </LinearLayout>
+ <LinearLayout
+ android:id="@+id/app_detail_links"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_alignParentEnd="true"
+ android:orientation="vertical">
+
+ <ImageButton
+ android:id="@+id/right_button"
+ style="@android:style/Widget.Material.Button.Borderless"
+ android:layout_width="wrap_content"
+ android:layout_weight="1"
+ android:layout_height="0dp"
+ android:src="@drawable/ic_settings_24dp"
+ android:tint="?android:attr/colorAccent"/>
+
+ <ImageButton
+ android:id="@+id/left_button"
+ style="@android:style/Widget.Material.Button.Borderless"
+ android:layout_width="wrap_content"
+ android:layout_weight="1"
+ android:layout_height="0dp"
+ android:tint="?android:attr/colorAccent"/>
+
+ </LinearLayout>
+
+ </RelativeLayout>
<TextView
android:id="@+id/instant_app_developer_title"
@@ -109,37 +134,4 @@
android:gravity="center_horizontal"
android:visibility="gone"/>
-
- <LinearLayout
- android:id="@+id/app_detail_links"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="bottom"
- android:paddingStart="8dp"
- android:paddingEnd="8dp"
- android:orientation="horizontal">
-
- <ImageButton
- android:id="@+id/left_button"
- style="@style/AppHeaderLinkButton"
- android:layout_width="0dp"
- android:layout_weight="1"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:paddingEnd="8dp"
- android:tint="?android:attr/colorAccent"/>
-
- <ImageButton
- android:id="@+id/right_button"
- style="@style/AppHeaderLinkButton"
- android:layout_width="0dp"
- android:layout_weight="1"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:paddingStart="8dp"
- android:src="@drawable/ic_settings_24dp"
- android:tint="?android:attr/colorAccent"/>
-
- </LinearLayout>
-
</LinearLayout>
\ No newline at end of file
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 2f6f120..3f36255 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -428,9 +428,5 @@
<item name="android:textSize">24sp</item>
</style>
- <style name="AppHeaderLinkButton" parent="android:Widget.Material.Button.Borderless">
- <item name="android:background">@drawable/button_bg_transparent</item>
- </style>
-
<style name="AppActionPrimaryButton" parent="android:Widget.Material.Button.Colored"/>
</resources>
diff --git a/res/xml/installed_app_details_ia.xml b/res/xml/installed_app_details_ia.xml
index e72384a..af3a851 100644
--- a/res/xml/installed_app_details_ia.xml
+++ b/res/xml/installed_app_details_ia.xml
@@ -20,7 +20,8 @@
<com.android.settings.applications.LayoutPreference
android:key="header_view"
android:layout="@layout/app_details"
- android:selectable="false"/>
+ android:selectable="false"
+ android:order="-10000"/>
<Preference
android:key="notification_settings"
diff --git a/src/com/android/settings/applications/AppHeaderController.java b/src/com/android/settings/applications/AppHeaderController.java
index 5b243ff..daafc18 100644
--- a/src/com/android/settings/applications/AppHeaderController.java
+++ b/src/com/android/settings/applications/AppHeaderController.java
@@ -163,17 +163,17 @@
final Resources res = mAppHeader.getResources();
// Set Icon
- final ImageView iconView = (ImageView) mAppHeader.findViewById(android.R.id.icon);
+ final ImageView iconView = (ImageView) mAppHeader.findViewById(R.id.app_detail_icon);
if (appEntry.icon != null) {
iconView.setImageDrawable(appEntry.icon.getConstantState().newDrawable(res));
}
// Set application name.
- final TextView labelView = (TextView) mAppHeader.findViewById(android.R.id.title);
+ final TextView labelView = (TextView) mAppHeader.findViewById(R.id.app_detail_title);
labelView.setText(appEntry.label);
// Version number of application
- final TextView appVersion = (TextView) mAppHeader.findViewById(android.R.id.summary);
+ final TextView appVersion = (TextView) mAppHeader.findViewById(R.id.app_detail_summary);
if (!TextUtils.isEmpty(versionName)) {
appVersion.setSelected(true);
@@ -206,12 +206,12 @@
* Done mutating appheader, rebinds everything (optionally skip rebinding buttons).
*/
public View done(boolean rebindActions) {
- ImageView iconView = (ImageView) mAppHeader.findViewById(android.R.id.icon);
+ ImageView iconView = (ImageView) mAppHeader.findViewById(R.id.app_detail_icon);
if (iconView != null) {
iconView.setImageDrawable(mIcon);
}
- setText(android.R.id.title, mLabel);
- setText(android.R.id.summary, mSummary);
+ setText(R.id.app_detail_title, mLabel);
+ setText(R.id.app_detail_summary, mSummary);
if (rebindActions) {
bindAppHeaderButtons();
}
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index 873c5fd..73164e4 100755
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -327,7 +327,7 @@
addDynamicPrefs();
if (mDashboardFeatureProvider.isEnabled()) {
mFooter = new LayoutPreference(getPrefContext(), R.layout.app_action_buttons);
- mFooter.setOrder(10000);
+ mFooter.setOrder(-9999);
mFooter.setKey(KEY_FOOTER);
getPreferenceScreen().addPreference(mFooter);
}
@@ -1098,10 +1098,10 @@
LayoutInflater.from(appSnippet.getContext()).inflate(R.layout.widget_text_views,
(ViewGroup) appSnippet.findViewById(android.R.id.widget_frame));
- ImageView iconView = (ImageView) appSnippet.findViewById(android.R.id.icon);
+ ImageView iconView = (ImageView) appSnippet.findViewById(R.id.app_detail_icon);
iconView.setImageDrawable(icon);
// Set application name.
- TextView labelView = (TextView) appSnippet.findViewById(android.R.id.title);
+ TextView labelView = (TextView) appSnippet.findViewById(R.id.app_detail_title);
labelView.setText(label);
// Version number of application
TextView appVersion = (TextView) appSnippet.findViewById(R.id.widget_text1);
diff --git a/tests/robotests/src/com/android/settings/applications/AppHeaderControllerTest.java b/tests/robotests/src/com/android/settings/applications/AppHeaderControllerTest.java
index 1625e1c..458af5b 100644
--- a/tests/robotests/src/com/android/settings/applications/AppHeaderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppHeaderControllerTest.java
@@ -115,8 +115,8 @@
public void bindViews_shouldBindAllData() {
final String testString = "test";
final View appHeader = mLayoutInflater.inflate(R.layout.app_details, null /* root */);
- final TextView label = (TextView) appHeader.findViewById(android.R.id.title);
- final TextView version = (TextView) appHeader.findViewById(android.R.id.summary);
+ final TextView label = (TextView) appHeader.findViewById(R.id.app_detail_title);
+ final TextView version = (TextView) appHeader.findViewById(R.id.app_detail_summary);
mController = new AppHeaderController(mShadowContext, mFragment, appHeader);
mController.setLabel(testString);