Fixed bugs in widget not using customExtras

pull/14/head
Sam Bosley 14 years ago
parent 9fd8cab63e
commit a2153ea237

@ -1,37 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="67"
android:id="@+id/tasklist_fragment_container">
<fragment
android:name="com.todoroo.astrid.activity.TaskListFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:tag="tasklist_fragment">
<!-- Preview: layout=@layout/task_list_activity -->
</fragment>
</FrameLayout>
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:background="#000000"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="33"
android:id="@+id/taskedit_fragment_container">
<fragment
android:name="com.todoroo.astrid.activity.TaskEditFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:tag="taskedit_fragment">
<!-- Preview: layout=@layout/task_edit_activity -->
</fragment>
</FrameLayout>
</LinearLayout>

@ -18,9 +18,6 @@ public class TaskEditActivity extends AstridActivity {
protected void onCreate(Bundle savedInstanceState) {
ThemeService.applyTheme(this);
super.onCreate(savedInstanceState);
if (AndroidUtilities.isTabletSized(this))
setContentView(R.layout.task_edit_wrapper_activity_3pane);
else
setContentView(R.layout.task_edit_wrapper_activity);
ActionBar actionBar = getSupportActionBar();

@ -402,8 +402,12 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
onTaskListItemClicked(id);
} else {
TaskListFragment tlf = getTaskListFragment();
if (tlf != null)
tlf.quickAddBar.quickAddTask("", true); //$NON-NLS-1$
if (tlf != null) {
System.err.println("Adding task");
Task result = tlf.quickAddBar.quickAddTask("", true); //$NON-NLS-1$
if (result != null)
onTaskListItemClicked(result.getId());
}
}
getIntent().removeExtra(OPEN_TASK);
}

@ -315,7 +315,7 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
super.onActivityCreated(savedInstanceState);
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
System.err.println("Initializing fragment");
syncActionHelper = new SyncActionHelper(getActivity(), this);
setUpUiComponents();
initializeData();
@ -368,6 +368,7 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
protected void initializeData() {
if (extras != null && extras.containsKey(TOKEN_FILTER)) {
filter = extras.getParcelable(TOKEN_FILTER);
System.err.println("Filter on init: " + filter);
extras.remove(TOKEN_FILTER); // Otherwise writing this filter to parcel gives infinite recursion
} else {
filter = CoreFilterExposer.buildInboxFilter(getResources());

@ -285,6 +285,10 @@ public class QuickAddBar extends LinearLayout {
peopleControl.saveSharingSettings(null);
}
System.err.println("Fragment: " + fragment);
if (fragment != null)
System.err.println("Filter: " + fragment.getFilter());
TaskService.createWithValues(task, fragment.getFilter().valuesForNewTasks, title,
taskService, metadataService);

@ -227,6 +227,10 @@ public class TasksWidget extends AppWidgetProvider {
} else {
listIntent.setAction("L" + widgetId);
}
if (filter instanceof FilterWithCustomIntent) {
listIntent.putExtras(((FilterWithCustomIntent) filter).customExtras);
}
PendingIntent pListIntent = PendingIntent.getActivity(context, widgetId,
listIntent, PendingIntent.FLAG_CANCEL_CURRENT);
if (pListIntent != null)
@ -235,8 +239,10 @@ public class TasksWidget extends AppWidgetProvider {
Intent editIntent;
boolean tablet = AndroidUtilities.isTabletSized(context);
if (tablet)
if (tablet) {
editIntent = new Intent(context, TaskListActivity.class);
editIntent.putExtra(TaskListActivity.OPEN_TASK, 0L);
}
else
editIntent = new Intent(context, TaskEditActivity.class);
@ -244,12 +250,18 @@ public class TasksWidget extends AppWidgetProvider {
editIntent.putExtra(TaskEditFragment.OVERRIDE_FINISH_ANIM, false);
if(filter != null) {
editIntent.putExtra(TaskListFragment.TOKEN_FILTER, filter);
if (filter.valuesForNewTasks != null && tablet) {
if (tablet) {
if (filter.valuesForNewTasks != null) {
String values = AndroidUtilities.contentValuesToSerializedString(filter.valuesForNewTasks);
values = PermaSql.replacePlaceholders(values);
editIntent.putExtra(TaskEditFragment.TOKEN_VALUES, values);
editIntent.setAction("E" + widgetId + values);
}
if (filter instanceof FilterWithCustomIntent) {
Bundle customExtras = ((FilterWithCustomIntent) filter).customExtras;
editIntent.putExtras(customExtras);
}
}
} else {
editIntent.setAction("E" + widgetId);
}

Loading…
Cancel
Save