summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/fragments
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/fragments')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/fragments/AboutFragment.java3
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java71
2 files changed, 72 insertions, 2 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/AboutFragment.java b/app/src/main/java/se/leap/bitmaskclient/fragments/AboutFragment.java
index 113ce397..2f37f5b0 100644
--- a/app/src/main/java/se/leap/bitmaskclient/fragments/AboutFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/fragments/AboutFragment.java
@@ -3,7 +3,6 @@ package se.leap.bitmaskclient.fragments;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
-import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
@@ -24,7 +23,7 @@ public class AboutFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- View view = inflater.inflate(R.layout.about, container, false);
+ View view = inflater.inflate(R.layout.f_about, container, false);
ButterKnife.inject(this, view);
return view;
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java b/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java
new file mode 100644
index 00000000..3558f378
--- /dev/null
+++ b/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java
@@ -0,0 +1,71 @@
+package se.leap.bitmaskclient.fragments;
+
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.support.v7.app.AlertDialog;
+import android.support.v7.app.AppCompatDialogFragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.CheckBox;
+
+import butterknife.ButterKnife;
+import butterknife.InjectView;
+import se.leap.bitmaskclient.R;
+import se.leap.bitmaskclient.views.IconTextView;
+
+import static se.leap.bitmaskclient.ConfigHelper.saveShowAlwaysOnDialog;
+
+/**
+ * Created by cyberta on 25.02.18.
+ */
+
+
+
+public class AlwaysOnDialog extends AppCompatDialogFragment {
+
+ public final static String TAG = AlwaysOnDialog.class.getName();
+
+ @InjectView(R.id.do_not_show_again)
+ CheckBox doNotShowAgainCheckBox;
+
+ @InjectView(R.id.user_message)
+ IconTextView userMessage;
+
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+
+ @NonNull
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+ LayoutInflater inflater = getActivity().getLayoutInflater();
+ View view = inflater.inflate(R.layout.d_checkbox_confirm, null);
+ ButterKnife.inject(this, view);
+
+ 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();
+ }
+ });
+ return builder.create();
+ }
+}