diff --git a/src/androidTest/java/org/tasks/injection/TestComponent.java b/src/androidTest/java/org/tasks/injection/BaseTestComponent.java similarity index 62% rename from src/androidTest/java/org/tasks/injection/TestComponent.java rename to src/androidTest/java/org/tasks/injection/BaseTestComponent.java index fec9cc37a..ce8a98ee8 100644 --- a/src/androidTest/java/org/tasks/injection/TestComponent.java +++ b/src/androidTest/java/org/tasks/injection/BaseTestComponent.java @@ -2,11 +2,6 @@ package org.tasks.injection; import com.todoroo.astrid.dao.MetadataDaoTests; import com.todoroo.astrid.dao.TaskDaoTests; -import com.todoroo.astrid.gtasks.GtasksIndentActionTest; -import com.todoroo.astrid.gtasks.GtasksListServiceTest; -import com.todoroo.astrid.gtasks.GtasksMetadataServiceTest; -import com.todoroo.astrid.gtasks.GtasksTaskListUpdaterTest; -import com.todoroo.astrid.gtasks.GtasksTaskMovingTest; import com.todoroo.astrid.model.TaskTest; import com.todoroo.astrid.provider.Astrid3ProviderTests; import com.todoroo.astrid.reminders.NotificationTests; @@ -20,13 +15,7 @@ import com.todoroo.astrid.sync.NewSyncTestCase; import org.tasks.scheduling.BackupServiceTests; -import javax.inject.Singleton; - -import dagger.Component; - -@Singleton -@Component(modules = TestModule.class) -public interface TestComponent { +public interface BaseTestComponent { void inject(ReminderServiceTest reminderServiceTest); void inject(TaskTest taskTest); @@ -51,15 +40,5 @@ public interface TestComponent { void inject(BackupServiceTests backupServiceTests); - void inject(GtasksIndentActionTest gtasksIndentActionTest); - - void inject(GtasksTaskMovingTest gtasksTaskMovingTest); - - void inject(GtasksListServiceTest gtasksListServiceTest); - - void inject(GtasksTaskListUpdaterTest gtasksTaskListUpdaterTest); - - GtasksMetadataServiceTest.GtasksMetadataServiceTestComponent plus(GtasksMetadataServiceTest.GtasksMetadataServiceTestModule gtasksMetadataServiceTestModule); - NotificationTests.NotificationTestsComponent plus(NotificationTests.NotificationTestsModule notificationTestsModule); } diff --git a/src/androidTest/java/org/tasks/injection/TestModule.java b/src/androidTest/java/org/tasks/injection/TestModule.java index 4e277376d..99696742c 100644 --- a/src/androidTest/java/org/tasks/injection/TestModule.java +++ b/src/androidTest/java/org/tasks/injection/TestModule.java @@ -2,25 +2,7 @@ package org.tasks.injection; import android.content.Context; -import org.tasks.scheduling.BackupServiceTests; import com.todoroo.astrid.dao.Database; -import com.todoroo.astrid.dao.MetadataDaoTests; -import com.todoroo.astrid.dao.TaskDaoTests; -import com.todoroo.astrid.gtasks.GtasksIndentActionTest; -import com.todoroo.astrid.gtasks.GtasksListServiceTest; -import com.todoroo.astrid.gtasks.GtasksTaskListUpdaterTest; -import com.todoroo.astrid.gtasks.GtasksTaskMovingTest; -import com.todoroo.astrid.model.TaskTest; -import com.todoroo.astrid.provider.Astrid3ProviderTests; -import com.todoroo.astrid.reminders.ReminderServiceTest; -import com.todoroo.astrid.repeats.NewRepeatTests; -import com.todoroo.astrid.service.QuickAddMarkupTest; -import com.todoroo.astrid.service.TitleParserTest; -import com.todoroo.astrid.subtasks.SubtasksHelperTest; -import com.todoroo.astrid.subtasks.SubtasksMovingTest; -import com.todoroo.astrid.subtasks.SubtasksTestCase; -import com.todoroo.astrid.sync.NewSyncTestCase; -import com.todoroo.astrid.sync.SyncModelTest; import javax.inject.Singleton; diff --git a/src/androidTestGeneric/java/com/todoroo/astrid/gtasks/GtasksIndentActionTest.java b/src/androidTestGeneric/java/com/todoroo/astrid/gtasks/GtasksIndentActionTest.java deleted file mode 100644 index bee865e81..000000000 --- a/src/androidTestGeneric/java/com/todoroo/astrid/gtasks/GtasksIndentActionTest.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.todoroo.astrid.gtasks; - -import android.test.AndroidTestCase; - -import javax.inject.Inject; - -public class GtasksIndentActionTest extends AndroidTestCase { - @Inject - public GtasksIndentActionTest() { - - } -} diff --git a/src/androidTestGeneric/java/com/todoroo/astrid/gtasks/GtasksListServiceTest.java b/src/androidTestGeneric/java/com/todoroo/astrid/gtasks/GtasksListServiceTest.java deleted file mode 100644 index b2b5fcc6a..000000000 --- a/src/androidTestGeneric/java/com/todoroo/astrid/gtasks/GtasksListServiceTest.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.todoroo.astrid.gtasks; - -import android.test.AndroidTestCase; - -import javax.inject.Inject; - -public class GtasksListServiceTest extends AndroidTestCase { - @Inject - public GtasksListServiceTest() { - - } -} diff --git a/src/androidTestGeneric/java/com/todoroo/astrid/gtasks/GtasksTaskListUpdaterTest.java b/src/androidTestGeneric/java/com/todoroo/astrid/gtasks/GtasksTaskListUpdaterTest.java deleted file mode 100644 index 487877a5f..000000000 --- a/src/androidTestGeneric/java/com/todoroo/astrid/gtasks/GtasksTaskListUpdaterTest.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.todoroo.astrid.gtasks; - -import android.test.AndroidTestCase; - -import javax.inject.Inject; - -public class GtasksTaskListUpdaterTest extends AndroidTestCase { - @Inject - public GtasksTaskListUpdaterTest() { - - } -} diff --git a/src/androidTestGeneric/java/com/todoroo/astrid/gtasks/GtasksTaskMovingTest.java b/src/androidTestGeneric/java/com/todoroo/astrid/gtasks/GtasksTaskMovingTest.java deleted file mode 100644 index f951bf065..000000000 --- a/src/androidTestGeneric/java/com/todoroo/astrid/gtasks/GtasksTaskMovingTest.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.todoroo.astrid.gtasks; - -import android.test.AndroidTestCase; - -import javax.inject.Inject; - -public class GtasksTaskMovingTest extends AndroidTestCase { - @Inject - public GtasksTaskMovingTest() { - - } -} diff --git a/src/androidTestGeneric/java/org/tasks/injection/TestComponent.java b/src/androidTestGeneric/java/org/tasks/injection/TestComponent.java new file mode 100644 index 000000000..873e51366 --- /dev/null +++ b/src/androidTestGeneric/java/org/tasks/injection/TestComponent.java @@ -0,0 +1,10 @@ +package org.tasks.injection; + +import javax.inject.Singleton; + +import dagger.Component; + +@Singleton +@Component(modules = TestModule.class) +public interface TestComponent extends BaseTestComponent { +} diff --git a/src/androidTestGoogleplay/java/org/tasks/injection/TestComponent.java b/src/androidTestGoogleplay/java/org/tasks/injection/TestComponent.java new file mode 100644 index 000000000..b274bc1c4 --- /dev/null +++ b/src/androidTestGoogleplay/java/org/tasks/injection/TestComponent.java @@ -0,0 +1,26 @@ +package org.tasks.injection; + +import com.todoroo.astrid.gtasks.GtasksIndentActionTest; +import com.todoroo.astrid.gtasks.GtasksListServiceTest; +import com.todoroo.astrid.gtasks.GtasksMetadataServiceTest; +import com.todoroo.astrid.gtasks.GtasksTaskListUpdaterTest; +import com.todoroo.astrid.gtasks.GtasksTaskMovingTest; + +import javax.inject.Singleton; + +import dagger.Component; + +@Singleton +@Component(modules = TestModule.class) +public interface TestComponent extends BaseTestComponent { + + GtasksMetadataServiceTest.GtasksMetadataServiceTestComponent plus(GtasksMetadataServiceTest.GtasksMetadataServiceTestModule gtasksMetadataServiceTestModule); + + void inject(GtasksIndentActionTest gtasksIndentActionTest); + + void inject(GtasksTaskMovingTest gtasksTaskMovingTest); + + void inject(GtasksListServiceTest gtasksListServiceTest); + + void inject(GtasksTaskListUpdaterTest gtasksTaskListUpdaterTest); +} diff --git a/src/generic/java/com/todoroo/astrid/gtasks/GtasksListFragment.java b/src/generic/java/com/todoroo/astrid/gtasks/GtasksListFragment.java index ad7b6eb5a..18eb862c3 100644 --- a/src/generic/java/com/todoroo/astrid/gtasks/GtasksListFragment.java +++ b/src/generic/java/com/todoroo/astrid/gtasks/GtasksListFragment.java @@ -1,7 +1,7 @@ package com.todoroo.astrid.gtasks; -import com.todoroo.astrid.activity.TaskListFragment; +import com.todoroo.astrid.subtasks.SubtasksListFragment; -public class GtasksListFragment extends TaskListFragment { +public class GtasksListFragment extends SubtasksListFragment { public static final String TOKEN_STORE_ID = "storeId"; } diff --git a/src/generic/java/com/todoroo/astrid/gtasks/GtasksMetadataService.java b/src/generic/java/com/todoroo/astrid/gtasks/GtasksMetadataService.java deleted file mode 100644 index 95390f949..000000000 --- a/src/generic/java/com/todoroo/astrid/gtasks/GtasksMetadataService.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.todoroo.astrid.gtasks; - -import javax.inject.Inject; - -public class GtasksMetadataService { - @Inject - public GtasksMetadataService() { - - } -} diff --git a/src/generic/java/com/todoroo/astrid/gtasks/GtasksPreferences.java b/src/generic/java/com/todoroo/astrid/gtasks/GtasksPreferences.java deleted file mode 100644 index 2ad98d226..000000000 --- a/src/generic/java/com/todoroo/astrid/gtasks/GtasksPreferences.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.todoroo.astrid.gtasks; - -import javax.inject.Inject; - -public class GtasksPreferences { - @Inject - public GtasksPreferences() { - - } -} diff --git a/src/generic/java/com/todoroo/astrid/gtasks/GtasksTaskListUpdater.java b/src/generic/java/com/todoroo/astrid/gtasks/GtasksTaskListUpdater.java deleted file mode 100644 index b900a77c8..000000000 --- a/src/generic/java/com/todoroo/astrid/gtasks/GtasksTaskListUpdater.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.todoroo.astrid.gtasks; - -import javax.inject.Inject; - -public class GtasksTaskListUpdater { - @Inject - public GtasksTaskListUpdater() { - - } -} diff --git a/src/generic/java/com/todoroo/astrid/gtasks/auth/GtasksLoginActivity.java b/src/generic/java/com/todoroo/astrid/gtasks/auth/GtasksLoginActivity.java deleted file mode 100644 index e60f2bdbe..000000000 --- a/src/generic/java/com/todoroo/astrid/gtasks/auth/GtasksLoginActivity.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.todoroo.astrid.gtasks.auth; - -import javax.inject.Inject; - -public class GtasksLoginActivity { - @Inject - public GtasksLoginActivity() { - - } -} diff --git a/src/generic/java/com/todoroo/astrid/gtasks/sync/GtasksSyncService.java b/src/generic/java/com/todoroo/astrid/gtasks/sync/GtasksSyncService.java deleted file mode 100644 index adcdcf54f..000000000 --- a/src/generic/java/com/todoroo/astrid/gtasks/sync/GtasksSyncService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.todoroo.astrid.gtasks.sync; - -import javax.inject.Inject; - -public class GtasksSyncService { - @Inject - public GtasksSyncService() { - - } - - public void initialize() { - - } -} diff --git a/src/generic/java/org/tasks/FlavorSetup.java b/src/generic/java/org/tasks/FlavorSetup.java new file mode 100644 index 000000000..c0b2cc78c --- /dev/null +++ b/src/generic/java/org/tasks/FlavorSetup.java @@ -0,0 +1,14 @@ +package org.tasks; + +import javax.inject.Inject; + +public class FlavorSetup { + @Inject + public FlavorSetup() { + + } + + public void setup() { + + } +} diff --git a/src/generic/java/org/tasks/injection/ActivityComponent.java b/src/generic/java/org/tasks/injection/ActivityComponent.java new file mode 100644 index 000000000..ee20c966e --- /dev/null +++ b/src/generic/java/org/tasks/injection/ActivityComponent.java @@ -0,0 +1,11 @@ +package org.tasks.injection; + +import javax.inject.Singleton; + +import dagger.Subcomponent; + +@Singleton +@Subcomponent(modules = ActivityModule.class) +public interface ActivityComponent extends BaseActivityComponent { + +} diff --git a/src/generic/java/org/tasks/injection/BroadcastComponent.java b/src/generic/java/org/tasks/injection/BroadcastComponent.java new file mode 100644 index 000000000..bfcf325f4 --- /dev/null +++ b/src/generic/java/org/tasks/injection/BroadcastComponent.java @@ -0,0 +1,8 @@ +package org.tasks.injection; + +import dagger.Subcomponent; + +@Subcomponent(modules = BroadcastModule.class) +public interface BroadcastComponent extends BaseBroadcastComponent { + +} diff --git a/src/generic/java/org/tasks/preferences/BasicPreferences.java b/src/generic/java/org/tasks/preferences/BasicPreferences.java new file mode 100644 index 000000000..1ba93e7ce --- /dev/null +++ b/src/generic/java/org/tasks/preferences/BasicPreferences.java @@ -0,0 +1,26 @@ +package org.tasks.preferences; + +import android.os.Bundle; +import android.preference.PreferenceScreen; + +import org.tasks.R; +import org.tasks.injection.ActivityComponent; + +public class BasicPreferences extends BaseBasicPreferences { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + PreferenceScreen preferenceScreen = getPreferenceScreen(); + preferenceScreen.removePreference(findPreference(getString(R.string.synchronization))); + preferenceScreen.removePreference(findPreference(getString(R.string.p_tesla_unread_enabled))); + preferenceScreen.removePreference(findPreference(getString(R.string.p_tasker_enabled))); + preferenceScreen.removePreference(findPreference(getString(R.string.p_collect_statistics))); + } + + @Override + public void inject(ActivityComponent component) { + component.inject(this); + } +} diff --git a/src/googleplay/java/org/tasks/FlavorSetup.java b/src/googleplay/java/org/tasks/FlavorSetup.java new file mode 100644 index 000000000..febc7ddf4 --- /dev/null +++ b/src/googleplay/java/org/tasks/FlavorSetup.java @@ -0,0 +1,39 @@ +package org.tasks; + +import com.todoroo.astrid.gtasks.GtasksPreferenceService; +import com.todoroo.astrid.gtasks.GtasksTaskListUpdater; +import com.todoroo.astrid.gtasks.sync.GtasksSyncService; + +import org.tasks.billing.IabHelper; +import org.tasks.preferences.Preferences; +import org.tasks.receivers.TeslaUnreadReceiver; + +import javax.inject.Inject; + +public class FlavorSetup { + + private final Preferences preferences; + private final GtasksSyncService gtasksSyncService; + private final GtasksPreferenceService gtasksPreferenceService; + private final TeslaUnreadReceiver teslaUnreadReceiver; + private final IabHelper iabHelper; + + @Inject + public FlavorSetup(Preferences preferences, + @SuppressWarnings("UnusedParameters") GtasksTaskListUpdater gtasksTaskListUpdater, + GtasksSyncService gtasksSyncService, GtasksPreferenceService gtasksPreferenceService, + TeslaUnreadReceiver teslaUnreadReceiver, IabHelper iabHelper) { + this.preferences = preferences; + this.gtasksSyncService = gtasksSyncService; + this.gtasksPreferenceService = gtasksPreferenceService; + this.teslaUnreadReceiver = teslaUnreadReceiver; + this.iabHelper = iabHelper; + } + + public void setup() { + iabHelper.startSetup(); + teslaUnreadReceiver.setEnabled(preferences.getBoolean(R.string.p_tesla_unread_enabled, false)); + gtasksPreferenceService.stopOngoing(); // if sync ongoing flag was set, clear it + gtasksSyncService.initialize(); + } +} diff --git a/src/googleplay/java/org/tasks/billing/IabHelper.java b/src/googleplay/java/org/tasks/billing/IabHelper.java index 59a7d88e7..98729266c 100644 --- a/src/googleplay/java/org/tasks/billing/IabHelper.java +++ b/src/googleplay/java/org/tasks/billing/IabHelper.java @@ -35,6 +35,7 @@ import org.json.JSONException; import org.tasks.BuildConfig; import org.tasks.R; import org.tasks.injection.ForApplication; +import org.tasks.preferences.Preferences; import java.util.ArrayList; import java.util.List; @@ -42,6 +43,8 @@ import java.util.List; import javax.inject.Inject; import javax.inject.Singleton; +import timber.log.Timber; + /** * Provides convenience methods for in-app billing. You can create one instance of this @@ -155,35 +158,23 @@ public class IabHelper { // some fields on the getSkuDetails response bundle public static final String GET_SKU_DETAILS_ITEM_LIST = "ITEM_ID_LIST"; public static final String GET_SKU_DETAILS_ITEM_TYPE_LIST = "ITEM_TYPE_LIST"; + private Preferences preferences; @Inject - public IabHelper(@ForApplication Context ctx) { + public IabHelper(@ForApplication Context ctx, Preferences preferences) { + this.preferences = preferences; mContext = ctx.getApplicationContext(); mSignatureBase64 = ctx.getString(R.string.gp_key); logDebug("IAB helper created."); } - /** - * Callback for setup process. This listener's {@link #onIabSetupFinished} method is called - * when the setup process is complete. - */ - public interface OnIabSetupFinishedListener { - /** - * Called to notify that setup is complete. - * - * @param result The result of the setup process. - */ - void onIabSetupFinished(IabResult result); - } - /** * Starts the setup process. This will start up the setup process asynchronously. * You will be notified through the listener when the setup process is complete. * This method is safe to call from a UI thread. * - * @param listener The listener to notify when the setup process is complete. */ - public void startSetup(final OnIabSetupFinishedListener listener) { + public void startSetup() { // If already set up, can't do it again. checkNotDisposed(); if (mSetupDone) throw new IllegalStateException("IAB helper is already set up."); @@ -209,7 +200,7 @@ public class IabHelper { // check for in-app billing v3 support int response = mService.isBillingSupported(3, packageName, ITEM_TYPE_INAPP); if (response != BILLING_RESPONSE_RESULT_OK) { - if (listener != null) listener.onIabSetupFinished(new IabResult(response, + onIabSetupFinished(new IabResult(response, "Error checking for billing v3 support.")); // if in-app purchases aren't supported, neither are subscriptions. @@ -231,17 +222,13 @@ public class IabHelper { mSetupDone = true; } catch (RemoteException e) { - if (listener != null) { - listener.onIabSetupFinished(new IabResult(IABHELPER_REMOTE_EXCEPTION, - "RemoteException while setting up in-app billing.")); - } + onIabSetupFinished(new IabResult(IABHELPER_REMOTE_EXCEPTION, + "RemoteException while setting up in-app billing.")); e.printStackTrace(); return; } - if (listener != null) { - listener.onIabSetupFinished(new IabResult(BILLING_RESPONSE_RESULT_OK, "Setup successful.")); - } + onIabSetupFinished(new IabResult(BILLING_RESPONSE_RESULT_OK, "Setup successful.")); } }; @@ -253,10 +240,30 @@ public class IabHelper { } else { // no service available to handle that Intent - if (listener != null) { - listener.onIabSetupFinished( - new IabResult(BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE, - "Billing service unavailable on device.")); + onIabSetupFinished( + new IabResult(BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE, + "Billing service unavailable on device.")); + } + } + + private void onIabSetupFinished(IabResult result) { + if (result.isSuccess()) { + Timber.d("IAB setup successful"); + queryInventoryAsync(); + } else { + Timber.e(result.getMessage()); + } + } + + private void onQueryInventoryFinished(IabResult result, Inventory inventory) { + if (result.isFailure()) { + Timber.e("Query inventory failed: %s", result); + } else { + if (inventory.hasPurchase(mContext.getString(R.string.sku_tesla_unread))) { + preferences.setBoolean(R.string.p_purchased_tesla_unread, false); + } + if (inventory.hasPurchase(mContext.getString(R.string.sku_tasker))) { + preferences.setBoolean(R.string.p_purchased_tasker, false); } } } @@ -291,7 +298,6 @@ public class IabHelper { return mSubscriptionsSupported; } - /** * Callback that notifies when a purchase is finished. */ @@ -508,7 +514,7 @@ public class IabHelper { /** * Queries the inventory. This will query all owned items from the server, as well as * information on additional skus, if specified. This method may block or take long to execute. - * Do not call from a UI thread. For that, use the non-blocking version {@link #refreshInventoryAsync}. + * Do not call from a UI thread. For that, use the non-blocking version {@link #queryInventoryAsync}. * * @param querySkuDetails if true, SKU details (price, description, etc) will be queried as well * as purchase information. @@ -561,20 +567,6 @@ public class IabHelper { } } - /** - * Listener that notifies when an inventory query operation completes. - */ - public interface QueryInventoryFinishedListener { - /** - * Called to notify that an inventory query operation completed. - * - * @param result The result of the operation. - * @param inv The inventory. - */ - public void onQueryInventoryFinished(IabResult result, Inventory inv); - } - - /** * Asynchronous wrapper for inventory query. This will perform an inventory * query as described in {@link #queryInventory}, but will do so asynchronously @@ -583,11 +575,8 @@ public class IabHelper { * * @param querySkuDetails as in {@link #queryInventory} * @param moreSkus as in {@link #queryInventory} - * @param listener The listener to notify when the refresh operation completes. */ - public void queryInventoryAsync(final boolean querySkuDetails, - final List moreSkus, - final QueryInventoryFinishedListener listener) { + public void queryInventoryAsync(final boolean querySkuDetails, final List moreSkus) { final Handler handler = new Handler(); checkNotDisposed(); checkSetupDone("queryInventory"); @@ -607,10 +596,10 @@ public class IabHelper { final IabResult result_f = result; final Inventory inv_f = inv; - if (!mDisposed && listener != null) { + if (!mDisposed) { handler.post(new Runnable() { public void run() { - listener.onQueryInventoryFinished(result_f, inv_f); + onQueryInventoryFinished(result_f, inv_f); } }); } @@ -618,15 +607,14 @@ public class IabHelper { })).start(); } - public void queryInventoryAsync(QueryInventoryFinishedListener listener) { - queryInventoryAsync(true, null, listener); + public void queryInventoryAsync() { + queryInventoryAsync(true, null); } - public void queryInventoryAsync(boolean querySkuDetails, QueryInventoryFinishedListener listener) { - queryInventoryAsync(querySkuDetails, null, listener); + public void queryInventoryAsync(boolean querySkuDetails) { + queryInventoryAsync(querySkuDetails, null); } - /** * Consumes a given in-app product. Consuming can only be done on an item * that's owned, and as a result of consumption, the user will no longer own it. @@ -679,7 +667,7 @@ public class IabHelper { * @param purchase The purchase that was (or was to be) consumed. * @param result The result of the consumption operation. */ - public void onConsumeFinished(Purchase purchase, IabResult result); + void onConsumeFinished(Purchase purchase, IabResult result); } /** @@ -693,7 +681,7 @@ public class IabHelper { * @param results The results of each consumption operation, corresponding to each * sku. */ - public void onConsumeMultiFinished(List purchases, List results); + void onConsumeMultiFinished(List purchases, List results); } /** @@ -713,7 +701,7 @@ public class IabHelper { } /** - * Same as {@link consumeAsync}, but for multiple items at once. + * Same as {@link #consumeAsync}, but for multiple items at once. * @param purchases The list of PurchaseInfo objects representing the purchases to consume. * @param listener The listener to notify when the consumption operation finishes. */ diff --git a/src/googleplay/java/org/tasks/injection/ActivityComponent.java b/src/googleplay/java/org/tasks/injection/ActivityComponent.java new file mode 100644 index 000000000..c21c48e4b --- /dev/null +++ b/src/googleplay/java/org/tasks/injection/ActivityComponent.java @@ -0,0 +1,20 @@ +package org.tasks.injection; + +import com.todoroo.astrid.gtasks.GtasksPreferences; +import com.todoroo.astrid.gtasks.auth.GtasksLoginActivity; + +import org.tasks.locale.ui.activity.TaskerSettingsActivity; + +import javax.inject.Singleton; + +import dagger.Subcomponent; + +@Singleton +@Subcomponent(modules = ActivityModule.class) +public interface ActivityComponent extends BaseActivityComponent { + void inject(GtasksPreferences gtasksPreferences); + + void inject(TaskerSettingsActivity taskerSettingsActivity); + + void inject(GtasksLoginActivity gtasksLoginActivity); +} diff --git a/src/googleplay/java/org/tasks/injection/BroadcastComponent.java b/src/googleplay/java/org/tasks/injection/BroadcastComponent.java new file mode 100644 index 000000000..dc62b365d --- /dev/null +++ b/src/googleplay/java/org/tasks/injection/BroadcastComponent.java @@ -0,0 +1,10 @@ +package org.tasks.injection; + +import org.tasks.receivers.TeslaUnreadReceiver; + +import dagger.Subcomponent; + +@Subcomponent(modules = BroadcastModule.class) +public interface BroadcastComponent extends BaseBroadcastComponent { + void inject(TeslaUnreadReceiver teslaUnreadReceiver); +} diff --git a/src/googleplay/java/org/tasks/preferences/BasicPreferences.java b/src/googleplay/java/org/tasks/preferences/BasicPreferences.java new file mode 100644 index 000000000..4c061df4c --- /dev/null +++ b/src/googleplay/java/org/tasks/preferences/BasicPreferences.java @@ -0,0 +1,104 @@ +package org.tasks.preferences; + +import android.content.Intent; +import android.os.Bundle; +import android.preference.Preference; + +import org.tasks.BuildConfig; +import org.tasks.R; +import org.tasks.analytics.Tracker; +import org.tasks.billing.IabHelper; +import org.tasks.billing.IabResult; +import org.tasks.billing.Purchase; +import org.tasks.injection.ActivityComponent; +import org.tasks.receivers.TeslaUnreadReceiver; + +import javax.inject.Inject; + +public class BasicPreferences extends BaseBasicPreferences implements IabHelper.OnIabPurchaseFinishedListener { + + private static final int REQUEST_PURCHASE_TESLA_UNREAD = 10002; + private static final int REQUEST_PURCHASE_TASKER = 10003; + + @Inject Tracker tracker; + @Inject IabHelper iabHelper; + @Inject TeslaUnreadReceiver teslaUnreadReceiver; + @Inject Preferences preferences; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + findPreference(getString(R.string.p_tesla_unread_enabled)).setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + if (newValue != null) { + if ((boolean) newValue && !preferences.getBoolean(R.string.p_purchased_tesla_unread, BuildConfig.DEBUG)) { + iabHelper.launchPurchaseFlow(BasicPreferences.this, getString(R.string.sku_tesla_unread), REQUEST_PURCHASE_TESLA_UNREAD, BasicPreferences.this); + } else { + teslaUnreadReceiver.setEnabled((boolean) newValue); + return true; + } + } + return false; + } + }); + + findPreference(getString(R.string.p_tasker_enabled)).setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + if (newValue != null) { + if ((boolean) newValue && !preferences.getBoolean(R.string.p_purchased_tasker, BuildConfig.DEBUG)) { + iabHelper.launchPurchaseFlow(BasicPreferences.this, getString(R.string.sku_tasker), REQUEST_PURCHASE_TASKER, BasicPreferences.this); + } else { + return true; + } + } + return false; + } + }); + + findPreference(getString(R.string.p_collect_statistics)).setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + if (newValue != null) { + tracker.setTrackingEnabled((boolean) newValue); + return true; + } + return false; + } + }); + } + + @Override + public void onIabPurchaseFinished(IabResult result, final Purchase info) { + if (result.isSuccess()) { + runOnUiThread(new Runnable() { + @Override + public void run() { + if (info.getSku().equals(getString(R.string.sku_tasker))) { + preferences.setBoolean(R.string.p_purchased_tasker, true); + findPreference(getString(R.string.p_tasker_enabled)).setEnabled(true); + } else if (info.getSku().equals(getString(R.string.sku_tesla_unread))) { + preferences.setBoolean(R.string.p_purchased_tesla_unread, true); + findPreference(getString(R.string.p_tesla_unread_enabled)).setEnabled(true); + } + } + }); + } + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == REQUEST_PURCHASE_TASKER || requestCode == REQUEST_PURCHASE_TESLA_UNREAD) { + iabHelper.handleActivityResult(requestCode, resultCode, data); + } else { + super.onActivityResult(requestCode, resultCode, data); + } + } + + @Override + public void inject(ActivityComponent component) { + component.inject(this); + } +} diff --git a/src/main/java/com/todoroo/astrid/service/StartupService.java b/src/main/java/com/todoroo/astrid/service/StartupService.java index a7e298c02..87165cbfc 100644 --- a/src/main/java/com/todoroo/astrid/service/StartupService.java +++ b/src/main/java/com/todoroo/astrid/service/StartupService.java @@ -23,8 +23,6 @@ import com.todoroo.astrid.dao.MetadataDao.MetadataCriteria; import com.todoroo.astrid.dao.TagDataDao; import com.todoroo.astrid.data.Metadata; import com.todoroo.astrid.data.TagData; -import com.todoroo.astrid.gtasks.GtasksPreferenceService; -import com.todoroo.astrid.gtasks.sync.GtasksSyncService; import com.todoroo.astrid.provider.Astrid2TaskProvider; import com.todoroo.astrid.provider.Astrid3ContentProvider; import com.todoroo.astrid.tags.TaskToTagMetadata; @@ -55,8 +53,6 @@ public class StartupService { private final TagDataDao tagDataDao; private final Database database; - private final GtasksPreferenceService gtasksPreferenceService; - private final GtasksSyncService gtasksSyncService; private final MetadataDao metadataDao; private final Preferences preferences; private final TasksXmlImporter xmlImporter; @@ -65,14 +61,11 @@ public class StartupService { private final DialogBuilder dialogBuilder; @Inject - public StartupService(TagDataDao tagDataDao, Database database, GtasksPreferenceService gtasksPreferenceService, - GtasksSyncService gtasksSyncService, MetadataDao metadataDao, + public StartupService(TagDataDao tagDataDao, Database database, MetadataDao metadataDao, Preferences preferences, TasksXmlImporter xmlImporter, TaskDeleter taskDeleter, Broadcaster broadcaster, DialogBuilder dialogBuilder) { this.tagDataDao = tagDataDao; this.database = database; - this.gtasksPreferenceService = gtasksPreferenceService; - this.gtasksSyncService = gtasksSyncService; this.metadataDao = metadataDao; this.preferences = preferences; this.xmlImporter = xmlImporter; @@ -136,11 +129,6 @@ public class StartupService { @Override public void run() { taskDeleter.deleteTasksWithEmptyTitles(null); - - // if sync ongoing flag was set, clear it - gtasksPreferenceService.stopOngoing(); - - gtasksSyncService.initialize(); } }).start(); diff --git a/src/main/java/org/tasks/Tasks.java b/src/main/java/org/tasks/Tasks.java index 6c69e6290..a64bd945a 100644 --- a/src/main/java/org/tasks/Tasks.java +++ b/src/main/java/org/tasks/Tasks.java @@ -1,7 +1,5 @@ package org.tasks; -import android.content.ComponentName; -import android.content.pm.PackageManager; import android.util.Log; import com.todoroo.astrid.dao.Database; @@ -12,34 +10,23 @@ import com.todoroo.astrid.dao.TaskAttachmentDao; import com.todoroo.astrid.dao.TaskDao; import com.todoroo.astrid.dao.TaskListMetadataDao; import com.todoroo.astrid.dao.UserActivityDao; -import com.todoroo.astrid.gtasks.GtasksListService; -import com.todoroo.astrid.gtasks.GtasksMetadataService; -import com.todoroo.astrid.gtasks.GtasksPreferenceService; -import com.todoroo.astrid.gtasks.GtasksTaskListUpdater; -import com.todoroo.astrid.gtasks.sync.GtasksSyncService; import com.todoroo.astrid.service.SyncV2Service; import com.todoroo.astrid.service.TaskService; import com.todoroo.astrid.tags.TagService; import org.tasks.analytics.Tracker; -import org.tasks.billing.IabHelper; -import org.tasks.billing.IabResult; -import org.tasks.billing.Inventory; import org.tasks.filters.FilterCounter; import org.tasks.injection.ApplicationComponent; import org.tasks.injection.InjectingApplication; import org.tasks.preferences.Preferences; -import org.tasks.receivers.TeslaUnreadReceiver; import org.tasks.sync.SyncThrottle; import javax.inject.Inject; import timber.log.Timber; -import static org.tasks.preferences.BasicPreferences.toggleTasker; - @SuppressWarnings("UnusedDeclaration") -public class Tasks extends InjectingApplication implements IabHelper.OnIabSetupFinishedListener, IabHelper.QueryInventoryFinishedListener { +public class Tasks extends InjectingApplication { @Inject Database database; @Inject TaskDao taskDao; @@ -51,19 +38,13 @@ public class Tasks extends InjectingApplication implements IabHelper.OnIabSetupF @Inject TaskListMetadataDao taskListMetadataDao; @Inject TaskService taskService; @Inject SyncV2Service syncV2Service; - @Inject GtasksPreferenceService gtasksPreferenceService; - @Inject GtasksListService gtasksListService; - @Inject GtasksMetadataService gtasksMetadataService; - @Inject GtasksTaskListUpdater gtasksTaskListUpdater; - @Inject GtasksSyncService gtasksSyncService; @Inject TagService tagService; @Inject Broadcaster broadcaster; @Inject FilterCounter filterCounter; @Inject SyncThrottle syncThrottle; @Inject Preferences preferences; @Inject Tracker tracker; - @Inject TeslaUnreadReceiver teslaUnreadReceiver; - @Inject IabHelper iabHelper; + @Inject FlavorSetup flavorSetup; @Override public void onCreate() { @@ -77,40 +58,7 @@ public class Tasks extends InjectingApplication implements IabHelper.OnIabSetupF tracker.setTrackingEnabled(preferences.isTrackingEnabled()); - iabHelper.startSetup(this); - - teslaUnreadReceiver.setEnabled(preferences.getBoolean(R.string.p_tesla_unread_enabled, false)); - - try { - toggleTasker(this, preferences.getBoolean(R.string.p_tasker_enabled, false)); - } catch(Exception e) { - Timber.e(e, e.getMessage()); - tracker.reportException(e); - } - } - - @Override - public void onIabSetupFinished(IabResult result) { - if (result.isSuccess()) { - Timber.d("IAB setup successful"); - iabHelper.queryInventoryAsync(this); - } else { - Timber.e(result.getMessage()); - } - } - - @Override - public void onQueryInventoryFinished(IabResult result, Inventory inventory) { - if (result.isFailure()) { - Timber.e("Query inventory failed: %s", result); - } else { - if (inventory.hasPurchase(getString(R.string.sku_tesla_unread))) { - preferences.setBoolean(R.string.p_purchased_tesla_unread, false); - } - if (inventory.hasPurchase(getString(R.string.sku_tasker))) { - preferences.setBoolean(R.string.p_purchased_tasker, false); - } - } + flavorSetup.setup(); } private static class ErrorReportingTree extends Timber.Tree { diff --git a/src/main/java/org/tasks/injection/ActivityComponent.java b/src/main/java/org/tasks/injection/BaseActivityComponent.java similarity index 90% rename from src/main/java/org/tasks/injection/ActivityComponent.java rename to src/main/java/org/tasks/injection/BaseActivityComponent.java index d96a60e80..146c431f3 100644 --- a/src/main/java/org/tasks/injection/ActivityComponent.java +++ b/src/main/java/org/tasks/injection/BaseActivityComponent.java @@ -12,8 +12,6 @@ import com.todoroo.astrid.core.DefaultsPreferences; import com.todoroo.astrid.core.OldTaskPreferences; import com.todoroo.astrid.files.AACRecordingActivity; import com.todoroo.astrid.gcal.CalendarReminderActivity; -import com.todoroo.astrid.gtasks.GtasksPreferences; -import com.todoroo.astrid.gtasks.auth.GtasksLoginActivity; import com.todoroo.astrid.reminders.ReminderPreferences; import com.todoroo.astrid.service.UpgradeActivity; import com.todoroo.astrid.widget.WidgetConfigActivity; @@ -37,7 +35,6 @@ import org.tasks.activities.ResetPreferencesActivity; import org.tasks.activities.SortActivity; import org.tasks.activities.TimePickerActivity; import org.tasks.files.FileExplore; -import org.tasks.locale.ui.activity.TaskerSettingsActivity; import org.tasks.preferences.AppearancePreferences; import org.tasks.preferences.BackupPreferences; import org.tasks.preferences.BasicPreferences; @@ -49,13 +46,7 @@ import org.tasks.reminders.NotificationActivity; import org.tasks.reminders.SnoozeActivity; import org.tasks.voice.VoiceCommandActivity; -import javax.inject.Singleton; - -import dagger.Subcomponent; - -@Singleton -@Subcomponent(modules = ActivityModule.class) -public interface ActivityComponent { +public interface BaseActivityComponent { FragmentComponent plus(FragmentModule module); @@ -123,8 +114,6 @@ public interface ActivityComponent { void inject(VoiceCommandActivity voiceCommandActivity); - void inject(GtasksLoginActivity gtasksLoginActivity); - void inject(DonationActivity donationActivity); void inject(ClearGtaskDataActivity clearGtaskDataActivity); @@ -150,8 +139,4 @@ public interface ActivityComponent { void inject(DateShortcutPreferences dateShortcutPreferences); void inject(AppearancePreferences appearancePreferences); - - void inject(GtasksPreferences gtasksPreferences); - - void inject(TaskerSettingsActivity taskerSettingsActivity); } diff --git a/src/main/java/org/tasks/injection/BroadcastComponent.java b/src/main/java/org/tasks/injection/BaseBroadcastComponent.java similarity index 88% rename from src/main/java/org/tasks/injection/BroadcastComponent.java rename to src/main/java/org/tasks/injection/BaseBroadcastComponent.java index 6ff8d348c..d51701326 100644 --- a/src/main/java/org/tasks/injection/BroadcastComponent.java +++ b/src/main/java/org/tasks/injection/BaseBroadcastComponent.java @@ -15,12 +15,8 @@ import org.tasks.receivers.ListNotificationReceiver; import org.tasks.receivers.MyPackageReplacedReceiver; import org.tasks.receivers.RefreshReceiver; import org.tasks.receivers.TaskNotificationReceiver; -import org.tasks.receivers.TeslaUnreadReceiver; -import dagger.Subcomponent; - -@Subcomponent(modules = BroadcastModule.class) -public interface BroadcastComponent { +public interface BaseBroadcastComponent { void inject(TimerTaskCompleteListener timerTaskCompleteListener); @@ -49,6 +45,4 @@ public interface BroadcastComponent { void inject(BootCompletedReceiver bootCompletedReceiver); void inject(TasksWidget tasksWidget); - - void inject(TeslaUnreadReceiver teslaUnreadReceiver); } diff --git a/src/main/java/org/tasks/preferences/BaseBasicPreferences.java b/src/main/java/org/tasks/preferences/BaseBasicPreferences.java new file mode 100644 index 000000000..ccca9796a --- /dev/null +++ b/src/main/java/org/tasks/preferences/BaseBasicPreferences.java @@ -0,0 +1,66 @@ +package org.tasks.preferences; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.preference.Preference; +import android.preference.PreferenceScreen; + +import com.todoroo.astrid.core.OldTaskPreferences; +import com.todoroo.astrid.reminders.ReminderPreferences; + +import org.tasks.R; +import org.tasks.injection.InjectingPreferenceActivity; + +public abstract class BaseBasicPreferences extends InjectingPreferenceActivity { + + private static final String EXTRA_RESULT = "extra_result"; + private static final int RC_PREFS = 10001; + + private Bundle result; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + result = savedInstanceState == null ? new Bundle() : savedInstanceState.getBundle(EXTRA_RESULT); + + addPreferencesFromResource(R.xml.preferences); + addPreferencesFromResource(R.xml.preferences_addons); + addPreferencesFromResource(R.xml.preferences_privacy); + + setupActivity(R.string.EPr_appearance_header, AppearancePreferences.class); + setupActivity(R.string.notifications, ReminderPreferences.class); + setupActivity(R.string.EPr_manage_header, OldTaskPreferences.class); + } + + private void setupActivity(int key, final Class target) { + findPreference(getString(key)).setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + startActivityForResult(new Intent(BaseBasicPreferences.this, target), RC_PREFS); + return true; + } + }); + } + + @Override + protected void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + outState.putBundle(EXTRA_RESULT, result); + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == RC_PREFS) { + if (resultCode == Activity.RESULT_OK && data != null) { + result.putAll(data.getExtras()); + setResult(Activity.RESULT_OK, new Intent() {{ + putExtras(result); + }}); + } + } else { + super.onActivityResult(requestCode, resultCode, data); + } + } +} diff --git a/src/main/java/org/tasks/preferences/BasicPreferences.java b/src/main/java/org/tasks/preferences/BasicPreferences.java deleted file mode 100644 index 7082a002c..000000000 --- a/src/main/java/org/tasks/preferences/BasicPreferences.java +++ /dev/null @@ -1,160 +0,0 @@ -package org.tasks.preferences; - -import android.app.Activity; -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.pm.PackageManager; -import android.os.Bundle; -import android.preference.Preference; - -import com.todoroo.astrid.core.OldTaskPreferences; -import com.todoroo.astrid.reminders.ReminderPreferences; - -import org.tasks.BuildConfig; -import org.tasks.R; -import org.tasks.analytics.Tracker; -import org.tasks.billing.IabHelper; -import org.tasks.billing.IabResult; -import org.tasks.billing.Purchase; -import org.tasks.injection.ActivityComponent; -import org.tasks.injection.InjectingPreferenceActivity; -import org.tasks.receivers.TeslaUnreadReceiver; - -import javax.inject.Inject; - -public class BasicPreferences extends InjectingPreferenceActivity implements IabHelper.OnIabPurchaseFinishedListener { - - private static final String EXTRA_RESULT = "extra_result"; - private static final int RC_PREFS = 10001; - private static final int REQUEST_PURCHASE_TESLA_UNREAD = 10002; - private static final int REQUEST_PURCHASE_TASKER = 10003; - - private Bundle result; - - @Inject Tracker tracker; - @Inject TeslaUnreadReceiver teslaUnreadReceiver; - @Inject Preferences preferences; - @Inject IabHelper iabHelper; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - result = savedInstanceState == null ? new Bundle() : savedInstanceState.getBundle(EXTRA_RESULT); - - addPreferencesFromResource(R.xml.preferences); - if (!getResources().getBoolean(R.bool.sync_supported)) { - getPreferenceScreen().removePreference(findPreference(getString(R.string.synchronization))); - } - if (getResources().getBoolean(R.bool.google_play_store_available)) { - addPreferencesFromResource(R.xml.preferences_addons); - addPreferencesFromResource(R.xml.preferences_privacy); - - findPreference(getString(R.string.p_tesla_unread_enabled)).setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - if (newValue != null) { - if ((boolean) newValue && !preferences.getBoolean(R.string.p_purchased_tesla_unread, BuildConfig.DEBUG)) { - iabHelper.launchPurchaseFlow(BasicPreferences.this, getString(R.string.sku_tesla_unread), REQUEST_PURCHASE_TESLA_UNREAD, BasicPreferences.this); - } else { - teslaUnreadReceiver.setEnabled((boolean) newValue); - return true; - } - } - return false; - } - }); - - findPreference(getString(R.string.p_tasker_enabled)).setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - if (newValue != null) { - if ((boolean) newValue && !preferences.getBoolean(R.string.p_purchased_tasker, BuildConfig.DEBUG)) { - iabHelper.launchPurchaseFlow(BasicPreferences.this, getString(R.string.sku_tasker), REQUEST_PURCHASE_TASKER, BasicPreferences.this); - } else { - toggleTasker(BasicPreferences.this, (boolean) newValue); - return true; - } - } - return false; - } - }); - - findPreference(getString(R.string.p_collect_statistics)).setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - if (newValue != null) { - tracker.setTrackingEnabled((boolean) newValue); - return true; - } - return false; - } - }); - } - setupActivity(R.string.EPr_appearance_header, AppearancePreferences.class); - setupActivity(R.string.notifications, ReminderPreferences.class); - setupActivity(R.string.EPr_manage_header, OldTaskPreferences.class); - } - - public static void toggleTasker(Context context, boolean enabled) { - ComponentName componentName = new ComponentName(context, "com.twofortyfouram.locale.example.setting.toast.ui.activity.PluginActivity"); - int state = enabled ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DISABLED; - context.getPackageManager().setComponentEnabledSetting(componentName, state, PackageManager.DONT_KILL_APP); - } - - private void setupActivity(int key, final Class target) { - findPreference(getString(key)).setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { - @Override - public boolean onPreferenceClick(Preference preference) { - startActivityForResult(new Intent(BasicPreferences.this, target), RC_PREFS); - return true; - } - }); - } - - @Override - protected void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - outState.putBundle(EXTRA_RESULT, result); - } - - @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - if (requestCode == RC_PREFS) { - if (resultCode == Activity.RESULT_OK && data != null) { - result.putAll(data.getExtras()); - setResult(Activity.RESULT_OK, new Intent() {{ - putExtras(result); - }}); - } - } else if (requestCode == REQUEST_PURCHASE_TESLA_UNREAD || requestCode == REQUEST_PURCHASE_TASKER) { - iabHelper.handleActivityResult(requestCode, resultCode, data); - } else { - super.onActivityResult(requestCode, resultCode, data); - } - } - - @Override - public void inject(ActivityComponent component) { - component.inject(this); - } - - @Override - public void onIabPurchaseFinished(IabResult result, final Purchase info) { - if (result.isSuccess()) { - runOnUiThread(new Runnable() { - @Override - public void run() { - if (info.getSku().equals(getString(R.string.sku_tasker))) { - preferences.setBoolean(R.string.p_purchased_tasker, true); - findPreference(getString(R.string.p_tasker_enabled)).setEnabled(true); - } else if (info.getSku().equals(getString(R.string.sku_tesla_unread))) { - preferences.setBoolean(R.string.p_purchased_tesla_unread, true); - findPreference(getString(R.string.p_tesla_unread_enabled)).setEnabled(true); - } - } - }); - } - } -} diff --git a/src/main/java/org/tasks/preferences/DefaultFilterProvider.java b/src/main/java/org/tasks/preferences/DefaultFilterProvider.java index 7bdfd0c2f..5aa8656c8 100644 --- a/src/main/java/org/tasks/preferences/DefaultFilterProvider.java +++ b/src/main/java/org/tasks/preferences/DefaultFilterProvider.java @@ -3,6 +3,7 @@ package org.tasks.preferences; import android.content.Context; import android.content.res.Resources; +import com.google.common.base.Strings; import com.todoroo.astrid.actfm.TagViewFragment; import com.todoroo.astrid.api.CustomFilter; import com.todoroo.astrid.api.Filter;