sysui: refactor for extensibility.
Bug: 28466607
Change-Id: I73b017240d86dd3d1be9f76bad284ef6f3c91c9f
(cherry picked from commit a78c415c79287f5d03086d0ebd9a7d970ac5360c)
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailItemView.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailItemView.java
index 99eae02..c485a9e 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailItemView.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailItemView.java
@@ -40,6 +40,8 @@
*/
public class UserDetailItemView extends LinearLayout {
+ protected static int layoutResId = R.layout.qs_user_detail_item;
+
private UserAvatarView mAvatar;
private TextView mName;
private Typeface mRegularTypeface;
@@ -83,7 +85,7 @@
ViewGroup root) {
if (!(convertView instanceof UserDetailItemView)) {
convertView = LayoutInflater.from(context).inflate(
- R.layout.qs_user_detail_item, root, false);
+ layoutResId, root, false);
}
return (UserDetailItemView) convertView;
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailView.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailView.java
index d4fa765..cd09231c 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailView.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailView.java
@@ -34,7 +34,7 @@
*/
public class UserDetailView extends PseudoGridView {
- private Adapter mAdapter;
+ protected Adapter mAdapter;
public UserDetailView(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -58,7 +58,7 @@
implements OnClickListener {
private final Context mContext;
- private final UserSwitcherController mController;
+ protected UserSwitcherController mController;
public Adapter(Context context, UserSwitcherController controller) {
super(controller);
@@ -69,6 +69,11 @@
@Override
public View getView(int position, View convertView, ViewGroup parent) {
UserSwitcherController.UserRecord item = getItem(position);
+ return createUserDetailItemView(convertView, parent, item);
+ }
+
+ public UserDetailItemView createUserDetailItemView(View convertView, ViewGroup parent,
+ UserSwitcherController.UserRecord item) {
UserDetailItemView v = UserDetailItemView.convertOrInflate(
mContext, convertView, parent);
if (v != convertView) {