Loading res/xml/my_device_info.xml +2 −2 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ <!-- Account name --> <Preference android:key="account" android:key="branded_account" android:order="1" android:title="@string/my_device_info_account_preference_title" android:summary="@string/summary_placeholder"/> Loading @@ -43,7 +43,7 @@ android:summary="@string/summary_placeholder"/> <!-- Device name --> <Preference <com.android.settings.widget.ValidatedEditTextPreference android:key="device_name" android:order="3" android:title="@string/my_device_info_device_name_preference_title" Loading src/com/android/settings/bluetooth/BluetoothLengthDeviceNameFilter.java 0 → 100644 +28 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 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.settings.bluetooth; /** * Filter to max the length of a Bluetotoh device name to 248 bytes, as defined by the spec. */ public class BluetoothLengthDeviceNameFilter extends Utf8ByteLengthFilter { private static final int BLUETOOTH_NAME_MAX_LENGTH_BYTES = 248; public BluetoothLengthDeviceNameFilter() { super(BLUETOOTH_NAME_MAX_LENGTH_BYTES); } } src/com/android/settings/bluetooth/BluetoothNameDialogFragment.java +1 −3 Original line number Diff line number Diff line Loading @@ -43,8 +43,6 @@ import com.android.settings.core.instrumentation.InstrumentedDialogFragment; */ abstract class BluetoothNameDialogFragment extends InstrumentedDialogFragment implements TextWatcher { private static final int BLUETOOTH_NAME_MAX_LENGTH_BYTES = 248; private AlertDialog mAlertDialog; private Button mOkButton; Loading Loading @@ -109,7 +107,7 @@ abstract class BluetoothNameDialogFragment extends InstrumentedDialogFragment View view = layoutInflater.inflate(R.layout.dialog_edittext, null); mDeviceNameView = (EditText) view.findViewById(R.id.edittext); mDeviceNameView.setFilters(new InputFilter[] { new Utf8ByteLengthFilter(BLUETOOTH_NAME_MAX_LENGTH_BYTES) new BluetoothLengthDeviceNameFilter() }); mDeviceNameView.setText(deviceName); // set initial value before adding listener if (!TextUtils.isEmpty(deviceName)) { Loading src/com/android/settings/bluetooth/Utf8ByteLengthFilter.java +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ import android.text.Spanned; * pairs are encoded as 4 bytes, with the caveat that the maximum * length will be constrained more conservatively than necessary. */ class Utf8ByteLengthFilter implements InputFilter { public class Utf8ByteLengthFilter implements InputFilter { private final int mMaxBytes; Utf8ByteLengthFilter(int maxBytes) { Loading src/com/android/settings/deviceinfo/BrandedAccountPreferenceController.java +1 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ import com.android.settings.core.BasePreferenceController; import com.android.settings.overlay.FeatureFactory; public class BrandedAccountPreferenceController extends BasePreferenceController { private static final String KEY_PREFERENCE_TITLE = "account"; private static final String KEY_PREFERENCE_TITLE = "branded_account"; private final Account[] mAccounts; public BrandedAccountPreferenceController(Context context) { Loading Loading
res/xml/my_device_info.xml +2 −2 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ <!-- Account name --> <Preference android:key="account" android:key="branded_account" android:order="1" android:title="@string/my_device_info_account_preference_title" android:summary="@string/summary_placeholder"/> Loading @@ -43,7 +43,7 @@ android:summary="@string/summary_placeholder"/> <!-- Device name --> <Preference <com.android.settings.widget.ValidatedEditTextPreference android:key="device_name" android:order="3" android:title="@string/my_device_info_device_name_preference_title" Loading
src/com/android/settings/bluetooth/BluetoothLengthDeviceNameFilter.java 0 → 100644 +28 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 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.settings.bluetooth; /** * Filter to max the length of a Bluetotoh device name to 248 bytes, as defined by the spec. */ public class BluetoothLengthDeviceNameFilter extends Utf8ByteLengthFilter { private static final int BLUETOOTH_NAME_MAX_LENGTH_BYTES = 248; public BluetoothLengthDeviceNameFilter() { super(BLUETOOTH_NAME_MAX_LENGTH_BYTES); } }
src/com/android/settings/bluetooth/BluetoothNameDialogFragment.java +1 −3 Original line number Diff line number Diff line Loading @@ -43,8 +43,6 @@ import com.android.settings.core.instrumentation.InstrumentedDialogFragment; */ abstract class BluetoothNameDialogFragment extends InstrumentedDialogFragment implements TextWatcher { private static final int BLUETOOTH_NAME_MAX_LENGTH_BYTES = 248; private AlertDialog mAlertDialog; private Button mOkButton; Loading Loading @@ -109,7 +107,7 @@ abstract class BluetoothNameDialogFragment extends InstrumentedDialogFragment View view = layoutInflater.inflate(R.layout.dialog_edittext, null); mDeviceNameView = (EditText) view.findViewById(R.id.edittext); mDeviceNameView.setFilters(new InputFilter[] { new Utf8ByteLengthFilter(BLUETOOTH_NAME_MAX_LENGTH_BYTES) new BluetoothLengthDeviceNameFilter() }); mDeviceNameView.setText(deviceName); // set initial value before adding listener if (!TextUtils.isEmpty(deviceName)) { Loading
src/com/android/settings/bluetooth/Utf8ByteLengthFilter.java +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ import android.text.Spanned; * pairs are encoded as 4 bytes, with the caveat that the maximum * length will be constrained more conservatively than necessary. */ class Utf8ByteLengthFilter implements InputFilter { public class Utf8ByteLengthFilter implements InputFilter { private final int mMaxBytes; Utf8ByteLengthFilter(int maxBytes) { Loading
src/com/android/settings/deviceinfo/BrandedAccountPreferenceController.java +1 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ import com.android.settings.core.BasePreferenceController; import com.android.settings.overlay.FeatureFactory; public class BrandedAccountPreferenceController extends BasePreferenceController { private static final String KEY_PREFERENCE_TITLE = "account"; private static final String KEY_PREFERENCE_TITLE = "branded_account"; private final Account[] mAccounts; public BrandedAccountPreferenceController(Context context) { Loading