Commit 2b649dbc authored by cyberta's avatar cyberta
Browse files

add blocking vpn info in corresponding alert dialog, use similar layout as for donation dialog

parent 65a09aa7
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;
/**
......@@ -36,6 +44,10 @@ public class AlwaysOnDialog extends AppCompatDialogFragment {
@InjectView(R.id.user_message)
IconTextView userMessage;
@InjectView(R.id.block_vpn_user_message)
AppCompatTextView blockVpnUserMessage;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -51,22 +63,28 @@ public class AlwaysOnDialog extends AppCompatDialogFragment {
userMessage.setIcon(R.drawable.ic_settings);
userMessage.setText(getString(R.string.always_on_vpn_user_message));
builder.setView(view)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int 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, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
blockVpnUserMessage.setVisibility(View.VISIBLE);
}
builder.setView(view);
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();
}
}
......@@ -4,16 +4,16 @@
<shape android:shape="rectangle" >
<corners android:radius="50dp" />
<padding android:left="8dp" android:right="8dp"/>
<solid android:color="@android:color/transparent"/>
<stroke android:width="2dp" android:color="@color/colorPrimary"/>
<solid android:color="#20000000"/>
<stroke android:width="2dp" android:color="@color/colorPrimaryDark"/>
</shape>
</item>
<item android:state_focused="true">
<shape android:shape="rectangle" >
<corners android:radius="50dp" />
<padding android:left="8dp" android:right="8dp"/>
<solid android:color="@android:color/transparent"/>
<stroke android:width="2dp" android:color="@color/colorPrimary"/>
<solid android:color="#20000000"/>
<stroke android:width="2dp" android:color="@color/colorPrimaryDark"/>
</shape>
</item>
<item >
......
......@@ -2,23 +2,86 @@
<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_margin="@dimen/activity_horizontal_margin"
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"
/>
<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"
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" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -113,6 +113,7 @@
<string name="always_on_vpn">VPN immer anlassen</string>
<string name="do_not_show_again">Nicht erneut anzeigen</string>
<string name="always_on_vpn_user_message">Um durchgehend aktives VPN in den Android VPN Einstellungen einzuschalten, klicke auf das Zahnrad [img src] und aktiviere den Schalter.</string>
<string name="always_on_blocking_vpn_user_message">Aktiviere zusätzlich die Option \"Verbindungen nur über VPN zulassen\", um deine Privatsphäre optimal zu schützen.</string>
<string name="donate_title">Spenden</string>
<string name="donate_default_message">Spende noch heute, wenn du sichere Kommunikation wertschätzt, die sowohl für Endnutzer*innen als auch Menschen die den Service bereit stellen leicht nutzbar ist.</string>
<string name="donate_message">LEAP benötigt Spenden und Stipendien. Spende noch heute wenn du sichere Kommunikation wertschätzt, die sowohl für Enandwender*innen als auch Menschen die den Dienst anbieten leicht nutzbar ist.</string>
......
......@@ -104,6 +104,7 @@
<string name="always_on_vpn">Always-on VPN</string>
<string name="do_not_show_again">Do not show again</string>
<string name="always_on_vpn_user_message">To enable always-on VPN in Android VPN Settings click on the configure icon [img src] and turn the switch on.</string>
<string name="always_on_blocking_vpn_user_message">To protect your privacy optimally, you should also activate the option \"Allow connections only via VPN\".</string>
<string name="donate_title">Donate</string>
<string name="donate_default_message">Please donate today if you value secure communication that is easy for both the end-user and the service provider.</string>
<string name="donate_message">LEAP depends on donations and grants. Please donate today if you value secure communication that is easy for both the end-user and the service provider.</string>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment