From 5af1883562e88fe36de1a4785cce60ddb6affedc Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Tue, 31 Mar 2015 13:28:03 -0500 Subject: [PATCH] Create googleplay and generic build flavors * gtask permissions moved to googleplay version * billing moved to googleplay version --- build.gradle | 5 ++++ src/googleplay/AndroidManifest.xml | 27 +++++++++++++++++++ .../vending/billing/IInAppBillingService.aidl | 0 .../tasks/activities/DonationActivity.java | 4 +-- .../java/org/tasks/billing/Base64.java | 0 .../tasks/billing/Base64DecoderException.java | 0 .../java/org/tasks/billing/IabException.java | 0 .../java/org/tasks/billing/IabHelper.java | 0 .../java/org/tasks/billing/IabResult.java | 0 .../java/org/tasks/billing/Inventory.java | 0 .../java/org/tasks/billing/Purchase.java | 0 .../java/org/tasks/billing/Security.java | 0 .../java/org/tasks/billing/SkuDetails.java | 0 src/googleplay/res/values-v8/bools.xml | 4 +++ src/googleplay/res/values/bools.xml | 4 +++ src/googleplay/res/values/keys.xml | 4 +++ src/main/AndroidManifest.xml | 18 ------------- .../org/tasks/injection/ActivityModule.java | 2 -- .../tasks/preferences/BasicPreferences.java | 3 +++ .../org/tasks/preferences/DeviceInfo.java | 6 ++--- src/main/res/values/bools.xml | 2 ++ src/main/res/values/keys.xml | 1 - 22 files changed, 54 insertions(+), 26 deletions(-) create mode 100644 src/googleplay/AndroidManifest.xml rename src/{main => googleplay}/aidl/com/android/vending/billing/IInAppBillingService.aidl (100%) rename src/{main => googleplay}/java/org/tasks/activities/DonationActivity.java (97%) rename src/{main => googleplay}/java/org/tasks/billing/Base64.java (100%) rename src/{main => googleplay}/java/org/tasks/billing/Base64DecoderException.java (100%) rename src/{main => googleplay}/java/org/tasks/billing/IabException.java (100%) rename src/{main => googleplay}/java/org/tasks/billing/IabHelper.java (100%) rename src/{main => googleplay}/java/org/tasks/billing/IabResult.java (100%) rename src/{main => googleplay}/java/org/tasks/billing/Inventory.java (100%) rename src/{main => googleplay}/java/org/tasks/billing/Purchase.java (100%) rename src/{main => googleplay}/java/org/tasks/billing/Security.java (100%) rename src/{main => googleplay}/java/org/tasks/billing/SkuDetails.java (100%) create mode 100644 src/googleplay/res/values-v8/bools.xml create mode 100644 src/googleplay/res/values/bools.xml create mode 100644 src/googleplay/res/values/keys.xml diff --git a/build.gradle b/build.gradle index 278f33713..909175b67 100644 --- a/build.gradle +++ b/build.gradle @@ -61,6 +61,11 @@ android { } else { buildTypes.release.signingConfig = null } + + productFlavors { + generic + googleplay + } } android.applicationVariants.all { variant -> diff --git a/src/googleplay/AndroidManifest.xml b/src/googleplay/AndroidManifest.xml new file mode 100644 index 000000000..bd4bbe0cb --- /dev/null +++ b/src/googleplay/AndroidManifest.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/aidl/com/android/vending/billing/IInAppBillingService.aidl b/src/googleplay/aidl/com/android/vending/billing/IInAppBillingService.aidl similarity index 100% rename from src/main/aidl/com/android/vending/billing/IInAppBillingService.aidl rename to src/googleplay/aidl/com/android/vending/billing/IInAppBillingService.aidl diff --git a/src/main/java/org/tasks/activities/DonationActivity.java b/src/googleplay/java/org/tasks/activities/DonationActivity.java similarity index 97% rename from src/main/java/org/tasks/activities/DonationActivity.java rename to src/googleplay/java/org/tasks/activities/DonationActivity.java index 344f94086..ff1e250bd 100644 --- a/src/main/java/org/tasks/activities/DonationActivity.java +++ b/src/googleplay/java/org/tasks/activities/DonationActivity.java @@ -1,5 +1,6 @@ package org.tasks.activities; +import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; @@ -14,14 +15,13 @@ import org.tasks.billing.IabHelper; import org.tasks.billing.IabResult; import org.tasks.billing.Inventory; import org.tasks.billing.Purchase; -import org.tasks.injection.InjectingActivity; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; -public class DonationActivity extends InjectingActivity implements IabHelper.OnIabSetupFinishedListener, +public class DonationActivity extends Activity implements IabHelper.OnIabSetupFinishedListener, IabHelper.QueryInventoryFinishedListener, IabHelper.OnIabPurchaseFinishedListener, IabHelper.OnConsumeFinishedListener, IabHelper.OnConsumeMultiFinishedListener { diff --git a/src/main/java/org/tasks/billing/Base64.java b/src/googleplay/java/org/tasks/billing/Base64.java similarity index 100% rename from src/main/java/org/tasks/billing/Base64.java rename to src/googleplay/java/org/tasks/billing/Base64.java diff --git a/src/main/java/org/tasks/billing/Base64DecoderException.java b/src/googleplay/java/org/tasks/billing/Base64DecoderException.java similarity index 100% rename from src/main/java/org/tasks/billing/Base64DecoderException.java rename to src/googleplay/java/org/tasks/billing/Base64DecoderException.java diff --git a/src/main/java/org/tasks/billing/IabException.java b/src/googleplay/java/org/tasks/billing/IabException.java similarity index 100% rename from src/main/java/org/tasks/billing/IabException.java rename to src/googleplay/java/org/tasks/billing/IabException.java diff --git a/src/main/java/org/tasks/billing/IabHelper.java b/src/googleplay/java/org/tasks/billing/IabHelper.java similarity index 100% rename from src/main/java/org/tasks/billing/IabHelper.java rename to src/googleplay/java/org/tasks/billing/IabHelper.java diff --git a/src/main/java/org/tasks/billing/IabResult.java b/src/googleplay/java/org/tasks/billing/IabResult.java similarity index 100% rename from src/main/java/org/tasks/billing/IabResult.java rename to src/googleplay/java/org/tasks/billing/IabResult.java diff --git a/src/main/java/org/tasks/billing/Inventory.java b/src/googleplay/java/org/tasks/billing/Inventory.java similarity index 100% rename from src/main/java/org/tasks/billing/Inventory.java rename to src/googleplay/java/org/tasks/billing/Inventory.java diff --git a/src/main/java/org/tasks/billing/Purchase.java b/src/googleplay/java/org/tasks/billing/Purchase.java similarity index 100% rename from src/main/java/org/tasks/billing/Purchase.java rename to src/googleplay/java/org/tasks/billing/Purchase.java diff --git a/src/main/java/org/tasks/billing/Security.java b/src/googleplay/java/org/tasks/billing/Security.java similarity index 100% rename from src/main/java/org/tasks/billing/Security.java rename to src/googleplay/java/org/tasks/billing/Security.java diff --git a/src/main/java/org/tasks/billing/SkuDetails.java b/src/googleplay/java/org/tasks/billing/SkuDetails.java similarity index 100% rename from src/main/java/org/tasks/billing/SkuDetails.java rename to src/googleplay/java/org/tasks/billing/SkuDetails.java diff --git a/src/googleplay/res/values-v8/bools.xml b/src/googleplay/res/values-v8/bools.xml new file mode 100644 index 000000000..195f21eec --- /dev/null +++ b/src/googleplay/res/values-v8/bools.xml @@ -0,0 +1,4 @@ + + + true + \ No newline at end of file diff --git a/src/googleplay/res/values/bools.xml b/src/googleplay/res/values/bools.xml new file mode 100644 index 000000000..9f359460c --- /dev/null +++ b/src/googleplay/res/values/bools.xml @@ -0,0 +1,4 @@ + + + true + \ No newline at end of file diff --git a/src/googleplay/res/values/keys.xml b/src/googleplay/res/values/keys.xml new file mode 100644 index 000000000..4c01a489a --- /dev/null +++ b/src/googleplay/res/values/keys.xml @@ -0,0 +1,4 @@ + + + MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk8mXRE3dDXwtinUILCEzKjov2rxs3kZbLRzNrcjFWXpG9OEsUzRGLzqEN+WwibVuMRpZLj/+IxbU2sJWq/M0q+90rOhmXn46ZPeNyr77IqX2pWKIAWpzBoWq/mshRwtm9m1FIiGdBNlXrhSE7u3TGB5FuEuuSqKWvWzxeqQ7fHmlM04Lqrh1mN3FaMne8rWv+DWVHDbLrtnXBuC36glOAj17HxrzaE2v6Pv7Df3QefJ3rM1+0fAp/5jNInaP0qHAlG8WTbUmDShQ5kG3urbv3HLByyx6TSqhmNudXUK/6TusvIj50OptAG7x+UFYf956dD3diXhY3yoICvyFWx1sNwIDAQAB + \ No newline at end of file diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index b7b8e6bfe..d254a131b 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -6,11 +6,6 @@ - - - - - @@ -32,15 +27,6 @@ - - - - - - - - - @@ -189,10 +175,6 @@ android:label="@string/help_and_feedback" android:theme="@style/Tasks" /> - - diff --git a/src/main/java/org/tasks/injection/ActivityModule.java b/src/main/java/org/tasks/injection/ActivityModule.java index e61f04d5b..5e9f89c4d 100644 --- a/src/main/java/org/tasks/injection/ActivityModule.java +++ b/src/main/java/org/tasks/injection/ActivityModule.java @@ -29,7 +29,6 @@ import org.tasks.activities.ClearGtaskDataActivity; import org.tasks.activities.DeleteAllCalendarEventsActivity; import org.tasks.activities.DeleteCompletedActivity; import org.tasks.activities.DeleteCompletedEventsActivity; -import org.tasks.activities.DonationActivity; import org.tasks.activities.ExportTaskActivity; import org.tasks.activities.ImportTaskActivity; import org.tasks.activities.PurgeDeletedActivity; @@ -81,7 +80,6 @@ import dagger.Provides; ClearGtaskDataActivity.class, ReminderPreferences.class, HelpAndFeedbackActivity.class, - DonationActivity.class, AppearancePreferences.class }) public class ActivityModule { diff --git a/src/main/java/org/tasks/preferences/BasicPreferences.java b/src/main/java/org/tasks/preferences/BasicPreferences.java index 4d072dfb8..5891d0da4 100644 --- a/src/main/java/org/tasks/preferences/BasicPreferences.java +++ b/src/main/java/org/tasks/preferences/BasicPreferences.java @@ -18,6 +18,9 @@ public class BasicPreferences extends InjectingPreferenceActivity { String action = getIntent().getAction(); if (action == null) { addPreferencesFromResource(R.xml.preferences); + if (!getResources().getBoolean(R.bool.sync_enabled)) { + getPreferenceScreen().removePreference(findPreference(getString(R.string.synchronization))); + } findPreference(getString(R.string.EPr_appearance_header)).setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { diff --git a/src/main/java/org/tasks/preferences/DeviceInfo.java b/src/main/java/org/tasks/preferences/DeviceInfo.java index c46dceb2b..33b3c9b4f 100644 --- a/src/main/java/org/tasks/preferences/DeviceInfo.java +++ b/src/main/java/org/tasks/preferences/DeviceInfo.java @@ -10,6 +10,7 @@ import com.google.api.client.repackaged.com.google.common.base.Joiner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.tasks.BuildConfig; +import org.tasks.R; import org.tasks.injection.ForApplication; import java.util.List; @@ -17,7 +18,6 @@ import java.util.List; import javax.inject.Inject; import javax.inject.Singleton; -import static com.todoroo.andlib.utility.AndroidUtilities.atLeastFroyo; import static java.util.Arrays.asList; @Singleton @@ -43,7 +43,7 @@ public class DeviceInfo { } public boolean supportsBilling() { - return atLeastFroyo() && isPlayStoreAvailable(); + return context.getResources().getBoolean(R.bool.billing_enabled) && isPlayStoreAvailable(); } public String getDebugInfo() { @@ -59,7 +59,7 @@ public class DeviceInfo { return Joiner.on("\n").join(asList( "", "----------", - "Tasks: " + BuildConfig.VERSION_NAME + " (build " + BuildConfig.VERSION_CODE + ")", + "Tasks: " + BuildConfig.VERSION_NAME + " (" + BuildConfig.FLAVOR + " build " + BuildConfig.VERSION_CODE + ")", "Android: " + Build.VERSION.RELEASE, "Model: " + Build.MANUFACTURER + " " + Build.MODEL, "Product: " + Build.PRODUCT + " (" + Build.DEVICE + ")", diff --git a/src/main/res/values/bools.xml b/src/main/res/values/bools.xml index 8afff434b..5b33fae3e 100644 --- a/src/main/res/values/bools.xml +++ b/src/main/res/values/bools.xml @@ -2,4 +2,6 @@ true false + false + false \ No newline at end of file diff --git a/src/main/res/values/keys.xml b/src/main/res/values/keys.xml index c408d2417..f08900910 100644 --- a/src/main/res/values/keys.xml +++ b/src/main/res/values/keys.xml @@ -6,7 +6,6 @@ AIzaSyBXGYNWNQcfse4JS5gI9teTSKMzinWzL2M - MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk8mXRE3dDXwtinUILCEzKjov2rxs3kZbLRzNrcjFWXpG9OEsUzRGLzqEN+WwibVuMRpZLj/+IxbU2sJWq/M0q+90rOhmXn46ZPeNyr77IqX2pWKIAWpzBoWq/mshRwtm9m1FIiGdBNlXrhSE7u3TGB5FuEuuSqKWvWzxeqQ7fHmlM04Lqrh1mN3FaMne8rWv+DWVHDbLrtnXBuC36glOAj17HxrzaE2v6Pv7Df3QefJ3rM1+0fAp/5jNInaP0qHAlG8WTbUmDShQ5kG3urbv3HLByyx6TSqhmNudXUK/6TusvIj50OptAG7x+UFYf956dD3diXhY3yoICvyFWx1sNwIDAQAB