Cherish: Set a text length on the carrier label

Up til now this has been gone unnoticed. Without a text limit the user
could very easily blow up the statusbar to the point that is not usable.

Change-Id: I2813af9e12c6d29e020669e0626faec8422fedbe
This commit is contained in:
Alex
2019-01-31 19:17:58 -06:00
committed by Hung Phan
parent fcfa74859b
commit e994676cd3

View File

@@ -23,6 +23,7 @@ import android.content.Intent;
import android.os.Bundle;
import android.os.UserHandle;
import android.provider.Settings;
import android.text.InputFilter;
import android.text.Spannable;
import android.text.TextUtils;
import android.widget.EditText;
@@ -69,7 +70,9 @@ public class CustomCarrierLabel extends SettingsPreferenceFragment
alert.setMessage(R.string.custom_carrier_label_explain);
// Set an EditText view to get user input
final EditText input = new EditText(getActivity());
int maxLength = 25;
input.setText(TextUtils.isEmpty(mCustomCarrierLabelText) ? "" : mCustomCarrierLabelText);
input.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength)});
input.setSelection(input.getText().length());
alert.setView(input);
alert.setPositiveButton(getString(android.R.string.ok),