Show swipe between lists helper dialog to help with discovery

pull/14/head
Sam Bosley 13 years ago
parent 35da0d9605
commit bbcf54daac

@ -651,10 +651,6 @@
<!-- slide 33f -->
<string name="EPr_labs_desc">Try and configure experimental features</string>
<!-- Preference: swipe between lists performance -->
<string name="EPr_swipe_lists_performance_title">Swipe between lists</string>
<string name="EPr_swipe_lists_performance_subtitle">Controls the memory performance of swipe between lists</string>
<!-- slide 49g: Preferences: use the system contact picker for task assignment -->
<string name="EPr_use_contact_picker">Use contact picker</string>
<!-- slide 49b -->
@ -682,6 +678,12 @@
<string name="EPr_swipe_lists_restart_alert">You will need to restart Astrid for this change to take effect</string>
<!-- Swipe between lists -->
<!-- Preference: swipe between lists performance -->
<string name="EPr_swipe_lists_performance_title">Swipe between lists</string>
<string name="EPr_swipe_lists_performance_subtitle">Controls the memory performance of swipe between lists</string>
<string-array name="EPr_swipe_lists_performance_mode">
<item>No swipe</item>
<item>Conserve Memory</item>
@ -689,7 +691,6 @@
<item>High Performance</item>
</string-array>
<string-array name="EPr_swipe_lists_performance_desc">
<!-- slide 49a -->
<item>Swipe between lists is disabled</item>
@ -698,6 +699,10 @@
<item>Uses more system resources</item>
</string-array>
<string name="swipe_lists_helper_title">Swipe between lists</string>
<string name="swipe_lists_helper_header">Swipe left or right to quickly move between lists</string>
<string name="swipe_lists_helper_subtitle">Change settings in Settings -> Appearance</string>
<!-- Format string for displaying the currently selected preference. $1 is name of selected mode, $2 is description -->
<string name="EPr_swipe_lists_display">%1$s - %2$s</string>

@ -63,6 +63,7 @@ import com.todoroo.astrid.service.StatisticsService;
import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.sync.SyncProviderPreferences;
import com.todoroo.astrid.ui.ContactListAdapter;
import com.todoroo.astrid.ui.TaskListFragmentPager;
import com.todoroo.astrid.utility.Constants;
import com.todoroo.astrid.utility.Flags;
import com.todoroo.astrid.voice.VoiceInputAssistant;
@ -505,7 +506,14 @@ public class EditPreferences extends TodorooPreferenceActivity {
else if (booleanPreference(preference, value, R.string.p_autoIdea,
R.string.EPr_ideaAuto_desc_disabled, R.string.EPr_ideaAuto_desc_enabled));
else if (r.getString(R.string.p_swipe_lists_performance_key).equals(preference.getKey())) {
preference.setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(RESULT_CODE_PERFORMANCE_PREF_CHANGED));
preference.setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(RESULT_CODE_PERFORMANCE_PREF_CHANGED) {
@Override
public boolean onPreferenceChange(Preference p, Object newValue) {
// If the user changes the setting themselves, no need to show the helper
Preferences.setBoolean(TaskListFragmentPager.PREF_SHOWED_SWIPE_HELPER, true);
return super.onPreferenceChange(p, newValue);
}
});
int index = 0;
if(value instanceof String && !TextUtils.isEmpty((String)value))

@ -374,6 +374,7 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
setCommentsCount(0);
if (swipeIsEnabled()) {
TaskListFragmentPager.showSwipeBetweenHelper(this);
tlfPager.showFilter((Filter) item);
return true;
}
@ -501,6 +502,8 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
fragment.initiateAutomaticSync();
fragment.requestCommentCountUpdate();
}
if (position != 0)
Preferences.setBoolean(TaskListFragmentPager.PREF_SHOWED_SWIPE_HELPER, true);
}
}

@ -5,6 +5,7 @@
*/
package com.todoroo.astrid.ui;
import android.app.Activity;
import android.content.Context;
import android.graphics.Rect;
import android.support.v4.view.PagerAdapter;
@ -14,14 +15,18 @@ import android.view.MotionEvent;
import android.view.View;
import com.timsu.astrid.R;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.adapter.TaskListFragmentPagerAdapter;
import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.service.ThemeService;
import com.todoroo.astrid.utility.Flags;
public class TaskListFragmentPager extends ViewPager {
public static final String PREF_SHOWED_SWIPE_HELPER = "showed_swipe_helper"; //$NON-NLS-1$
public TaskListFragmentPager(Context context, AttributeSet attrs) {
super(context, attrs);
int offscreenPageLimit = Preferences.getIntegerFromString(R.string.p_swipe_lists_performance_key, 3);
@ -104,4 +109,22 @@ public class TaskListFragmentPager extends ViewPager {
}
return false;
}
@SuppressWarnings("nls")
public static void showSwipeBetweenHelper(Activity activity) {
if (!Preferences.getBoolean(PREF_SHOWED_SWIPE_HELPER, false)) {
String body = String.format("<h3>%s</h3><img src='%s'><br><br>%s",
activity.getString(R.string.swipe_lists_helper_header),
"subtasks_horizontal.png",
activity.getString(R.string.swipe_lists_helper_subtitle));
String color = ThemeService.getDialogTextColor();
String html = String.format("<html><body style='text-align:center;color:%s'>%s</body></html>",
color, body);
DialogUtilities.htmlDialog(activity, html, R.string.swipe_lists_helper_title);
Preferences.setBoolean(PREF_SHOWED_SWIPE_HELPER, true);
}
}
}

Loading…
Cancel
Save