1486b78e42652466f6241eb87d5bed60040db7a25John Spurlock/* 2486b78e42652466f6241eb87d5bed60040db7a25John Spurlock * Copyright (C) 2014 The Android Open Source Project 3486b78e42652466f6241eb87d5bed60040db7a25John Spurlock * 4486b78e42652466f6241eb87d5bed60040db7a25John Spurlock * Licensed under the Apache License, Version 2.0 (the "License"); 5486b78e42652466f6241eb87d5bed60040db7a25John Spurlock * you may not use this file except in compliance with the License. 6486b78e42652466f6241eb87d5bed60040db7a25John Spurlock * You may obtain a copy of the License at 7486b78e42652466f6241eb87d5bed60040db7a25John Spurlock * 8486b78e42652466f6241eb87d5bed60040db7a25John Spurlock * http://www.apache.org/licenses/LICENSE-2.0 9486b78e42652466f6241eb87d5bed60040db7a25John Spurlock * 10486b78e42652466f6241eb87d5bed60040db7a25John Spurlock * Unless required by applicable law or agreed to in writing, software 11486b78e42652466f6241eb87d5bed60040db7a25John Spurlock * distributed under the License is distributed on an "AS IS" BASIS, 12486b78e42652466f6241eb87d5bed60040db7a25John Spurlock * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13486b78e42652466f6241eb87d5bed60040db7a25John Spurlock * See the License for the specific language governing permissions and 14486b78e42652466f6241eb87d5bed60040db7a25John Spurlock * limitations under the License. 15486b78e42652466f6241eb87d5bed60040db7a25John Spurlock */ 16486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 17486b78e42652466f6241eb87d5bed60040db7a25John Spurlockpackage com.android.systemui.qs; 18486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 19486b78e42652466f6241eb87d5bed60040db7a25John Spurlockimport android.content.Context; 20e17c4b49a41ec9de5c1d7f229273fc4677ec24b1Jorim Jaggiimport android.content.res.Configuration; 21b27ec6d37d277fe54cb8b85590758a7ad1767ff0Jason Monkimport android.graphics.drawable.Drawable; 22486b78e42652466f6241eb87d5bed60040db7a25John Spurlockimport android.os.Handler; 23486b78e42652466f6241eb87d5bed60040db7a25John Spurlockimport android.os.Looper; 24486b78e42652466f6241eb87d5bed60040db7a25John Spurlockimport android.os.Message; 25486b78e42652466f6241eb87d5bed60040db7a25John Spurlockimport android.text.TextUtils; 26486b78e42652466f6241eb87d5bed60040db7a25John Spurlockimport android.util.AttributeSet; 27486b78e42652466f6241eb87d5bed60040db7a25John Spurlockimport android.util.Log; 28486b78e42652466f6241eb87d5bed60040db7a25John Spurlockimport android.view.LayoutInflater; 29486b78e42652466f6241eb87d5bed60040db7a25John Spurlockimport android.view.View; 30486b78e42652466f6241eb87d5bed60040db7a25John Spurlockimport android.view.ViewGroup; 316573ef20790b0438cfd60c6306e58db0ef85c31bJason Monkimport android.widget.BaseAdapter; 32486b78e42652466f6241eb87d5bed60040db7a25John Spurlockimport android.widget.FrameLayout; 33486b78e42652466f6241eb87d5bed60040db7a25John Spurlockimport android.widget.ImageView; 34486b78e42652466f6241eb87d5bed60040db7a25John Spurlockimport android.widget.TextView; 35e17c4b49a41ec9de5c1d7f229273fc4677ec24b1Jorim Jaggiimport com.android.systemui.FontSizeUtils; 36486b78e42652466f6241eb87d5bed60040db7a25John Spurlockimport com.android.systemui.R; 37486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 38486b78e42652466f6241eb87d5bed60040db7a25John Spurlock/** 39486b78e42652466f6241eb87d5bed60040db7a25John Spurlock * Quick settings common detail view with line items. 40486b78e42652466f6241eb87d5bed60040db7a25John Spurlock */ 41486b78e42652466f6241eb87d5bed60040db7a25John Spurlockpublic class QSDetailItems extends FrameLayout { 42486b78e42652466f6241eb87d5bed60040db7a25John Spurlock private static final String TAG = "QSDetailItems"; 43486b78e42652466f6241eb87d5bed60040db7a25John Spurlock private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); 44486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 45486b78e42652466f6241eb87d5bed60040db7a25John Spurlock private final Context mContext; 46486b78e42652466f6241eb87d5bed60040db7a25John Spurlock private final H mHandler = new H(); 476573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk private final Adapter mAdapter = new Adapter(); 48486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 49486b78e42652466f6241eb87d5bed60040db7a25John Spurlock private String mTag; 50486b78e42652466f6241eb87d5bed60040db7a25John Spurlock private Callback mCallback; 51486b78e42652466f6241eb87d5bed60040db7a25John Spurlock private boolean mItemsVisible = true; 526573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk private AutoSizingList mItemList; 53486b78e42652466f6241eb87d5bed60040db7a25John Spurlock private View mEmpty; 54486b78e42652466f6241eb87d5bed60040db7a25John Spurlock private TextView mEmptyText; 55486b78e42652466f6241eb87d5bed60040db7a25John Spurlock private ImageView mEmptyIcon; 566573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk 576573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk private Item[] mItems; 58486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 59486b78e42652466f6241eb87d5bed60040db7a25John Spurlock public QSDetailItems(Context context, AttributeSet attrs) { 60486b78e42652466f6241eb87d5bed60040db7a25John Spurlock super(context, attrs); 61486b78e42652466f6241eb87d5bed60040db7a25John Spurlock mContext = context; 62486b78e42652466f6241eb87d5bed60040db7a25John Spurlock mTag = TAG; 63486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 64486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 65486b78e42652466f6241eb87d5bed60040db7a25John Spurlock public static QSDetailItems convertOrInflate(Context context, View convert, ViewGroup parent) { 66486b78e42652466f6241eb87d5bed60040db7a25John Spurlock if (convert instanceof QSDetailItems) { 67486b78e42652466f6241eb87d5bed60040db7a25John Spurlock return (QSDetailItems) convert; 68486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 69486b78e42652466f6241eb87d5bed60040db7a25John Spurlock return (QSDetailItems) LayoutInflater.from(context).inflate(R.layout.qs_detail_items, 70486b78e42652466f6241eb87d5bed60040db7a25John Spurlock parent, false); 71486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 72486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 73486b78e42652466f6241eb87d5bed60040db7a25John Spurlock @Override 74486b78e42652466f6241eb87d5bed60040db7a25John Spurlock protected void onFinishInflate() { 75486b78e42652466f6241eb87d5bed60040db7a25John Spurlock super.onFinishInflate(); 766573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk mItemList = (AutoSizingList) findViewById(android.R.id.list); 776573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk mItemList.setVisibility(GONE); 786573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk mItemList.setAdapter(mAdapter); 79486b78e42652466f6241eb87d5bed60040db7a25John Spurlock mEmpty = findViewById(android.R.id.empty); 80486b78e42652466f6241eb87d5bed60040db7a25John Spurlock mEmpty.setVisibility(GONE); 81486b78e42652466f6241eb87d5bed60040db7a25John Spurlock mEmptyText = (TextView) mEmpty.findViewById(android.R.id.title); 82486b78e42652466f6241eb87d5bed60040db7a25John Spurlock mEmptyIcon = (ImageView) mEmpty.findViewById(android.R.id.icon); 83486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 84486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 85e17c4b49a41ec9de5c1d7f229273fc4677ec24b1Jorim Jaggi @Override 86e17c4b49a41ec9de5c1d7f229273fc4677ec24b1Jorim Jaggi protected void onConfigurationChanged(Configuration newConfig) { 87e17c4b49a41ec9de5c1d7f229273fc4677ec24b1Jorim Jaggi super.onConfigurationChanged(newConfig); 88e17c4b49a41ec9de5c1d7f229273fc4677ec24b1Jorim Jaggi FontSizeUtils.updateFontSize(mEmptyText, R.dimen.qs_detail_empty_text_size); 896573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk int count = mItemList.getChildCount(); 90e17c4b49a41ec9de5c1d7f229273fc4677ec24b1Jorim Jaggi for (int i = 0; i < count; i++) { 916573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk View item = mItemList.getChildAt(i); 92e17c4b49a41ec9de5c1d7f229273fc4677ec24b1Jorim Jaggi FontSizeUtils.updateFontSize(item, android.R.id.title, 93e17c4b49a41ec9de5c1d7f229273fc4677ec24b1Jorim Jaggi R.dimen.qs_detail_item_primary_text_size); 94e17c4b49a41ec9de5c1d7f229273fc4677ec24b1Jorim Jaggi FontSizeUtils.updateFontSize(item, android.R.id.summary, 95e17c4b49a41ec9de5c1d7f229273fc4677ec24b1Jorim Jaggi R.dimen.qs_detail_item_secondary_text_size); 96e17c4b49a41ec9de5c1d7f229273fc4677ec24b1Jorim Jaggi } 97e17c4b49a41ec9de5c1d7f229273fc4677ec24b1Jorim Jaggi } 98e17c4b49a41ec9de5c1d7f229273fc4677ec24b1Jorim Jaggi 99486b78e42652466f6241eb87d5bed60040db7a25John Spurlock public void setTagSuffix(String suffix) { 100486b78e42652466f6241eb87d5bed60040db7a25John Spurlock mTag = TAG + "." + suffix; 101486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 102486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 103486b78e42652466f6241eb87d5bed60040db7a25John Spurlock public void setEmptyState(int icon, int text) { 104486b78e42652466f6241eb87d5bed60040db7a25John Spurlock mEmptyIcon.setImageResource(icon); 105486b78e42652466f6241eb87d5bed60040db7a25John Spurlock mEmptyText.setText(text); 106486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 107486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 108486b78e42652466f6241eb87d5bed60040db7a25John Spurlock @Override 109486b78e42652466f6241eb87d5bed60040db7a25John Spurlock protected void onAttachedToWindow() { 110486b78e42652466f6241eb87d5bed60040db7a25John Spurlock super.onAttachedToWindow(); 111486b78e42652466f6241eb87d5bed60040db7a25John Spurlock if (DEBUG) Log.d(mTag, "onAttachedToWindow"); 112486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 113486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 114486b78e42652466f6241eb87d5bed60040db7a25John Spurlock @Override 115486b78e42652466f6241eb87d5bed60040db7a25John Spurlock protected void onDetachedFromWindow() { 116486b78e42652466f6241eb87d5bed60040db7a25John Spurlock super.onDetachedFromWindow(); 117486b78e42652466f6241eb87d5bed60040db7a25John Spurlock if (DEBUG) Log.d(mTag, "onDetachedFromWindow"); 118486b78e42652466f6241eb87d5bed60040db7a25John Spurlock mCallback = null; 119486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 120486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 121486b78e42652466f6241eb87d5bed60040db7a25John Spurlock public void setCallback(Callback callback) { 122486b78e42652466f6241eb87d5bed60040db7a25John Spurlock mHandler.removeMessages(H.SET_CALLBACK); 123486b78e42652466f6241eb87d5bed60040db7a25John Spurlock mHandler.obtainMessage(H.SET_CALLBACK, callback).sendToTarget(); 124486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 125486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 126486b78e42652466f6241eb87d5bed60040db7a25John Spurlock public void setItems(Item[] items) { 127486b78e42652466f6241eb87d5bed60040db7a25John Spurlock mHandler.removeMessages(H.SET_ITEMS); 128486b78e42652466f6241eb87d5bed60040db7a25John Spurlock mHandler.obtainMessage(H.SET_ITEMS, items).sendToTarget(); 129486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 130486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 131486b78e42652466f6241eb87d5bed60040db7a25John Spurlock public void setItemsVisible(boolean visible) { 132486b78e42652466f6241eb87d5bed60040db7a25John Spurlock mHandler.removeMessages(H.SET_ITEMS_VISIBLE); 133486b78e42652466f6241eb87d5bed60040db7a25John Spurlock mHandler.obtainMessage(H.SET_ITEMS_VISIBLE, visible ? 1 : 0, 0).sendToTarget(); 134486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 135486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 136486b78e42652466f6241eb87d5bed60040db7a25John Spurlock private void handleSetCallback(Callback callback) { 137486b78e42652466f6241eb87d5bed60040db7a25John Spurlock mCallback = callback; 138486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 139486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 140486b78e42652466f6241eb87d5bed60040db7a25John Spurlock private void handleSetItems(Item[] items) { 1416573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk final int itemCount = items != null ? items.length : 0; 142486b78e42652466f6241eb87d5bed60040db7a25John Spurlock mEmpty.setVisibility(itemCount == 0 ? VISIBLE : GONE); 1436573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk mItemList.setVisibility(itemCount == 0 ? GONE : VISIBLE); 1446573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk mItems = items; 1456573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk mAdapter.notifyDataSetChanged(); 146486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 147486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 148486b78e42652466f6241eb87d5bed60040db7a25John Spurlock private void handleSetItemsVisible(boolean visible) { 149486b78e42652466f6241eb87d5bed60040db7a25John Spurlock if (mItemsVisible == visible) return; 150486b78e42652466f6241eb87d5bed60040db7a25John Spurlock mItemsVisible = visible; 1516573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk for (int i = 0; i < mItemList.getChildCount(); i++) { 1526573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk mItemList.getChildAt(i).setVisibility(mItemsVisible ? VISIBLE : INVISIBLE); 153486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 154486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 155486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 1566573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk private class Adapter extends BaseAdapter { 1576573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk 1586573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk @Override 1596573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk public int getCount() { 1606573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk return mItems != null ? mItems.length : 0; 1616573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk } 1626573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk 1636573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk @Override 1646573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk public Object getItem(int position) { 1656573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk return mItems[position]; 166486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 1676573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk 1686573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk @Override 1696573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk public long getItemId(int position) { 1706573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk return 0; 171b27ec6d37d277fe54cb8b85590758a7ad1767ff0Jason Monk } 1726573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk 1736573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk @Override 1746573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk public View getView(int position, View view, ViewGroup parent) { 1756573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk final Item item = mItems[position]; 1766573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk if (view == null) { 1776573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk view = LayoutInflater.from(mContext).inflate(R.layout.qs_detail_item, parent, 1786573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk false); 179486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 1806573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk view.setVisibility(mItemsVisible ? VISIBLE : INVISIBLE); 1816573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk final ImageView iv = (ImageView) view.findViewById(android.R.id.icon); 1826573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk iv.setImageResource(item.icon); 1836573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk iv.getOverlay().clear(); 1846573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk if (item.overlay != null) { 1856573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk item.overlay.setBounds(0, 0, item.overlay.getIntrinsicWidth(), 1866573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk item.overlay.getIntrinsicHeight()); 1876573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk iv.getOverlay().add(item.overlay); 188486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 1896573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk final TextView title = (TextView) view.findViewById(android.R.id.title); 1906573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk title.setText(item.line1); 1916573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk final TextView summary = (TextView) view.findViewById(android.R.id.summary); 1926573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk final boolean twoLines = !TextUtils.isEmpty(item.line2); 1936573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk title.setMaxLines(twoLines ? 1 : 2); 1946573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk summary.setVisibility(twoLines ? VISIBLE : GONE); 1956573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk summary.setText(twoLines ? item.line2 : null); 1966573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk view.setOnClickListener(new OnClickListener() { 1976573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk @Override 1986573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk public void onClick(View v) { 1996573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk if (mCallback != null) { 2006573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk mCallback.onDetailItemClick(item); 2016573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk } 2026573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk } 2036573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk }); 2046573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk final ImageView disconnect = (ImageView) view.findViewById(android.R.id.icon2); 2056573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk disconnect.setVisibility(item.canDisconnect ? VISIBLE : GONE); 2066573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk disconnect.setOnClickListener(new OnClickListener() { 2076573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk @Override 2086573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk public void onClick(View v) { 2096573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk if (mCallback != null) { 2106573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk mCallback.onDetailItemDisconnect(item); 2116573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk } 2126573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk } 2136573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk }); 2146573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk return view; 2156573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk } 2166573ef20790b0438cfd60c6306e58db0ef85c31bJason Monk }; 217486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 218486b78e42652466f6241eb87d5bed60040db7a25John Spurlock private class H extends Handler { 219486b78e42652466f6241eb87d5bed60040db7a25John Spurlock private static final int SET_ITEMS = 1; 220486b78e42652466f6241eb87d5bed60040db7a25John Spurlock private static final int SET_CALLBACK = 2; 221486b78e42652466f6241eb87d5bed60040db7a25John Spurlock private static final int SET_ITEMS_VISIBLE = 3; 222486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 223486b78e42652466f6241eb87d5bed60040db7a25John Spurlock public H() { 224486b78e42652466f6241eb87d5bed60040db7a25John Spurlock super(Looper.getMainLooper()); 225486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 226486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 227486b78e42652466f6241eb87d5bed60040db7a25John Spurlock @Override 228486b78e42652466f6241eb87d5bed60040db7a25John Spurlock public void handleMessage(Message msg) { 229486b78e42652466f6241eb87d5bed60040db7a25John Spurlock if (msg.what == SET_ITEMS) { 230486b78e42652466f6241eb87d5bed60040db7a25John Spurlock handleSetItems((Item[]) msg.obj); 231486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } else if (msg.what == SET_CALLBACK) { 232486b78e42652466f6241eb87d5bed60040db7a25John Spurlock handleSetCallback((QSDetailItems.Callback) msg.obj); 233486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } else if (msg.what == SET_ITEMS_VISIBLE) { 234486b78e42652466f6241eb87d5bed60040db7a25John Spurlock handleSetItemsVisible(msg.arg1 != 0); 235486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 236486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 237486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 238486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 239486b78e42652466f6241eb87d5bed60040db7a25John Spurlock public static class Item { 240486b78e42652466f6241eb87d5bed60040db7a25John Spurlock public int icon; 241b27ec6d37d277fe54cb8b85590758a7ad1767ff0Jason Monk public Drawable overlay; 2426980d12c5864941e68933705c1f15a102ac348cbJason Monk public CharSequence line1; 2436980d12c5864941e68933705c1f15a102ac348cbJason Monk public CharSequence line2; 244486b78e42652466f6241eb87d5bed60040db7a25John Spurlock public Object tag; 245486b78e42652466f6241eb87d5bed60040db7a25John Spurlock public boolean canDisconnect; 246486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 247486b78e42652466f6241eb87d5bed60040db7a25John Spurlock 248486b78e42652466f6241eb87d5bed60040db7a25John Spurlock public interface Callback { 249486b78e42652466f6241eb87d5bed60040db7a25John Spurlock void onDetailItemClick(Item item); 250486b78e42652466f6241eb87d5bed60040db7a25John Spurlock void onDetailItemDisconnect(Item item); 251486b78e42652466f6241eb87d5bed60040db7a25John Spurlock } 252486b78e42652466f6241eb87d5bed60040db7a25John Spurlock} 253