Merge pull request #13671 from brave/update_vpn_support_page

updated checkboxes to radiobuttons and changed behavior of continue to email button
This commit is contained in:
Deep Pandya
2022-06-09 12:03:29 -04:00
committed by GitHub
2 changed files with 57 additions and 61 deletions
@@ -19,9 +19,11 @@ import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.RadioGroup;
import android.widget.TextView;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.AppCompatRadioButton;
import androidx.appcompat.widget.SwitchCompat;
import androidx.appcompat.widget.Toolbar;
@@ -55,31 +57,35 @@ public class BraveVpnSupportActivity extends AsyncInitializationActivity {
SwitchCompat networkTypeSwitch = findViewById(R.id.network_type_switch);
SwitchCompat cellularCarrierSwitch = findViewById(R.id.cellular_carrier_switch);
LinearLayout otherIssuesLayout = findViewById(R.id.other_issues_layout);
CheckBox otherIssueCheckbox1 = findViewById(R.id.other_issue_checkbox_1);
CheckBox otherIssueCheckbox2 = findViewById(R.id.other_issue_checkbox_2);
CheckBox otherIssueCheckbox3 = findViewById(R.id.other_issue_checkbox_3);
CheckBox otherIssueCheckbox4 = findViewById(R.id.other_issue_checkbox_4);
CheckBox otherIssueCheckbox5 = findViewById(R.id.other_issue_checkbox_5);
RadioGroup otherIssuesRadioGroup = findViewById(R.id.other_issues_radiogroup);
TextView otherIssuesText = findViewById(R.id.other_issues_text);
otherIssuesText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (otherIssuesLayout.isShown()) {
if (otherIssuesRadioGroup.isShown()) {
otherIssuesText.setCompoundDrawablesWithIntrinsicBounds(
0, 0, R.drawable.ic_toggle_down, 0);
otherIssuesLayout.setVisibility(View.GONE);
otherIssuesRadioGroup.setVisibility(View.GONE);
} else {
otherIssuesText.setCompoundDrawablesWithIntrinsicBounds(
0, 0, R.drawable.ic_toggle_up, 0);
otherIssuesLayout.setVisibility(View.VISIBLE);
otherIssuesRadioGroup.setVisibility(View.VISIBLE);
}
}
});
Button btnContinueToEmail = findViewById(R.id.btn_continue_to_email);
otherIssuesRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (!btnContinueToEmail.isEnabled()) {
btnContinueToEmail.setEnabled(true);
btnContinueToEmail.setBackgroundResource(R.drawable.orange_rounded_button);
}
}
});
btnContinueToEmail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -112,21 +118,9 @@ public class BraveVpnSupportActivity extends AsyncInitializationActivity {
}
bodyText.append("\n\nOther Issue\n");
if (otherIssueCheckbox1.isChecked()) {
bodyText.append(otherIssueCheckbox1.getText() + "\n");
}
if (otherIssueCheckbox2.isChecked()) {
bodyText.append(otherIssueCheckbox2.getText() + "\n");
}
if (otherIssueCheckbox3.isChecked()) {
bodyText.append(otherIssueCheckbox3.getText() + "\n");
}
if (otherIssueCheckbox4.isChecked()) {
bodyText.append(otherIssueCheckbox4.getText() + "\n");
}
if (otherIssueCheckbox5.isChecked()) {
bodyText.append(otherIssueCheckbox5.getText() + "\n");
}
AppCompatRadioButton checkedRadioButton =
findViewById(otherIssuesRadioGroup.getCheckedRadioButtonId());
bodyText.append(checkedRadioButton.getText() + "\n");
bodyText.append("\n\nPlatform\n")
.append("Android"
+ "\n");
@@ -35,69 +35,70 @@
android:paddingEnd="32dp"
android:textSize="16sp"
android:drawablePadding="32dp"
app:drawableEndCompat="@drawable/ic_toggle_down"
app:drawableEndCompat="@drawable/ic_toggle_up"
android:text="@string/other_issues"/>
<LinearLayout
android:id="@+id/other_issues_layout"
<RadioGroup
android:id="@+id/other_issues_radiogroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:visibility="gone"
android:orientation="vertical">
android:orientation="vertical"
android:visibility="visible">
<android.widget.CheckBox
android:id="@+id/other_issue_checkbox_1"
<androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/other_issue_radiobutton_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layoutDirection="rtl"
android:padding="16dp"
android:text="@string/cannot_connect_to_vpn"
android:layoutDirection="rtl"
android:layout_marginStart="24dp"
android:padding="16dp"
android:textSize="16sp"/>
android:textSize="16sp" />
<android.widget.CheckBox
android:id="@+id/other_issue_checkbox_2"
<androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/other_issue_radiobutton_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layoutDirection="rtl"
android:padding="16dp"
android:text="@string/no_internet"
android:layoutDirection="rtl"
android:layout_marginStart="24dp"
android:padding="16dp"
android:textSize="16sp"/>
android:textSize="16sp" />
<android.widget.CheckBox
android:id="@+id/other_issue_checkbox_3"
<androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/other_issue_radiobutton_3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layoutDirection="rtl"
android:padding="16dp"
android:text="@string/slow_connection"
android:layoutDirection="rtl"
android:layout_marginStart="24dp"
android:padding="16dp"
android:textSize="16sp"/>
android:textSize="16sp" />
<android.widget.CheckBox
android:id="@+id/other_issue_checkbox_4"
<androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/other_issue_radiobutton_4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layoutDirection="rtl"
android:padding="16dp"
android:text="@string/website_doesnt_work"
android:layoutDirection="rtl"
android:layout_marginStart="24dp"
android:padding="16dp"
android:textSize="16sp"/>
android:textSize="16sp" />
<android.widget.CheckBox
android:id="@+id/other_issue_checkbox_5"
<androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/other_issue_radiobutton_5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/other"
android:layoutDirection="rtl"
android:layout_marginStart="24dp"
android:layoutDirection="rtl"
android:padding="16dp"
android:textSize="16sp"/>
android:text="@string/other"
android:textSize="16sp" />
</RadioGroup>
</LinearLayout>
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/vpn_hostname_switch"
@@ -178,7 +179,8 @@
android:layout_marginEnd="16dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:background="@drawable/orange_rounded_button"
android:background="@drawable/set_default_rounded_button_disabled"
android:enabled="false"
android:text="@string/continue_to_email"
android:textAllCaps="false"
android:textColor="@android:color/white"