From 0157b7b54f864258ae437c3566fe2cb74f0da61e Mon Sep 17 00:00:00 2001 From: cyBerta Date: Wed, 1 Jan 2020 21:24:50 +0100 Subject: add new icons for tethering --- .../bitmaskclient/fragments/TetheringDialog.java | 76 +++++++++++++++ .../bitmaskclient/views/IconCheckboxEntry.java | 106 +++++++++++++++++++++ .../main/res/drawable-hdpi/ic_access_point_36.png | Bin 0 -> 2246 bytes app/src/main/res/drawable-hdpi/ic_bluetooth.png | Bin 0 -> 1043 bytes app/src/main/res/drawable-hdpi/ic_check_bold.png | Bin 0 -> 808 bytes app/src/main/res/drawable-hdpi/ic_usb.png | Bin 0 -> 1000 bytes app/src/main/res/drawable-hdpi/ic_wifi.png | Bin 0 -> 1496 bytes app/src/main/res/drawable-ldpi/ic_bluetooth.png | Bin 0 -> 797 bytes app/src/main/res/drawable-ldpi/ic_check_bold.png | Bin 0 -> 652 bytes app/src/main/res/drawable-ldpi/ic_usb.png | Bin 0 -> 644 bytes app/src/main/res/drawable-ldpi/ic_wifi.png | Bin 0 -> 881 bytes .../main/res/drawable-mdpi/ic_access_point_36.png | Bin 0 -> 1301 bytes app/src/main/res/drawable-mdpi/ic_bluetooth.png | Bin 0 -> 980 bytes app/src/main/res/drawable-mdpi/ic_check_bold.png | Bin 0 -> 725 bytes app/src/main/res/drawable-mdpi/ic_usb.png | Bin 0 -> 859 bytes app/src/main/res/drawable-mdpi/ic_wifi.png | Bin 0 -> 1123 bytes .../main/res/drawable-xhdpi/ic_access_point_36.png | Bin 0 -> 2878 bytes app/src/main/res/drawable-xhdpi/ic_bluetooth.png | Bin 0 -> 1300 bytes app/src/main/res/drawable-xhdpi/ic_check_bold.png | Bin 0 -> 900 bytes app/src/main/res/drawable-xhdpi/ic_usb.png | Bin 0 -> 1397 bytes app/src/main/res/drawable-xhdpi/ic_wifi.png | Bin 0 -> 1894 bytes app/src/main/res/drawable-xxhdpi/ic_bluetooth.png | Bin 0 -> 1805 bytes app/src/main/res/drawable-xxhdpi/ic_check_bold.png | Bin 0 -> 1212 bytes app/src/main/res/drawable-xxhdpi/ic_usb.png | Bin 0 -> 1707 bytes app/src/main/res/drawable-xxhdpi/ic_wifi.png | Bin 0 -> 2639 bytes .../res/drawable-xxxhdpi/ic_access_point_36.png | Bin 0 -> 5906 bytes app/src/main/res/drawable-xxxhdpi/ic_bluetooth.png | Bin 0 -> 2138 bytes .../main/res/drawable-xxxhdpi/ic_check_bold.png | Bin 0 -> 1494 bytes app/src/main/res/drawable-xxxhdpi/ic_usb.png | Bin 0 -> 2359 bytes app/src/main/res/drawable-xxxhdpi/ic_wifi.png | Bin 0 -> 3399 bytes app/src/main/res/layout/d_list_selection.xml | 63 ++++++++++++ .../res/layout/v_icon_select_text_list_item.xml | 58 +++++++++++ 32 files changed, 303 insertions(+) create mode 100644 app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java create mode 100644 app/src/main/java/se/leap/bitmaskclient/views/IconCheckboxEntry.java create mode 100644 app/src/main/res/drawable-hdpi/ic_access_point_36.png create mode 100644 app/src/main/res/drawable-hdpi/ic_bluetooth.png create mode 100644 app/src/main/res/drawable-hdpi/ic_check_bold.png create mode 100644 app/src/main/res/drawable-hdpi/ic_usb.png create mode 100644 app/src/main/res/drawable-hdpi/ic_wifi.png create mode 100644 app/src/main/res/drawable-ldpi/ic_bluetooth.png create mode 100644 app/src/main/res/drawable-ldpi/ic_check_bold.png create mode 100644 app/src/main/res/drawable-ldpi/ic_usb.png create mode 100644 app/src/main/res/drawable-ldpi/ic_wifi.png create mode 100644 app/src/main/res/drawable-mdpi/ic_access_point_36.png create mode 100644 app/src/main/res/drawable-mdpi/ic_bluetooth.png create mode 100644 app/src/main/res/drawable-mdpi/ic_check_bold.png create mode 100644 app/src/main/res/drawable-mdpi/ic_usb.png create mode 100644 app/src/main/res/drawable-mdpi/ic_wifi.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_access_point_36.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_bluetooth.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_check_bold.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_usb.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_wifi.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_bluetooth.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_check_bold.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_usb.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_wifi.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_access_point_36.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_bluetooth.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_check_bold.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_usb.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_wifi.png create mode 100644 app/src/main/res/layout/d_list_selection.xml create mode 100644 app/src/main/res/layout/v_icon_select_text_list_item.xml 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 new file mode 100644 index 00000000..03444d0f Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_access_point_36.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_bluetooth.png b/app/src/main/res/drawable-hdpi/ic_bluetooth.png new file mode 100644 index 00000000..e7c1589b Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_bluetooth.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_check_bold.png b/app/src/main/res/drawable-hdpi/ic_check_bold.png new file mode 100644 index 00000000..28418346 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_check_bold.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_usb.png b/app/src/main/res/drawable-hdpi/ic_usb.png new file mode 100644 index 00000000..b9de586f Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_usb.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_wifi.png b/app/src/main/res/drawable-hdpi/ic_wifi.png new file mode 100644 index 00000000..ca6b94a3 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_wifi.png differ diff --git a/app/src/main/res/drawable-ldpi/ic_bluetooth.png b/app/src/main/res/drawable-ldpi/ic_bluetooth.png new file mode 100644 index 00000000..3a73c82f Binary files /dev/null and b/app/src/main/res/drawable-ldpi/ic_bluetooth.png differ diff --git a/app/src/main/res/drawable-ldpi/ic_check_bold.png b/app/src/main/res/drawable-ldpi/ic_check_bold.png new file mode 100644 index 00000000..4f765ed4 Binary files /dev/null and b/app/src/main/res/drawable-ldpi/ic_check_bold.png differ diff --git a/app/src/main/res/drawable-ldpi/ic_usb.png b/app/src/main/res/drawable-ldpi/ic_usb.png new file mode 100644 index 00000000..d48d2f50 Binary files /dev/null and b/app/src/main/res/drawable-ldpi/ic_usb.png differ diff --git a/app/src/main/res/drawable-ldpi/ic_wifi.png b/app/src/main/res/drawable-ldpi/ic_wifi.png new file mode 100644 index 00000000..56ad6403 Binary files /dev/null and b/app/src/main/res/drawable-ldpi/ic_wifi.png differ 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 new file mode 100644 index 00000000..c461a0a5 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_access_point_36.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_bluetooth.png b/app/src/main/res/drawable-mdpi/ic_bluetooth.png new file mode 100644 index 00000000..a1cecd2b Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_bluetooth.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_check_bold.png b/app/src/main/res/drawable-mdpi/ic_check_bold.png new file mode 100644 index 00000000..872ef957 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_check_bold.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_usb.png b/app/src/main/res/drawable-mdpi/ic_usb.png new file mode 100644 index 00000000..3ad5ebc1 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_usb.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_wifi.png b/app/src/main/res/drawable-mdpi/ic_wifi.png new file mode 100644 index 00000000..21a69023 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_wifi.png differ 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 new file mode 100644 index 00000000..4ae3d1d9 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_access_point_36.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_bluetooth.png b/app/src/main/res/drawable-xhdpi/ic_bluetooth.png new file mode 100644 index 00000000..32a854e5 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_bluetooth.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_check_bold.png b/app/src/main/res/drawable-xhdpi/ic_check_bold.png new file mode 100644 index 00000000..da6a1ecb Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_check_bold.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_usb.png b/app/src/main/res/drawable-xhdpi/ic_usb.png new file mode 100644 index 00000000..c11940b1 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_usb.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_wifi.png b/app/src/main/res/drawable-xhdpi/ic_wifi.png new file mode 100644 index 00000000..cf1bb909 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_wifi.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_bluetooth.png b/app/src/main/res/drawable-xxhdpi/ic_bluetooth.png new file mode 100644 index 00000000..9c30e5b4 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_bluetooth.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_check_bold.png b/app/src/main/res/drawable-xxhdpi/ic_check_bold.png new file mode 100644 index 00000000..f6b50706 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_check_bold.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_usb.png b/app/src/main/res/drawable-xxhdpi/ic_usb.png new file mode 100644 index 00000000..c78e33af Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_usb.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_wifi.png b/app/src/main/res/drawable-xxhdpi/ic_wifi.png new file mode 100644 index 00000000..ea9e08a9 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_wifi.png differ 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 new file mode 100644 index 00000000..4a2f25c1 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_access_point_36.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_bluetooth.png b/app/src/main/res/drawable-xxxhdpi/ic_bluetooth.png new file mode 100644 index 00000000..6eccbbd6 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_bluetooth.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_check_bold.png b/app/src/main/res/drawable-xxxhdpi/ic_check_bold.png new file mode 100644 index 00000000..19029a0d Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_check_bold.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_usb.png b/app/src/main/res/drawable-xxxhdpi/ic_usb.png new file mode 100644 index 00000000..4bebd840 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_usb.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_wifi.png b/app/src/main/res/drawable-xxxhdpi/ic_wifi.png new file mode 100644 index 00000000..b5a05f7a Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_wifi.png differ 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 @@ + + + + + + + + + + + + + + + + + \ 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 @@ + + + + + + + + + -- cgit v1.2.3