Loading res/drawable/ic_instant_apps_badge.xml 0 → 100644 +33 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2017 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 --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="48dp" android:height="48dp" android:viewportWidth="48" android:viewportHeight="48"> <path android:fillColor="#FFFFFF" android:fillType="evenOdd" android:pathData="M 24.5 2.7 C 35.5456949966 2.7 44.5 11.6543050034 44.5 22.7 C 44.5 33.7456949966 35.5456949966 42.7 24.5 42.7 C 13.4543050034 42.7 4.5 33.7456949966 4.5 22.7 C 4.5 11.6543050034 13.4543050034 2.7 24.5 2.7 Z" /> <path android:fillColor="#757575" android:fillType="evenOdd" android:pathData="M 33.3 19.1 L 26.4 19.1 L 26.4 5.8 L 16.6 26.4 L 23.5 26.3 L 23.5 39.6 Z" /> <path android:fillType="evenOdd" android:pathData="M 0.5 0 H 48.5 V 48 H 0.5 V 0 Z" /> </vector> No newline at end of file res/drawable/ic_instant_apps_badge_bg.xml 0 → 100644 +23 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2017 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 --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <gradient android:type="radial" android:startColor="#4d000000" android:endColor="#00000000" android:gradientRadius="12dp"/> </shape> No newline at end of file res/layout/app_details.xml +21 −8 Original line number Diff line number Diff line Loading @@ -34,13 +34,26 @@ android:layout_height="wrap_content" android:paddingStart="8dp"> <FrameLayout android:id="@+id/app_icon_frame" android:layout_width="80dp" android:layout_height="80dp"> <ImageView android:id="@+id/app_detail_icon" android:layout_width="80dp" android:layout_height="80dp" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="fitXY" android:layout_gravity="center_horizontal" android:antialias="true"/> <ImageView android:id="@+id/app_icon_instant_apps_badge" android:layout_width="22dp" android:layout_height="22dp" android:layout_gravity="end|bottom" android:layout_margin="8dp" android:visibility="gone" android:elevation="20dp" android:background="@drawable/ic_instant_apps_badge_bg" android:src="@drawable/ic_instant_apps_badge" /> </FrameLayout> <LinearLayout android:id="@+id/app_detail_links" Loading Loading @@ -71,7 +84,7 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_toEndOf="@id/app_detail_icon" android:layout_toEndOf="@id/app_icon_frame" android:layout_toStartOf="@id/app_detail_links" android:paddingStart="24dp" android:paddingEnd="24dp" Loading src/com/android/settings/applications/AppHeaderController.java +4 −0 Original line number Diff line number Diff line Loading @@ -212,6 +212,10 @@ public class AppHeaderController { ImageView iconView = (ImageView) mAppHeader.findViewById(R.id.app_detail_icon); if (iconView != null) { iconView.setImageDrawable(mIcon); ImageView badgeView = mAppHeader.findViewById(R.id.app_icon_instant_apps_badge); if (badgeView != null) { badgeView.setVisibility(mIsInstantApp ? View.VISIBLE : View.GONE); } } setText(R.id.app_detail_title, mLabel); setText(R.id.app_detail_summary, mSummary); Loading tests/robotests/src/com/android/settings/applications/AppHeaderControllerTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.os.UserHandle; import android.support.v7.preference.Preference; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.android.settings.R; Loading Loading @@ -276,6 +277,17 @@ public class AppHeaderControllerTest { .isEqualTo(View.GONE); } // Ensure that the instant app label does not show up when we haven't told the controller the // app is instant. @Test public void instantApps_normalAppsDontGetInstantAppsBadge() { final View appHeader = mLayoutInflater.inflate(R.layout.app_details, null /* root */); mController = new AppHeaderController(mContext, mFragment, appHeader); mController.done(); assertThat(appHeader.findViewById(R.id.app_icon_instant_apps_badge).getVisibility()) .isEqualTo(View.GONE); } // Test that the "instant apps" label is present in the header when we have an instant app. @Test public void instantApps_expectedHeaderItem() { Loading @@ -284,6 +296,8 @@ public class AppHeaderControllerTest { mController.setIsInstantApp(true); mController.done(); TextView label = (TextView)appHeader.findViewById(R.id.install_type); ImageView badgeView = appHeader.findViewById(R.id.app_icon_instant_apps_badge); assertThat(badgeView.getVisibility()).isEqualTo(View.VISIBLE); assertThat(label.getVisibility()).isEqualTo(View.VISIBLE); assertThat(label.getText()).isEqualTo( appHeader.getResources().getString(R.string.install_type_instant)); Loading Loading
res/drawable/ic_instant_apps_badge.xml 0 → 100644 +33 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2017 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 --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="48dp" android:height="48dp" android:viewportWidth="48" android:viewportHeight="48"> <path android:fillColor="#FFFFFF" android:fillType="evenOdd" android:pathData="M 24.5 2.7 C 35.5456949966 2.7 44.5 11.6543050034 44.5 22.7 C 44.5 33.7456949966 35.5456949966 42.7 24.5 42.7 C 13.4543050034 42.7 4.5 33.7456949966 4.5 22.7 C 4.5 11.6543050034 13.4543050034 2.7 24.5 2.7 Z" /> <path android:fillColor="#757575" android:fillType="evenOdd" android:pathData="M 33.3 19.1 L 26.4 19.1 L 26.4 5.8 L 16.6 26.4 L 23.5 26.3 L 23.5 39.6 Z" /> <path android:fillType="evenOdd" android:pathData="M 0.5 0 H 48.5 V 48 H 0.5 V 0 Z" /> </vector> No newline at end of file
res/drawable/ic_instant_apps_badge_bg.xml 0 → 100644 +23 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2017 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 --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <gradient android:type="radial" android:startColor="#4d000000" android:endColor="#00000000" android:gradientRadius="12dp"/> </shape> No newline at end of file
res/layout/app_details.xml +21 −8 Original line number Diff line number Diff line Loading @@ -34,13 +34,26 @@ android:layout_height="wrap_content" android:paddingStart="8dp"> <FrameLayout android:id="@+id/app_icon_frame" android:layout_width="80dp" android:layout_height="80dp"> <ImageView android:id="@+id/app_detail_icon" android:layout_width="80dp" android:layout_height="80dp" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="fitXY" android:layout_gravity="center_horizontal" android:antialias="true"/> <ImageView android:id="@+id/app_icon_instant_apps_badge" android:layout_width="22dp" android:layout_height="22dp" android:layout_gravity="end|bottom" android:layout_margin="8dp" android:visibility="gone" android:elevation="20dp" android:background="@drawable/ic_instant_apps_badge_bg" android:src="@drawable/ic_instant_apps_badge" /> </FrameLayout> <LinearLayout android:id="@+id/app_detail_links" Loading Loading @@ -71,7 +84,7 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_toEndOf="@id/app_detail_icon" android:layout_toEndOf="@id/app_icon_frame" android:layout_toStartOf="@id/app_detail_links" android:paddingStart="24dp" android:paddingEnd="24dp" Loading
src/com/android/settings/applications/AppHeaderController.java +4 −0 Original line number Diff line number Diff line Loading @@ -212,6 +212,10 @@ public class AppHeaderController { ImageView iconView = (ImageView) mAppHeader.findViewById(R.id.app_detail_icon); if (iconView != null) { iconView.setImageDrawable(mIcon); ImageView badgeView = mAppHeader.findViewById(R.id.app_icon_instant_apps_badge); if (badgeView != null) { badgeView.setVisibility(mIsInstantApp ? View.VISIBLE : View.GONE); } } setText(R.id.app_detail_title, mLabel); setText(R.id.app_detail_summary, mSummary); Loading
tests/robotests/src/com/android/settings/applications/AppHeaderControllerTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.os.UserHandle; import android.support.v7.preference.Preference; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.android.settings.R; Loading Loading @@ -276,6 +277,17 @@ public class AppHeaderControllerTest { .isEqualTo(View.GONE); } // Ensure that the instant app label does not show up when we haven't told the controller the // app is instant. @Test public void instantApps_normalAppsDontGetInstantAppsBadge() { final View appHeader = mLayoutInflater.inflate(R.layout.app_details, null /* root */); mController = new AppHeaderController(mContext, mFragment, appHeader); mController.done(); assertThat(appHeader.findViewById(R.id.app_icon_instant_apps_badge).getVisibility()) .isEqualTo(View.GONE); } // Test that the "instant apps" label is present in the header when we have an instant app. @Test public void instantApps_expectedHeaderItem() { Loading @@ -284,6 +296,8 @@ public class AppHeaderControllerTest { mController.setIsInstantApp(true); mController.done(); TextView label = (TextView)appHeader.findViewById(R.id.install_type); ImageView badgeView = appHeader.findViewById(R.id.app_icon_instant_apps_badge); assertThat(badgeView.getVisibility()).isEqualTo(View.VISIBLE); assertThat(label.getVisibility()).isEqualTo(View.VISIBLE); assertThat(label.getText()).isEqualTo( appHeader.getResources().getString(R.string.install_type_instant)); Loading