Clean up settings_entity_header layout.
update layout view IDs, and controller variable names to be more generic. Fix: 36734470 Bug: 37669238 Test: make RunSettingsRoboTests Change-Id: Ib80827ae3eae6d01a600068b4a8a44b239c32511
This commit is contained in:
@@ -28,6 +28,7 @@ import android.content.pm.PermissionInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -64,7 +65,7 @@ public class AppOpsDetails extends InstrumentedPreferenceFragment {
|
||||
final View appSnippet = mRootView.findViewById(R.id.app_snippet);
|
||||
CharSequence label = mPm.getApplicationLabel(pkgInfo.applicationInfo);
|
||||
Drawable icon = mPm.getApplicationIcon(pkgInfo.applicationInfo);
|
||||
InstalledAppDetails.setupAppSnippet(appSnippet, label, icon,
|
||||
setupAppSnippet(appSnippet, label, icon,
|
||||
pkgInfo != null ? pkgInfo.versionName : null);
|
||||
}
|
||||
|
||||
@@ -191,4 +192,30 @@ public class AppOpsDetails extends InstrumentedPreferenceFragment {
|
||||
setIntentAndFinish(true, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated app info pages should use {@link EntityHeaderController} to show the app header.
|
||||
*/
|
||||
void setupAppSnippet(View appSnippet, CharSequence label, Drawable icon,
|
||||
CharSequence versionName) {
|
||||
LayoutInflater.from(appSnippet.getContext()).inflate(R.layout.widget_text_views,
|
||||
appSnippet.findViewById(android.R.id.widget_frame));
|
||||
|
||||
ImageView iconView = appSnippet.findViewById(android.R.id.icon);
|
||||
iconView.setImageDrawable(icon);
|
||||
// Set application name.
|
||||
TextView labelView = appSnippet.findViewById(android.R.id.title);
|
||||
labelView.setText(label);
|
||||
// Version number of application
|
||||
TextView appVersion = appSnippet.findViewById(R.id.widget_text1);
|
||||
|
||||
if (!TextUtils.isEmpty(versionName)) {
|
||||
appVersion.setSelected(true);
|
||||
appVersion.setVisibility(View.VISIBLE);
|
||||
appVersion.setText(appSnippet.getContext().getString(R.string.version_text,
|
||||
String.valueOf(versionName)));
|
||||
} else {
|
||||
appVersion.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user