Allow ability to show welcome activity from settings

pull/14/head
Tim Su 13 years ago
parent 7412481730
commit 14f8d81ae8

@ -328,6 +328,7 @@
<string name="p_showed_collaborators_help">showed_collaborators_help</string> <string name="p_showed_collaborators_help">showed_collaborators_help</string>
<string name="p_showed_when_shortcut">showed_when_shortcut</string> <string name="p_showed_when_shortcut">showed_when_shortcut</string>
<string name="p_showed_when_row">showed_when_row</string> <string name="p_showed_when_row">showed_when_row</string>
<string name="p_tutorial">tutorial</string>
<!-- ============================================================ OTHER == --> <!-- ============================================================ OTHER == -->

@ -3,6 +3,8 @@
<string name="welcome_show_eula">Accept EULA to get started!</string> <string name="welcome_show_eula">Accept EULA to get started!</string>
<string name="welcome_setting">Show Tutorial</string>
<string name="welcome_title_1">Welcome to Astrid!</string> <string name="welcome_title_1">Welcome to Astrid!</string>
<string name="welcome_title_2">Make lists</string> <string name="welcome_title_2">Make lists</string>
<string name="welcome_title_3">Share lists</string> <string name="welcome_title_3">Share lists</string>
@ -11,6 +13,8 @@
<string name="welcome_title_6">Discover</string> <string name="welcome_title_6">Discover</string>
<string name="welcome_title_7">Connect now\nto get started!</string> <string name="welcome_title_7">Connect now\nto get started!</string>
<string name="welcome_title_7_return">That\'s it!</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>
<string name="welcome_body_3">Share lists\nwith friends, housemates,\nor your sweetheart!</string> <string name="welcome_body_3">Share lists\nwith friends, housemates,\nor your sweetheart!</string>
@ -19,4 +23,6 @@
<string name="welcome_body_6">Additional features,\nproductivity tips, and\nsuggestions from friends</string> <string name="welcome_body_6">Additional features,\nproductivity tips, and\nsuggestions from friends</string>
<string name="welcome_body_7">Login</string> <string name="welcome_body_7">Login</string>
<string name="welcome_body_7_return">Tap Astrid to return.</string>
</resources> </resources>

@ -3,8 +3,9 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/EPr_title"> android:title="@string/EPr_title">
<PreferenceScreen android:title="" android:key="@string/p_about" /> <PreferenceScreen android:title="@string/p_about" android:key="@string/p_about" />
<PreferenceScreen android:title="" android:key="@string/p_help"/> <PreferenceScreen android:title="@string/welcome_setting" android:key="@string/p_tutorial"/>
<PreferenceScreen android:title="@string/p_help" android:key="@string/p_help"/>
<PreferenceCategory <PreferenceCategory
android:title="@string/EPr_appearance_header"> android:title="@string/EPr_appearance_header">
<com.todoroo.astrid.ui.MultilineListPreference <com.todoroo.astrid.ui.MultilineListPreference

@ -38,6 +38,7 @@ import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DialogUtilities; import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences; import com.todoroo.andlib.utility.Preferences;
import com.todoroo.andlib.utility.TodorooPreferenceActivity; import com.todoroo.andlib.utility.TodorooPreferenceActivity;
import com.todoroo.astrid.actfm.ActFmLoginActivity;
import com.todoroo.astrid.api.AstridApiConstants; import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.dao.Database; import com.todoroo.astrid.dao.Database;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
@ -52,6 +53,7 @@ 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.voice.VoiceOutputService; import com.todoroo.astrid.voice.VoiceOutputService;
import com.todoroo.astrid.welcome.tutorial.WelcomeWalkthrough;
/** /**
* Displays the preference screen for users to edit their preferences * Displays the preference screen for users to edit their preferences
@ -61,10 +63,8 @@ import com.todoroo.astrid.voice.VoiceOutputService;
*/ */
public class EditPreferences extends TodorooPreferenceActivity { public class EditPreferences extends TodorooPreferenceActivity {
private static final int ABOUT_PREFERENCE = 0; // see preferences.xml for order of prefs private static final int APPEARANCE_PREFERENCE = 3;
private static final int HELP_PREFERENCE = 1; private static final int POWER_PACK_PREFERENCE = 4;
private static final int APPEARANCE_PREFERENCE = 2;
private static final int POWER_PACK_PREFERENCE = 3;
public static final int RESULT_CODE_THEME_CHANGED = 1; public static final int RESULT_CODE_THEME_CHANGED = 1;
@ -101,9 +101,9 @@ public class EditPreferences extends TodorooPreferenceActivity {
screen.getPreference(POWER_PACK_PREFERENCE).setEnabled(addOnService.hasPowerPack()); screen.getPreference(POWER_PACK_PREFERENCE).setEnabled(addOnService.hasPowerPack());
final Resources r = getResources(); final Resources r = getResources();
// About pref
Preference preference = screen.getPreference(ABOUT_PREFERENCE); // first-order preferences
preference.setTitle(r.getString(R.string.p_about)); Preference preference = screen.findPreference(getString(R.string.p_about));
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() { preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference p) { public boolean onPreferenceClick(Preference p) {
showAbout(); showAbout();
@ -111,9 +111,20 @@ public class EditPreferences extends TodorooPreferenceActivity {
} }
}); });
Preference helpPref = screen.getPreference(HELP_PREFERENCE); preference = screen.findPreference(getString(R.string.p_tutorial));
helpPref.setTitle(r.getString(R.string.p_help)); preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
helpPref.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override
public boolean onPreferenceClick(Preference p) {
Intent showWelcomeLogin = new Intent(EditPreferences.this, WelcomeWalkthrough.class);
showWelcomeLogin.putExtra(ActFmLoginActivity.SHOW_TOAST, false);
showWelcomeLogin.putExtra(WelcomeWalkthrough.TOKEN_MANUAL_SHOW, true);
startActivity(showWelcomeLogin);
return true;
}
});
preference = screen.findPreference(getString(R.string.p_help));
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override @Override
public boolean onPreferenceClick(Preference p) { public boolean onPreferenceClick(Preference p) {
showHelp(); showHelp();

@ -174,17 +174,11 @@ public final class UpgradeService {
StringBuilder changeLog = new StringBuilder(); StringBuilder changeLog = new StringBuilder();
if (from >= V3_9_2 && from < V3_9_2_2) { if (from >= V3_9_2 && from < V3_9_2_2) {
newVersionString(changeLog, "3.9.2.2", new String[] { newVersionString(changeLog, "3.9.2.2 (1/19/12)", new String[] {
"Astrid now recognizes words like 'tomorrow', 'monday', '!!!' and '2 pm' to set date and importance",
"New tutorial walkthrough for new users. Access it from the settings menu!",
"Reduced APK size", "Reduced APK size",
"Fixed bugs with Google Task sync", "Minor UI tweaks, bug fixes",
});
}
if (from < V3_9_2) {
newVersionString(changeLog, "3.9.2 (01/13/12)", new String[] {
"Made selecting dates and times easier:",
"New tutorial walkthrough for new users",
"Stomped on a few bugs",
"Feedback welcomed!" "Feedback welcomed!"
}); });
} }

@ -13,6 +13,9 @@ import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.timsu.astrid.R; import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.viewpagerindicator.TitleProvider; import com.viewpagerindicator.TitleProvider;
public class ViewPagerAdapter extends PagerAdapter implements TitleProvider public class ViewPagerAdapter extends PagerAdapter implements TitleProvider
@ -60,10 +63,20 @@ public class ViewPagerAdapter extends PagerAdapter implements TitleProvider
}; };
private final Context context; private final Context context;
public WelcomeWalkthrough parent; public WelcomeWalkthrough parent;
@Autowired ActFmPreferenceService actFmPreferenceService;
public ViewPagerAdapter( Context context ) public ViewPagerAdapter( Context context, boolean manual)
{ {
this.context = context; this.context = context;
DependencyInjectionService.getInstance().inject(this);
if(manual) {
layouts[layouts.length - 1] = R.layout.welcome_walkthrough_page;
title[title.length - 1] = R.string.welcome_title_7_return;
images[images.length - 1] = R.drawable.welcome_walkthrough_1;
body[body.length - 1] = R.string.welcome_body_7_return;
}
} }
@ -81,12 +94,13 @@ public class ViewPagerAdapter extends PagerAdapter implements TitleProvider
View pageView = inflater.inflate(layouts[position], null, true); View pageView = inflater.inflate(layouts[position], null, true);
pageView.setLayoutParams( new ViewGroup.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT)); pageView.setLayoutParams( new ViewGroup.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT));
if (position != getCount()-1){ if (pageView.findViewById(R.id.welcome_walkthrough_image) != null) {
ImageView imageView = (ImageView) pageView.findViewById(R.id.welcome_walkthrough_image); ImageView imageView = (ImageView) pageView.findViewById(R.id.welcome_walkthrough_image);
imageView.setImageResource(images[position]); imageView.setImageResource(images[position]);
TextView titleView = (TextView) pageView.findViewById(R.id.welcome_walkthrough_title); TextView titleView = (TextView) pageView.findViewById(R.id.welcome_walkthrough_title);
titleView.setText(title[position]); titleView.setText(title[position]);
TextView bodyView = (TextView) pageView.findViewById(R.id.welcome_walkthrough_body); TextView bodyView = (TextView) pageView.findViewById(R.id.welcome_walkthrough_body);
bodyView.setText(body[position]); bodyView.setText(body[position]);
} }

@ -31,12 +31,14 @@ public class WelcomeWalkthrough extends ActFmLoginActivity {
public static final String KEY_SHOWED_WELCOME_LOGIN = "key_showed_welcome_login"; //$NON-NLS-1$ public static final String KEY_SHOWED_WELCOME_LOGIN = "key_showed_welcome_login"; //$NON-NLS-1$
public static final String TOKEN_MANUAL_SHOW = "manual"; //$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);
mAdapter = new ViewPagerAdapter(this); mAdapter = new ViewPagerAdapter(this, getIntent().hasExtra(TOKEN_MANUAL_SHOW));
mAdapter.parent = this; mAdapter.parent = this;
mPager = (ViewPager)findViewById(R.id.pager); mPager = (ViewPager)findViewById(R.id.pager);
@ -44,6 +46,7 @@ public class WelcomeWalkthrough extends ActFmLoginActivity {
mIndicator = (CirclePageIndicator)findViewById(R.id.indicator); mIndicator = (CirclePageIndicator)findViewById(R.id.indicator);
mIndicator.setViewPager(mPager); mIndicator.setViewPager(mPager);
} }
@Override @Override
protected int getContentViewResource() { protected int getContentViewResource() {
@ -69,9 +72,21 @@ public class WelcomeWalkthrough extends ActFmLoginActivity {
if(mAdapter == null) if(mAdapter == null)
return; return;
if(currentPage == mAdapter.getCount()-1) { if(currentPage == mAdapter.getCount()-1) {
if(findViewById(R.id.fb_login) != null) {
super.initializeUI(); super.initializeUI();
setupTermsOfService(); setupTermsOfService();
setupLoginLater(); setupLoginLater();
} else {
OnClickListener done = new OnClickListener() {
@Override
public void onClick(View arg0) {
finish();
}
};
currentView.findViewById(R.id.welcome_walkthrough_title).setOnClickListener(done);
currentView.findViewById(R.id.welcome_walkthrough_image).setOnClickListener(done);
}
} }
} }
@ -106,12 +121,6 @@ public class WelcomeWalkthrough extends ActFmLoginActivity {
Button pwLogin = (Button) findViewById(R.id.pw_login); Button pwLogin = (Button) findViewById(R.id.pw_login);
pwLogin.setOnClickListener(signUpListener); pwLogin.setOnClickListener(signUpListener);
} }
/*
protected void setupWalkthroughLogin() {
Button loginButton = (Button)currentView.findViewById(R.id.walkthrough_login);
loginButton.setOnClickListener(showWalkthroughLoginListener);
}*/
protected void setupLoginLater() { protected void setupLoginLater() {
TextView loginLater = (TextView)currentView.findViewById(R.id.login_later); TextView loginLater = (TextView)currentView.findViewById(R.id.login_later);

Loading…
Cancel
Save