diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java | 34 | ||||
-rw-r--r-- | app/src/main/res/layout/d_checkbox_confirm.xml | 136 |
2 files changed, 66 insertions, 104 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java b/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java index 34ad971e..09817b78 100644 --- a/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java +++ b/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java @@ -1,31 +1,24 @@ package se.leap.bitmaskclient.fragments; import android.app.Dialog; -import android.content.Context; -import android.content.DialogInterface; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; -import android.support.v4.text.TextUtilsCompat; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatDialogFragment; import android.support.v7.widget.AppCompatTextView; -import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; -import android.widget.Button; import android.widget.CheckBox; import butterknife.ButterKnife; import butterknife.InjectView; -import butterknife.OnClick; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.views.IconTextView; import static se.leap.bitmaskclient.utils.PreferenceHelper.saveShowAlwaysOnDialog; -import static se.leap.bitmaskclient.utils.ViewHelper.convertDimensionToPx; /** @@ -68,23 +61,16 @@ public class AlwaysOnDialog extends AppCompatDialogFragment { blockVpnUserMessage.setVisibility(View.VISIBLE); } - builder.setView(view); + builder.setView(view) + .setPositiveButton(android.R.string.ok, (dialog, id) -> { + if (doNotShowAgainCheckBox.isChecked()) { + saveShowAlwaysOnDialog(getContext(), false); + } + Intent intent = new Intent("android.net.vpn.SETTINGS"); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + }) + .setNegativeButton(R.string.cancel, (dialog, id) -> dialog.cancel()); return builder.create(); } - - @OnClick(R.id.button_ok) - public void onOkClicked() { - if (doNotShowAgainCheckBox.isChecked()) { - saveShowAlwaysOnDialog(getContext(), false); - } - Intent intent = new Intent("android.net.vpn.SETTINGS"); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(intent); - dismiss(); - } - - @OnClick(R.id.button_cancel) - public void onCancelClicked() { - dismiss(); - } } diff --git a/app/src/main/res/layout/d_checkbox_confirm.xml b/app/src/main/res/layout/d_checkbox_confirm.xml index 5a7f3508..a9a84c0e 100644 --- a/app/src/main/res/layout/d_checkbox_confirm.xml +++ b/app/src/main/res/layout/d_checkbox_confirm.xml @@ -1,87 +1,63 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:orientation="vertical"> - - <android.support.v7.widget.AppCompatTextView - android:id="@+id/tvTitle" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/standard_margin" - android:layout_marginTop="@dimen/add_button_margin" - android:gravity="center" - android:text="@string/always_on_vpn" - android:textAllCaps="true" - android:textColor="@color/colorPrimary" - android:textSize="28sp" - android:textStyle="bold" /> - - <se.leap.bitmaskclient.views.IconTextView - android:id="@+id/user_message" - android:textAppearance="@style/TextAppearance.AppCompat.Small" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/activity_horizontal_margin" - android:layout_marginRight="@dimen/activity_horizontal_margin" - android:layout_marginBottom="0dp" - android:autoLink="web" - tools:text="@string/always_on_vpn_user_message" - /> - - <android.support.v7.widget.AppCompatTextView - android:id="@+id/block_vpn_user_message" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:textAppearance="@style/TextAppearance.AppCompat.Small" - android:layout_marginLeft="@dimen/activity_horizontal_margin" - android:layout_marginRight="@dimen/activity_horizontal_margin" - android:layout_marginTop="@dimen/standard_margin" - android:layout_marginBottom="@dimen/standard_margin" - android:text="@string/always_on_blocking_vpn_user_message" - android:visibility="gone" - tools:visibility="visible" - /> +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content"> - <CheckBox - android:id="@+id/do_not_show_again" - android:textAppearance="@style/TextAppearance.AppCompat.Small" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_margin="@dimen/stdpadding" - android:text="@string/do_not_show_again" /> - - <LinearLayout - android:orientation="horizontal" + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:gravity="end" - android:layout_gravity="end" android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/activity_horizontal_margin" - android:layout_marginRight="@dimen/activity_horizontal_margin" - android:layout_marginLeft="@dimen/activity_horizontal_margin" - > - <android.support.v7.widget.AppCompatButton - android:id="@+id/button_cancel" - android:layout_width="100dp" - android:layout_height="38dp" - android:layout_marginRight="@dimen/standard_margin" - android:background="@drawable/cust_button_secondary" - android:text="@android:string/cancel" - android:textColor="@android:color/tab_indicator_text" - android:textStyle="bold" /> - <android.support.v7.widget.AppCompatButton - android:id="@+id/button_ok" - android:layout_width="100dp" - android:layout_height="38dp" - android:background="@drawable/cust_button_primary" - android:text="@android:string/ok" - android:textColor="@color/white" - android:textStyle="bold" /> + xmlns:tools="http://schemas.android.com/tools" + android:orientation="vertical"> + + <android.support.v7.widget.AppCompatTextView + android:id="@+id/tvTitle" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/standard_margin" + android:layout_marginTop="@dimen/add_button_margin" + android:layout_marginLeft="@dimen/activity_horizontal_margin" + android:layout_marginRight="@dimen/activity_horizontal_margin" + android:text="@string/always_on_vpn" + android:textAllCaps="true" + android:textAppearance="@style/TextAppearance.AppCompat.Title" + android:textStyle="bold" + /> + + <se.leap.bitmaskclient.views.IconTextView + android:id="@+id/user_message" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="@dimen/activity_horizontal_margin" + android:layout_marginRight="@dimen/activity_horizontal_margin" + android:layout_marginBottom="0dp" + android:autoLink="web" + tools:text="@string/always_on_vpn_user_message" + android:textSize="17sp" + /> + + <android.support.v7.widget.AppCompatTextView + android:id="@+id/block_vpn_user_message" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="@dimen/activity_horizontal_margin" + android:layout_marginRight="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/standard_margin" + android:layout_marginBottom="@dimen/standard_margin" + android:text="@string/always_on_blocking_vpn_user_message" + android:visibility="gone" + tools:visibility="visible" + android:textSize="17sp" + /> + + + <CheckBox + android:id="@+id/do_not_show_again" + android:textAppearance="@style/TextAppearance.AppCompat" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="@dimen/stdpadding" + android:text="@string/do_not_show_again" /> </LinearLayout> - -</LinearLayout>
\ No newline at end of file +</ScrollView>
\ No newline at end of file |