Reuse NPVPlugin for QS Controls Tile
Enabled reuse for better support/easier flow for user. adb shell settings put system npv_plugin_flag 3 Test: visual Change-Id: I9e3e2b02e60bf732ab6e6c1f184b4bdfcf368934
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/home_controls_layout"
|
||||
android:layout_width="match_parent"
|
||||
@@ -8,6 +8,5 @@
|
||||
android:visibility="gone"
|
||||
android:padding="8dp"
|
||||
android:layout_margin="5dp"
|
||||
android:background="?android:attr/colorBackgroundFloating"
|
||||
android:orientation="vertical">
|
||||
</LinearLayout>
|
||||
android:background="?android:attr/colorBackgroundFloating">
|
||||
</FrameLayout>
|
||||
|
||||
@@ -145,7 +145,7 @@ public class QSFactoryImpl implements QSFactory {
|
||||
return mBluetoothTileProvider.get();
|
||||
case "controls":
|
||||
if (Settings.System.getInt(mHost.getContext().getContentResolver(),
|
||||
"qs_controls_tile_enabled", 0) == 1) {
|
||||
"npv_plugin_flag", 0) == 3) {
|
||||
return mControlsTileProvider.get();
|
||||
} else return null;
|
||||
case "cell":
|
||||
|
||||
@@ -22,11 +22,11 @@ import android.content.Intent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.plugins.ActivityStarter;
|
||||
import com.android.systemui.plugins.HomeControlsPlugin;
|
||||
import com.android.systemui.plugins.NPVPlugin;
|
||||
import com.android.systemui.plugins.PluginListener;
|
||||
import com.android.systemui.plugins.qs.DetailAdapter;
|
||||
import com.android.systemui.plugins.qs.QSTile.BooleanState;
|
||||
@@ -44,7 +44,7 @@ public class ControlsTile extends QSTileImpl<BooleanState> {
|
||||
private ControlsDetailAdapter mDetailAdapter;
|
||||
private final ActivityStarter mActivityStarter;
|
||||
private PluginManager mPluginManager;
|
||||
private HomeControlsPlugin mPlugin;
|
||||
private NPVPlugin mPlugin;
|
||||
private Intent mHomeAppIntent;
|
||||
|
||||
@Inject
|
||||
@@ -81,7 +81,7 @@ public class ControlsTile extends QSTileImpl<BooleanState> {
|
||||
public void setDetailListening(boolean listening) {
|
||||
if (mPlugin == null) return;
|
||||
|
||||
mPlugin.setVisible(listening);
|
||||
mPlugin.setListening(listening);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -142,7 +142,7 @@ public class ControlsTile extends QSTileImpl<BooleanState> {
|
||||
|
||||
private class ControlsDetailAdapter implements DetailAdapter {
|
||||
private View mDetailView;
|
||||
protected LinearLayout mHomeControlsLayout;
|
||||
protected FrameLayout mHomeControlsLayout;
|
||||
|
||||
public CharSequence getTitle() {
|
||||
return "Controls";
|
||||
@@ -157,24 +157,30 @@ public class ControlsTile extends QSTileImpl<BooleanState> {
|
||||
}
|
||||
|
||||
public View createDetailView(Context context, View convertView, final ViewGroup parent) {
|
||||
mHomeControlsLayout = (LinearLayout) LayoutInflater.from(context).inflate(
|
||||
R.layout.home_controls, parent, false);
|
||||
if (convertView != null) return convertView;
|
||||
|
||||
mHomeControlsLayout = (FrameLayout) LayoutInflater.from(context).inflate(
|
||||
R.layout.home_controls, parent, false);
|
||||
mHomeControlsLayout.setVisibility(View.VISIBLE);
|
||||
parent.addView(mHomeControlsLayout);
|
||||
|
||||
mPluginManager.addPluginListener(
|
||||
new PluginListener<HomeControlsPlugin>() {
|
||||
new PluginListener<NPVPlugin>() {
|
||||
@Override
|
||||
public void onPluginConnected(HomeControlsPlugin plugin,
|
||||
public void onPluginConnected(NPVPlugin plugin,
|
||||
Context pluginContext) {
|
||||
mPlugin = plugin;
|
||||
mPlugin.sendParentGroup(mHomeControlsLayout);
|
||||
mPlugin.setVisible(true);
|
||||
mPlugin.attachToRoot(mHomeControlsLayout);
|
||||
mPlugin.setListening(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPluginDisconnected(HomeControlsPlugin plugin) {
|
||||
public void onPluginDisconnected(NPVPlugin plugin) {
|
||||
mPlugin.setListening(false);
|
||||
mHomeControlsLayout.removeAllViews();
|
||||
|
||||
}
|
||||
}, HomeControlsPlugin.class, false);
|
||||
}, NPVPlugin.class, false);
|
||||
return mHomeControlsLayout;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,6 @@ import android.view.ViewGroup;
|
||||
import android.view.WindowInsets;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
|
||||
@@ -243,7 +242,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
private View mQsNavbarScrim;
|
||||
protected NotificationsQuickSettingsContainer mNotificationContainerParent;
|
||||
protected NotificationStackScrollLayout mNotificationStackScroller;
|
||||
protected LinearLayout mHomeControlsLayout;
|
||||
protected FrameLayout mHomeControlsLayout;
|
||||
private boolean mAnimateNextPositionUpdate;
|
||||
|
||||
private int mTrackingPointer;
|
||||
|
||||
Reference in New Issue
Block a user