Merge "Allow QS detail panels to change text of settings button" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
d1f955b200
@@ -16,6 +16,7 @@ package com.android.systemui.plugins.qs;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
@@ -34,7 +35,22 @@ public interface DetailAdapter {
|
||||
}
|
||||
|
||||
View createDetailView(Context context, View convertView, ViewGroup parent);
|
||||
|
||||
/**
|
||||
* @return intent for opening more settings related to this detail panel. If null, the more
|
||||
* settings button will not be shown
|
||||
*/
|
||||
Intent getSettingsIntent();
|
||||
|
||||
/**
|
||||
* @return resource id of the string to use for opening the settings intent. If
|
||||
* {@code Resources.ID_NULL}, then use the default string:
|
||||
* {@code com.android.systemui.R.string.quick_settings_more_settings}
|
||||
*/
|
||||
default int getSettingsText() {
|
||||
return Resources.ID_NULL;
|
||||
}
|
||||
|
||||
void setToggleState(boolean state);
|
||||
int getMetricsCategory();
|
||||
|
||||
|
||||
@@ -889,6 +889,8 @@
|
||||
<string name="quick_settings_color_space_label">Color correction mode</string>
|
||||
<!-- QuickSettings: Control panel: Label for button that navigates to settings. [CHAR LIMIT=NONE] -->
|
||||
<string name="quick_settings_more_settings">More settings</string>
|
||||
<!-- QuickSettings: Control panel: Label for button that navigates to user settings. [CHAR LIMIT=NONE] -->
|
||||
<string name="quick_settings_more_user_settings">User settings</string>
|
||||
<!-- QuickSettings: Control panel: Label for button that dismisses control panel. [CHAR LIMIT=NONE] -->
|
||||
<string name="quick_settings_done">Done</string>
|
||||
<!-- QuickSettings: Control panel: Label for connected device. [CHAR LIMIT=NONE] -->
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Animatable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.SparseArray;
|
||||
@@ -140,7 +141,10 @@ public class QSDetail extends LinearLayout {
|
||||
|
||||
private void updateDetailText() {
|
||||
mDetailDoneButton.setText(R.string.quick_settings_done);
|
||||
mDetailSettingsButton.setText(R.string.quick_settings_more_settings);
|
||||
final int resId =
|
||||
mDetailAdapter != null ? mDetailAdapter.getSettingsText() : Resources.ID_NULL;
|
||||
mDetailSettingsButton.setText(
|
||||
(resId != Resources.ID_NULL) ? resId : R.string.quick_settings_more_settings);
|
||||
}
|
||||
|
||||
public void updateResources() {
|
||||
@@ -218,6 +222,7 @@ public class QSDetail extends LinearLayout {
|
||||
mQsPanelController.setGridContentVisibility(true);
|
||||
mQsPanelCallback.onScanStateChanged(false);
|
||||
}
|
||||
updateDetailText();
|
||||
sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
|
||||
|
||||
if (mShouldAnimate) {
|
||||
|
||||
@@ -821,6 +821,11 @@ public class UserSwitcherController implements Dumpable {
|
||||
return USER_SETTINGS_INTENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSettingsText() {
|
||||
return R.string.quick_settings_more_user_settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean getToggleState() {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user