Fix some two pane layout issues

pull/281/head
Alex Baker 11 years ago
parent 06d5d47700
commit 0fec8c9252

@ -273,7 +273,7 @@ public class TaskListFragment extends InjectingListFragment implements OnSortSel
parent.findViewById(R.id.fab).setOnClickListener(new OnClickListener() { parent.findViewById(R.id.fab).setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (ActivityPreferences.isTabletSized(context)) { if (getResources().getBoolean(R.bool.two_pane_layout)) {
Task task = quickAddBar.quickAddTask(); Task task = quickAddBar.quickAddTask();
onTaskListItemClicked(task.getId()); onTaskListItemClicked(task.getId());
} else { } else {

@ -52,7 +52,7 @@ public class TasksWidget extends InjectingAppWidgetProvider {
broadcaster.toggleCompletedState(intent.getLongExtra(TaskEditFragment.TOKEN_ID, 0)); broadcaster.toggleCompletedState(intent.getLongExtra(TaskEditFragment.TOKEN_ID, 0));
break; break;
case EDIT_TASK: case EDIT_TASK:
if(ActivityPreferences.isTabletSized(context)) { if (context.getResources().getBoolean(R.bool.two_pane_layout)) {
intent.setClass(context, TaskListActivity.class); intent.setClass(context, TaskListActivity.class);
} else { } else {
intent.setClass(context, TaskEditActivity.class); intent.setClass(context, TaskEditActivity.class);

@ -14,14 +14,14 @@ import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.api.FilterWithCustomIntent; import com.todoroo.astrid.api.FilterWithCustomIntent;
import org.tasks.preferences.ActivityPreferences; import org.tasks.R;
public class TaskIntents { public class TaskIntents {
public static Intent getNewTaskIntent(Context context, Filter filter) { public static Intent getNewTaskIntent(Context context, Filter filter) {
Intent intent; Intent intent;
boolean tablet = ActivityPreferences.isTabletSized(context); boolean twoPaneLayout = context.getResources().getBoolean(R.bool.two_pane_layout);
if (tablet) { if (twoPaneLayout) {
intent = new Intent(context, TaskListActivity.class); intent = new Intent(context, TaskListActivity.class);
intent.putExtra(TaskListActivity.OPEN_TASK, 0L); intent.putExtra(TaskListActivity.OPEN_TASK, 0L);
} else { } else {
@ -36,7 +36,7 @@ public class TaskIntents {
intent.putExtra(TaskEditFragment.TOKEN_VALUES, values); intent.putExtra(TaskEditFragment.TOKEN_VALUES, values);
intent.setAction("E" + values); intent.setAction("E" + values);
} }
if (tablet) { if (twoPaneLayout) {
if (filter instanceof FilterWithCustomIntent) { if (filter instanceof FilterWithCustomIntent) {
Bundle customExtras = ((FilterWithCustomIntent) filter).customExtras; Bundle customExtras = ((FilterWithCustomIntent) filter).customExtras;
intent.putExtras(customExtras); intent.putExtras(customExtras);
@ -49,8 +49,8 @@ public class TaskIntents {
} }
public static PendingIntent getEditTaskPendingIntent(Context context, final Filter filter, final long taskId) { public static PendingIntent getEditTaskPendingIntent(Context context, final Filter filter, final long taskId) {
boolean tablet = ActivityPreferences.isTabletSized(context); boolean twoPaneLayout = context.getResources().getBoolean(R.bool.two_pane_layout);
if (tablet) { if (twoPaneLayout) {
Intent intent = new Intent(context, TaskListActivity.class) {{ Intent intent = new Intent(context, TaskListActivity.class) {{
putExtra(TaskListActivity.OPEN_TASK, taskId); putExtra(TaskListActivity.OPEN_TASK, taskId);
if (filter != null && filter instanceof FilterWithCustomIntent) { if (filter != null && filter instanceof FilterWithCustomIntent) {

@ -122,7 +122,7 @@ public class WidgetHelper {
private PendingIntent getEditTaskIntent(Context context, Filter filter, int widgetId) { private PendingIntent getEditTaskIntent(Context context, Filter filter, int widgetId) {
Intent intent = new Intent(context, TasksWidget.class); Intent intent = new Intent(context, TasksWidget.class);
if (ActivityPreferences.isTabletSized(context)) { if (context.getResources().getBoolean(R.bool.two_pane_layout)) {
if (filter != null && filter instanceof FilterWithCustomIntent) { if (filter != null && filter instanceof FilterWithCustomIntent) {
Bundle customExtras = ((FilterWithCustomIntent) filter).customExtras; Bundle customExtras = ((FilterWithCustomIntent) filter).customExtras;
intent.putExtras(customExtras); intent.putExtras(customExtras);

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

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<bool name="two_pane_layout">false</bool>
<bool name="at_most_honeycomb">true</bool> <bool name="at_most_honeycomb">true</bool>
<bool name="at_least_honeycomb_mr1">false</bool> <bool name="at_least_honeycomb_mr1">false</bool>
<bool name="billing_enabled">false</bool> <bool name="billing_enabled">false</bool>

Loading…
Cancel
Save