Lots of styling on the billing page

pull/14/head
Sam Bosley 13 years ago
parent 85c17a53f2
commit 4fb0cace8a

@ -2,26 +2,18 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#aaa"
android:orientation="vertical" >
<TextView
android:id="@+id/premium_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="24dip"
android:text="@string/premium_billing_title" />
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/premium_description_holder"
android:layout_width="wrap_content"
android:layout_height="0dip"
android:layout_weight="1"
android:background="@drawable/post_it"
android:orientation="vertical"
android:paddingRight="30dip"
android:paddingLeft="30dip"
android:paddingTop="30dip"
android:paddingRight="5dip"
android:paddingLeft="5dip"
android:paddingTop="15dip"
android:paddingBottom="70dip" >
<TextView
@ -31,129 +23,40 @@
android:layout_marginBottom="16dip"
android:gravity="left"
android:text="@string/premium_description_header"
android:textColor="@color/dark_blue_theme_color"
android:textSize="24dip" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_height="15dip"
android:layout_width="15dip"
android:src="@drawable/icn_premium_checkmark"
android:layout_gravity="top|left"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="left"
android:text="@string/premium_description_1"
android:layout_marginBottom="12dip"
style="@style/TextAppearance.Premium_Billing"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_height="15dip"
android:layout_width="15dip"
android:src="@drawable/icn_premium_checkmark"
android:layout_gravity="top|left"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="left"
android:text="@string/premium_description_2"
android:layout_marginBottom="12dip"
style="@style/TextAppearance.Premium_Billing"/>
</LinearLayout>
<LinearLayout
android:textColor="#404040"
android:paddingLeft="15dip"
android:textSize="24dip"
android:textStyle="bold" />
<WebView
android:id="@+id/premium_bullets"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_height="15dip"
android:layout_width="15dip"
android:src="@drawable/icn_premium_checkmark"
android:layout_gravity="top|left"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="left"
android:text="@string/premium_description_3"
android:layout_marginBottom="12dip"
style="@style/TextAppearance.Premium_Billing"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_height="15dip"
android:layout_width="15dip"
android:src="@drawable/icn_premium_checkmark"
android:layout_gravity="top|left"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="left"
android:text="@string/premium_description_4"
android:layout_marginBottom="12dip"
style="@style/TextAppearance.Premium_Billing"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_height="15dip"
android:layout_width="15dip"
android:src="@drawable/icn_premium_checkmark"
android:layout_gravity="top|left"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="left"
android:text="@string/premium_description_5"
android:layout_marginBottom="12dip"
style="@style/TextAppearance.Premium_Billing"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_height="15dip"
android:layout_width="15dip"
android:src="@drawable/icn_premium_checkmark"
android:layout_gravity="top|left"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="left"
android:text="@string/premium_description_6"
android:layout_marginBottom="12dip"
style="@style/TextAppearance.Premium_Billing"/>
</LinearLayout>
android:layout_height="fill_parent"
android:textSize="20dip" />
</LinearLayout>
<include layout="@layout/astrid_speech_bubble"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:orientation="horizontal"
android:gravity="center_vertical"
android:background="@android:color/white">
<Button
android:id="@+id/premium_buy_month"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:layout_marginBottom="15dip"
android:layout_marginTop="0dip"
android:layout_marginLeft="8dip"
android:layout_marginRight="8dip"
android:layout_marginBottom="8dip"
android:layout_marginTop="8dip"
android:layout_weight="1"
android:background="@drawable/bluebutton"
android:background="#707070"
android:textColor="@android:color/white"
android:textStyle="bold"
android:textSize="24sp"
android:text="@string/premium_buy_month"
android:gravity="center"/>
@ -161,12 +64,15 @@
android:id="@+id/premium_buy_year"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:layout_marginBottom="15dip"
android:layout_marginTop="0dip"
android:layout_marginLeft="8dip"
android:layout_marginRight="8dip"
android:layout_marginBottom="8dip"
android:layout_marginTop="8dip"
android:layout_weight="1"
android:background="@drawable/bluebutton"
android:background="?attr/asThemeTextColor"
android:textColor="@android:color/white"
android:textSize="24sp"
android:textStyle="bold"
android:text="@string/premium_buy_year"
android:gravity="center" />

@ -312,7 +312,8 @@
<string name="actfm_account_basic">Basic</string>
<string name="actfm_account_none">None</string>
<string name="actfm_inapp_billing">In App Billing</string>
<string name="actfm_inapp_billing">Upgrade to Premium</string>
<string name="actfm_inapp_billing_summary">Attach files, voice backups, premium support &amp; more</string>
</resources>

@ -80,15 +80,16 @@
<string name="subscriptions_help_url" formatted="false">http://market.android.com/support/bin/answer.py?answer=1050566&amp;hl=%lang%&amp;dl=%region%</string>
<string name="premium_billing_title">Astrid Premium</string>
<string name="premium_buy_month">$4.99\n1 month</string>
<string name="premium_buy_year">$39.99\n1 year</string>
<string name="premium_description_header">Do more with Astrid!</string>
<string name="premium_buy_month">1 Month</string>
<string name="premium_buy_year">1 Year</string>
<string name="premium_description_header">Do more with Astrid Premium!</string>
<string name="premium_description_1">Attach files to to-dos (pdfs, doc, ppt…)</string>
<string name="premium_description_2">Syncs files with astrid.com</string>
<string name="premium_description_3">Turn emails with attachments into tasks</string>
<string name="premium_description_4">Save voice notes as audio files</string>
<string name="premium_description_5">Preview upcoming features</string>
<string name="premium_description_6">Support the Astrid Team!</string>
<string name="premium_speech_bubble">Premium will power up your productivity! Order one year and save 25%!</string>
<string name="premium_already_subscribed">You are already subscribed to Astrid Premium!</string>
<string name="premium_login_prompt">You need to have an Astrid.com account in order to subscribe to premium. Please log in or sign up.</string>
<string name="premium_success">Thanks for subscribing to Astrid Premium!</string>

@ -26,7 +26,8 @@
<PreferenceScreen
android:key="@string/actfm_inapp_billing"
android:title="@string/actfm_inapp_billing"/>
android:title="@string/actfm_inapp_billing"
android:summary="@string/actfm_inapp_billing_summary"/>
<PreferenceCategory
android:key="@string/sync_SPr_key_options"

@ -2,7 +2,6 @@ package com.todoroo.astrid.billing;
import java.util.Locale;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
@ -10,10 +9,14 @@ import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.ActionBar;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.TextView;
import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired;
@ -21,9 +24,10 @@ import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.service.ThemeService;
import com.todoroo.astrid.utility.Constants;
public class BillingActivity extends Activity {
public class BillingActivity extends FragmentActivity {
private static final int DIALOG_CANNOT_CONNECT_ID = 1;
private static final int DIALOG_BILLING_NOT_SUPPORTED_ID = 2;
@ -40,12 +44,17 @@ public class BillingActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
ThemeService.applyTheme(this);
DependencyInjectionService.getInstance().inject(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.billing_activity);
setupActionBar();
setupButtons();
setupText();
handler = new Handler();
billingService = new BillingService();
billingService.setContext(this);
@ -70,6 +79,16 @@ public class BillingActivity extends Activity {
}
private void setupActionBar() {
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setCustomView(R.layout.header_title_view);
((TextView) actionBar.getCustomView().findViewById(R.id.title)).setText(R.string.premium_billing_title);
}
@Override
protected void onStart() {
super.onStart();
@ -93,13 +112,13 @@ public class BillingActivity extends Activity {
super.onResume();
if (!actFmPreferenceService.isLoggedIn()) {
// Prompt to log in
DialogUtilities.okDialog(this, getString(R.string.premium_login_prompt),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
// DialogUtilities.okDialog(this, getString(R.string.premium_login_prompt),
// new DialogInterface.OnClickListener() {
// @Override
// public void onClick(DialogInterface dialog, int which) {
// finish();
// }
// });
} else if (!billingService.checkBillingSupported(BillingConstants.ITEM_TYPE_SUBSCRIPTION)) {
showDialog(DIALOG_SUBSCRIPTIONS_NOT_SUPPORTED_ID);
} else if (ActFmPreferenceService.isPremiumUser()) {
@ -140,6 +159,29 @@ public class BillingActivity extends Activity {
});
}
@SuppressWarnings("nls")
private void setupText() {
int[] bullets = new int[] { R.string.premium_description_1, R.string.premium_description_2, R.string.premium_description_3,
R.string.premium_description_4, R.string.premium_description_5, R.string.premium_description_6
};
StringBuilder builder = new StringBuilder("<html><body><ul>");
for(int item : bullets)
builder.append("<li><font style='color=#404040; font-size: 18px'>").append(getString(item)).append("</font></li>\n");
builder.append("</ul></body></html>");
WebView list = (WebView) findViewById(R.id.premium_bullets);
list.loadDataWithBaseURL("file:///android_asset/", builder.toString(), "text/html", "utf-8", null);
list.setBackgroundColor(0);
View speechBubbleBackground = findViewById(R.id.speech_bubble_container);
speechBubbleBackground.setBackgroundColor(0);
TextView speechBubble = (TextView) findViewById(R.id.reminder_message);
speechBubble.setText(R.string.premium_speech_bubble);
}
/**
* Replaces the language and/or country of the device into the given string.
* The pattern "%lang%" will be replaced by the device's language code and

Loading…
Cancel
Save