Merge changes from topic "entity_ui"
* changes: Do not show installation status on Q New UI design for entity header on Q
This commit is contained in:
committed by
Android (Google) Code Review
commit
c32de1a2d9
@@ -1,113 +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.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!-- Entity header -->
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/entity_header"
|
|
||||||
style="@style/EntityHeader"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingTop="24dp"
|
|
||||||
android:paddingBottom="24dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/entity_header_content"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="?android:attr/selectableItemBackground"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:paddingStart="56dp">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/entity_header_icon"
|
|
||||||
android:layout_width="48dp"
|
|
||||||
android:layout_height="48dp"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:antialias="true" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:paddingStart="16dp"
|
|
||||||
android:paddingEnd="16dp"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/entity_header_title"
|
|
||||||
style="@style/TextAppearance.EntityHeaderTitle"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:singleLine="false"
|
|
||||||
android:ellipsize="marquee"
|
|
||||||
android:gravity="start"
|
|
||||||
android:textDirection="locale" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/install_type"
|
|
||||||
style="@style/TextAppearance.EntityHeaderSummary"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/entity_header_summary"
|
|
||||||
style="@style/TextAppearance.EntityHeaderSummary"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/entity_header_second_summary"
|
|
||||||
style="@style/TextAppearance.EntityHeaderSummary"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/entity_header_links"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@android:id/button1"
|
|
||||||
style="?android:attr/actionOverflowButtonStyle"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:minWidth="@dimen/min_tap_target_size"
|
|
||||||
android:src="@null"
|
|
||||||
android:tint="?android:attr/colorAccent" />
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@android:id/button2"
|
|
||||||
style="?android:attr/actionOverflowButtonStyle"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:minWidth="@dimen/min_tap_target_size"
|
|
||||||
android:src="@null"
|
|
||||||
android:tint="?android:attr/colorAccent" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@@ -16,60 +16,58 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- Entity header -->
|
<!-- Entity header -->
|
||||||
<LinearLayout
|
<RelativeLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/entity_header"
|
android:id="@+id/entity_header"
|
||||||
style="@style/EntityHeader"
|
style="@style/EntityHeader"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingStart="@dimen/preference_no_icon_padding_start"
|
|
||||||
android:paddingTop="24dp"
|
|
||||||
android:paddingBottom="32dp"
|
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/entity_header_content"
|
android:id="@+id/entity_header_content"
|
||||||
android:layout_width="0dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_centerHorizontal="true"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:gravity="center_horizontal"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/entity_header_icon"
|
android:id="@+id/entity_header_icon"
|
||||||
android:layout_width="48dp"
|
android:layout_width="48dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
android:scaleType="fitXY"
|
android:scaleType="fitXY"
|
||||||
android:antialias="true" />
|
android:antialias="true"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/entity_header_title"
|
android:id="@+id/entity_header_title"
|
||||||
style="@style/TextAppearance.EntityHeaderTitle"
|
style="@style/TextAppearance.EntityHeaderTitle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="false"
|
android:singleLine="false"
|
||||||
android:ellipsize="marquee"
|
android:ellipsize="marquee"
|
||||||
android:gravity="start"
|
android:textDirection="locale"
|
||||||
android:textDirection="locale" />
|
android:layout_marginTop="8dp"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/install_type"
|
android:id="@+id/install_type"
|
||||||
style="@style/TextAppearance.EntityHeaderSummary"
|
style="@style/TextAppearance.EntityHeaderSummary"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="2dp"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/entity_header_summary"
|
android:id="@+id/entity_header_summary"
|
||||||
style="@style/TextAppearance.EntityHeaderSummary"
|
style="@style/TextAppearance.EntityHeaderSummary"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="2dp"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/entity_header_second_summary"
|
android:id="@+id/entity_header_second_summary"
|
||||||
style="@style/TextAppearance.EntityHeaderSummary"
|
style="@style/TextAppearance.EntityHeaderSummary"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -78,6 +76,8 @@
|
|||||||
android:id="@+id/entity_header_links"
|
android:id="@+id/entity_header_links"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
@@ -102,4 +102,4 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</RelativeLayout>
|
||||||
|
@@ -320,8 +320,9 @@
|
|||||||
|
|
||||||
<style name="TextAppearance.EntityHeaderTitle"
|
<style name="TextAppearance.EntityHeaderTitle"
|
||||||
parent="@android:style/TextAppearance.Material.Subhead">
|
parent="@android:style/TextAppearance.Material.Subhead">
|
||||||
|
<item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item>
|
||||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||||
<item name="android:textSize">16sp</item>
|
<item name="android:textSize">20sp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="TextAppearance.EntityHeaderSummary"
|
<style name="TextAppearance.EntityHeaderSummary"
|
||||||
@@ -331,6 +332,7 @@
|
|||||||
<item name="android:gravity">start</item>
|
<item name="android:gravity">start</item>
|
||||||
<item name="android:singleLine">true</item>
|
<item name="android:singleLine">true</item>
|
||||||
<item name="android:ellipsize">marquee</item>
|
<item name="android:ellipsize">marquee</item>
|
||||||
|
<item name="android:textSize">14sp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="TextAppearance.ZenOnboardingButton">
|
<style name="TextAppearance.ZenOnboardingButton">
|
||||||
@@ -397,12 +399,10 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="EntityHeader">
|
<style name="EntityHeader">
|
||||||
<item name="android:background">?android:attr/colorPrimary</item>
|
<item name="android:background">?android:attr/colorPrimaryDark</item>
|
||||||
<item name="android:gravity">center_horizontal</item>
|
<item name="android:paddingTop">24dp</item>
|
||||||
<item name="android:paddingTop">16dp</item>
|
<item name="android:paddingBottom">16dp</item>
|
||||||
<item name="android:paddingStart">16dp</item>
|
|
||||||
<item name="android:paddingEnd">16dp</item>
|
<item name="android:paddingEnd">16dp</item>
|
||||||
<item name="android:paddingBottom">8dp</item>
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="ActionPrimaryButton" parent="android:Widget.DeviceDefault.Button.Colored"/>
|
<style name="ActionPrimaryButton" parent="android:Widget.DeviceDefault.Button.Colored"/>
|
||||||
|
@@ -90,12 +90,9 @@ public class AppHeaderViewPreferenceController extends BasePreferenceController
|
|||||||
private void setAppLabelAndIcon(PackageInfo pkgInfo, AppEntry appEntry) {
|
private void setAppLabelAndIcon(PackageInfo pkgInfo, AppEntry appEntry) {
|
||||||
final Activity activity = mParent.getActivity();
|
final Activity activity = mParent.getActivity();
|
||||||
final boolean isInstantApp = AppUtils.isInstant(pkgInfo.applicationInfo);
|
final boolean isInstantApp = AppUtils.isInstant(pkgInfo.applicationInfo);
|
||||||
final CharSequence summary = isInstantApp
|
|
||||||
? null : mContext.getString(Utils.getInstallationStatus(appEntry.info));
|
|
||||||
mEntityHeaderController
|
mEntityHeaderController
|
||||||
.setLabel(appEntry)
|
.setLabel(appEntry)
|
||||||
.setIcon(appEntry)
|
.setIcon(appEntry)
|
||||||
.setSummary(summary)
|
|
||||||
.setIsInstantApp(isInstantApp)
|
.setIsInstantApp(isInstantApp)
|
||||||
.done(activity, false /* rebindActions */);
|
.done(activity, false /* rebindActions */);
|
||||||
}
|
}
|
||||||
|
@@ -235,10 +235,7 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements
|
|||||||
controller.setLabel(mAppEntry);
|
controller.setLabel(mAppEntry);
|
||||||
controller.setIcon(mAppEntry);
|
controller.setIcon(mAppEntry);
|
||||||
boolean isInstantApp = AppUtils.isInstant(mAppEntry.info);
|
boolean isInstantApp = AppUtils.isInstant(mAppEntry.info);
|
||||||
CharSequence summary = isInstantApp
|
|
||||||
? null : getString(Utils.getInstallationStatus(mAppEntry.info));
|
|
||||||
controller.setIsInstantApp(AppUtils.isInstant(mAppEntry.info));
|
controller.setIsInstantApp(AppUtils.isInstant(mAppEntry.info));
|
||||||
controller.setSummary(summary);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
controller.done(context, true /* rebindActions */);
|
controller.done(context, true /* rebindActions */);
|
||||||
|
@@ -106,15 +106,12 @@ public class AppHeaderViewPreferenceControllerTest {
|
|||||||
|
|
||||||
|
|
||||||
final TextView title = mHeader.findViewById(R.id.entity_header_title);
|
final TextView title = mHeader.findViewById(R.id.entity_header_title);
|
||||||
final TextView summary = mHeader.findViewById(R.id.entity_header_summary);
|
|
||||||
|
|
||||||
mController.displayPreference(mScreen);
|
mController.displayPreference(mScreen);
|
||||||
mController.refreshUi();
|
mController.refreshUi();
|
||||||
|
|
||||||
assertThat(title).isNotNull();
|
assertThat(title).isNotNull();
|
||||||
assertThat(title.getText()).isEqualTo(appLabel);
|
assertThat(title.getText()).isEqualTo(appLabel);
|
||||||
assertThat(summary).isNotNull();
|
|
||||||
assertThat(summary.getText()).isEqualTo(mContext.getString(R.string.installed));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@@ -258,7 +258,6 @@ public class AdvancedPowerUsageDetailTest {
|
|||||||
verify(mEntityHeaderController).setIcon(mAppEntry);
|
verify(mEntityHeaderController).setIcon(mAppEntry);
|
||||||
verify(mEntityHeaderController).setLabel(mAppEntry);
|
verify(mEntityHeaderController).setLabel(mAppEntry);
|
||||||
verify(mEntityHeaderController).setIsInstantApp(true);
|
verify(mEntityHeaderController).setIsInstantApp(true);
|
||||||
verify(mEntityHeaderController).setSummary((CharSequence) null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Reference in New Issue
Block a user