Snap for 10289553 from e5aa469940 to udc-qpr1-release

Change-Id: I83117a6cabc2d8a6523063a965666ad9bf4ebe11
This commit is contained in:
Android Build Coastguard Worker
2023-06-09 03:18:27 +00:00
6 changed files with 66 additions and 9 deletions

View File

@@ -15,9 +15,12 @@
limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:shape="rectangle">
<solid
android:color="?androidprv:attr/materialColorPrimaryContainer" />
<stroke
android:width="2dp"
android:color="?android:attr/colorAccent"/>
android:width="1dp"
android:color="?androidprv:attr/materialColorOnPrimaryContainer"/>
<corners android:radius="@dimen/rect_button_radius" />
</shape>

View File

@@ -15,10 +15,10 @@
limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:shape="rectangle">
<stroke
android:width="1dp"
android:color="?android:attr/colorAccent"/>
android:color="?androidprv:attr/materialColorOutlineVariant"/>
<corners android:radius="@dimen/rect_button_radius" />
</shape>

View File

@@ -413,7 +413,7 @@
<!-- The title of the menu entry of Numbers system preference. [CHAR LIMIT=50] -->
<string name="numbers_preferences_title">Numbers preferences</string>
<!-- The summary of default string for each regional preference. [CHAR LIMIT=50] -->
<string name="default_string_of_regional_preference">Use app default</string>
<string name="default_string_of_regional_preference">Use default</string>
<!-- The title of Celsius for preference of temperature unit. [CHAR LIMIT=50] -->
<string name="celsius_temperature_unit">Celsius (\u00B0C)</string>
<!-- The title of Fahrenheit for preference of temperature unit. [CHAR LIMIT=50] -->

View File

@@ -420,7 +420,7 @@
<style name="WorkChallengeEmergencyButtonStyle">
<item name="android:background">@drawable/work_challenge_emergency_button_background</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textColor">@android:color/system_accent3_900</item>
<item name="android:outlineProvider">none</item>
<item name="android:paddingTop">15dp</item>
<item name="android:paddingBottom">15dp</item>

View File

@@ -16,9 +16,14 @@
package com.android.settings.language;
import android.app.Dialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.UserInfo;
import android.os.UserHandle;
import android.os.UserManager;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.Nullable;
@@ -26,8 +31,12 @@ import androidx.preference.Preference;
import com.android.internal.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.dashboard.profileselector.ProfileSelectDialog;
import com.android.settings.dashboard.profileselector.UserAdapter;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
/** Controller of the On-device recognition preference. */
@@ -37,6 +46,8 @@ public class OnDeviceRecognitionPreferenceController extends BasePreferenceContr
private Optional<Intent> mIntent;
private WeakReference<Dialog> mProfileSelectDialog = new WeakReference<>(null);
public OnDeviceRecognitionPreferenceController(Context context, String preferenceKey) {
super(context, preferenceKey);
}
@@ -59,6 +70,48 @@ public class OnDeviceRecognitionPreferenceController extends BasePreferenceContr
}
}
@Override
public boolean handlePreferenceTreeClick(Preference preference) {
if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) {
return super.handlePreferenceTreeClick(preference);
}
show(preference);
return true;
}
private void show(Preference preference) {
final List<UserHandle> userHandles = new ArrayList<>();
for (UserInfo userInfo : UserManager.get(mContext).getUsers()) {
userHandles.add(userInfo.getUserHandle());
}
// Only a single profile is installed. Proceed with its settings.
if (userHandles.size() == 1) {
mContext.startActivityAsUser(preference.getIntent(), userHandles.get(0));
return;
}
// Multiple profiles are installed. Show a dialog to the user to pick one to proceed with.
createAndShowProfileSelectDialog(preference.getIntent(), userHandles);
}
private UserAdapter.OnClickListener createProfileDialogClickCallback(
Intent intent, List<UserHandle> userHandles) {
return (int position) -> {
mContext.startActivityAsUser(intent, userHandles.get(position));
if (mProfileSelectDialog.get() != null) {
mProfileSelectDialog.get().dismiss();
}
};
}
private void createAndShowProfileSelectDialog(Intent intent, List<UserHandle> userHandles) {
Dialog profileSelectDialog = ProfileSelectDialog.createDialog(
mContext, userHandles, createProfileDialogClickCallback(intent, userHandles));
mProfileSelectDialog = new WeakReference<>(profileSelectDialog);
profileSelectDialog.show();
}
/**
* Create an {@link Intent} for the activity in the default on-device recognizer service if
* there is a properly defined speech recognition xml meta-data for that service.

View File

@@ -167,9 +167,10 @@ public class BubblePreference extends Preference implements View.OnClickListener
: R.drawable.button_border_unselected));
mView.setSelected(selected);
ColorStateList stateList = selected
? Utils.getColorAccent(context)
: Utils.getColorAttr(context, android.R.attr.textColorPrimary);
int colorResId = selected
? com.android.internal.R.attr.materialColorOnPrimaryContainer
: com.android.internal.R.attr.materialColorOnSurfaceVariant;
ColorStateList stateList = Utils.getColorAttr(context, colorResId);
mImageView.setImageTintList(stateList);
mTextView.setTextColor(stateList);
}