Merge "Add missing settings strings." into tm-dev am: af5a015198 am: f01fbbcec3

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/17692465

Change-Id: Ia062145408e033588a1478b341e7a6c91738ea16
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot
2022-05-05 14:06:01 +00:00
committed by Automerger Merge Worker
63 changed files with 470 additions and 88 deletions

View File

@@ -16,6 +16,8 @@
package com.android.settings.display;
import static android.app.admin.DevicePolicyResources.Strings.Settings.OTHER_OPTIONS_DISABLED_BY_ADMIN;
import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
import android.app.Dialog;
@@ -24,7 +26,9 @@ import android.content.Context;
import android.content.DialogInterface;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog.Builder;
@@ -52,13 +56,26 @@ public class TimeoutListPreference extends RestrictedListPreference {
DialogInterface.OnClickListener listener) {
super.onPrepareDialogBuilder(builder, listener);
if (mAdmin != null) {
builder.setView(R.layout.admin_disabled_other_options_footer);
// TODO: replace Text on textview with admin_disabled_other_options
updateTextOnDialog(builder);
} else {
builder.setView(null);
}
}
private void updateTextOnDialog(Builder builder) {
LayoutInflater inflater = getContext().getSystemService(LayoutInflater.class);
DevicePolicyManager devicePolicyManager = getContext()
.getSystemService(DevicePolicyManager.class);
View v = inflater.inflate(R.layout.admin_disabled_other_options_footer, null);
builder.setView(v);
TextView textView = v.findViewById(R.id.admin_disabled_other_options_text);
String replacementText = devicePolicyManager.getResources().getString(
OTHER_OPTIONS_DISABLED_BY_ADMIN, () -> null);
if (replacementText != null) {
textView.setText(replacementText);
}
}
@Override
protected void onDialogCreated(Dialog dialog) {
super.onDialogCreated(dialog);