diff --git a/astrid/res/layout/task_list_activity.xml b/astrid/res/layout/task_list_activity.xml index aa2d1df0d..a10f9e049 100644 --- a/astrid/res/layout/task_list_activity.xml +++ b/astrid/res/layout/task_list_activity.xml @@ -4,6 +4,9 @@ android:id="@+id/taskListParent" android:layout_width="fill_parent" android:layout_height="fill_parent" + android:focusable="true" + android:focusableInTouchMode="true" + android:descendantFocusability="beforeDescendants" style="@style/Content" android:orientation="vertical"> @@ -26,24 +29,33 @@ android:orientation="vertical" style="@style/Content"> - - + android:layout_height="wrap_content" + android:orientation="vertical" + android:visibility="gone"> - - + android:layout_width="fill_parent" + android:layout_height="1px" + android:background="?attr/asSeparatorBackground"/> + + + + + + + syncActions = new LinkedHashSet(); private boolean isFilter; @@ -519,6 +524,16 @@ public class TaskListFragment extends ListFragment implements OnScrollListener, } }); + getListView().setOnTouchListener(new OnTouchListener() { + @Override + public boolean onTouch(View v, MotionEvent event) { + quickAddBox.clearFocus(); + return false; + } + }); + + quickAddControls = (LinearLayout) getView().findViewById(R.id.taskListQuickaddControls); + quickAddControlsContainer = getView().findViewById(R.id.taskListQuickaddControlsContainer); setUpQuickAddControlSets(); // set listener for pressing enter in quick-add box @@ -539,6 +554,13 @@ public class TaskListFragment extends ListFragment implements OnScrollListener, } }); + quickAddBox.setOnFocusChangeListener(new OnFocusChangeListener() { + @Override + public void onFocusChange(View v, boolean hasFocus) { + quickAddControlsContainer.setVisibility(hasFocus ? View.VISIBLE : View.GONE); + } + }); + quickAddButton = ((ImageButton) getView().findViewById( R.id.quickAddButton)); @@ -637,9 +659,8 @@ public class TaskListFragment extends ListFragment implements OnScrollListener, resetControlSets(); LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT, 1.0f); - LinearLayout container = (LinearLayout) getView().findViewById(R.id.taskListQuickaddControls); - container.addView(peopleControl.getDisplayView(), 0, lp); - container.addView(deadlineControl.getDisplayView(), 2, lp); + quickAddControls.addView(peopleControl.getDisplayView(), 0, lp); + quickAddControls.addView(deadlineControl.getDisplayView(), 2, lp); } private void resetControlSets() {