diff options
author | Adnan Begovic <adnan@cyngn.com> | 2015-07-28 18:40:46 -0700 |
---|---|---|
committer | Adnan Begovic <adnan@cyngn.com> | 2015-12-07 15:24:12 -0800 |
commit | a0b5d767d6dcfa1972a9158564f90e070ac1ead6 (patch) | |
tree | 3cff073414f45519384532ee3801ab6d188fe1ac /packages | |
parent | 12bee1e3ed6022db805bfb1ef5ab371f899c5169 (diff) | |
download | frameworks_base-a0b5d767d6dcfa1972a9158564f90e070ac1ead6.zip frameworks_base-a0b5d767d6dcfa1972a9158564f90e070ac1ead6.tar.gz frameworks_base-a0b5d767d6dcfa1972a9158564f90e070ac1ead6.tar.bz2 |
systemui: Support remote expanded style.
Change-Id: Ia324db41310c61cd0acd83633a9728b7562fd300
Diffstat (limited to 'packages')
10 files changed, 73 insertions, 9 deletions
diff --git a/packages/SystemUI/res/layout/qs_custom_detail.xml b/packages/SystemUI/res/layout/qs_custom_detail.xml index f7a002e..6aa1fc0 100644 --- a/packages/SystemUI/res/layout/qs_custom_detail.xml +++ b/packages/SystemUI/res/layout/qs_custom_detail.xml @@ -15,10 +15,12 @@ limitations under the License. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:paddingBottom="8dp"> + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + android:paddingTop="@dimen/detail_exterior_padding" + android:paddingStart="@dimen/detail_exterior_padding" + android:paddingEnd="@dimen/detail_exterior_padding"> <LinearLayout android:layout_height="wrap_content" android:layout_width="match_parent" diff --git a/packages/SystemUI/res/layout/qs_custom_detail_remote.xml b/packages/SystemUI/res/layout/qs_custom_detail_remote.xml new file mode 100644 index 0000000..bdbe6bb --- /dev/null +++ b/packages/SystemUI/res/layout/qs_custom_detail_remote.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2015 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + android:paddingTop="@dimen/detail_exterior_padding" + android:paddingStart="@dimen/detail_exterior_padding" + android:paddingEnd="@dimen/detail_exterior_padding"> + +</LinearLayout>
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/qs_detail.xml b/packages/SystemUI/res/layout/qs_detail.xml index 14ecd33..38daf0f 100644 --- a/packages/SystemUI/res/layout/qs_detail.xml +++ b/packages/SystemUI/res/layout/qs_detail.xml @@ -18,7 +18,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/qs_detail_background" - android:paddingBottom="8dp" + android:paddingBottom="@dimen/detail_exterior_padding" android:orientation="vertical"> <FrameLayout diff --git a/packages/SystemUI/res/layout/qs_detail_items.xml b/packages/SystemUI/res/layout/qs_detail_items.xml index c22e42c..4ad82cb 100644 --- a/packages/SystemUI/res/layout/qs_detail_items.xml +++ b/packages/SystemUI/res/layout/qs_detail_items.xml @@ -18,9 +18,9 @@ <com.android.systemui.qs.QSDetailItems xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:paddingTop="16dp" - android:paddingStart="16dp" - android:paddingEnd="16dp"> + android:paddingTop="@dimen/detail_exterior_padding" + android:paddingStart="@dimen/detail_exterior_padding" + android:paddingEnd="@dimen/detail_exterior_padding"> <LinearLayout android:id="@android:id/list" diff --git a/packages/SystemUI/res/layout/qs_user_detail_item.xml b/packages/SystemUI/res/layout/qs_user_detail_item.xml index af22f03..666f878 100644 --- a/packages/SystemUI/res/layout/qs_user_detail_item.xml +++ b/packages/SystemUI/res/layout/qs_user_detail_item.xml @@ -24,7 +24,7 @@ android:layout_height="wrap_content" android:orientation="vertical" android:gravity="top|center_horizontal" - android:paddingTop="16dp" + android:paddingTop="@dimen/detail_exterior_padding" android:minHeight="112dp" android:clipChildren="false" android:clipToPadding="false" diff --git a/packages/SystemUI/res/values/cm_dimens.xml b/packages/SystemUI/res/values/cm_dimens.xml index 0e9690e..aade9f0 100644 --- a/packages/SystemUI/res/values/cm_dimens.xml +++ b/packages/SystemUI/res/values/cm_dimens.xml @@ -47,4 +47,6 @@ <dimen name="phone_height">420dp</dimen> <dimen name="qs_detail_item_height_twoline">72dp</dimen> + + <dimen name="detail_exterior_padding">8dp</dimen> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java index 689c0fb..9e98ea3 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java @@ -31,6 +31,7 @@ import android.util.SparseArray; import android.view.View; import android.view.ViewGroup; +import android.widget.RemoteViews; import com.android.systemui.qs.QSTile.State; import com.android.systemui.statusbar.policy.BluetoothController; import com.android.systemui.statusbar.policy.CastController; @@ -327,6 +328,7 @@ public abstract class QSTile<TState extends State> implements Listenable { void startActivityDismissingKeyguard(Intent intent); void warn(String message, Throwable t); void collapsePanels(); + RemoteViews.OnClickHandler getOnClickHandler(); Looper getLooper(); Context getContext(); Collection<QSTile<?>> getTiles(); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CustomQSTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CustomQSTile.java index b3b17ef..4bc30a4 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CustomQSTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CustomQSTile.java @@ -19,6 +19,8 @@ package com.android.systemui.qs.tiles; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; +import android.content.res.Configuration; +import android.content.res.ThemeConfig; import android.net.Uri; import android.os.UserHandle; import android.text.TextUtils; @@ -28,9 +30,11 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; +import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; +import android.widget.RemoteViews; import android.widget.TextView; import com.android.internal.logging.MetricsLogger; @@ -206,6 +210,19 @@ public class CustomQSTile extends QSTile<QSTile.State> { mExpandedStyle.getExpandedItems()); mGridAdapter.setOnPseudoGridItemClickListener(this); break; + case CustomTile.ExpandedStyle.REMOTE_STYLE: + rootView = (LinearLayout) LayoutInflater.from(context) + .inflate(R.layout.qs_custom_detail_remote, parent, false); + RemoteViews remoteViews = mExpandedStyle.getContentViews(); + if (remoteViews != null) { + View localView = mTile.getCustomTile().expandedStyle.getContentViews() + .apply(context, (ViewGroup) rootView, + mHost.getOnClickHandler(), getThemePackageName()); + ((LinearLayout) rootView).addView(localView); + } else { + Log.d(TAG, "Unable to add null remoteview for " + mTile.getOpPkg()); + } + break; case CustomTile.ExpandedStyle.LIST_STYLE: default: rootView = QSDetailItemsList.convertOrInflate(context, convertView, parent); @@ -242,5 +259,11 @@ public class CustomQSTile extends QSTile<QSTile.State> { // } } + + private String getThemePackageName() { + final Configuration config = mContext.getResources().getConfiguration(); + final ThemeConfig themeConfig = config != null ? config.themeConfig : null; + return themeConfig != null ? themeConfig.getOverlayForStatusBar() : null; + } } }
\ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 564fbb5..32da495 100755 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -284,6 +284,10 @@ public abstract class BaseStatusBar extends SystemUI implements } }; + public RemoteViews.OnClickHandler getOnClickHandler() { + return mOnClickHandler; + } + private RemoteViews.OnClickHandler mOnClickHandler = new RemoteViews.OnClickHandler() { @Override public boolean onClickHandler( diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java index e8a0550..5828e70 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java @@ -32,6 +32,7 @@ import android.text.TextUtils; import android.util.Log; import com.android.internal.logging.MetricsLogger; +import android.widget.RemoteViews; import com.android.systemui.R; import com.android.systemui.qs.QSTile; import com.android.systemui.qs.tiles.AirplaneModeTile; @@ -199,6 +200,11 @@ public class QSTileHost implements QSTile.Host, Tunable { } @Override + public RemoteViews.OnClickHandler getOnClickHandler() { + return mStatusBar.getOnClickHandler(); + } + + @Override public Looper getLooper() { return mLooper; } |