Methods Summary |
---|
private void | bind(com.android.systemui.qs.QSDetailItems$Item item, android.view.View view)
if (view == null) {
view = LayoutInflater.from(mContext).inflate(R.layout.qs_detail_item, this, false);
mItems.addView(view);
}
view.setVisibility(mItemsVisible ? VISIBLE : INVISIBLE);
final ImageView iv = (ImageView) view.findViewById(android.R.id.icon);
iv.setImageResource(item.icon);
iv.getOverlay().clear();
if (item.overlay != null) {
item.overlay.setBounds(0, 0, item.overlay.getIntrinsicWidth(),
item.overlay.getIntrinsicHeight());
iv.getOverlay().add(item.overlay);
}
final TextView title = (TextView) view.findViewById(android.R.id.title);
title.setText(item.line1);
final TextView summary = (TextView) view.findViewById(android.R.id.summary);
final boolean twoLines = !TextUtils.isEmpty(item.line2);
title.setMaxLines(twoLines ? 1 : 2);
summary.setVisibility(twoLines ? VISIBLE : GONE);
summary.setText(twoLines ? item.line2 : null);
view.setMinimumHeight(mContext.getResources() .getDimensionPixelSize(
twoLines ? R.dimen.qs_detail_item_height_twoline : R.dimen.qs_detail_item_height));
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mCallback != null) {
mCallback.onDetailItemClick(item);
}
}
});
final ImageView disconnect = (ImageView) view.findViewById(android.R.id.icon2);
disconnect.setVisibility(item.canDisconnect ? VISIBLE : GONE);
disconnect.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mCallback != null) {
mCallback.onDetailItemDisconnect(item);
}
}
});
|
public static com.android.systemui.qs.QSDetailItems | convertOrInflate(android.content.Context context, android.view.View convert, android.view.ViewGroup parent)
if (convert instanceof QSDetailItems) {
return (QSDetailItems) convert;
}
return (QSDetailItems) LayoutInflater.from(context).inflate(R.layout.qs_detail_items,
parent, false);
|
private void | handleSetCallback(com.android.systemui.qs.QSDetailItems$Callback callback)
mCallback = callback;
|
private void | handleSetItems(com.android.systemui.qs.QSDetailItems$Item[] items)
final int itemCount = items != null ? Math.min(items.length, mMaxItems) : 0;
mEmpty.setVisibility(itemCount == 0 ? VISIBLE : GONE);
mItems.setVisibility(itemCount == 0 ? GONE : VISIBLE);
for (int i = mItems.getChildCount() - 1; i >= itemCount; i--) {
mItems.removeViewAt(i);
}
for (int i = 0; i < itemCount; i++) {
bind(items[i], mItems.getChildAt(i));
}
|
private void | handleSetItemsVisible(boolean visible)
if (mItemsVisible == visible) return;
mItemsVisible = visible;
for (int i = 0; i < mItems.getChildCount(); i++) {
mItems.getChildAt(i).setVisibility(mItemsVisible ? VISIBLE : INVISIBLE);
}
|
protected void | onAttachedToWindow()
super.onAttachedToWindow();
if (DEBUG) Log.d(mTag, "onAttachedToWindow");
|
protected void | onConfigurationChanged(android.content.res.Configuration newConfig)
super.onConfigurationChanged(newConfig);
FontSizeUtils.updateFontSize(mEmptyText, R.dimen.qs_detail_empty_text_size);
int count = mItems.getChildCount();
for (int i = 0; i < count; i++) {
View item = mItems.getChildAt(i);
FontSizeUtils.updateFontSize(item, android.R.id.title,
R.dimen.qs_detail_item_primary_text_size);
FontSizeUtils.updateFontSize(item, android.R.id.summary,
R.dimen.qs_detail_item_secondary_text_size);
}
|
protected void | onDetachedFromWindow()
super.onDetachedFromWindow();
if (DEBUG) Log.d(mTag, "onDetachedFromWindow");
mCallback = null;
|
protected void | onFinishInflate()
super.onFinishInflate();
mItems = (LinearLayout) findViewById(android.R.id.list);
mItems.setVisibility(GONE);
mEmpty = findViewById(android.R.id.empty);
mEmpty.setVisibility(GONE);
mEmptyText = (TextView) mEmpty.findViewById(android.R.id.title);
mEmptyIcon = (ImageView) mEmpty.findViewById(android.R.id.icon);
mMinHeightSpacer = findViewById(R.id.min_height_spacer);
// By default, a detail item view has fixed size.
mMaxItems = getResources().getInteger(
R.integer.quick_settings_detail_max_item_count);
setMinHeightInItems(mMaxItems);
|
public void | setCallback(com.android.systemui.qs.QSDetailItems$Callback callback)
mHandler.removeMessages(H.SET_CALLBACK);
mHandler.obtainMessage(H.SET_CALLBACK, callback).sendToTarget();
|
public void | setEmptyState(int icon, int text)
mEmptyIcon.setImageResource(icon);
mEmptyText.setText(text);
|
public void | setItems(com.android.systemui.qs.QSDetailItems$Item[] items)
mHandler.removeMessages(H.SET_ITEMS);
mHandler.obtainMessage(H.SET_ITEMS, items).sendToTarget();
|
public void | setItemsVisible(boolean visible)
mHandler.removeMessages(H.SET_ITEMS_VISIBLE);
mHandler.obtainMessage(H.SET_ITEMS_VISIBLE, visible ? 1 : 0, 0).sendToTarget();
|
public void | setMinHeightInItems(int minHeightInItems)Set the minimum height of this detail view, in item count.
ViewGroup.LayoutParams lp = mMinHeightSpacer.getLayoutParams();
lp.height = minHeightInItems * getResources().getDimensionPixelSize(
R.dimen.qs_detail_item_height);
mMinHeightSpacer.setLayoutParams(lp);
|
public void | setTagSuffix(java.lang.String suffix)
mTag = TAG + "." + suffix;
|