Add Amazon build flavor

pull/384/head
Alex Baker 9 years ago
parent 4f4b83bde3
commit 6410570d84

@ -68,6 +68,7 @@ android {
productFlavors {
generic
googleplay
amazon
}
}
@ -103,6 +104,8 @@ dependencies {
googleplayCompile 'com.google.apis:google-api-services-tasks:v1-rev43-1.21.0'
googleplayCompile 'com.google.api-client:google-api-client-android:1.21.0'
amazonCompile 'com.google.android.gms:play-services-analytics:8.4.0'
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
androidTestCompile 'com.natpryce:make-it-easy:4.0.0'
}

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.tasks">
<application>
<!-- Google Analytics -->
<receiver
android:name="com.google.android.gms.analytics.AnalyticsReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.analytics.AnalyticsService"
android:enabled="true"
android:exported="false" />
<receiver
android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<service android:name="com.google.android.gms.analytics.CampaignTrackingService" />
</application>
</manifest>

@ -0,0 +1,23 @@
package com.todoroo.astrid.gtasks;
import com.todoroo.astrid.api.Filter;
import java.util.Collections;
import java.util.List;
import javax.inject.Inject;
public class GtasksFilterExposer {
@Inject
public GtasksFilterExposer() {
}
public List<Filter> getFilters() {
return Collections.emptyList();
}
public Filter getFilter(long aLong) {
return null;
}
}

@ -0,0 +1,13 @@
package com.todoroo.astrid.gtasks;
import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.api.GtasksFilter;
import com.todoroo.astrid.subtasks.SubtasksListFragment;
public class GtasksListFragment extends SubtasksListFragment {
public static final String TOKEN_STORE_ID = "storeId";
public static TaskListFragment newGtasksListFragment(GtasksFilter gtasksFilter, GtasksList list) {
return null;
}
}

@ -0,0 +1,22 @@
package com.todoroo.astrid.gtasks;
import java.util.Collections;
import java.util.List;
import javax.inject.Inject;
public class GtasksListService {
@Inject
public GtasksListService() {
}
public List<GtasksList> getLists() {
return Collections.emptyList();
}
public GtasksList getList(long storeId) {
return null;
}
}

@ -0,0 +1,30 @@
package com.todoroo.astrid.gtasks.sync;
import com.todoroo.astrid.gtasks.GtasksList;
import com.todoroo.astrid.sync.SyncResultCallback;
import javax.inject.Inject;
public class GtasksSyncV2Provider {
@Inject
public GtasksSyncV2Provider() {
}
public boolean isActive() {
return false;
}
public void synchronizeActiveTasks(SyncResultCallback callback) {
}
public void synchronizeList(GtasksList list, SyncResultCallback callback) {
}
public void clearCompleted(GtasksList list, SyncResultCallback callback) {
}
}

@ -0,0 +1,21 @@
package org.tasks;
import java.util.Collections;
import java.util.List;
import javax.inject.Inject;
public class AccountManager {
@Inject
public AccountManager() {
}
public List<String> getAccounts() {
return Collections.emptyList();
}
public boolean hasAccount(String account) {
return false;
}
}

@ -0,0 +1,14 @@
package org.tasks;
import javax.inject.Inject;
public class FlavorSetup {
@Inject
public FlavorSetup() {
}
public void setup() {
}
}

@ -0,0 +1,10 @@
package org.tasks.activities;
import javax.inject.Inject;
public class ClearGtaskDataActivity {
@Inject
public ClearGtaskDataActivity() {
}
}

@ -0,0 +1,61 @@
package org.tasks.analytics;
import android.content.Context;
import com.google.android.gms.analytics.GoogleAnalytics;
import com.google.android.gms.analytics.HitBuilders;
import com.google.android.gms.analytics.StandardExceptionParser;
import org.tasks.BuildConfig;
import org.tasks.R;
import org.tasks.injection.ForApplication;
import javax.inject.Inject;
import javax.inject.Singleton;
@Singleton
public class Tracker {
private final GoogleAnalytics analytics;
private final com.google.android.gms.analytics.Tracker tracker;
private final StandardExceptionParser exceptionParser;
private Context context;
@Inject
public Tracker(@ForApplication Context context) {
this.context = context;
analytics = GoogleAnalytics.getInstance(context);
tracker = analytics.newTracker(R.xml.google_analytics);
tracker.setAppVersion(Integer.toString(BuildConfig.VERSION_CODE));
exceptionParser = new StandardExceptionParser(context, null);
if (BuildConfig.DEBUG) {
analytics.setDryRun(true);
}
}
public void showScreen(String screenName) {
tracker.setScreenName(screenName);
tracker.send(new HitBuilders.ScreenViewBuilder().build());
}
public void setTrackingEnabled(boolean enabled) {
analytics.setAppOptOut(!enabled);
}
public void reportException(Exception e) {
tracker.send(new HitBuilders.ExceptionBuilder()
.setDescription(exceptionParser.getDescription(Thread.currentThread().getName(), e))
.setFatal(false)
.build());
}
public void reportEvent(Tracking.Events event) {
HitBuilders.EventBuilder eventBuilder = new HitBuilders.EventBuilder()
.setCategory(context.getString(event.category))
.setAction(context.getString(event.action));
if (event.label > 0) {
eventBuilder.setLabel(context.getString(event.label));
}
tracker.send(eventBuilder.build());
}
}

@ -0,0 +1,10 @@
package org.tasks.dialogs;
import javax.inject.Inject;
public class AccountSelectionDialog {
@Inject
public AccountSelectionDialog() {
}
}

@ -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 {
}

@ -0,0 +1,8 @@
package org.tasks.injection;
import dagger.Subcomponent;
@Subcomponent(modules = BroadcastModule.class)
public interface BroadcastComponent extends BaseBroadcastComponent {
}

@ -0,0 +1,8 @@
package org.tasks.injection;
import dagger.Subcomponent;
@Subcomponent(modules = ServiceModule.class)
public interface ServiceComponent extends BaseServiceComponent {
}

@ -0,0 +1,26 @@
package org.tasks.location;
import java.util.List;
import javax.inject.Inject;
@SuppressWarnings("EmptyMethod")
public class GeofenceApi {
@Inject
public GeofenceApi() {
}
public void register(List<Geofence> activeGeofences) {
}
public void cancel(Geofence geofence) {
}
public void cancel(List<Geofence> geofences) {
}
}

@ -0,0 +1,5 @@
package org.tasks.location;
public class GeofenceTransitionsIntentService {
}

@ -0,0 +1,17 @@
package org.tasks.location;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import org.tasks.preferences.Preferences;
public class PlacePicker {
public static Intent getIntent(Activity activity) {
return null;
}
public static Geofence getPlace(Context context, Intent data, Preferences preferences) {
return null;
}
}

@ -0,0 +1,21 @@
package org.tasks.preferences;
import android.os.Bundle;
import org.tasks.R;
import org.tasks.injection.ActivityComponent;
public class BasicPreferences extends BaseBasicPreferences {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requires(false, R.string.synchronization, R.string.get_plugins);
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
}

@ -0,0 +1,10 @@
package org.tasks.scheduling;
import javax.inject.Inject;
public class GtasksBackgroundService {
@Inject
public GtasksBackgroundService() {
}
}

@ -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 {
}

@ -26,7 +26,7 @@ public class Tracker {
public Tracker(@ForApplication Context context) {
this.context = context;
analytics = GoogleAnalytics.getInstance(context);
tracker = analytics.newTracker(R.xml.analytics);
tracker = analytics.newTracker(R.xml.google_analytics);
tracker.setAppVersion(Integer.toString(BuildConfig.VERSION_CODE));
exceptionParser = new StandardExceptionParser(context, null);
if (BuildConfig.DEBUG) {

@ -4,12 +4,10 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceCategory;
import android.preference.TwoStatePreference;
import org.tasks.BuildConfig;
import org.tasks.R;
import org.tasks.analytics.Tracker;
import org.tasks.billing.PurchaseHelper;
import org.tasks.billing.PurchaseHelperCallback;
import org.tasks.dialogs.DialogBuilder;
@ -32,7 +30,6 @@ public class BasicPreferences extends BaseBasicPreferences implements PurchaseHe
private static final int REQUEST_PURCHASE = 10005;
@Inject Tracker tracker;
@Inject TeslaUnreadReceiver teslaUnreadReceiver;
@Inject Preferences preferences;
@Inject PurchaseHelper purchaseHelper;
@ -100,17 +97,6 @@ public class BasicPreferences extends BaseBasicPreferences implements PurchaseHe
}
});
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;
}
});
if (BuildConfig.DEBUG) {
addPreferencesFromResource(R.xml.preferences_debug);

@ -1,5 +1,6 @@
package org.tasks;
import android.content.res.Configuration;
import android.util.Log;
import com.todoroo.astrid.dao.Database;
@ -61,6 +62,16 @@ public class Tasks extends InjectingApplication {
flavorSetup.setup();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (BuildConfig.DEBUG) {
Timber.d("current screen width: %s, smallest screen width: %s", newConfig.screenWidthDp, newConfig.smallestScreenWidthDp);
}
}
private static class ErrorReportingTree extends Timber.Tree {
@Override
protected void log(int priority, String tag, String message, Throwable t) {

@ -4,19 +4,22 @@ 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.analytics.Tracker;
import org.tasks.injection.InjectingPreferenceActivity;
import javax.inject.Inject;
public abstract class BaseBasicPreferences extends InjectingPreferenceActivity {
private static final String EXTRA_RESULT = "extra_result";
private static final int RC_PREFS = 10001;
@Inject Tracker tracker;
private Bundle result;
@Override
@ -29,6 +32,17 @@ public abstract class BaseBasicPreferences extends InjectingPreferenceActivity {
addPreferencesFromResource(R.xml.preferences_addons);
addPreferencesFromResource(R.xml.preferences_privacy);
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);

@ -4,7 +4,6 @@
** See the file "LICENSE" for the full license governing this code.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/taskEditParent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/taskEditParent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="?attr/asContentBackground"

@ -16,6 +16,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:layout_marginBottom="5dip"
android:paddingLeft="@dimen/keyline_first"
android:paddingStart="@dimen/keyline_first"
android:paddingEnd="@dimen/keyline_first"
android:paddingRight="@dimen/keyline_first">
@ -25,8 +27,6 @@
android:layout_height="wrap_content"
android:scaleType="center"
android:gravity="center"
android:paddingLeft="@dimen/keyline_first"
android:paddingStart="@dimen/keyline_first"
android:paddingRight="@dimen/keyline_second"
android:paddingEnd="@dimen/keyline_second"
android:layout_centerVertical="true" />

@ -1,12 +1,11 @@
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tasks="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_height="wrap_content"
android:background="?attr/asAbBackgroundColor"
android:paddingEnd="@dimen/toolbar_horizontal_padding"
android:paddingRight="@dimen/toolbar_horizontal_padding"
android:elevation="@dimen/elevation_toolbar"
tasks:popupTheme="?attr/popup_theme"
tasks:theme="@style/ActionBarThemeOverlay"
tasks:titleTextAppearance="@style/ActionBar.TitleText" />
app:toolbarStyle="@style/Toolbar"
app:popupTheme="?attr/popup_theme"
app:theme="@style/ActionBarThemeOverlay"
app:titleTextAppearance="@style/ActionBar.TitleText" />

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="keyline_first">24dp</dimen>
<dimen name="toolbar_horizontal_padding">12dp</dimen>
<dimen name="keyline_second_absolute">68dp</dimen>
<dimen name="keyline_content_inset">68dp</dimen>
</resources>

@ -2,9 +2,8 @@
<resources>
<dimen name="navigation_drawer_width">260dp</dimen>
<dimen name="keyline_first">16dp</dimen>
<dimen name="keyline_second">20dp</dimen>
<dimen name="keyline_second_absolute">60dp</dimen>
<dimen name="toolbar_horizontal_padding">4dp</dimen>
<dimen name="keyline_second">20dp</dimen> <!-- 16dp + toolbar title margin -->
<dimen name="keyline_content_inset">60dp</dimen>
<dimen name="widget_margin">0dp</dimen>
<dimen name="task_list_footer_height">88dp</dimen>

@ -11,6 +11,8 @@
<item name="android:textColor">#fff</item>
</style>
<style name="Toolbar" parent="@style/Widget.AppCompat.Toolbar" />
<style name="TextBoxText">
<item name="android:textColor">?attr/asTextColor</item>
</style>
@ -66,8 +68,8 @@
</style>
<style name="task_edit_row_divider">
<item name="android:layout_marginLeft">@dimen/keyline_second_absolute</item>
<item name="android:layout_marginStart">@dimen/keyline_second_absolute</item>
<item name="android:layout_marginLeft">@dimen/keyline_content_inset</item>
<item name="android:layout_marginStart">@dimen/keyline_content_inset</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">1px</item>
<item name="android:background">?attr/task_edit_divider</item>

Loading…
Cancel
Save