Set values for new tasks in list notifications

pull/321/head
Alex Baker 10 years ago
parent 79baa61f9a
commit f9706fb314

@ -27,7 +27,7 @@ android {
buildToolsVersion "22.0.1"
defaultConfig {
versionCode 365
versionCode 366
versionName "4.7.13"
minSdkVersion 7
targetSdkVersion 22

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="billing_enabled">true</bool>
<bool name="tasker_available">true</bool>
</resources>

@ -67,7 +67,7 @@ public class Notifier {
this.preferences = preferences;
}
public void triggerFilterNotification(String title, String query) {
public void triggerFilterNotification(String title, String query, String valuesForNewTasks) {
TodorooCursor<Task> taskTodorooCursor = null;
int count;
try {
@ -90,7 +90,7 @@ public class Notifier {
String subtitle = context.getString(R.string.task_count, count);
showFilterNotification(title, subtitle, query);
showFilterNotification(title, subtitle, query, valuesForNewTasks);
}
public void triggerTaskNotification(long id, int type) {
@ -167,10 +167,10 @@ public class Notifier {
return true;
}
private void showFilterNotification(final String title, String subtitle, final String query) {
private void showFilterNotification(final String title, String subtitle, final String query, final String valuesForNewTasks) {
PendingIntent pendingIntent = PendingIntent.getActivity(context, (title + query).hashCode(), new Intent(context, TaskListActivity.class) {{
setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_MULTIPLE_TASK);
putExtra(TaskListActivity.TOKEN_SWITCH_TO_FILTER, new Filter(title, query, null));
putExtra(TaskListActivity.TOKEN_SWITCH_TO_FILTER, new Filter(title, query, AndroidUtilities.contentValuesFromSerializedString(valuesForNewTasks)));
}}, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context)

@ -5,6 +5,7 @@ import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.astrid.adapter.FilterAdapter;
import com.todoroo.astrid.api.Filter;
@ -19,6 +20,7 @@ public class FilterSelectionActivity extends InjectingFragmentActivity {
public static final String EXTRA_FILTER_NAME = "extra_filter_name";
public static final String EXTRA_FILTER_SQL = "extra_filter_query";
public static final String EXTRA_FILTER_VALUES = "extra_filter_values";
@Inject FilterProvider filterProvider;
@Inject FilterCounter filterCounter;
@ -38,6 +40,9 @@ public class FilterSelectionActivity extends InjectingFragmentActivity {
setResult(RESULT_OK, new Intent() {{
putExtra(EXTRA_FILTER_NAME, selectedFilter.listingTitle);
putExtra(EXTRA_FILTER_SQL, selectedFilter.getSqlQuery());
if (selectedFilter.valuesForNewTasks != null) {
putExtra(EXTRA_FILTER_VALUES, AndroidUtilities.contentValuesToSerializedString(selectedFilter.valuesForNewTasks));
}
}});
dialog.dismiss();
}

@ -31,6 +31,9 @@ public class BasicPreferences extends InjectingPreferenceActivity {
if (!getResources().getBoolean(R.bool.sync_enabled)) {
getPreferenceScreen().removePreference(findPreference(getString(R.string.synchronization)));
}
if (getResources().getBoolean(R.bool.tasker_available)) {
addPreferencesFromResource(R.xml.preferences_addons);
}
setupActivity(R.string.EPr_appearance_header, AppearancePreferences.class);
setupActivity(R.string.notifications, ReminderPreferences.class);
setupActivity(R.string.EPr_manage_header, OldTaskPreferences.class);

@ -21,6 +21,7 @@ public class ListNotificationReceiver extends InjectingBroadcastReceiver {
public static final String EXTRA_FILTER_TITLE = "extra_filter_title";
public static final String EXTRA_FILTER_QUERY = "extra_filter_query";
public static final String EXTRA_FILTER_VALUES = "extra_filter_values";
@Inject Notifier notifier;
@ -35,7 +36,8 @@ public class ListNotificationReceiver extends InjectingBroadcastReceiver {
public void run() {
notifier.triggerFilterNotification(
intent.getStringExtra(EXTRA_FILTER_TITLE),
intent.getStringExtra(EXTRA_FILTER_QUERY));
intent.getStringExtra(EXTRA_FILTER_QUERY),
intent.getStringExtra(EXTRA_FILTER_VALUES));
}
});
}

@ -6,4 +6,5 @@
<bool name="billing_enabled">false</bool>
<bool name="sync_enabled">true</bool>
<bool name="location_enabled">false</bool>
<bool name="tasker_available">false</bool>
</resources>

@ -125,6 +125,7 @@
<string name="show_completed">Show completed</string>
<string name="reverse">Reverse</string>
<string name="task_count">%s Tasks</string>
<string name="get_plugins">Get Plug-ins</string>
<string-array name="sync_SPr_interval_entries">
<!-- sync_SPr_interval_entries: Synchronization Intervals -->

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="@string/get_plugins">
<Preference
android:title="Tasker/Locale">
<intent
android:action="android.intent.action.VIEW"
android:data="market://details?id=org.tasks.locale" />
</Preference>
</PreferenceCategory>
</PreferenceScreen>
Loading…
Cancel
Save