Revert "Removed Nook and Amazon Market Strategies"

This reverts commit 5cc5dd9b0d.

Conflicts:
	astrid/src/com/todoroo/astrid/activity/EditPreferences.java
pull/14/head
Sam Bosley 12 years ago
parent 897a5dab81
commit 730aae9294

@ -104,6 +104,7 @@ import com.todoroo.astrid.data.UserActivityOutstanding;
import com.todoroo.astrid.gtasks.auth.ModernAuthManager;
import com.todoroo.astrid.helper.UUIDHelper;
import com.todoroo.astrid.service.AstridDependencyInjector;
import com.todoroo.astrid.service.MarketStrategy.AmazonMarketStrategy;
import com.todoroo.astrid.service.StatisticsConstants;
import com.todoroo.astrid.service.StatisticsService;
import com.todoroo.astrid.service.SyncV2Service;
@ -302,6 +303,8 @@ public class ActFmLoginActivity extends SherlockFragmentActivity {
loginButton.setReadPermissions(Arrays.asList("email", "offline_access"));
View googleLogin = findViewById(R.id.gg_login);
if(AmazonMarketStrategy.isKindleFire())
googleLogin.setVisibility(View.GONE);
googleLogin.setOnClickListener(googleListener);
View fbLogin = findViewById(R.id.fb_login_dummy);

@ -50,8 +50,10 @@ import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.data.TaskAttachment;
import com.todoroo.astrid.files.FileExplore;
import com.todoroo.astrid.gcal.CalendarStartupReceiver;
import com.todoroo.astrid.gtasks.GtasksPreferences;
import com.todoroo.astrid.helper.MetadataHelper;
import com.todoroo.astrid.service.AddOnService;
import com.todoroo.astrid.service.MarketStrategy.AmazonMarketStrategy;
import com.todoroo.astrid.service.StartupService;
import com.todoroo.astrid.service.StatisticsConstants;
import com.todoroo.astrid.service.StatisticsService;
@ -347,6 +349,10 @@ public class EditPreferences extends TodorooPreferenceActivity {
intent.setClassName(resolveInfo.activityInfo.packageName,
resolveInfo.activityInfo.name);
if (GtasksPreferences.class.getName().equals(resolveInfo.activityInfo.name)
&& AmazonMarketStrategy.isKindleFire())
continue;
Preference preference = new Preference(this);
preference.setTitle(resolveInfo.activityInfo.loadLabel(pm));
Bundle metadata = resolveInfo.activityInfo.metaData;

@ -59,8 +59,10 @@ import com.todoroo.astrid.api.FilterWithCustomIntent;
import com.todoroo.astrid.api.FilterWithUpdate;
import com.todoroo.astrid.data.RemoteModel;
import com.todoroo.astrid.helper.AsyncImageView;
import com.todoroo.astrid.service.MarketStrategy.NookMarketStrategy;
import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.tags.TagService;
import com.todoroo.astrid.utility.Constants;
import com.todoroo.astrid.utility.ResourceDrawableCache;
public class FilterAdapter extends ArrayAdapter<Filter> {
@ -112,6 +114,8 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
private FilterDataSourceChangedListener listener;
private final boolean nook;
// Previous solution involved a queue of filters and a filterSizeLoadingThread. The filterSizeLoadingThread had
// a few problems: how to make sure that the thread is resumed when the controlling activity is resumed, and
@ -141,6 +145,8 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
this.selectable = selectable;
this.filterCounts = new HashMap<Filter, Integer>();
this.nook = (Constants.MARKET_STRATEGY instanceof NookMarketStrategy);
if (activity instanceof AstridActivity && ((AstridActivity) activity).getFragmentLayout() != AstridActivity.LAYOUT_SINGLE)
filterStyle = R.style.TextAppearance_FLA_Filter_Tablet;
@ -505,7 +511,7 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
viewHolder.urlImage.setVisibility(View.GONE);
viewHolder.icon.setVisibility(View.GONE);
if(filter.listingIcon != null) {
if(!nook && filter.listingIcon != null) {
viewHolder.icon.setVisibility(View.VISIBLE);
viewHolder.icon.setImageBitmap(filter.listingIcon);
}
@ -548,7 +554,7 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
viewHolder.name.setTextColor(Color.GRAY);
viewHolder.name.getLayoutParams().height = (int) (58 * metrics.density);
if(filter instanceof FilterWithUpdate) {
if(!nook && filter instanceof FilterWithUpdate) {
String defaultImageId = RemoteModel.NO_UUID;
FilterWithUpdate fwu = (FilterWithUpdate) filter;
Bundle customExtras = fwu.customExtras;
@ -562,6 +568,11 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
viewHolder.urlImage.setUrl(((FilterWithUpdate)filter).imageUrl);
}
if (nook) {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) viewHolder.name.getLayoutParams();
params.setMargins((int) (8 * metrics.density), 0, 0, 0);
}
if (filter.color != 0)
viewHolder.name.setTextColor(filter.color);

@ -8,6 +8,8 @@ package com.todoroo.astrid.service;
import android.content.Intent;
import android.net.Uri;
import com.timsu.astrid.R;
public abstract class MarketStrategy {
/**
@ -94,4 +96,90 @@ public abstract class MarketStrategy {
}
public static class AmazonMarketStrategy extends MarketStrategy {
@Override
public Intent generateMarketLink(String packageName) {
return new Intent(Intent.ACTION_VIEW,
Uri.parse("http://www.amazon.com/gp/mas/dl/android?p=" + //$NON-NLS-1$
packageName));
}
@Override
public boolean includesLocalePlugin() {
return false;
}
/**
* @return true if the device is a kindle fire and needs special treatment
*/
public static boolean isKindleFire() {
return android.os.Build.MANUFACTURER.equals("Amazon") && //$NON-NLS-1$
android.os.Build.MODEL.contains("Kindle"); //$NON-NLS-1$
}
@Override
public int[] excludedSettings() {
return new int[] {
R.string.p_theme_widget,
R.string.p_voicePrefSection,
R.string.p_end_at_deadline,
R.string.p_field_missed_calls
};
}
@Override
public String strategyId() {
return "amazon_market"; //$NON-NLS-1$
}
}
public static class NookMarketStrategy extends MarketStrategy {
@Override
public Intent generateMarketLink(String packageName) {
return new Intent(Intent.ACTION_VIEW,
Uri.parse("market://search?q=pname:" + //$NON-NLS-1$
packageName));
}
@Override
public boolean includesLocalePlugin() {
return false;
}
@Override
public boolean allowIdeasTab() {
return false;
}
@Override
public int[] excludedSettings() {
return new int[] {
R.string.p_theme_widget,
R.string.p_voicePrefSection,
R.string.p_end_at_deadline,
R.string.p_field_missed_calls,
R.string.p_rmd_vibrate,
R.string.gcal_p_default,
R.string.p_theme_widget,
R.string.p_voiceInputEnabled,
R.string.p_voiceInputCreatesTask,
R.string.p_use_contact_picker
};
}
@Override
public boolean defaultPhoneLayout() {
return true;
}
@Override
public String strategyId() {
return "nook_market"; //$NON-NLS-1$
}
}
}

@ -32,7 +32,7 @@
</subant>
</target>
<target name="release-all" depends="clean,get-version,release,release-lite,release-nomarket">
<target name="release-all" depends="clean,get-version,release,release-lite,release-amazon,release-amazon-signed,release-nook,release-webmarket,release-nomarket">
<!-- custom builds -->
<for list="-other" param="name">
<sequential>
@ -44,6 +44,15 @@
</for>
</target>
<target name="release-amazon" depends="get-version">
<subant>
<fileset file="astrid/build.xml" />
<property name="custom.version.name" value=".1000" />
<property name="custom.market.strategy" value="AmazonMarketStrategy" />
<target name="unsigned-custom" />
</subant>
</target>
<target name="release-amazon-signed" depends="get-version">
<subant target="release-custom">
<fileset file="astrid/build.xml" />
@ -60,6 +69,14 @@
</subant>
</target>
<target name="release-nook" depends="get-version">
<subant target="release-custom">
<fileset file="astrid/build.xml" />
<property name="custom.version.name" value="-nook" />
<property name="custom.market.strategy" value="NookMarketStrategy" />
</subant>
</target>
<target name="release-lite" depends="get-version">
<subant target="release-lite">
<fileset file="astrid/build.xml" />

Loading…
Cancel
Save