diff options
Diffstat (limited to 'app')
32 files changed, 303 insertions, 0 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java b/app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java new file mode 100644 index 00000000..90e3c5a1 --- /dev/null +++ b/app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java @@ -0,0 +1,76 @@ +package se.leap.bitmaskclient.fragments; + +import android.app.Dialog; +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.v7.app.AlertDialog; +import android.support.v7.app.AppCompatDialogFragment; +import android.support.v7.widget.AppCompatTextView; +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.utils.PreferenceHelper.saveShowAlwaysOnDialog; + + +/** + * Created by cyberta on 25.02.18. + */ + + + +public class TetheringDialog extends AppCompatDialogFragment { + + public final static String TAG = TetheringDialog.class.getName(); + + @InjectView(R.id.do_not_show_again) + CheckBox doNotShowAgainCheckBox; + + @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); + } + + @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)); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + blockVpnUserMessage.setVisibility(View.VISIBLE); + } + + 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(); + } +} diff --git a/app/src/main/java/se/leap/bitmaskclient/views/IconCheckboxEntry.java b/app/src/main/java/se/leap/bitmaskclient/views/IconCheckboxEntry.java new file mode 100644 index 00000000..cd151885 --- /dev/null +++ b/app/src/main/java/se/leap/bitmaskclient/views/IconCheckboxEntry.java @@ -0,0 +1,106 @@ +package se.leap.bitmaskclient.views; + +import android.annotation.TargetApi; +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.drawable.Drawable; +import android.support.annotation.ColorRes; +import android.support.annotation.DrawableRes; +import android.support.annotation.Nullable; +import android.support.annotation.StringRes; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import se.leap.bitmaskclient.R; + + +public class IconTextEntry extends LinearLayout { + + private TextView textView; + private ImageView iconView; + private TextView subtitleView; + + public IconTextEntry(Context context) { + super(context); + initLayout(context, null); + } + + public IconTextEntry(Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + initLayout(context, attrs); + } + + public IconTextEntry(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + initLayout(context, attrs); + } + + @TargetApi(21) + public IconTextEntry(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + initLayout(context, attrs); + } + + void initLayout(Context context, AttributeSet attrs) { + LayoutInflater inflater = (LayoutInflater) context + .getSystemService(Context.LAYOUT_INFLATER_SERVICE); + View rootview = inflater.inflate(R.layout.v_icon_text_list_item, this, true); + textView = rootview.findViewById(android.R.id.text1); + subtitleView = rootview.findViewById(R.id.subtitle); + iconView = rootview.findViewById(R.id.material_icon); + + if (attrs != null) { + TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.IconTextEntry); + + String entryText = typedArray.getString(R.styleable.IconTextEntry_text); + if (entryText != null) { + textView.setText(entryText); + } + + String subtitle = typedArray.getString(R.styleable.IconTextEntry_subtitle); + if (subtitle != null) { + subtitleView.setText(subtitle); + subtitleView.setVisibility(VISIBLE); + } + + Drawable drawable = typedArray.getDrawable(R.styleable.IconTextEntry_icon); + if (drawable != null) { + iconView.setImageDrawable(drawable); + } + + typedArray.recycle(); + } + + + } + + public void setText(@StringRes int id) { + textView.setText(id); + } + + public void setSubtitle(String text) { + subtitleView.setText(text); + subtitleView.setVisibility(VISIBLE); + } + + public void hideSubtitle() { + subtitleView.setVisibility(GONE); + } + + public void setSubtitleColor(@ColorRes int color) { + subtitleView.setTextColor(getContext().getResources().getColor(color)); + } + + public void setText(CharSequence text) { + textView.setText(text); + } + + public void setIcon(@DrawableRes int id) { + iconView.setImageResource(id); + } + +} diff --git a/app/src/main/res/drawable-hdpi/ic_access_point_36.png b/app/src/main/res/drawable-hdpi/ic_access_point_36.png Binary files differnew file mode 100644 index 00000000..03444d0f --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_access_point_36.png diff --git a/app/src/main/res/drawable-hdpi/ic_bluetooth.png b/app/src/main/res/drawable-hdpi/ic_bluetooth.png Binary files differnew file mode 100644 index 00000000..e7c1589b --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_bluetooth.png diff --git a/app/src/main/res/drawable-hdpi/ic_check_bold.png b/app/src/main/res/drawable-hdpi/ic_check_bold.png Binary files differnew file mode 100644 index 00000000..28418346 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_check_bold.png diff --git a/app/src/main/res/drawable-hdpi/ic_usb.png b/app/src/main/res/drawable-hdpi/ic_usb.png Binary files differnew file mode 100644 index 00000000..b9de586f --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_usb.png diff --git a/app/src/main/res/drawable-hdpi/ic_wifi.png b/app/src/main/res/drawable-hdpi/ic_wifi.png Binary files differnew file mode 100644 index 00000000..ca6b94a3 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_wifi.png diff --git a/app/src/main/res/drawable-ldpi/ic_bluetooth.png b/app/src/main/res/drawable-ldpi/ic_bluetooth.png Binary files differnew file mode 100644 index 00000000..3a73c82f --- /dev/null +++ b/app/src/main/res/drawable-ldpi/ic_bluetooth.png diff --git a/app/src/main/res/drawable-ldpi/ic_check_bold.png b/app/src/main/res/drawable-ldpi/ic_check_bold.png Binary files differnew file mode 100644 index 00000000..4f765ed4 --- /dev/null +++ b/app/src/main/res/drawable-ldpi/ic_check_bold.png diff --git a/app/src/main/res/drawable-ldpi/ic_usb.png b/app/src/main/res/drawable-ldpi/ic_usb.png Binary files differnew file mode 100644 index 00000000..d48d2f50 --- /dev/null +++ b/app/src/main/res/drawable-ldpi/ic_usb.png diff --git a/app/src/main/res/drawable-ldpi/ic_wifi.png b/app/src/main/res/drawable-ldpi/ic_wifi.png Binary files differnew file mode 100644 index 00000000..56ad6403 --- /dev/null +++ b/app/src/main/res/drawable-ldpi/ic_wifi.png diff --git a/app/src/main/res/drawable-mdpi/ic_access_point_36.png b/app/src/main/res/drawable-mdpi/ic_access_point_36.png Binary files differnew file mode 100644 index 00000000..c461a0a5 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/ic_access_point_36.png diff --git a/app/src/main/res/drawable-mdpi/ic_bluetooth.png b/app/src/main/res/drawable-mdpi/ic_bluetooth.png Binary files differnew file mode 100644 index 00000000..a1cecd2b --- /dev/null +++ b/app/src/main/res/drawable-mdpi/ic_bluetooth.png diff --git a/app/src/main/res/drawable-mdpi/ic_check_bold.png b/app/src/main/res/drawable-mdpi/ic_check_bold.png Binary files differnew file mode 100644 index 00000000..872ef957 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/ic_check_bold.png diff --git a/app/src/main/res/drawable-mdpi/ic_usb.png b/app/src/main/res/drawable-mdpi/ic_usb.png Binary files differnew file mode 100644 index 00000000..3ad5ebc1 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/ic_usb.png diff --git a/app/src/main/res/drawable-mdpi/ic_wifi.png b/app/src/main/res/drawable-mdpi/ic_wifi.png Binary files differnew file mode 100644 index 00000000..21a69023 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/ic_wifi.png diff --git a/app/src/main/res/drawable-xhdpi/ic_access_point_36.png b/app/src/main/res/drawable-xhdpi/ic_access_point_36.png Binary files differnew file mode 100644 index 00000000..4ae3d1d9 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/ic_access_point_36.png diff --git a/app/src/main/res/drawable-xhdpi/ic_bluetooth.png b/app/src/main/res/drawable-xhdpi/ic_bluetooth.png Binary files differnew file mode 100644 index 00000000..32a854e5 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/ic_bluetooth.png diff --git a/app/src/main/res/drawable-xhdpi/ic_check_bold.png b/app/src/main/res/drawable-xhdpi/ic_check_bold.png Binary files differnew file mode 100644 index 00000000..da6a1ecb --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/ic_check_bold.png diff --git a/app/src/main/res/drawable-xhdpi/ic_usb.png b/app/src/main/res/drawable-xhdpi/ic_usb.png Binary files differnew file mode 100644 index 00000000..c11940b1 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/ic_usb.png diff --git a/app/src/main/res/drawable-xhdpi/ic_wifi.png b/app/src/main/res/drawable-xhdpi/ic_wifi.png Binary files differnew file mode 100644 index 00000000..cf1bb909 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/ic_wifi.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_bluetooth.png b/app/src/main/res/drawable-xxhdpi/ic_bluetooth.png Binary files differnew file mode 100644 index 00000000..9c30e5b4 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/ic_bluetooth.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_check_bold.png b/app/src/main/res/drawable-xxhdpi/ic_check_bold.png Binary files differnew file mode 100644 index 00000000..f6b50706 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/ic_check_bold.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_usb.png b/app/src/main/res/drawable-xxhdpi/ic_usb.png Binary files differnew file mode 100644 index 00000000..c78e33af --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/ic_usb.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_wifi.png b/app/src/main/res/drawable-xxhdpi/ic_wifi.png Binary files differnew file mode 100644 index 00000000..ea9e08a9 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/ic_wifi.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_access_point_36.png b/app/src/main/res/drawable-xxxhdpi/ic_access_point_36.png Binary files differnew file mode 100644 index 00000000..4a2f25c1 --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/ic_access_point_36.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_bluetooth.png b/app/src/main/res/drawable-xxxhdpi/ic_bluetooth.png Binary files differnew file mode 100644 index 00000000..6eccbbd6 --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/ic_bluetooth.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_check_bold.png b/app/src/main/res/drawable-xxxhdpi/ic_check_bold.png Binary files differnew file mode 100644 index 00000000..19029a0d --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/ic_check_bold.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_usb.png b/app/src/main/res/drawable-xxxhdpi/ic_usb.png Binary files differnew file mode 100644 index 00000000..4bebd840 --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/ic_usb.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_wifi.png b/app/src/main/res/drawable-xxxhdpi/ic_wifi.png Binary files differnew file mode 100644 index 00000000..b5a05f7a --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/ic_wifi.png diff --git a/app/src/main/res/layout/d_list_selection.xml b/app/src/main/res/layout/d_list_selection.xml new file mode 100644 index 00000000..a9a84c0e --- /dev/null +++ b/app/src/main/res/layout/d_list_selection.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="utf-8"?> +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + 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> +</ScrollView>
\ No newline at end of file diff --git a/app/src/main/res/layout/v_icon_select_text_list_item.xml b/app/src/main/res/layout/v_icon_select_text_list_item.xml new file mode 100644 index 00000000..64cc474a --- /dev/null +++ b/app/src/main/res/layout/v_icon_select_text_list_item.xml @@ -0,0 +1,58 @@ +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/item_container" + android:layout_height="?android:attr/listPreferredItemHeightSmall" + android:layout_width="match_parent" + android:orientation="horizontal" + xmlns:tools="http://schemas.android.com/tools"> + + <ImageView + android:id="@+id/material_icon" + android:layout_width="?android:attr/listPreferredItemHeightSmall" + android:layout_height="?android:attr/listPreferredItemHeightSmall" + android:layout_gravity="center" + android:paddingStart="?android:attr/listPreferredItemPaddingStart" + android:paddingLeft="?android:attr/listPreferredItemPaddingLeft" + tools:src="@drawable/ic_add_circle_outline_grey600_24dp" + /> + <TextView + android:id="@android:id/text1" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textAppearance="?android:attr/textAppearanceListItemSmall" + android:gravity="center_vertical" + android:paddingStart="?android:attr/listPreferredItemPaddingStart" + android:paddingLeft="?android:attr/listPreferredItemPaddingLeft" + android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" + android:paddingRight="?android:attr/listPreferredItemPaddingRight" + android:minHeight="?android:attr/listPreferredItemHeightSmall" + tools:text="TEST" + android:layout_toEndOf="@id/material_icon" + android:layout_toRightOf="@+id/material_icon" + android:layout_above="@+id/subtitle" + /> + + <TextView + android:id="@+id/subtitle" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:layout_alignParentBottom="true" + android:textAppearance="?android:attr/textAppearanceSmall" + android:paddingStart="?android:attr/listPreferredItemPaddingStart" + android:paddingLeft="?android:attr/listPreferredItemPaddingLeft" + android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" + android:paddingRight="?android:attr/listPreferredItemPaddingRight" + android:paddingBottom="4dp" + tools:text="TEST" + android:visibility="gone" + android:layout_toEndOf="@id/material_icon" + android:layout_toRightOf="@+id/material_icon" + /> + + <View + android:layout_width="match_parent" + android:layout_height="1px" + android:background="@android:color/darker_gray" + android:layout_alignParentBottom="true" + /> +</RelativeLayout> |