diff options
author | Bonian Chen <bonianchen@google.com> | 2020-06-09 18:07:56 +0800 |
---|---|---|
committer | Bonian Chen <bonianchen@google.com> | 2020-06-15 03:08:31 +0000 |
commit | 723c251c13aa7d1ae79709225385b89877e6eaf0 (patch) | |
tree | 6602f56ac828a87a87fbdb6d4e83d9985f42be19 /src/com/android/settings/network | |
parent | 36dd53a0dbe521c8fed5c4b30ae434d2d8523516 (diff) | |
download | packages_apps_Settings-723c251c13aa7d1ae79709225385b89877e6eaf0.tar.gz packages_apps_Settings-723c251c13aa7d1ae79709225385b89877e6eaf0.tar.bz2 packages_apps_Settings-723c251c13aa7d1ae79709225385b89877e6eaf0.zip |
[Settings] Allow talkback to focus and select APN
Change the focus area to help talkback focus on APN items.
Bug: 149794675
Test: manual
Change-Id: I5f391be89a5b22095d6f0d04b187ea18970f18d4
Diffstat (limited to 'src/com/android/settings/network')
-rwxr-xr-x | src/com/android/settings/network/ApnPreference.java | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/src/com/android/settings/network/ApnPreference.java b/src/com/android/settings/network/ApnPreference.java index 2ec83d1ec2..63e283818f 100755 --- a/src/com/android/settings/network/ApnPreference.java +++ b/src/com/android/settings/network/ApnPreference.java @@ -27,6 +27,7 @@ import android.util.Log; import android.view.View; import android.widget.CompoundButton; import android.widget.RadioButton; +import android.widget.RelativeLayout; import android.widget.Toast; import androidx.preference.Preference; @@ -34,19 +35,32 @@ import androidx.preference.PreferenceViewHolder; import com.android.settings.R; -public class ApnPreference extends Preference implements CompoundButton.OnCheckedChangeListener { +/** + * Preference of APN UI entry + */ +public class ApnPreference extends Preference implements CompoundButton.OnCheckedChangeListener, + View.OnClickListener { final static String TAG = "ApnPreference"; private int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; + /** + * Constructor of Preference + */ public ApnPreference(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } + /** + * Constructor of Preference + */ public ApnPreference(Context context, AttributeSet attrs) { this(context, attrs, R.attr.apnPreferenceStyle); } + /** + * Constructor of Preference + */ public ApnPreference(Context context) { this(context, null); } @@ -61,6 +75,9 @@ public class ApnPreference extends Preference implements CompoundButton.OnChecke public void onBindViewHolder(PreferenceViewHolder view) { super.onBindViewHolder(view); + final RelativeLayout textArea = (RelativeLayout) view.findViewById(R.id.text_layout); + textArea.setOnClickListener(this); + final View widget = view.findViewById(R.id.apn_radiobutton); if ((widget != null) && widget instanceof RadioButton) { final RadioButton rb = (RadioButton) widget; @@ -111,22 +128,25 @@ public class ApnPreference extends Preference implements CompoundButton.OnChecke } @Override - protected void onClick() { + public void onClick(View layoutView) { super.onClick(); final Context context = getContext(); - if (context != null) { - if (mHideDetails) { - Toast.makeText(context, context.getString( - R.string.cannot_change_apn_toast), Toast.LENGTH_LONG).show(); - return; - } - final int pos = Integer.parseInt(getKey()); - final Uri url = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI, pos); - final Intent editIntent = new Intent(Intent.ACTION_EDIT, url); - editIntent.putExtra(ApnSettings.SUB_ID, mSubId); - editIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - context.startActivity(editIntent); + final int pos = Integer.parseInt(getKey()); + if (context == null) { + Log.w(TAG, "No context available for pos=" + pos); + return; + } + + if (mHideDetails) { + Toast.makeText(context, context.getString( + R.string.cannot_change_apn_toast), Toast.LENGTH_LONG).show(); + return; } + final Uri url = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI, pos); + final Intent editIntent = new Intent(Intent.ACTION_EDIT, url); + editIntent.putExtra(ApnSettings.SUB_ID, mSubId); + editIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + context.startActivity(editIntent); } public void setSelectable(boolean selectable) { |