Killed welcomeLogin class, made welcome walkthrough dots smaller, localize a string.

pull/14/head
Tim Su 13 years ago
parent c4cc1477e3
commit 3c2f614cec

@ -15,7 +15,7 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:paddingBottom="10dip" android:paddingBottom="10dip"
android:layout_marginTop="30dip" android:layout_marginTop="30dip"
android:text="Connect now\nto get started!" android:text="@string/welcome_title_7"
android:textColor="#444444" android:textColor="#444444"
android:textSize="40dip" android:textSize="40dip"
android:textStyle="bold" android:textStyle="bold"

@ -9,7 +9,7 @@
<string name="welcome_title_4">Divvy up tasks</string> <string name="welcome_title_4">Divvy up tasks</string>
<string name="welcome_title_5">Provide details</string> <string name="welcome_title_5">Provide details</string>
<string name="welcome_title_6">Discover</string> <string name="welcome_title_6">Discover</string>
<string name="welcome_title_7">Login</string> <string name="welcome_title_7">Connect now\nto get started!</string>
<string name="welcome_body_1">The perfect personal\nto-do list that works great\nwith friends</string> <string name="welcome_body_1">The perfect personal\nto-do list that works great\nwith friends</string>
<string name="welcome_body_2">Perfect for any list:\nto read, to watch, to buy,\nto visit, to do!</string> <string name="welcome_body_2">Perfect for any list:\nto read, to watch, to buy,\nto visit, to do!</string>

@ -232,12 +232,12 @@
<item name="android:textColor">@android:color/black</item> <item name="android:textColor">@android:color/black</item>
</style> </style>
<style name="CustomCirclePageIndicator"> <style name="CustomCirclePageIndicator">
<item name="fillColor">#FFFFFFFF</item> <item name="fillColor">#333333</item>
<item name="strokeColor">#FF000000</item> <item name="strokeColor">#333333</item>
<item name="strokeWidth">2dp</item> <item name="strokeWidth">2dp</item>
<item name="radius">10dp</item> <item name="radius">5dp</item>
<item name="centered">true</item> <item name="centered">true</item>
<item name="android:background">#FFCCCCCC</item> <item name="android:background">#333333</item>
</style> </style>
</resources> </resources>

@ -114,7 +114,6 @@ import com.todoroo.astrid.utility.Constants;
import com.todoroo.astrid.utility.Flags; import com.todoroo.astrid.utility.Flags;
import com.todoroo.astrid.voice.VoiceInputAssistant; import com.todoroo.astrid.voice.VoiceInputAssistant;
import com.todoroo.astrid.welcome.HelpInfoPopover; import com.todoroo.astrid.welcome.HelpInfoPopover;
import com.todoroo.astrid.welcome.WelcomeLogin;
import com.todoroo.astrid.welcome.tutorial.WelcomeWalkthrough; import com.todoroo.astrid.welcome.tutorial.WelcomeWalkthrough;
import com.todoroo.astrid.widget.TasksWidget; import com.todoroo.astrid.widget.TasksWidget;
@ -579,8 +578,8 @@ public class TaskListActivity extends ListActivity implements OnScrollListener,
new IntentFilter(AstridApiConstants.BROADCAST_SEND_SYNC_ACTIONS)); new IntentFilter(AstridApiConstants.BROADCAST_SEND_SYNC_ACTIONS));
setUpBackgroundJobs(); setUpBackgroundJobs();
if (!Preferences.getBoolean(WelcomeLogin.KEY_SHOWED_WELCOME_LOGIN, false)) { if (!Preferences.getBoolean(WelcomeWalkthrough.KEY_SHOWED_WELCOME_LOGIN, false)) {
Preferences.setBoolean(WelcomeLogin.KEY_SHOWED_WELCOME_LOGIN, true); Preferences.setBoolean(WelcomeWalkthrough.KEY_SHOWED_WELCOME_LOGIN, true);
Intent showWelcomeLogin = new Intent(this, WelcomeWalkthrough.class); Intent showWelcomeLogin = new Intent(this, WelcomeWalkthrough.class);
showWelcomeLogin.putExtra(ActFmLoginActivity.SHOW_TOAST, false); showWelcomeLogin.putExtra(ActFmLoginActivity.SHOW_TOAST, false);
startActivity(showWelcomeLogin); startActivity(showWelcomeLogin);

@ -1,153 +0,0 @@
package com.todoroo.astrid.welcome;
import org.json.JSONObject;
import android.content.DialogInterface;
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.astrid.actfm.ActFmLoginActivity;
import com.todoroo.astrid.activity.Eula;
import com.todoroo.astrid.data.Task;
public class WelcomeLogin extends ActFmLoginActivity implements AuthListener {
// --- ui initialization
public static final String KEY_SHOWED_WELCOME_LOGIN = "key_showed_welcome_login"; //$NON-NLS-1$
@Override
protected int getContentViewResource() {
return R.layout.welcome_login_activity;
}
@Override
protected int getTitleResource() {
return R.string.welcome_login_title;
}
@Override
protected void recordPageView() {
// don't record, every new user hits this page
}
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
ContextManager.setContext(this);
initializeUI();
}
@Override
protected void initializeUI() {
findViewById(R.id.gg_login).setOnClickListener(googleListener);
setupTermsOfService();
setupPWLogin();
setupLoginLater();
}
protected 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;
}
protected 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);
}
protected void setupPWLogin() {
Button pwLogin = (Button) findViewById(R.id.pw_login);
pwLogin.setOnClickListener(signUpListener);
}
protected 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
protected final OnClickListener showTosListener = new OnClickListener() {
@Override
public void onClick(View v) {
Eula.showEulaBasic(WelcomeLogin.this);
}
};
protected 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,
android.R.drawable.ic_dialog_alert,
null, confirmLaterListener);
}
private final DialogInterface.OnClickListener confirmLaterListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
};
};
@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);
}
}

@ -2,7 +2,6 @@
package com.todoroo.astrid.welcome.tutorial; package com.todoroo.astrid.welcome.tutorial;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color; import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
@ -10,7 +9,6 @@ import android.text.SpannableString;
import android.text.Spanned; import android.text.Spanned;
import android.text.TextPaint; import android.text.TextPaint;
import android.text.style.ClickableSpan; import android.text.style.ClickableSpan;
import android.util.Log;
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;
@ -21,22 +19,22 @@ import com.timsu.astrid.R;
import com.todoroo.andlib.utility.DialogUtilities; import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.astrid.actfm.ActFmLoginActivity; import com.todoroo.astrid.actfm.ActFmLoginActivity;
import com.todoroo.astrid.activity.Eula; import com.todoroo.astrid.activity.Eula;
import com.todoroo.astrid.welcome.WelcomeLogin;
import com.viewpagerindicator.CirclePageIndicator; import com.viewpagerindicator.CirclePageIndicator;
import com.viewpagerindicator.PageIndicator; import com.viewpagerindicator.PageIndicator;
public class WelcomeWalkthrough extends ActFmLoginActivity { public class WelcomeWalkthrough extends ActFmLoginActivity {
ViewPager mPager; private ViewPager mPager;
ViewPagerAdapter mAdapter; private ViewPagerAdapter mAdapter;
PageIndicator mIndicator; private PageIndicator mIndicator;
View currentView; private View currentView;
int currentPage; private int currentPage;
public static final String KEY_SHOWED_WELCOME_LOGIN = "key_showed_welcome_login"; //$NON-NLS-1$
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
//setContentView(R.layout.welcome_walkthrough);
mAdapter = new ViewPagerAdapter(this); mAdapter = new ViewPagerAdapter(this);
mAdapter.parent = this; mAdapter.parent = this;
@ -57,7 +55,6 @@ public class WelcomeWalkthrough extends ActFmLoginActivity {
return 0; return 0;
} }
public void pageScrolled(int position, View view){ public void pageScrolled(int position, View view){
Log.d(null, "Updated ui");
currentView = view; currentView = view;
currentPage = position; currentPage = position;
if (position == mAdapter.getCount()-1) { if (position == mAdapter.getCount()-1) {
@ -90,7 +87,7 @@ public class WelcomeWalkthrough extends ActFmLoginActivity {
@Override @Override
public void updateDrawState(TextPaint ds) { public void updateDrawState(TextPaint ds) {
ds.setUnderlineText(true); ds.setUnderlineText(true);
ds.setColor(Color.rgb(255, 255, 255)); ds.setColor(Color.rgb(68, 68, 68));
} }
}; };
link.setSpan(linkSpan, start, link.length() + endOffset, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); link.setSpan(linkSpan, start, link.length() + endOffset, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
@ -129,7 +126,7 @@ public class WelcomeWalkthrough extends ActFmLoginActivity {
@Override @Override
public void updateDrawState(TextPaint ds) { public void updateDrawState(TextPaint ds) {
ds.setUnderlineText(true); ds.setUnderlineText(true);
ds.setColor(Color.rgb(255, 255, 255)); ds.setColor(Color.rgb(68, 68, 68));
} }
}; };
loginLaterLink.setSpan(laterSpan, 0, loginLaterBase.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); loginLaterLink.setSpan(laterSpan, 0, loginLaterBase.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
@ -142,17 +139,6 @@ public class WelcomeWalkthrough extends ActFmLoginActivity {
Eula.showEulaBasic(WelcomeWalkthrough.this); Eula.showEulaBasic(WelcomeWalkthrough.this);
} }
}; };
private void showWelcomeLoginActivty() {
Intent showWelcomeLogin = new Intent(this, WelcomeLogin.class);
showWelcomeLogin.putExtra(ActFmLoginActivity.SHOW_TOAST, false);
startActivity(showWelcomeLogin);
}
protected final OnClickListener showWalkthroughLoginListener = new OnClickListener() {
@Override
public void onClick(View v) {
showWelcomeLoginActivty();
}
};
protected final OnClickListener loginLaterListener = new OnClickListener() { protected final OnClickListener loginLaterListener = new OnClickListener() {
@Override @Override

Loading…
Cancel
Save