Added basic popover views for new user help

pull/14/head
Sam Bosley 14 years ago
parent 00fe08c5e0
commit 201f4218c4

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

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<FrameLayout
android:id="@+id/gdi_header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/gdi_arrow_up"
android:layout_marginTop="-1px"
android:background="@drawable/gd_quick_action_top_frame" />
<TextView
android:id="@+id/gdi_message"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/gdi_header"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:gravity="center"
android:textColor="@android:color/black"
android:background="#ffffffff"
android:fadingEdgeLength="0dp"/>
<FrameLayout
android:id="@+id/gdi_footer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/gdi_message"
android:background="@drawable/gd_quick_action_bar_bottom_frame" />
<ImageView
android:id="@+id/gdi_arrow_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/gd_quick_action_arrow_up" />
<ImageView
android:id="@+id/gdi_arrow_down"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-1px"
android:layout_below="@id/gdi_footer"
android:src="@drawable/gd_quick_action_bar_arrow_down" />
</RelativeLayout>

@ -300,6 +300,13 @@
<!-- Anonymous usage statistics -->
<string name="p_statistics">statistics</string>
<!-- ================================================= NEW USER EXPERIENCE -->
<!-- Preference Keys (do not translate) -->
<string name="p_showed_add_task_help">showed_add_task_help</string>
<string name="p_showed_tap_task_help">showed_tap_task_help</string>
<string name="p_showed_list_settings_help">showed_list_settings_help</string>
<string name="p_showed_collaborators_help">showed_collaborators_help</string>
<!-- ============================================================ OTHER == -->
<!-- Preference Key (do not translate) -->

@ -45,4 +45,19 @@
4) Log In &amp; Synchronize!\n
\n
</string>
<!-- NEW USER EXPERIENCE, help bubbles -->
<!-- Shown the first time a user sees the task list activity -->
<string name="help_popover_add_task">Add a task here</string>
<!-- Shown the first time a user adds a task to a list -->
<string name="help_popover_tap_task">Tap task to edit and share</string>
<!-- Shown the first time a user sees the list activity -->
<string name="help_popover_list_settings">Tap list settings to share the entire list</string>
<!-- 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>
</resources>

@ -49,7 +49,7 @@ public final class Eula {
* @param activity
* The Activity to finish if the user rejects the EULA
*/
static void showEula(final Activity activity) {
public static void showEula(final Activity activity) {
if(!new Eula().shouldShowEula(activity))
return;

@ -101,6 +101,7 @@ import com.todoroo.astrid.utility.AstridPreferences;
import com.todoroo.astrid.utility.Constants;
import com.todoroo.astrid.utility.Flags;
import com.todoroo.astrid.voice.VoiceInputAssistant;
import com.todoroo.astrid.welcome.HelpInfoPopover;
import com.todoroo.astrid.widget.TasksWidget;
/**
@ -227,6 +228,11 @@ public class TaskListActivity extends ListActivity implements OnScrollListener,
Eula.showEula(this);
if (!Preferences.getBoolean(R.string.p_showed_add_task_help, false)) {
HelpInfoPopover.showPopover(TaskListActivity.this, quickAddBox, R.string.help_popover_add_task);
Preferences.setBoolean(R.string.p_showed_add_task_help, true);
}
if(getIntent().hasExtra(TOKEN_SOURCE)) {
switch(getIntent().getIntExtra(TOKEN_SOURCE, Constants.SOURCE_DEFAULT)) {
case Constants.SOURCE_NOTIFICATION:

@ -0,0 +1,61 @@
package com.todoroo.astrid.welcome;
import greendroid.widget.QuickAction;
import greendroid.widget.QuickActionWidget;
import java.util.List;
import android.app.Activity;
import android.content.Context;
import android.graphics.Rect;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;
import com.timsu.astrid.R;
public class HelpInfoPopover extends QuickActionWidget {
public static void showPopover(final Activity activity, final View parent, final int textId) {
parent.post(new Runnable() {
@Override
public void run() {
HelpInfoPopover toShow = new HelpInfoPopover(activity, textId);
toShow.show(parent);
}
});
}
public HelpInfoPopover(Context context, int textId) {
super(context);
setContentView(R.layout.help_popover);
TextView message = (TextView)getContentView().findViewById(R.id.gdi_message);
message.setText(textId);
}
@Override
protected void populateQuickActions(List<QuickAction> quickActions) {
// Do nothing
}
@Override
protected void onMeasureAndLayout(Rect anchorRect, View contentView) {
contentView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
contentView.measure(MeasureSpec.makeMeasureSpec(getScreenWidth(), MeasureSpec.EXACTLY),
ViewGroup.LayoutParams.WRAP_CONTENT);
int rootHeight = contentView.getMeasuredHeight();
int offsetY = getArrowOffsetY();
int dyTop = anchorRect.top;
int dyBottom = getScreenHeight() - anchorRect.bottom;
boolean onTop = (dyTop > dyBottom);
int popupY = (onTop) ? anchorRect.top - rootHeight + offsetY : anchorRect.bottom - offsetY;
setWidgetSpecs(popupY, onTop);
}
}

@ -1,4 +1,4 @@
package com.todoroo.astrid.activity;
package com.todoroo.astrid.welcome;
import android.app.Activity;
import android.content.Intent;
@ -12,10 +12,14 @@ import com.timsu.astrid.R;
import com.todoroo.andlib.service.ContextManager;
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.service.StartupService;
public class WelcomeScreen extends Activity implements Eula.EulaCallback {
Button showEula;
@Override
protected void onCreate(Bundle savedInstanceState) {
ContextManager.setContext(this);
@ -32,7 +36,7 @@ public class WelcomeScreen extends Activity implements Eula.EulaCallback {
return;
}
Button showEula = (Button) findViewById(R.id.show_eula);
showEula = (Button) findViewById(R.id.show_eula);
showEula.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Loading…
Cancel
Save