From ced2e5f4973fb8aae015f8d2ec2e3cd70d450ea7 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Mon, 1 Apr 2019 01:46:00 +0200 Subject: fix layout inflation exeption occuring with vector graphics on Android 4.X --- .../java/se/leap/bitmaskclient/BitmaskApp.java | 2 ++ .../fragments/DonationReminderDialog.java | 28 +++++++++------------- 2 files changed, 13 insertions(+), 17 deletions(-) (limited to 'app/src/main/java') diff --git a/app/src/main/java/se/leap/bitmaskclient/BitmaskApp.java b/app/src/main/java/se/leap/bitmaskclient/BitmaskApp.java index fd9aa029..45664653 100644 --- a/app/src/main/java/se/leap/bitmaskclient/BitmaskApp.java +++ b/app/src/main/java/se/leap/bitmaskclient/BitmaskApp.java @@ -3,6 +3,7 @@ package se.leap.bitmaskclient; import android.content.Context; import android.content.SharedPreferences; import android.support.multidex.MultiDexApplication; +import android.support.v7.app.AppCompatDelegate; import com.squareup.leakcanary.LeakCanary; import com.squareup.leakcanary.RefWatcher; @@ -36,6 +37,7 @@ public class BitmaskApp extends MultiDexApplication { providerObservable = ProviderObservable.getInstance(); providerObservable.updateProvider(getSavedProviderFromSharedPreferences(preferences)); EipSetupObserver.init(this, preferences); + AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); } /** diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/DonationReminderDialog.java b/app/src/main/java/se/leap/bitmaskclient/fragments/DonationReminderDialog.java index 001d7e6c..66db9bc8 100644 --- a/app/src/main/java/se/leap/bitmaskclient/fragments/DonationReminderDialog.java +++ b/app/src/main/java/se/leap/bitmaskclient/fragments/DonationReminderDialog.java @@ -55,23 +55,17 @@ public class DonationReminderDialog extends AppCompatDialogFragment { 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(); - } + btnDonate.setOnClickListener(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(); - } + btnLater.setOnClickListener(v -> { + PreferenceHelper.putString(getContext(), LAST_DONATION_REMINDER_DATE, + DateHelper.getCurrentDateString()); + dismiss(); }); return builder.create(); @@ -90,7 +84,7 @@ public class DonationReminderDialog extends AppCompatDialogFragment { 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()); -- cgit v1.2.3