Refactor common layout

- reuse preference_widget_dialog_radiobutton

Bug: 144746899
Test: manual
Change-Id: Icfba629eb05b9db1dc6802e26c087b30f0fe88ed
This commit is contained in:
timhypeng
2019-11-21 10:33:33 +08:00
parent 426a2721d7
commit 456285ca5b
2 changed files with 21 additions and 27 deletions

View File

@@ -40,6 +40,7 @@ import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
@@ -176,6 +177,15 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
mRadioGroup.setOnCheckedChangeListener(this);
mRadioGroup.check(PRIVATE_DNS_MAP.getOrDefault(mMode, R.id.private_dns_mode_opportunistic));
// Initial radio button text
final RadioButton offRadioButton = view.findViewById(R.id.private_dns_mode_off);
offRadioButton.setText(R.string.private_dns_mode_off);
final RadioButton opportunisticRadioButton =
view.findViewById(R.id.private_dns_mode_opportunistic);
opportunisticRadioButton.setText(R.string.private_dns_mode_opportunistic);
final RadioButton providerRadioButton = view.findViewById(R.id.private_dns_mode_provider);
providerRadioButton.setText(R.string.private_dns_mode_provider);
final TextView helpTextView = view.findViewById(R.id.private_dns_help_info);
helpTextView.setMovementMethod(LinkMovementMethod.getInstance());
final Intent helpIntent = HelpUtils.getHelpIntent(context,