Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 456285ca authored by timhypeng's avatar timhypeng
Browse files

Refactor common layout

- reuse preference_widget_dialog_radiobutton

Bug: 144746899
Test: manual
Change-Id: Icfba629eb05b9db1dc6802e26c087b30f0fe88ed
parent 426a2721
Loading
Loading
Loading
Loading
+11 −27
Original line number Diff line number Diff line
@@ -28,31 +28,20 @@
        <RadioGroup
            android:id="@+id/private_dns_radio_group"
            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:text="@string/private_dns_mode_off"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:minHeight="48dp"/>
                layout="@layout/preference_widget_dialog_radiobutton"/>

            <RadioButton
            <include
                android:id="@+id/private_dns_mode_opportunistic"
                android:text="@string/private_dns_mode_opportunistic"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:minHeight="48dp"/>
                layout="@layout/preference_widget_dialog_radiobutton"/>

            <RadioButton
            <include
                android:id="@+id/private_dns_mode_provider"
                android:text="@string/private_dns_mode_provider"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:minHeight="48dp"/>
                layout="@layout/preference_widget_dialog_radiobutton"/>

            <EditText
                android:id="@+id/private_dns_mode_provider_hostname"
@@ -64,17 +53,12 @@
                android:layout_height="wrap_content"
                android:layout_marginStart="40dp"
                android:layout_marginEnd="8dp"
                android:minHeight="48dp"/>
                android:minHeight="@dimen/developer_option_dialog_min_height"/>
        </RadioGroup>

        <TextView
        <include
            android:id="@+id/private_dns_help_info"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:minHeight="48dp"
            android:paddingStart="16dp"
            android:textAppearance="?android:attr/textAppearanceSmall"/>
            layout="@layout/preference_widget_dialog_summary"/>
    </LinearLayout>

</ScrollView>
+10 −0
Original line number Diff line number Diff line
@@ -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,