Using a common class for loading drawables and handling various badging

Test: make RunSettingsRoboTests -j31
Bug: 36591157

Change-Id: I4cb1d313920d5d8604fd79ff65b40e2dda180e2e
This commit is contained in:
Sunny Goyal
2017-04-12 15:53:30 -07:00
parent cf172040a9
commit 3b172d7b89
12 changed files with 37 additions and 116 deletions

View File

@@ -18,6 +18,7 @@ package com.android.settings.applications;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.eq;
@@ -38,7 +39,6 @@ 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;
@@ -276,17 +276,6 @@ 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(mActivity);
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() {
@@ -295,8 +284,6 @@ public class AppHeaderControllerTest {
mController.setIsInstantApp(true);
mController.done(mActivity);
TextView label = 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));