Merge branch 'master' into dev

pull/14/head
Tim Su 15 years ago
commit b8623d2500

@ -23,8 +23,8 @@ import android.text.InputType;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.widget.TextView;
import com.todoroo.andlib.service.Autowired;
@ -39,22 +39,6 @@ import com.todoroo.andlib.service.ExceptionService;
*/
public class AndroidUtilities {
// --- activity management
private static Activity currentlyActive = null;
public static void setCurrentlyActive(Activity currentlyActive) {
AndroidUtilities.currentlyActive = currentlyActive;
}
/**
* @return our best-guess currently active activity. Maybe null, may
* be out of view already.
*/
public static Activity getCurrentlyActiveActivity() {
return currentlyActive;
}
// --- utility methods
private static class ExceptionHelper {

@ -3,14 +3,17 @@
*/
package com.todoroo.astrid.notes;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.timsu.astrid.R;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.api.DetailExposer;
import com.todoroo.astrid.core.PluginServices;
import com.todoroo.astrid.model.Task;
import com.todoroo.astrid.utility.Preferences;
/**
* Exposes Task Detail for notes
@ -43,8 +46,14 @@ public class NoteDetailExposer extends BroadcastReceiver implements DetailExpose
@Override
public String getTaskDetails(Context context, long id, boolean extended) {
if(!extended)
return null;
if(Preferences.getBoolean(R.string.p_showNotes, false)) {
if(extended)
return null;
} else {
if(!extended)
return null;
}
Task task = PluginServices.getTaskService().fetchById(id, Task.NOTES);
if(task == null)

@ -123,6 +123,7 @@
<string name="p_colorize">colorize</string>
<string name="p_fontSize">font_size</string>
<string name="p_showNotes">notesVisible</string>
<string-array name="EPr_font_size">
<!-- font_size: options for preference menu -->

@ -388,10 +388,16 @@ to the plugin creator for fastest service.
<!-- Preference: Task List Font Size Title -->
<string name="EPr_fontSize_title">Task List Size</string>
<!-- Preference: Task List Font Size Description -->
<string name="EPr_fontSize_desc">Font size on the main listing page</string>
<!-- Preference: Task List Show Notes -->
<string name="EPr_showNotes_title">Show Notes In Task</string>
<!-- Preference: Task List Show Notes Description (disabled) -->
<string name="EPr_showNotes_desc_disabled">Notes will be displayed when you tap a task</string>
<!-- Preference: Task List Show Notes Description (enabled) -->
<string name="EPr_showNotes_desc_enabled">Notes will always displayed</string>
<!-- Preference Category: Defaults Title -->
<string name="EPr_defaults_header">New Task Defaults</string>

@ -11,14 +11,11 @@
android:entryValues="@array/EPr_font_size"
android:title="@string/EPr_fontSize_title"
android:summary="@string/EPr_fontSize_desc" />
</PreferenceCategory>
<!-- PreferenceCategory
android:title="@string/prefs_category_other">
<CheckBoxPreference
android:key="@string/p_backup"
android:title="@string/prefs_backup_title"
android:summary="@string/prefs_backup_desc"
android:defaultValue="true" /> -->
android:key="@string/p_showNotes"
android:title="@string/EPr_showNotes_title"
android:defaultValue="false" />
</PreferenceCategory>
</PreferenceScreen>

@ -11,6 +11,7 @@ import java.util.Map.Entry;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
@ -31,6 +32,8 @@ import com.todoroo.astrid.model.Task;
import com.todoroo.astrid.service.StartupService;
import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.utility.Constants;
import com.todoroo.astrid.utility.Flags;
import com.todoroo.astrid.utility.Preferences;
/**
* Displays the preference screen for users to edit their preferences
@ -150,7 +153,16 @@ public class EditPreferences extends TodorooPreferences {
@Override
public void updatePreferences(Preference preference, Object value) {
// nothing to do
Resources r = getResources();
// auto
if (r.getString(R.string.p_showNotes).equals(preference.getKey())) {
if (value != null && !(Boolean)value)
preference.setSummary(R.string.EPr_showNotes_desc_disabled);
else
preference.setSummary(R.string.EPr_showNotes_desc_enabled);
if((Boolean)value != Preferences.getBoolean(preference.getKey(), false))
Flags.set(Flags.REFRESH);
}
}

@ -71,6 +71,7 @@ import com.todoroo.astrid.service.MetadataService;
import com.todoroo.astrid.service.StartupService;
import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.utility.Constants;
import com.todoroo.astrid.utility.Flags;
/**
* Primary activity for the Bente application. Shows a list of upcoming
@ -446,8 +447,10 @@ public class TaskListActivity extends ListActivity implements OnScrollListener {
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if(hasFocus)
AndroidUtilities.setCurrentlyActive(this);
if(hasFocus && Flags.checkAndClear(Flags.REFRESH)) {
taskAdapter.flushCaches();
loadTaskListContent(true);
}
}
@Override

@ -14,12 +14,12 @@ import android.database.Cursor;
import android.graphics.Paint;
import android.text.Html;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener;
import android.view.View.OnCreateContextMenuListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.CheckBox;
@ -566,6 +566,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
public void notifyDataSetChanged() {
super.notifyDataSetChanged();
fontSize = Preferences.getIntegerFromString(R.string.p_fontSize, 20);
}
private final View.OnClickListener completeBoxListener = new View.OnClickListener() {

@ -61,6 +61,7 @@ public final class UpgradeService {
"This update contains for free all of the " +
"powerpack's features for evaluation purposes",
"Fixed widget not updating when tasks are edited",
"Added a setting for displaying task notes",
"If you liked the old version, you can also go back by " +
"<a href='http://bit.ly/oldastrid'>clicking here</a>",
});

@ -0,0 +1,22 @@
package com.todoroo.astrid.utility;
public class Flags {
private static int state = 0;
/**
* Whether to refresh the task list
*/
public static final int REFRESH = 1;
public static boolean checkAndClear(int flag) {
boolean set = (state & flag) > 0;
state &= ~flag;
return set;
}
public static void set(int flag) {
state |= flag;
}
}
Loading…
Cancel
Save