Refactor common layout
- reuse preference_widget_dialog_radiobutton Bug: 144746899 Test: manual Change-Id: Icfba629eb05b9db1dc6802e26c087b30f0fe88ed
This commit is contained in:
@@ -28,31 +28,20 @@
|
|||||||
<RadioGroup
|
<RadioGroup
|
||||||
android:id="@+id/private_dns_radio_group"
|
android:id="@+id/private_dns_radio_group"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/developer_option_dialog_margin_start">
|
||||||
|
|
||||||
<RadioButton
|
<include
|
||||||
android:id="@+id/private_dns_mode_off"
|
android:id="@+id/private_dns_mode_off"
|
||||||
android:text="@string/private_dns_mode_off"
|
layout="@layout/preference_widget_dialog_radiobutton"/>
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:minHeight="48dp"/>
|
|
||||||
|
|
||||||
<RadioButton
|
<include
|
||||||
android:id="@+id/private_dns_mode_opportunistic"
|
android:id="@+id/private_dns_mode_opportunistic"
|
||||||
android:text="@string/private_dns_mode_opportunistic"
|
layout="@layout/preference_widget_dialog_radiobutton"/>
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:minHeight="48dp"/>
|
|
||||||
|
|
||||||
<RadioButton
|
<include
|
||||||
android:id="@+id/private_dns_mode_provider"
|
android:id="@+id/private_dns_mode_provider"
|
||||||
android:text="@string/private_dns_mode_provider"
|
layout="@layout/preference_widget_dialog_radiobutton"/>
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:minHeight="48dp"/>
|
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/private_dns_mode_provider_hostname"
|
android:id="@+id/private_dns_mode_provider_hostname"
|
||||||
@@ -64,17 +53,12 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="40dp"
|
android:layout_marginStart="40dp"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:minHeight="48dp"/>
|
android:minHeight="@dimen/developer_option_dialog_min_height"/>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|
||||||
<TextView
|
<include
|
||||||
android:id="@+id/private_dns_help_info"
|
android:id="@+id/private_dns_help_info"
|
||||||
android:layout_width="match_parent"
|
layout="@layout/preference_widget_dialog_summary"/>
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:minHeight="48dp"
|
|
||||||
android:paddingStart="16dp"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
@@ -40,6 +40,7 @@ import android.util.Log;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.RadioButton;
|
||||||
import android.widget.RadioGroup;
|
import android.widget.RadioGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@@ -176,6 +177,15 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
|
|||||||
mRadioGroup.setOnCheckedChangeListener(this);
|
mRadioGroup.setOnCheckedChangeListener(this);
|
||||||
mRadioGroup.check(PRIVATE_DNS_MAP.getOrDefault(mMode, R.id.private_dns_mode_opportunistic));
|
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);
|
final TextView helpTextView = view.findViewById(R.id.private_dns_help_info);
|
||||||
helpTextView.setMovementMethod(LinkMovementMethod.getInstance());
|
helpTextView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
final Intent helpIntent = HelpUtils.getHelpIntent(context,
|
final Intent helpIntent = HelpUtils.getHelpIntent(context,
|
||||||
|
Reference in New Issue
Block a user