Revert "Toggle user switcher in car QS footer."
This reverts commit df63d97e1a.
This commit will be replaced by ag/2690511, which implements the user
switcher using UserGridView instead.
Change-Id: I8f21f1dc1653834b3408e1c22a67d7787673185c
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2017 The Android Open Source 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.
|
||||
-->
|
||||
<!-- Extends FrameLayout -->
|
||||
<com.android.systemui.qs.car.CarQSDetail
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/qs_detail_background"
|
||||
android:paddingBottom="8dp"
|
||||
android:visibility="gone">
|
||||
|
||||
</com.android.systemui.qs.car.CarQSDetail>
|
||||
@@ -24,11 +24,4 @@
|
||||
|
||||
<include layout="@layout/car_status_bar_header" />
|
||||
<include layout="@layout/car_qs_footer" />
|
||||
|
||||
<include android:id="@+id/qs_detail" layout="@layout/car_qs_detail" />
|
||||
|
||||
<com.android.systemui.qs.QSPanel
|
||||
android:id="@+id/quick_settings_panel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source 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.
|
||||
*/
|
||||
|
||||
package com.android.systemui.qs.car;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.SparseArray;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.systemui.Dependency;
|
||||
import com.android.systemui.plugins.qs.DetailAdapter;
|
||||
import com.android.systemui.qs.QSDetail;
|
||||
import com.android.systemui.qs.QSPanel;
|
||||
|
||||
/**
|
||||
* The detail view that displays below the status bar header in the auto use-case. This view
|
||||
* additional details of quick settings options, such as for showing the users when user switcher
|
||||
* has been selected.
|
||||
*/
|
||||
public class CarQSDetail extends FrameLayout {
|
||||
|
||||
private final SparseArray<View> mDetailViews = new SparseArray<>();
|
||||
|
||||
private DetailAdapter mDetailAdapter;
|
||||
|
||||
public CarQSDetail(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
|
||||
for (int i = 0; i < mDetailViews.size(); i++) {
|
||||
mDetailViews.valueAt(i).dispatchConfigurationChanged(newConfig);
|
||||
}
|
||||
}
|
||||
|
||||
public void setQsPanel(QSPanel panel) {
|
||||
panel.setCallback(mQsPanelCallback);
|
||||
}
|
||||
|
||||
public boolean isShowingDetail() {
|
||||
return mDetailAdapter != null;
|
||||
}
|
||||
|
||||
public void handleShowingDetail(@Nullable DetailAdapter adapter) {
|
||||
boolean showingDetail = adapter != null;
|
||||
setClickable(showingDetail);
|
||||
|
||||
// If it's already in the right state (not showing or already showing the right adapter),
|
||||
// then no need to change.
|
||||
if ((mDetailAdapter == null && adapter == null) || mDetailAdapter == adapter) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (showingDetail) {
|
||||
int viewCacheIndex = adapter.getMetricsCategory();
|
||||
View detailView = adapter.createDetailView(mContext, mDetailViews.get(viewCacheIndex),
|
||||
this);
|
||||
if (detailView == null) {
|
||||
throw new IllegalStateException("Must return detail view");
|
||||
}
|
||||
|
||||
removeAllViews();
|
||||
addView(detailView);
|
||||
mDetailViews.put(viewCacheIndex, detailView);
|
||||
Dependency.get(MetricsLogger.class).visible(adapter.getMetricsCategory());
|
||||
mDetailAdapter = adapter;
|
||||
setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
if (mDetailAdapter != null) {
|
||||
Dependency.get(MetricsLogger.class).hidden(mDetailAdapter.getMetricsCategory());
|
||||
}
|
||||
mDetailAdapter = null;
|
||||
setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private QSDetail.Callback mQsPanelCallback = new QSDetail.Callback() {
|
||||
@Override
|
||||
public void onToggleStateChanged(final boolean state) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowingDetail(final DetailAdapter detail, final int x, final int y) {
|
||||
post(() -> handleShowingDetail(detail));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScanStateChanged(final boolean state) {
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -18,7 +18,6 @@ import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
@@ -38,16 +37,11 @@ import com.android.systemui.statusbar.policy.UserInfoController;
|
||||
*/
|
||||
public class CarQSFooter extends RelativeLayout implements QSFooter,
|
||||
UserInfoController.OnUserInfoChangedListener {
|
||||
private static final String TAG = "CarQSFooter";
|
||||
|
||||
private UserInfoController mUserInfoController;
|
||||
|
||||
private MultiUserSwitch mMultiUserSwitch;
|
||||
private ImageView mMultiUserAvatar;
|
||||
|
||||
private CarQSDetail mQsDetail;
|
||||
private QSPanel mQsPanel;
|
||||
|
||||
public CarQSFooter(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
@@ -60,21 +54,6 @@ public class CarQSFooter extends RelativeLayout implements QSFooter,
|
||||
|
||||
mUserInfoController = Dependency.get(UserInfoController.class);
|
||||
|
||||
mMultiUserSwitch.setOnClickListener(v -> {
|
||||
if (mQsDetail == null || mQsPanel == null) {
|
||||
Log.e(TAG, "CarQSFooter not properly set up; cannot display user switcher.");
|
||||
return;
|
||||
}
|
||||
|
||||
// MultiUserSwitch.onClick() shows the detail, but does not close the detail, so need
|
||||
// to use the detail's showing state to determine the correct action.
|
||||
if (mQsDetail.isShowingDetail()) {
|
||||
mQsPanel.closeDetail();
|
||||
} else {
|
||||
mMultiUserSwitch.onClick(v);
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.settings_button).setOnClickListener(v -> {
|
||||
ActivityStarter activityStarter = Dependency.get(ActivityStarter.class);
|
||||
|
||||
@@ -94,22 +73,11 @@ public class CarQSFooter extends RelativeLayout implements QSFooter,
|
||||
mMultiUserAvatar.setImageDrawable(picture);
|
||||
}
|
||||
|
||||
/**
|
||||
* Needed for setup in order to allow the multi user switch to show the users.
|
||||
*
|
||||
* @param panel the QSPanel that listens to the user switch controller. This cannot be null
|
||||
* during normal operation.
|
||||
*/
|
||||
@Override
|
||||
public void setQSPanel(@Nullable QSPanel panel) {
|
||||
if (panel != null) {
|
||||
mMultiUserSwitch.setQsPanel(panel);
|
||||
}
|
||||
mQsPanel = panel;
|
||||
}
|
||||
|
||||
public void setQSDetail(CarQSDetail detail) {
|
||||
mQsDetail = detail;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,7 +25,6 @@ import android.view.ViewGroup;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.plugins.qs.QS;
|
||||
import com.android.systemui.qs.QSFooter;
|
||||
import com.android.systemui.qs.QSPanel;
|
||||
|
||||
/**
|
||||
* A quick settings fragment for the car. For auto, there is no row for quick settings or ability
|
||||
@@ -34,9 +33,7 @@ import com.android.systemui.qs.QSPanel;
|
||||
*/
|
||||
public class CarQSFragment extends Fragment implements QS {
|
||||
private View mHeader;
|
||||
private CarQSFooter mFooter;
|
||||
private QSPanel mQsPanel;
|
||||
private CarQSDetail mQsDetail;
|
||||
private QSFooter mFooter;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@@ -49,13 +46,6 @@ public class CarQSFragment extends Fragment implements QS {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
mHeader = view.findViewById(R.id.header);
|
||||
mFooter = view.findViewById(R.id.qs_footer);
|
||||
mQsPanel = view.findViewById(R.id.quick_settings_panel);
|
||||
mQsDetail = view.findViewById(R.id.qs_detail);
|
||||
|
||||
// Inform each other about their existence.
|
||||
mQsDetail.setQsPanel(mQsPanel);
|
||||
mFooter.setQSDetail(mQsDetail);
|
||||
mFooter.setQSPanel(mQsPanel);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -133,13 +123,13 @@ public class CarQSFragment extends Fragment implements QS {
|
||||
|
||||
@Override
|
||||
public boolean isShowingDetail() {
|
||||
return mQsDetail.isShowingDetail();
|
||||
// No detail panel to close.
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeDetail() {
|
||||
mQsDetail.setVisibility(View.GONE);
|
||||
mQsPanel.closeDetail();
|
||||
// No detail panel to close.
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.android.keyguard.CarrierText;
|
||||
import com.android.systemui.Dependency;
|
||||
import com.android.systemui.SysuiBaseFragmentTest;
|
||||
import com.android.systemui.statusbar.policy.Clock;
|
||||
import com.android.systemui.statusbar.policy.UserSwitcherController;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -58,8 +57,6 @@ public class CarQsFragmentTest extends SysuiBaseFragmentTest {
|
||||
|
||||
mDependency.injectTestDependency(Dependency.BG_LOOPER,
|
||||
TestableLooper.get(this).getLooper());
|
||||
mDependency.injectMockDependency(UserSwitcherController.class);
|
||||
injectLeakCheckedDependencies(ALL_SUPPORTED_CLASSES);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user