diff options
author | cyberta <cyberta@riseup.net> | 2018-08-17 04:51:32 -0700 |
---|---|---|
committer | cyberta <cyberta@riseup.net> | 2018-08-17 04:51:32 -0700 |
commit | 0616d90013cd3ecac6dc97d7f9aced381578fea1 (patch) | |
tree | 883d936edfd1cda9074172c4c6d2e3de5d954042 /app/src/main | |
parent | 7434a53d0c2545375ff9844a510c9fc8b09948f0 (diff) | |
parent | 49a2d6f3c7d4afbd645f524c3be60f0f0ac13311 (diff) |
Merge branch 'customisation_feature' into 'master'
Customisation Feature
See merge request leap/bitmask_android!78
Diffstat (limited to 'app/src/main')
27 files changed, 389 insertions, 99 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java index 51f787b7..a168059f 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java @@ -25,27 +25,21 @@ import android.content.ServiceConnection; import android.content.SharedPreferences; import android.graphics.ColorMatrix; import android.graphics.ColorMatrixColorFilter; -import android.net.Uri; import android.os.Bundle; import android.os.IBinder; import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import android.support.v4.app.DialogFragment; import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AlertDialog; import android.support.v7.widget.AppCompatImageView; import android.support.v7.widget.AppCompatTextView; -import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.time.temporal.ChronoUnit; -import java.util.Date; -import java.util.Locale; import java.util.Observable; import java.util.Observer; @@ -58,23 +52,17 @@ import de.blinkt.openvpn.core.OpenVPNService; import de.blinkt.openvpn.core.ProfileManager; import se.leap.bitmaskclient.eip.EipCommand; import se.leap.bitmaskclient.eip.EipStatus; -import se.leap.bitmaskclient.utils.DateHelper; +import se.leap.bitmaskclient.fragments.DonationReminderDialog; import se.leap.bitmaskclient.views.VpnStateImage; import static android.view.View.GONE; import static android.view.View.VISIBLE; import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_NONETWORK; -import static se.leap.bitmaskclient.Constants.DONATION_REMINDER_DURATION; import static se.leap.bitmaskclient.Constants.EIP_RESTART_ON_BOOT; -import static se.leap.bitmaskclient.Constants.FIRST_TIME_USER_DATE; import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; import static se.leap.bitmaskclient.Constants.REQUEST_CODE_LOG_IN; import static se.leap.bitmaskclient.Constants.REQUEST_CODE_SWITCH_PROVIDER; import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; -import static se.leap.bitmaskclient.Constants.DONATION_URL; -import static se.leap.bitmaskclient.Constants.ENABLE_DONATION; -import static se.leap.bitmaskclient.Constants.ENABLE_DONATION_REMINDER; -import static se.leap.bitmaskclient.Constants.LAST_DONATION_REMINDER_DATE; import static se.leap.bitmaskclient.ProviderAPI.UPDATE_INVALID_VPN_CERTIFICATE; import static se.leap.bitmaskclient.ProviderAPI.USER_MESSAGE; import static se.leap.bitmaskclient.R.string.vpn_certificate_user_message; @@ -85,7 +73,6 @@ public class EipFragment extends Fragment implements Observer { public static final String ASK_TO_CANCEL_VPN = "ask_to_cancel_vpn"; - private SharedPreferences preferences; private Provider provider; @@ -117,9 +104,6 @@ public class EipFragment extends Fragment implements Observer { private IOpenVPNServiceInternal mService; private ServiceConnection openVpnConnection; - private final String DATE_PATTERN = "dd/MM/yyyy"; - private final int ONE_DAY = 86400000; //1000*60*60*24 - @Override public void onAttach(Context context) { super.onAttach(context); @@ -172,8 +156,8 @@ public class EipFragment extends Fragment implements Observer { @Override public void onStart() { super.onStart(); - if (isDonationReminderCallable()) { - showDonationReminder(); + if (DonationReminderDialog.isCallable(getContext())) { + showDonationReminderDialog(); } } @@ -509,71 +493,16 @@ public class EipFragment extends Fragment implements Observer { } } - private void showDonationReminder() { - Activity activity = getActivity(); - if (activity == null) { - Log.e(TAG, "activity is null when triggering donation reminder"); - return; - } - String message = TextUtils.isEmpty(activity.getString(R.string.donate_message)) ? - activity.getString(R.string.donate_default_message) : activity.getString(R.string.donate_message); - AlertDialog.Builder alertBuilder = new AlertDialog.Builder(activity); - alertDialog = alertBuilder.setTitle(activity.getString(R.string.donate_title)) - .setMessage(message) - .setPositiveButton(R.string.donate_button_donate, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(DONATION_URL)); - startActivity(browserIntent); - } - }) - .setNegativeButton(R.string.donate_button_remind_later, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - } - }).setOnDismissListener(new DialogInterface.OnDismissListener() { - @Override - public void onDismiss(DialogInterface dialog) { - preferences.edit().putString(LAST_DONATION_REMINDER_DATE, - DateHelper.getCurrentDateString()).apply(); - } - }).show(); - } - - private boolean isDonationReminderCallable() { - if (!ENABLE_DONATION || !ENABLE_DONATION_REMINDER) { - return false; - } - - if (preferences == null) { - Log.e(TAG, "preferences is null!"); - return false; - } - - String firstTimeUserDate = preferences.getString(FIRST_TIME_USER_DATE, null); - if (firstTimeUserDate == null) { - preferences.edit().putString(FIRST_TIME_USER_DATE, DateHelper.getCurrentDateString()).apply(); - return false; - } - + public void showDonationReminderDialog() { try { - long diffDays; - - diffDays = DateHelper.getDateDiffToCurrentDateInDays(firstTimeUserDate); - if (diffDays < 1) { - return false; - } - - String lastDonationReminderDate = preferences.getString(LAST_DONATION_REMINDER_DATE, null); - if (lastDonationReminderDate == null) { - return true; - } - diffDays = DateHelper.getDateDiffToCurrentDateInDays(lastDonationReminderDate); - return diffDays >= DONATION_REMINDER_DURATION; - - } catch (ParseException e) { + FragmentTransaction fragmentTransaction = new FragmentManagerEnhanced( + getActivity().getSupportFragmentManager()).removePreviousFragment( + DonationReminderDialog.TAG); + DialogFragment newFragment = new DonationReminderDialog(); + newFragment.setCancelable(false); + newFragment.show(fragmentTransaction, DonationReminderDialog.TAG); + } catch (IllegalStateException | NullPointerException e) { e.printStackTrace(); - Log.e(TAG, e.getMessage()); - return false; } } - } diff --git a/app/src/main/java/se/leap/bitmaskclient/LoginActivity.java b/app/src/main/java/se/leap/bitmaskclient/LoginActivity.java index a407b0a9..00ede1a6 100644 --- a/app/src/main/java/se/leap/bitmaskclient/LoginActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/LoginActivity.java @@ -17,7 +17,7 @@ public class LoginActivity extends ProviderCredentialsBaseActivity { protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setProgressbarText(R.string.logging_in); - setProviderHeaderLogo(R.drawable.mask); + setProviderHeaderLogo(R.drawable.logo); setProviderHeaderText(R.string.login_to_profile); } diff --git a/app/src/main/java/se/leap/bitmaskclient/SignupActivity.java b/app/src/main/java/se/leap/bitmaskclient/SignupActivity.java index 0ff792bb..3eac711f 100644 --- a/app/src/main/java/se/leap/bitmaskclient/SignupActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/SignupActivity.java @@ -18,7 +18,7 @@ public class SignupActivity extends ProviderCredentialsBaseActivity { protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setProviderHeaderLogo(R.drawable.mask); + setProviderHeaderLogo(R.drawable.logo); setProviderHeaderText(R.string.create_profile); setProgressbarText(R.string.signing_up); diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/DonationReminderDialog.java b/app/src/main/java/se/leap/bitmaskclient/fragments/DonationReminderDialog.java new file mode 100644 index 00000000..001d7e6c --- /dev/null +++ b/app/src/main/java/se/leap/bitmaskclient/fragments/DonationReminderDialog.java @@ -0,0 +1,121 @@ +package se.leap.bitmaskclient.fragments; + +import android.app.Dialog; +import android.content.Context; +import android.content.Intent; +import android.net.Uri; +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.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.Button; + +import java.text.ParseException; + +import butterknife.ButterKnife; +import butterknife.InjectView; +import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.utils.DateHelper; +import se.leap.bitmaskclient.utils.PreferenceHelper; + +import static se.leap.bitmaskclient.Constants.DONATION_REMINDER_DURATION; +import static se.leap.bitmaskclient.Constants.DONATION_URL; +import static se.leap.bitmaskclient.Constants.ENABLE_DONATION; +import static se.leap.bitmaskclient.Constants.ENABLE_DONATION_REMINDER; +import static se.leap.bitmaskclient.Constants.FIRST_TIME_USER_DATE; +import static se.leap.bitmaskclient.Constants.LAST_DONATION_REMINDER_DATE; + +public class DonationReminderDialog extends AppCompatDialogFragment { + + public final static String TAG = DonationReminderDialog.class.getName(); + private static boolean isShown = false; + + @InjectView(R.id.btnDonate) + Button btnDonate; + + @InjectView(R.id.btnLater) + Button btnLater; + + @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.donation_reminder_dialog, null); + ButterKnife.inject(this, view); + isShown = true; + + builder.setView(view); + btnDonate.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(DONATION_URL)); + startActivity(browserIntent); + PreferenceHelper.putString(getContext(), LAST_DONATION_REMINDER_DATE, + DateHelper.getCurrentDateString()); + dismiss(); + } + }); + btnLater.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + PreferenceHelper.putString(getContext(), LAST_DONATION_REMINDER_DATE, + DateHelper.getCurrentDateString()); + dismiss(); + } + }); + + return builder.create(); + } + + public static boolean isCallable(Context context) { + if (isShown) { + return false; + } + + if (!ENABLE_DONATION || !ENABLE_DONATION_REMINDER) { + return false; + } + + if (context == null) { + Log.e(TAG, "context is null!"); + return false; + } + + String firstTimeUserDate = PreferenceHelper.getString(context, FIRST_TIME_USER_DATE, null); + if (firstTimeUserDate == null) { + PreferenceHelper.putString(context, FIRST_TIME_USER_DATE, DateHelper.getCurrentDateString()); + return false; + } + + try { + long diffDays; + + diffDays = DateHelper.getDateDiffToCurrentDateInDays(firstTimeUserDate); + if (diffDays < 1) { + return false; + } + + String lastDonationReminderDate = PreferenceHelper.getString(context, LAST_DONATION_REMINDER_DATE, null); + if (lastDonationReminderDate == null) { + return true; + } + diffDays = DateHelper.getDateDiffToCurrentDateInDays(lastDonationReminderDate); + return diffDays >= DONATION_REMINDER_DURATION; + + } catch (ParseException e) { + e.printStackTrace(); + Log.e(TAG, e.getMessage()); + return false; + } + } +} diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java b/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java index 12015dfb..b1da1284 100644 --- a/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java @@ -239,4 +239,13 @@ public class PreferenceHelper { return result; } + public static String getString(Context context, String key, String defValue) { + SharedPreferences preferences = context.getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE); + return preferences.getString(key, defValue); + } + + public static void putString(Context context, String key, String value){ + SharedPreferences preferences = context.getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE); + preferences.edit().putString(key, value).apply(); + } } diff --git a/app/src/main/res/drawable-ldpi/mask.png b/app/src/main/res/drawable-ldpi/logo.png Binary files differindex 4e22d99f..4e22d99f 100644 --- a/app/src/main/res/drawable-ldpi/mask.png +++ b/app/src/main/res/drawable-ldpi/logo.png diff --git a/app/src/main/res/drawable-mdpi/mask.png b/app/src/main/res/drawable-mdpi/logo.png Binary files differindex e53cb15c..e53cb15c 100644 --- a/app/src/main/res/drawable-mdpi/mask.png +++ b/app/src/main/res/drawable-mdpi/logo.png diff --git a/app/src/main/res/drawable-xxxhdpi/mask.png b/app/src/main/res/drawable-xxxhdpi/logo.png Binary files differindex 4297d90c..4297d90c 100644 --- a/app/src/main/res/drawable-xxxhdpi/mask.png +++ b/app/src/main/res/drawable-xxxhdpi/logo.png diff --git a/app/src/main/res/drawable/ic_colorsquare.xml b/app/src/main/res/drawable/background_drawer.xml index 4b60e9dc..4b60e9dc 100644 --- a/app/src/main/res/drawable/ic_colorsquare.xml +++ b/app/src/main/res/drawable/background_drawer.xml diff --git a/app/src/main/res/drawable/background_eip.xml b/app/src/main/res/drawable/background_eip.xml new file mode 100644 index 00000000..4b60e9dc --- /dev/null +++ b/app/src/main/res/drawable/background_eip.xml @@ -0,0 +1,52 @@ +<vector android:height="24dp" android:viewportHeight="100.0" + android:viewportWidth="100.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:pathData="M50,50m-82000,0a82000,82000 0,1 1,164000 0a82000,82000 0,1 1,-164000 0"/> + <path android:fillAlpha="1" android:fillColor="#e6ee9c" + android:pathData="M50,50 L30664.67,-73860.37A80000,80000 0,0 0,50 -79950Z" + android:strokeColor="#e6ee9c" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#fff59d" + android:pathData="m50,50 l56568.54,-56568.54a80000,80000 0,0 0,-25953.87 -17341.82z" + android:strokeColor="#fff59d" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#ffe082" + android:pathData="m50,50 l73910.37,-30614.67a80000,80000 0,0 0,-17341.82 -25953.87z" + android:strokeColor="#ffe082" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#ffcc80" + android:pathData="M50,50L80050,50A80000,80000 0,0 0,73960.37 -30564.67Z" + android:strokeColor="#ffcc80" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#ffab91" + android:pathData="M50,50 L73960.37,30664.67A80000,80000 0,0 0,80050 50Z" + android:strokeColor="#ffab91" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#ef9a9a" + android:pathData="m50,50 l56568.54,56568.54a80000,80000 0,0 0,17341.82 -25953.87z" + android:strokeColor="#ef9a9a" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#f48fb1" + android:pathData="m50,50 l30614.67,73910.37a80000,80000 0,0 0,25953.87 -17341.82z" + android:strokeColor="#f48fb1" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#ce93d8" + android:pathData="M50,50L50,80050A80000,80000 0,0 0,30664.67 73960.37Z" + android:strokeColor="#ce93d8" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#b39ddb" + android:pathData="M50,50 L-30564.67,73960.37A80000,80000 0,0 0,50 80050Z" + android:strokeColor="#b39ddb" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#9fa8da" + android:pathData="m50,50 l-56568.54,56568.54a80000,80000 0,0 0,25953.87 17341.82z" + android:strokeColor="#9fa8da" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#90caf9" + android:pathData="m50,50 l-73910.37,30614.67a80000,80000 0,0 0,17341.82 25953.87z" + android:strokeColor="#90caf9" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#81d4fa" + android:pathData="m50,50l-80000,0a80000,80000 0,0 0,6089.64 30614.67z" + android:strokeColor="#81d4fa" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#80deea" + android:pathData="M50,50 L-73860.37,-30564.67A80000,80000 0,0 0,-79950 50Z" + android:strokeColor="#80deea" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#80cbc4" + android:pathData="m50,50 l-56568.54,-56568.54a80000,80000 0,0 0,-17341.82 25953.87z" + android:strokeColor="#80cbc4" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#a5d6a7" + android:pathData="m50,50 l-30614.67,-73910.37a80000,80000 0,0 0,-25953.87 17341.82z" + android:strokeColor="#a5d6a7" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#c5e1a5" + android:pathData="m50,50l0,-80000a80000,80000 0,0 0,-30614.67 6089.64z" + android:strokeColor="#c5e1a5" android:strokeWidth="0"/> +</vector> diff --git a/app/src/main/res/drawable/background_main.xml b/app/src/main/res/drawable/background_main.xml new file mode 100644 index 00000000..4b60e9dc --- /dev/null +++ b/app/src/main/res/drawable/background_main.xml @@ -0,0 +1,52 @@ +<vector android:height="24dp" android:viewportHeight="100.0" + android:viewportWidth="100.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:pathData="M50,50m-82000,0a82000,82000 0,1 1,164000 0a82000,82000 0,1 1,-164000 0"/> + <path android:fillAlpha="1" android:fillColor="#e6ee9c" + android:pathData="M50,50 L30664.67,-73860.37A80000,80000 0,0 0,50 -79950Z" + android:strokeColor="#e6ee9c" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#fff59d" + android:pathData="m50,50 l56568.54,-56568.54a80000,80000 0,0 0,-25953.87 -17341.82z" + android:strokeColor="#fff59d" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#ffe082" + android:pathData="m50,50 l73910.37,-30614.67a80000,80000 0,0 0,-17341.82 -25953.87z" + android:strokeColor="#ffe082" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#ffcc80" + android:pathData="M50,50L80050,50A80000,80000 0,0 0,73960.37 -30564.67Z" + android:strokeColor="#ffcc80" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#ffab91" + android:pathData="M50,50 L73960.37,30664.67A80000,80000 0,0 0,80050 50Z" + android:strokeColor="#ffab91" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#ef9a9a" + android:pathData="m50,50 l56568.54,56568.54a80000,80000 0,0 0,17341.82 -25953.87z" + android:strokeColor="#ef9a9a" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#f48fb1" + android:pathData="m50,50 l30614.67,73910.37a80000,80000 0,0 0,25953.87 -17341.82z" + android:strokeColor="#f48fb1" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#ce93d8" + android:pathData="M50,50L50,80050A80000,80000 0,0 0,30664.67 73960.37Z" + android:strokeColor="#ce93d8" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#b39ddb" + android:pathData="M50,50 L-30564.67,73960.37A80000,80000 0,0 0,50 80050Z" + android:strokeColor="#b39ddb" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#9fa8da" + android:pathData="m50,50 l-56568.54,56568.54a80000,80000 0,0 0,25953.87 17341.82z" + android:strokeColor="#9fa8da" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#90caf9" + android:pathData="m50,50 l-73910.37,30614.67a80000,80000 0,0 0,17341.82 25953.87z" + android:strokeColor="#90caf9" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#81d4fa" + android:pathData="m50,50l-80000,0a80000,80000 0,0 0,6089.64 30614.67z" + android:strokeColor="#81d4fa" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#80deea" + android:pathData="M50,50 L-73860.37,-30564.67A80000,80000 0,0 0,-79950 50Z" + android:strokeColor="#80deea" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#80cbc4" + android:pathData="m50,50 l-56568.54,-56568.54a80000,80000 0,0 0,-17341.82 25953.87z" + android:strokeColor="#80cbc4" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#a5d6a7" + android:pathData="m50,50 l-30614.67,-73910.37a80000,80000 0,0 0,-25953.87 17341.82z" + android:strokeColor="#a5d6a7" android:strokeWidth="0"/> + <path android:fillAlpha="1" android:fillColor="#c5e1a5" + android:pathData="m50,50l0,-80000a80000,80000 0,0 0,-30614.67 6089.64z" + android:strokeColor="#c5e1a5" android:strokeWidth="0"/> +</vector> diff --git a/app/src/main/res/drawable/cust_button_primary.xml b/app/src/main/res/drawable/cust_button_primary.xml new file mode 100644 index 00000000..3b0f7e26 --- /dev/null +++ b/app/src/main/res/drawable/cust_button_primary.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android" > + <item android:state_pressed="true" > + <shape android:shape="rectangle" > + <corners android:radius="50dp" /> + <padding android:left="8dp" android:right="8dp"/> + <solid 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="@color/colorPrimaryDark"/> + </shape> + </item> + <item > + <shape android:shape="rectangle" > + <corners android:radius="50dp" /> + <padding android:left="8dp" android:right="8dp"/> + <solid android:color="@color/colorPrimary"/> + </shape> + </item> +</selector>
\ No newline at end of file diff --git a/app/src/main/res/drawable/cust_button_secondary.xml b/app/src/main/res/drawable/cust_button_secondary.xml new file mode 100644 index 00000000..553adca8 --- /dev/null +++ b/app/src/main/res/drawable/cust_button_secondary.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android" > + <item android:state_pressed="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"/> + </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"/> + </shape> + </item> + <item > + <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"/> + </shape> + </item> +</selector>
\ No newline at end of file diff --git a/app/src/main/res/drawable/donation_img.xml b/app/src/main/res/drawable/donation_img.xml new file mode 100644 index 00000000..1e0b405e --- /dev/null +++ b/app/src/main/res/drawable/donation_img.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:drawable="@drawable/background_main" + android:gravity="fill_horizontal|fill_vertical"/> + <item android:drawable="@drawable/logo" + android:gravity="center" + /> +</layer-list> diff --git a/app/src/main/res/drawable/splash_page.xml b/app/src/main/res/drawable/splash_page.xml index 44112f06..1740da58 100644 --- a/app/src/main/res/drawable/splash_page.xml +++ b/app/src/main/res/drawable/splash_page.xml @@ -6,7 +6,7 @@ <item> <bitmap - android:src="@drawable/mask" + android:src="@drawable/logo" android:gravity="center" /> </item> diff --git a/app/src/main/res/layout-sw600dp-port/a_provider_credentials.xml b/app/src/main/res/layout-sw600dp-port/a_provider_credentials.xml index 0aae8ede..ab140a2e 100644 --- a/app/src/main/res/layout-sw600dp-port/a_provider_credentials.xml +++ b/app/src/main/res/layout-sw600dp-port/a_provider_credentials.xml @@ -10,7 +10,7 @@ <android.support.v7.widget.AppCompatImageView android:layout_width="match_parent" android:layout_height="match_parent" - app:srcCompat="@drawable/ic_colorsquare" + app:srcCompat="@drawable/background_main" android:scaleType="centerCrop" /> diff --git a/app/src/main/res/layout-sw600dp-port/a_provider_detail.xml b/app/src/main/res/layout-sw600dp-port/a_provider_detail.xml index 67ac1cfd..dac21eaf 100644 --- a/app/src/main/res/layout-sw600dp-port/a_provider_detail.xml +++ b/app/src/main/res/layout-sw600dp-port/a_provider_detail.xml @@ -11,7 +11,7 @@ <android.support.v7.widget.AppCompatImageView android:layout_width="match_parent" android:layout_height="match_parent" - app:srcCompat="@drawable/ic_colorsquare" + app:srcCompat="@drawable/background_main" android:scaleType="centerCrop" /> diff --git a/app/src/main/res/layout-sw600dp-port/a_provider_list.xml b/app/src/main/res/layout-sw600dp-port/a_provider_list.xml index fbfba403..61ea6882 100644 --- a/app/src/main/res/layout-sw600dp-port/a_provider_list.xml +++ b/app/src/main/res/layout-sw600dp-port/a_provider_list.xml @@ -11,7 +11,7 @@ <android.support.v7.widget.AppCompatImageView android:layout_width="match_parent" android:layout_height="match_parent" - app:srcCompat="@drawable/ic_colorsquare" + app:srcCompat="@drawable/background_main" android:scaleType="centerCrop" /> diff --git a/app/src/main/res/layout-xlarge/a_provider_credentials.xml b/app/src/main/res/layout-xlarge/a_provider_credentials.xml index f55f142c..02ad25f9 100644 --- a/app/src/main/res/layout-xlarge/a_provider_credentials.xml +++ b/app/src/main/res/layout-xlarge/a_provider_credentials.xml @@ -10,7 +10,7 @@ <android.support.v7.widget.AppCompatImageView android:layout_width="match_parent" android:layout_height="match_parent" - app:srcCompat="@drawable/ic_colorsquare" + app:srcCompat="@drawable/background_main" android:scaleType="centerCrop" /> diff --git a/app/src/main/res/layout-xlarge/a_provider_detail.xml b/app/src/main/res/layout-xlarge/a_provider_detail.xml index ea677786..75aa8bbd 100644 --- a/app/src/main/res/layout-xlarge/a_provider_detail.xml +++ b/app/src/main/res/layout-xlarge/a_provider_detail.xml @@ -11,7 +11,7 @@ <android.support.v7.widget.AppCompatImageView android:layout_width="match_parent" android:layout_height="match_parent" - app:srcCompat="@drawable/ic_colorsquare" + app:srcCompat="@drawable/background_main" android:scaleType="centerCrop" /> diff --git a/app/src/main/res/layout-xlarge/a_provider_list.xml b/app/src/main/res/layout-xlarge/a_provider_list.xml index 4e666a90..7bdcba9e 100644 --- a/app/src/main/res/layout-xlarge/a_provider_list.xml +++ b/app/src/main/res/layout-xlarge/a_provider_list.xml @@ -11,7 +11,7 @@ <android.support.v7.widget.AppCompatImageView android:layout_width="match_parent" android:layout_height="match_parent" - app:srcCompat="@drawable/ic_colorsquare" + app:srcCompat="@drawable/background_main" android:scaleType="centerCrop" /> diff --git a/app/src/main/res/layout-xlarge/f_eip.xml b/app/src/main/res/layout-xlarge/f_eip.xml index 2326ffe8..4db7cc56 100644 --- a/app/src/main/res/layout-xlarge/f_eip.xml +++ b/app/src/main/res/layout-xlarge/f_eip.xml @@ -51,7 +51,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="fitXY" - app:srcCompat="@drawable/ic_colorsquare" /> + app:srcCompat="@drawable/background_eip" /> <android.support.v7.widget.AppCompatTextView diff --git a/app/src/main/res/layout-xlarge/v_provider_header.xml b/app/src/main/res/layout-xlarge/v_provider_header.xml index 6c06111a..cbd5813c 100644 --- a/app/src/main/res/layout-xlarge/v_provider_header.xml +++ b/app/src/main/res/layout-xlarge/v_provider_header.xml @@ -9,7 +9,7 @@ android:layout_width="@dimen/bitmask_logo" android:layout_height="@dimen/bitmask_logo" android:adjustViewBounds="true" - app:srcCompat="@drawable/mask" /> + app:srcCompat="@drawable/logo" /> <android.support.v7.widget.AppCompatTextView android:id="@+id/provider_header_text" diff --git a/app/src/main/res/layout/donation_reminder_dialog.xml b/app/src/main/res/layout/donation_reminder_dialog.xml new file mode 100644 index 00000000..ce29eeb8 --- /dev/null +++ b/app/src/main/res/layout/donation_reminder_dialog.xml @@ -0,0 +1,68 @@ +<?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="match_parent" + android:scrollbars="none"> + + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center" + android:orientation="vertical"> + + <TextView + 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/donate_title" + android:textAllCaps="true" + android:textColor="@color/colorPrimary" + android:textSize="28sp" + android:textStyle="bold" /> + + <TextView + android:id="@+id/tvMessage" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_margin="@dimen/standard_margin" + android:gravity="center" + android:text="@string/donate_message" /> + + <ImageView + android:id="@+id/ivImg" + android:layout_width="120dp" + android:layout_height="120dp" + android:layout_marginBottom="@dimen/add_button_margin" + android:layout_marginTop="@dimen/add_button_margin" + android:src="@drawable/donation_img" /> + + <Button + android:id="@+id/btnDonate" + android:layout_width="200dp" + android:layout_height="38dp" + android:layout_marginLeft="@dimen/add_button_margin" + android:layout_marginRight="@dimen/add_button_margin" + android:layout_marginTop="@dimen/standard_margin" + android:background="@drawable/cust_button_primary" + android:text="@string/donate_button_donate" + android:textColor="@color/white" + android:textStyle="bold" /> + + <Button + android:id="@+id/btnLater" + android:layout_width="200dp" + android:layout_height="38dp" + android:layout_marginBottom="@dimen/mainbutton_padding" + android:layout_marginLeft="@dimen/add_button_margin" + android:layout_marginRight="@dimen/add_button_margin" + android:layout_marginTop="@dimen/standard_margin" + android:background="@drawable/cust_button_secondary" + android:text="@string/donate_button_remind_later" + android:textColor="@android:color/tab_indicator_text" + android:textStyle="bold" /> + + </LinearLayout> +</ScrollView> diff --git a/app/src/main/res/layout/f_drawer_main.xml b/app/src/main/res/layout/f_drawer_main.xml index 54614f3f..549b4b6a 100644 --- a/app/src/main/res/layout/f_drawer_main.xml +++ b/app/src/main/res/layout/f_drawer_main.xml @@ -20,13 +20,13 @@ android:adjustViewBounds="false" android:cropToPadding="false" android:scaleType="fitXY" - app:srcCompat="@drawable/ic_colorsquare" /> + app:srcCompat="@drawable/background_drawer" /> <android.support.v7.widget.AppCompatImageView android:id="@+id/mask" android:layout_width="match_parent" android:layout_height="wrap_content" - app:srcCompat="@drawable/mask" /> + app:srcCompat="@drawable/logo" /> </FrameLayout> <RelativeLayout android:layout_width="match_parent" diff --git a/app/src/main/res/layout/f_eip.xml b/app/src/main/res/layout/f_eip.xml index e220bf16..ed4ec9c4 100644 --- a/app/src/main/res/layout/f_eip.xml +++ b/app/src/main/res/layout/f_eip.xml @@ -49,7 +49,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="fitXY" - app:srcCompat="@drawable/ic_colorsquare" /> + app:srcCompat="@drawable/background_eip" /> <android.support.v7.widget.AppCompatTextView diff --git a/app/src/main/res/layout/v_provider_header.xml b/app/src/main/res/layout/v_provider_header.xml index d089b205..823f3163 100644 --- a/app/src/main/res/layout/v_provider_header.xml +++ b/app/src/main/res/layout/v_provider_header.xml @@ -9,7 +9,7 @@ android:layout_width="@dimen/bitmask_logo" android:layout_height="@dimen/bitmask_logo" android:adjustViewBounds="true" - app:srcCompat="@drawable/mask" /> + app:srcCompat="@drawable/logo" /> <android.support.v7.widget.AppCompatTextView android:id="@+id/provider_header_text" |