Merge pull request #79 from sbosley/rebase-mania

New user experience with login prompt and welcome graphic
pull/14/head
sbosley 13 years ago
commit 3c012b4d1d

@ -122,20 +122,8 @@ public class DialogUtilities {
public static void okCancelDialog(final Activity activity, final String title, public static void okCancelDialog(final Activity activity, final String title,
final String text, final DialogInterface.OnClickListener okListener, final String text, final DialogInterface.OnClickListener okListener,
final DialogInterface.OnClickListener cancelListener) { final DialogInterface.OnClickListener cancelListener) {
if(activity.isFinishing())
return;
tryOnUiThread(activity, new Runnable() { okCancelCustomDialog(activity, title, text, android.R.string.ok, android.R.string.cancel, okListener, cancelListener);
public void run() {
new AlertDialog.Builder(activity)
.setTitle(title)
.setMessage(text)
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton(android.R.string.ok, okListener)
.setNegativeButton(android.R.string.cancel, cancelListener)
.show().setOwnerActivity(activity);
}
});
} }
/** /**
@ -149,6 +137,19 @@ public class DialogUtilities {
public static void okCancelDialog(final Activity activity, final String text, public static void okCancelDialog(final Activity activity, final String text,
final DialogInterface.OnClickListener okListener, final DialogInterface.OnClickListener okListener,
final DialogInterface.OnClickListener cancelListener) { final DialogInterface.OnClickListener cancelListener) {
okCancelCustomDialog(activity, activity.getString(R.string.DLG_confirm_title), text, android.R.string.ok, android.R.string.cancel, okListener, cancelListener);
}
/**
* Displays a dialog box with custom titled OK and cancel button titles
*/
public static void okCancelCustomDialog(final Activity activity, final String title, final String text,
final int okTitleId, final int cancelTitleId,
final DialogInterface.OnClickListener okListener,
final DialogInterface.OnClickListener cancelListener) {
if(activity.isFinishing()) if(activity.isFinishing())
return; return;
@ -157,9 +158,10 @@ public class DialogUtilities {
new AlertDialog.Builder(activity) new AlertDialog.Builder(activity)
.setTitle(R.string.DLG_confirm_title) .setTitle(R.string.DLG_confirm_title)
.setMessage(text) .setMessage(text)
.setTitle(title)
.setIcon(android.R.drawable.ic_dialog_alert) .setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton(android.R.string.ok, okListener) .setPositiveButton(okTitleId, okListener)
.setNegativeButton(android.R.string.cancel, cancelListener) .setNegativeButton(cancelTitleId, cancelListener)
.show().setOwnerActivity(activity); .show().setOwnerActivity(activity);
} }
}); });

@ -73,13 +73,16 @@
<!-- ====================================================== Activities = --> <!-- ====================================================== Activities = -->
<!-- Activity that displays task list --> <!-- Activity that displays task list -->
<activity android:name="com.todoroo.astrid.welcome.WelcomeScreen" <activity android:name="com.todoroo.astrid.welcome.WelcomeLogin"
android:windowSoftInputMode="stateHidden"> android:windowSoftInputMode="stateHidden">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="com.todoroo.astrid.welcome.WelcomeScreen"
android:windowSoftInputMode="stateHidden">
</activity>
<activity android:name="com.todoroo.astrid.activity.TaskListActivity" <activity android:name="com.todoroo.astrid.activity.TaskListActivity"
android:windowSoftInputMode="stateHidden"> android:windowSoftInputMode="stateHidden">
<intent-filter> <intent-filter>

@ -35,15 +35,10 @@ import android.app.AlertDialog;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color;
import android.graphics.PixelFormat; import android.graphics.PixelFormat;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.method.PasswordTransformationMethod; import android.text.method.PasswordTransformationMethod;
import android.text.style.ClickableSpan;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.WindowManager; import android.view.WindowManager;
@ -72,7 +67,6 @@ import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.sync.ActFmInvoker; import com.todoroo.astrid.actfm.sync.ActFmInvoker;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService; import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.actfm.sync.ActFmSyncProvider; import com.todoroo.astrid.actfm.sync.ActFmSyncProvider;
import com.todoroo.astrid.activity.TaskListActivity;
import com.todoroo.astrid.gtasks.auth.ModernAuthManager; import com.todoroo.astrid.gtasks.auth.ModernAuthManager;
import com.todoroo.astrid.service.AstridDependencyInjector; import com.todoroo.astrid.service.AstridDependencyInjector;
import com.todoroo.astrid.service.StatisticsService; import com.todoroo.astrid.service.StatisticsService;
@ -88,45 +82,52 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
public static final String APP_ID = "183862944961271"; //$NON-NLS-1$ public static final String APP_ID = "183862944961271"; //$NON-NLS-1$
@Autowired ExceptionService exceptionService; @Autowired protected ExceptionService exceptionService;
@Autowired TaskService taskService; @Autowired protected TaskService taskService;
@Autowired ActFmPreferenceService actFmPreferenceService; @Autowired protected ActFmPreferenceService actFmPreferenceService;
private final ActFmInvoker actFmInvoker = new ActFmInvoker(); private final ActFmInvoker actFmInvoker = new ActFmInvoker();
private Facebook facebook; private Facebook facebook;
private AsyncFacebookRunner facebookRunner; private AsyncFacebookRunner facebookRunner;
private TextView errors; private TextView errors;
private boolean noSync = false; protected boolean noSync = false;
// True if this screen was shown as part of new user experience
private boolean shownFromWelcome = false;
// --- ui initialization // --- ui initialization
private static final int REQUEST_CODE_GOOGLE_ACCOUNTS = 1; private static final int REQUEST_CODE_GOOGLE_ACCOUNTS = 1;
private static final int REQUEST_CODE_OAUTH = 2; private static final int REQUEST_CODE_OAUTH = 2;
public static final String KEY_SHOW_LATER_BUTTON = "actfm_login_show_later";
static { static {
AstridDependencyInjector.initialize(); AstridDependencyInjector.initialize();
} }
public static final String EXTRA_DO_NOT_SYNC = "nosync"; //$NON-NLS-1$ public static final String EXTRA_DO_NOT_SYNC = "nosync"; //$NON-NLS-1$
protected int getContentViewResource() {
return R.layout.actfm_login_activity;
}
protected int getTitleResource() {
return R.string.actfm_ALA_title;
}
public ActFmLoginActivity() { public ActFmLoginActivity() {
super(); super();
DependencyInjectionService.getInstance().inject(this); DependencyInjectionService.getInstance().inject(this);
} }
protected void finishAndShowNext() {
finish();
}
@SuppressWarnings("nls") @SuppressWarnings("nls")
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
ContextManager.setContext(this); ContextManager.setContext(this);
setContentView(R.layout.actfm_login_activity); setContentView(getContentViewResource());
setTitle(R.string.actfm_ALA_title); setTitle(getTitleResource());
noSync = getIntent().getBooleanExtra(EXTRA_DO_NOT_SYNC, false); noSync = getIntent().getBooleanExtra(EXTRA_DO_NOT_SYNC, false);
@ -151,18 +152,12 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
setResult(RESULT_CANCELED); setResult(RESULT_CANCELED);
} }
private void initializeUI() { protected void initializeUI() {
shownFromWelcome = getIntent().getBooleanExtra(KEY_SHOW_LATER_BUTTON, false);
if (shownFromWelcome) {
Button loginLater = (Button)findViewById(R.id.login_later);
loginLater.setVisibility(View.VISIBLE);
loginLater.setOnClickListener(loginLaterListener);
}
findViewById(R.id.gg_login).setOnClickListener(googleListener); findViewById(R.id.gg_login).setOnClickListener(googleListener);
TextView pwLogin = (TextView) findViewById(R.id.pw_login); Button pwLogin = (Button) findViewById(R.id.pw_login);
pwLogin.setOnClickListener(signUpListener); pwLogin.setOnClickListener(signUpListener);
String pwLoginBase = getString(R.string.actfm_ALA_pw_login); /*String pwLoginBase = getString(R.string.actfm_ALA_pw_login);
SpannableString link = new SpannableString(String.format("%s %s", //$NON-NLS-1$ SpannableString link = new SpannableString(String.format("%s %s", //$NON-NLS-1$
pwLoginBase, getString(R.string.actfm_ALA_pw_link))); pwLoginBase, getString(R.string.actfm_ALA_pw_link)));
ClickableSpan linkSpan = new ClickableSpan() { ClickableSpan linkSpan = new ClickableSpan() {
@ -175,31 +170,15 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
ds.setUnderlineText(true); ds.setUnderlineText(true);
ds.setColor(Color.rgb(255, 96, 0)); ds.setColor(Color.rgb(255, 96, 0));
} }
}; };
link.setSpan(linkSpan, pwLoginBase.length() + 1, link.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); link.setSpan(linkSpan, pwLoginBase.length() + 1, link.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
pwLogin.setText(link); pwLogin.setText(link);//*/
} }
// --- event handler // --- event handler
private final OnClickListener loginLaterListener = new OnClickListener() { protected final OnClickListener googleListener = new OnClickListener() {
@Override
public void onClick(View arg0) {
String confirmLater = ActFmLoginActivity.this.getString(R.string.actfm_ALA_confirm_later_dialog);
DialogUtilities.okCancelDialog(ActFmLoginActivity.this, confirmLater, confirmLaterListener, null);
}
private final DialogInterface.OnClickListener confirmLaterListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent taskListStartup = new Intent(ActFmLoginActivity.this, TaskListActivity.class);
ActFmLoginActivity.this.startActivity(taskListStartup);
ActFmLoginActivity.this.finish();
}
};
};
private final OnClickListener googleListener = new OnClickListener() {
@Override @Override
@SuppressWarnings("nls") @SuppressWarnings("nls")
public void onClick(View arg0) { public void onClick(View arg0) {
@ -216,7 +195,7 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
} }
}; };
private final OnClickListener signUpListener = new OnClickListener() { protected final OnClickListener signUpListener = new OnClickListener() {
@Override @Override
public void onClick(View arg0) { public void onClick(View arg0) {
final LinearLayout body = new LinearLayout(ActFmLoginActivity.this); final LinearLayout body = new LinearLayout(ActFmLoginActivity.this);
@ -381,7 +360,7 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
} }
@SuppressWarnings("nls") @SuppressWarnings("nls")
private void postAuthenticate(JSONObject result, String token) { protected void postAuthenticate(JSONObject result, String token) {
actFmPreferenceService.setToken(token); actFmPreferenceService.setToken(token);
Preferences.setLong(ActFmPreferenceService.PREF_USER_ID, Preferences.setLong(ActFmPreferenceService.PREF_USER_ID,
@ -391,11 +370,7 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
Preferences.setString(ActFmPreferenceService.PREF_PICTURE, result.optString("picture")); Preferences.setString(ActFmPreferenceService.PREF_PICTURE, result.optString("picture"));
setResult(RESULT_OK); setResult(RESULT_OK);
if (shownFromWelcome) { finishAndShowNext();
Intent taskListStartup = new Intent(ActFmLoginActivity.this, TaskListActivity.class);
this.startActivity(taskListStartup);
}
finish();
if(!noSync) { if(!noSync) {
new ActFmSyncProvider().synchronize(this); new ActFmSyncProvider().synchronize(this);

@ -24,7 +24,7 @@ public class NotesDecorationExposer implements TaskDecorationExposer {
@Override @Override
public TaskDecoration expose(Task task) { public TaskDecoration expose(Task task) {
if(Preferences.getBoolean(R.string.p_showNotes, false)) if(Preferences.getBoolean(R.string.p_showNotes, true))
return null; return null;
if(task == null || !NotesPlugin.hasNotes(task)) if(task == null || !NotesPlugin.hasNotes(task))
return null; return null;

@ -49,7 +49,7 @@ public class NotesDetailExposer extends BroadcastReceiver {
@SuppressWarnings("nls") @SuppressWarnings("nls")
public String getTaskDetails(long id) { public String getTaskDetails(long id) {
if(!Preferences.getBoolean(R.string.p_showNotes, false)) if(!Preferences.getBoolean(R.string.p_showNotes, true))
return null; return null;
Task task = PluginServices.getTaskService().fetchById(id, Task.ID, Task.NOTES); Task task = PluginServices.getTaskService().fetchById(id, Task.ID, Task.NOTES);

@ -3,8 +3,8 @@
android:shape="rectangle"> android:shape="rectangle">
<gradient <gradient
android:type="radial" android:type="radial"
android:startColor="#035ab6" android:startColor="#88d0f4"
android:endColor="#003471" android:endColor="#60abd6"
android:gradientRadius="300" android:gradientRadius="300"
android:centerX="0.5" android:centerX="0.5"
android:centerY="0.5" /> android:centerY="0.5" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

@ -1,64 +1,54 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:paddingLeft="4px" android:paddingLeft="4dip"
android:paddingRight="4px" android:paddingRight="4dip"
android:background="@drawable/astrid_com_gradient"> android:background="@drawable/astrid_com_gradient"
android:orientation="vertical">
<TextView <TextView
android:id="@+id/intro" android:id="@+id/intro"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:textSize="16sp" android:textSize="16sp"
android:paddingTop="20dip" android:paddingTop="20dip"
android:textColor="#ffffff" android:textColor="#ffffff"
android:text="@string/actfm_ALA_body" /> android:text="@string/actfm_ALA_body" />
<ImageView
android:id="@+id/logo"
android:layout_width="fill_parent"
android:layout_height="110dip"
android:scaleType="fitCenter"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:paddingBottom="10dip"
android:src="@drawable/astrid_com_logo" />
<TextView <TextView
android:id="@+id/error" android:id="@+id/error"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/intro"
android:layout_alignParentLeft="true"
android:gravity="center" android:gravity="center"
android:paddingTop="5dip"
android:textColor="#ff0000" android:textColor="#ff0000"
android:textSize="16sp" android:textSize="16sp"
android:textStyle="bold" /> android:textStyle="bold" />
<ImageView <RelativeLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:layout_alignParentTop="true" android:paddingTop="5dip">
android:layout_alignParentLeft="true"
android:scaleType="fitCenter"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:layout_marginBottom="95dip"
android:src="@drawable/astrid_com_logo" />
<TextView
android:id="@+id/pw_login"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:gravity="center"
android:layout_marginBottom="10dip"
android:textSize="12sp"
android:textColor="#cccccc" />
<TextView <TextView
android:id="@+id/notice" android:id="@+id/notice"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_above="@id/pw_login" android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:gravity="center" android:gravity="center"
android:layout_marginBottom="5dip" android:layout_marginBottom="5dip"
@ -67,42 +57,52 @@
android:text="@string/actfm_ALA_notice" /> android:text="@string/actfm_ALA_notice" />
<Button <Button
android:id="@+id/login_later" android:id="@+id/pw_login"
android:layout_weight="1"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="45dip" android:layout_height="45dip"
android:layout_above="@id/notice" android:layout_above="@id/notice"
android:paddingLeft="20dip" android:paddingLeft="20dip"
android:paddingRight="20dip" android:paddingRight="20dip"
android:layout_marginBottom="20dip" android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:textSize="16sp" android:textSize="16sp"
android:text="@string/actfm_ALA_login_later" android:text="@string/welcome_login_pw"/>
android:visibility="gone" />
<com.facebook.android.LoginButton <com.facebook.android.LoginButton
android:id="@+id/fb_login" android:id="@+id/fb_login"
android:layout_weight="1"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="45dip" android:layout_height="45dip"
android:layout_above="@id/login_later" android:layout_above="@id/pw_login"
android:paddingLeft="20dip" android:paddingLeft="20dip"
android:paddingRight="20dip" android:paddingRight="20dip"
android:layout_marginBottom="20dip" android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:textSize="16sp" android:textSize="16sp"
android:drawableLeft="@drawable/facebook" android:drawableLeft="@drawable/facebook"
android:text="@string/actfm_ALA_fb_login" /> android:text="@string/actfm_ALA_fb_login" />
<Button <Button
android:id="@+id/gg_login" android:id="@+id/gg_login"
android:layout_weight="1"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="45dip" android:layout_height="45dip"
android:layout_above="@id/fb_login" android:layout_above="@id/fb_login"
android:paddingLeft="20dip" android:paddingLeft="20dip"
android:paddingRight="20dip" android:paddingRight="20dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:textSize="16sp" android:textSize="16sp"
android:drawableLeft="@drawable/google" android:drawableLeft="@drawable/google"
android:text="@string/actfm_ALA_gg_login" /> android:text="@string/actfm_ALA_gg_login" />
<TextView
android:id="@+id/tos"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:layout_above="@id/gg_login"
android:gravity="center"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:textSize="12.5sp"
android:textColor="#ffffff" />
</RelativeLayout> </RelativeLayout>
</LinearLayout>

@ -17,11 +17,9 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/gdi_header" android:layout_below="@id/gdi_header"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:gravity="center" android:gravity="center"
android:textColor="@android:color/black" android:textColor="@android:color/black"
android:background="#ffffffff" android:background="#ffeeeeee"
android:fadingEdgeLength="0dp"/> android:fadingEdgeLength="0dp"/>
<FrameLayout <FrameLayout

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="4dip"
android:paddingRight="4dip"
android:background="@drawable/astrid_com_gradient"
android:orientation="vertical">
<ImageView
android:id="@+id/logo"
android:layout_width="fill_parent"
android:layout_height="110dip"
android:scaleType="fitCenter"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:paddingBottom="10dip"
android:layout_marginTop="40dip"
android:src="@drawable/astrid_com_logo" />
<TextView
android:id="@+id/error"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#ff0000"
android:textSize="16sp"
android:textStyle="bold" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="5dip">
<TextView
android:id="@+id/login_later"
android:layout_width="fill_parent"
android:layout_height="45dip"
android:gravity="center"
android:layout_alignParentBottom="true"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:paddingBottom="5dip"
android:textSize="16sp"
android:textColor="#ffffff" />
<Button
android:id="@+id/pw_login"
android:layout_width="fill_parent"
android:layout_height="45dip"
android:layout_above="@id/login_later"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:textSize="16sp"
android:text="@string/welcome_login_pw"/>
<com.facebook.android.LoginButton
android:id="@+id/fb_login"
android:layout_width="fill_parent"
android:layout_height="45dip"
android:layout_above="@id/pw_login"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:textSize="16sp"
android:drawableLeft="@drawable/facebook"
android:text="@string/actfm_ALA_fb_login" />
<Button
android:id="@+id/gg_login"
android:layout_width="fill_parent"
android:layout_height="45dip"
android:layout_above="@id/fb_login"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:textSize="16sp"
android:drawableLeft="@drawable/google"
android:text="@string/actfm_ALA_gg_login" />
<TextView
android:id="@+id/tos"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:layout_above="@id/gg_login"
android:gravity="center"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:textSize="12.5sp"
android:textColor="#ffffff" />
</RelativeLayout>
</LinearLayout>

@ -7,16 +7,9 @@
android:orientation="vertical"> android:orientation="vertical">
<ImageView android:id="@+id/welcome_image" <ImageView android:id="@+id/welcome_image"
android:src="@drawable/welcome_screen" android:src="@drawable/welcome_android_overlay"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:layout_weight="1"/> android:layout_weight="1"/>
<Button android:id="@+id/show_eula"
android:layout_width="fill_parent"
android:text="@string/welcome_show_eula"
android:layout_height="45dp"
android:layout_weight="1"
android:layout_alignParentBottom="true"/>
</RelativeLayout> </RelativeLayout>

@ -139,19 +139,13 @@
share, and delegate with others.</string> share, and delegate with others.</string>
<!-- share login: Sharing Login FB Prompt --> <!-- share login: Sharing Login FB Prompt -->
<string name="actfm_ALA_fb_login">Sign in with Facebook</string> <string name="actfm_ALA_fb_login">Login with Facebook</string>
<!-- share login: Sharing Login GG Prompt --> <!-- share login: Sharing Login GG Prompt -->
<string name="actfm_ALA_gg_login">Sign in with Google</string> <string name="actfm_ALA_gg_login">Login with Google</string>
<!-- share login: Login later button -->
<string name="actfm_ALA_login_later">Later</string>
<!-- share login: Login later button -->
<string name="actfm_ALA_confirm_later_dialog">Are you sure you don\'t want to login now?</string>
<!-- share login: Sharing Footer Password Label --> <!-- share login: Sharing Footer Password Label -->
<string name="actfm_ALA_pw_login">Don\'t have a Google or Facebook Account?</string> <string name="actfm_ALA_pw_login">Don\'t use Google or Facebook?</string>
<!-- share login: Sharing Password Link --> <!-- share login: Sharing Password Link -->
<string name="actfm_ALA_pw_link">Sign In Here</string> <string name="actfm_ALA_pw_link">Sign In Here</string>

@ -19,6 +19,9 @@
\n \n
</string> </string>
<!-- Task 1 due date setting. Corresponds to Task.URGENCY_TOMORROW -->
<string name="intro_task_1_due_setting">2</string>
<!-- Task 2 Summary --> <!-- Task 2 Summary -->
<string name="intro_task_2_summary">Add a widget to your desktop</string> <string name="intro_task_2_summary">Add a widget to your desktop</string>
@ -31,6 +34,9 @@
\n \n
</string> </string>
<!-- Task 2 due date setting. Corresponds to Task.URGENCY_DAY_AFTER -->
<string name="intro_task_2_due_setting">3</string>
<!-- Task 3 Summary --> <!-- Task 3 Summary -->
<string name="intro_task_3_summary">Setup sync with Astrid.com</string> <string name="intro_task_3_summary">Setup sync with Astrid.com</string>
@ -43,6 +49,11 @@
\n \n
</string> </string>
<!-- Task 1 due date setting. Corresponds to Task.URGENCY_NONE -->
<string name="intro_task_3_due_setting">0</string>
<!-- NEW USER EXPERIENCE -->
<!-- NEW USER EXPERIENCE, help bubbles --> <!-- NEW USER EXPERIENCE, help bubbles -->
<!-- Shown the first time a user sees the task list activity --> <!-- Shown the first time a user sees the task list activity -->
<string name="help_popover_add_task">Add a task here</string> <string name="help_popover_add_task">Add a task here</string>
@ -56,5 +67,25 @@
<!-- Shown the first time a user sees the list settings tab --> <!-- Shown the first time a user sees the list settings tab -->
<string name="help_popover_collaborators">Collaborators can help you build your list or finish tasks</string> <string name="help_popover_collaborators">Collaborators can help you build your list or finish tasks</string>
<!-- Login activity -->
<string name="welcome_login_title">Welcome to Astrid!</string>
<string name="welcome_login_intro"></string>
<string name="welcome_login_tos_base">By using Astrid you agree to the</string>
<string name="welcome_login_tos_link">\"Terms of Service\"</string>
<string name="welcome_login_pw">Login with Username/Password</string>
<string name="welcome_login_later">Login Later</string>
<string name="welcome_login_confirm_later_title">Why not sign in?</string>
<string name="welcome_login_confirm_later_ok">I\'ll do it!</string>
<string name="welcome_login_confirm_later_cancel">No thanks</string>
<string name="welcome_login_confirm_later_dialog">Sign-in to get the most out of Astrid! For free you get online backup, full synchronization with with Astrid.com the ability to add tasks via email and you can even share tasks lists with friends!</string>
</resources> </resources>

@ -16,7 +16,7 @@
<CheckBoxPreference <CheckBoxPreference
android:key="@string/p_showNotes" android:key="@string/p_showNotes"
android:title="@string/EPr_showNotes_title" android:title="@string/EPr_showNotes_title"
android:defaultValue="false" /> android:defaultValue="true" />
<ListPreference <ListPreference
android:key="@string/p_theme" android:key="@string/p_theme"

@ -80,6 +80,14 @@ public final class Eula {
builder.show(); builder.show();
} }
public static void showEulaBasic(Activity activity) {
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(R.string.DLG_eula_title);
builder.setMessage(AndroidUtilities.readFile(activity, R.raw.eula));
builder.setNeutralButton(android.R.string.ok, null);
builder.show();
}
private boolean shouldShowEula(Activity activity) { private boolean shouldShowEula(Activity activity) {
if(Preferences.getBoolean(PREFERENCE_EULA_ACCEPTED, false)) if(Preferences.getBoolean(PREFERENCE_EULA_ACCEPTED, false))
return false; return false;

@ -226,8 +226,6 @@ public class TaskListActivity extends ListActivity implements OnScrollListener,
setUpUiComponents(); setUpUiComponents();
onNewIntent(getIntent()); onNewIntent(getIntent());
Eula.showEula(this);
if (!Preferences.getBoolean(R.string.p_showed_add_task_help, false)) { if (!Preferences.getBoolean(R.string.p_showed_add_task_help, false)) {
HelpInfoPopover.showPopover(TaskListActivity.this, quickAddBox, R.string.help_popover_add_task); HelpInfoPopover.showPopover(TaskListActivity.this, quickAddBox, R.string.help_popover_add_task);
Preferences.setBoolean(R.string.p_showed_add_task_help, true); Preferences.setBoolean(R.string.p_showed_add_task_help, true);

@ -72,7 +72,6 @@ import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.helper.TaskAdapterAddOnManager; import com.todoroo.astrid.helper.TaskAdapterAddOnManager;
import com.todoroo.astrid.notes.NotesDecorationExposer; import com.todoroo.astrid.notes.NotesDecorationExposer;
import com.todoroo.astrid.notes.NotesPlugin; import com.todoroo.astrid.notes.NotesPlugin;
import com.todoroo.astrid.service.StartupService;
import com.todoroo.astrid.service.StatisticsService; import com.todoroo.astrid.service.StatisticsService;
import com.todoroo.astrid.service.TaskService; import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.timers.TimerDecorationExposer; import com.todoroo.astrid.timers.TimerDecorationExposer;
@ -966,8 +965,8 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
} }
private boolean isIntroTask(long taskId) { private boolean isIntroTask(long taskId) {
if(taskId <= StartupService.INTRO_TASK_SIZE) /*if(taskId <= StartupService.INTRO_TASK_SIZE)
return true; return true;//*/
return false; return false;
} }

@ -28,7 +28,6 @@ import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.service.ExceptionService; import com.todoroo.andlib.service.ExceptionService;
import com.todoroo.andlib.service.ExceptionService.TodorooUncaughtExceptionHandler; import com.todoroo.andlib.service.ExceptionService.TodorooUncaughtExceptionHandler;
import com.todoroo.andlib.utility.AndroidUtilities; import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences; import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService; import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.actfm.sync.ActFmSyncService; import com.todoroo.astrid.actfm.sync.ActFmSyncService;
@ -208,9 +207,10 @@ public class StartupService {
if(taskService.countTasks() > 0) if(taskService.countTasks() > 0)
return; return;
for(int i = 0; i < INTRO_TASKS.length; i += 2) for(int i = 0; i < INTRO_TASKS.length; i += 3)
addIntroTask(r, INTRO_TASKS[i], INTRO_TASKS[i + 1]); addIntroTask(r, INTRO_TASKS[i], INTRO_TASKS[i + 1], INTRO_TASKS[i + 2]);
} }
}).start(); }).start();
} catch (Exception e) { } catch (Exception e) {
exceptionService.reportError("on-first-time", e); //$NON-NLS-1$ exceptionService.reportError("on-first-time", e); //$NON-NLS-1$
@ -218,21 +218,24 @@ public class StartupService {
} }
private static final int[] INTRO_TASKS = new int[] { private static final int[] INTRO_TASKS = new int[] {
R.string.intro_task_1_summary,
R.string.intro_task_1_note,
R.string.intro_task_2_summary, R.string.intro_task_2_summary,
R.string.intro_task_2_note, R.string.intro_task_2_note,
R.string.intro_task_2_due_setting,
R.string.intro_task_3_summary, R.string.intro_task_3_summary,
R.string.intro_task_3_note, R.string.intro_task_3_note,
R.string.intro_task_3_due_setting,
}; };
public static final int INTRO_TASK_SIZE = INTRO_TASKS.length / 2; public static final int INTRO_TASK_SIZE = INTRO_TASKS.length / 3;
private void addIntroTask(Resources r, int summary, int note) { private void addIntroTask(Resources r, int summary, int note, int dueSetting) {
Task task = new Task(); Task task = new Task();
task.setValue(Task.TITLE, r.getString(summary)); task.setValue(Task.TITLE, r.getString(summary));
task.setValue(Task.DETAILS, r.getString(R.string.intro_click_prompt)); //task.setValue(Task.DETAILS, r.getString(R.string.intro_click_prompt));
task.setValue(Task.DETAILS_DATE, 2*DateUtilities.now()); //task.setValue(Task.DETAILS_DATE, 2*DateUtilities.now());
task.setValue(Task.NOTES, r.getString(note)); task.setValue(Task.NOTES, r.getString(note));
int dueSettingParse = Integer.parseInt(r.getString(dueSetting));
long dueDate = Task.createDueDate(dueSettingParse, 0);
task.setValue(Task.DUE_DATE, dueDate);
taskService.save(task); taskService.save(task);
} }

@ -29,7 +29,7 @@ public class AstridPreferences {
Preferences.setIfUnset(prefs, editor, r, R.string.p_default_reminders_key, 6); Preferences.setIfUnset(prefs, editor, r, R.string.p_default_reminders_key, 6);
Preferences.setIfUnset(prefs, editor, r, R.string.p_rmd_default_random_hours, 0); Preferences.setIfUnset(prefs, editor, r, R.string.p_rmd_default_random_hours, 0);
Preferences.setIfUnset(prefs, editor, r, R.string.p_fontSize, 20); Preferences.setIfUnset(prefs, editor, r, R.string.p_fontSize, 20);
Preferences.setIfUnset(prefs, editor, r, R.string.p_showNotes, false); Preferences.setIfUnset(prefs, editor, r, R.string.p_showNotes, true);
editor.commit(); editor.commit();
} }

@ -0,0 +1,181 @@
package com.todoroo.astrid.welcome;
import org.json.JSONObject;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;
import com.facebook.android.AuthListener;
import com.timsu.astrid.R;
import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.ActFmLoginActivity;
import com.todoroo.astrid.activity.Eula;
import com.todoroo.astrid.activity.TaskListActivity;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.AstridDependencyInjector;
import com.todoroo.astrid.service.StartupService;
import com.todoroo.astrid.utility.AstridPreferences;
public class WelcomeLogin extends ActFmLoginActivity implements AuthListener {
// --- ui initialization
public static final String KEY_SHOWED_WELCOME_LOGIN = "key_showed_welcome_login"; //$NON-NLS-1$
public static final String KEY_IS_NEW_INSTALL = "key_is_new_install"; //$NON-NLS-1$
private boolean shouldShowWelcomeScreen = true;
static {
AstridDependencyInjector.initialize();
}
@Override
protected int getContentViewResource() {
return R.layout.welcome_login_activity;
}
@Override
protected int getTitleResource() {
return R.string.welcome_login_title;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
int latestSetVersion = AstridPreferences.getCurrentVersion();
shouldShowWelcomeScreen = (latestSetVersion == 0);
new StartupService().onStartupApplication(this);
ContextManager.setContext(this);
if (latestSetVersion !=0 || Preferences.getBoolean(KEY_SHOWED_WELCOME_LOGIN, false)) {
finishAndShowNext();
}
initializeUI();
}
@Override
protected void finishAndShowNext() {
if (shouldShowWelcomeScreen) {
Intent welcomeScreen = new Intent(this, WelcomeScreen.class);
startActivity(welcomeScreen);
finish();
Preferences.setBoolean(KEY_SHOWED_WELCOME_LOGIN, true);
} else {
Intent taskListStartup = new Intent(this, TaskListActivity.class);
startActivity(taskListStartup);
finish();
}
}
@Override
protected void initializeUI() {
findViewById(R.id.gg_login).setOnClickListener(googleListener);
setupTermsOfService();
setupPWLogin();
setupLoginLater();
}
private SpannableString getLinkStringWithCustomInterval(String base, String linkComponent,
int start, int endOffset, final OnClickListener listener) {
SpannableString link = new SpannableString (String.format("%s %s", //$NON-NLS-1$
base, linkComponent));
ClickableSpan linkSpan = new ClickableSpan() {
@Override
public void onClick(View widget) {
listener.onClick(widget);
}
@Override
public void updateDrawState(TextPaint ds) {
ds.setUnderlineText(true);
ds.setColor(Color.rgb(255, 255, 255));
}
};
link.setSpan(linkSpan, start, link.length() + endOffset, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
return link;
}
private void setupTermsOfService() {
TextView tos = (TextView)findViewById(R.id.tos);
tos.setOnClickListener(showTosListener);
String tosBase = getString(R.string.welcome_login_tos_base);
String tosLink = getString(R.string.welcome_login_tos_link);
SpannableString link = getLinkStringWithCustomInterval(tosBase, tosLink, tosBase.length() + 2, -1, showTosListener);
tos.setText(link);
}
private void setupPWLogin() {
Button pwLogin = (Button) findViewById(R.id.pw_login);
pwLogin.setOnClickListener(signUpListener);
}
private void setupLoginLater() {
TextView loginLater = (TextView)findViewById(R.id.login_later);
loginLater.setOnClickListener(loginLaterListener);
String loginLaterBase = getString(R.string.welcome_login_later);
SpannableString loginLaterLink = new SpannableString(String.format("%s", loginLaterBase)); //$NON-NLS-1$
ClickableSpan laterSpan = new ClickableSpan() {
@Override
public void onClick(View widget) {
loginLaterListener.onClick(widget);
}
@Override
public void updateDrawState(TextPaint ds) {
ds.setUnderlineText(true);
ds.setColor(Color.rgb(255, 255, 255));
}
};
loginLaterLink.setSpan(laterSpan, 0, loginLaterBase.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
loginLater.setText(loginLaterLink);
}
// --- event handler
private final OnClickListener showTosListener = new OnClickListener() {
@Override
public void onClick(View v) {
Eula.showEulaBasic(WelcomeLogin.this);
}
};
private final OnClickListener loginLaterListener = new OnClickListener() {
@Override
public void onClick(View arg0) {
String title = getString(R.string.welcome_login_confirm_later_title);
String confirmLater = getString(R.string.welcome_login_confirm_later_dialog);
DialogUtilities.okCancelCustomDialog(WelcomeLogin.this, title, confirmLater,
R.string.welcome_login_confirm_later_ok,
R.string.welcome_login_confirm_later_cancel,
null, confirmLaterListener);
}
private final DialogInterface.OnClickListener confirmLaterListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finishAndShowNext();
}
};
};
@Override
protected void postAuthenticate(JSONObject result, String token) {
// Delete the "Setup sync" task on successful login
taskService.deleteWhere(Task.TITLE.eq(getString(R.string.intro_task_3_summary)));
super.postAuthenticate(result, token);
}
}

@ -6,19 +6,18 @@ import android.os.Bundle;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.Window; import android.view.Window;
import android.widget.Button; import android.widget.ImageView;
import com.timsu.astrid.R; import com.timsu.astrid.R;
import com.todoroo.andlib.service.ContextManager; import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.Preferences; import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.ActFmLoginActivity;
import com.todoroo.astrid.activity.Eula;
import com.todoroo.astrid.activity.TaskListActivity; import com.todoroo.astrid.activity.TaskListActivity;
import com.todoroo.astrid.service.StartupService; import com.todoroo.astrid.service.StartupService;
public class WelcomeScreen extends Activity implements Eula.EulaCallback { public class WelcomeScreen extends Activity {
Button showEula; public static final String KEY_SHOWED_WELCOME_SCREEN = "key_showed_welcome_screen"; //$NON-NLS-1$
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -29,32 +28,35 @@ public class WelcomeScreen extends Activity implements Eula.EulaCallback {
new StartupService().onStartupApplication(this); new StartupService().onStartupApplication(this);
setContentView(R.layout.welcome_screen); setContentView(R.layout.welcome_screen);
if(Preferences.getBoolean(Eula.PREFERENCE_EULA_ACCEPTED, false)) { final ImageView image = (ImageView)findViewById(R.id.welcome_image);
Intent taskListStartup = new Intent(this, TaskListActivity.class); image.setOnClickListener(new OnClickListener() {
startActivity(taskListStartup);
finish();
return;
}
showEula = (Button) findViewById(R.id.show_eula);
showEula.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Eula.showEula(WelcomeScreen.this); image.setOnClickListener(null); // Prevent double click
new Thread() {
@Override
public void run() {
AndroidUtilities.sleepDeep(1000L);
runOnUiThread(new Runnable() {
@Override
public void run() {
finishAndStartNext();
} }
}); });
} }
}.start();
}
});
@Override if(Preferences.getBoolean(KEY_SHOWED_WELCOME_SCREEN, false)) {
public void eulaAccepted() { finishAndStartNext();
Intent login = new Intent(this, ActFmLoginActivity.class); }
login.putExtra(ActFmLoginActivity.KEY_SHOW_LATER_BUTTON, true);
startActivity(login);
finish();
} }
@Override private void finishAndStartNext() {
public void eulaRefused() { Intent taskListStartup = new Intent(this, TaskListActivity.class);
// Do nothing startActivity(taskListStartup);
finish();
Preferences.setBoolean(KEY_SHOWED_WELCOME_SCREEN, true);
} }
} }

Loading…
Cancel
Save