Permalink
Browse files

Refactored quick add bar from Task List Fragment out into QuickAddBar…

…. Seems like it works... like a boss!
  • Loading branch information...
timsu committed Feb 17, 2012
1 parent e8c06cd commit 3d02188f7d1cb30ab05d9321791ff04f71bd3859
@@ -36,7 +36,6 @@
import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities;
-import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.actfm.sync.ActFmSyncService;
@@ -213,7 +212,7 @@ protected void onNewIntent(Intent intent) {
}
@Override
- protected TagData getActiveTagData() {
+ public TagData getActiveTagData() {
return tagData;
}
@@ -451,16 +450,6 @@ public void onPause() {
getActivity().unregisterReceiver(notifyReceiver);
}
- @Override
- protected Task quickAddTask(String title, boolean selectNewTask) {
- if(!tagData.containsNonNullValue(TagData.NAME) ||
- tagData.getValue(TagData.NAME).length() == 0) {
- DialogUtilities.okDialog(getActivity(), getString(R.string.tag_no_title_error), null);
- return null;
- }
- return super.quickAddTask(title, selectNewTask);
- }
-
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE_SETTINGS && resultCode == Activity.RESULT_OK) {
@@ -53,7 +53,6 @@
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.OAuthLoginActivity;
import com.todoroo.astrid.activity.TaskEditFragment;
-import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.dao.Database;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.helper.TaskEditControlSet;
@@ -239,7 +238,7 @@ protected void loadItem(Intent intent) {
} catch (Exception e) {
// oops, can't serialize
}
- model = TaskListFragment.createWithValues(values, null,
+ model = TaskService.createWithValues(values, null,
taskService, metadataService);
}
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- See the file "LICENSE" for the full license governing this code. -->
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="50dip"
+ android:padding="3dip"
+ android:paddingBottom="0dip"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
+
+ <!-- Voice Add Button -->
+ <ImageButton android:id="@+id/voiceAddButton"
+ android:layout_width="39dip"
+ android:layout_height="39dip"
+ android:layout_gravity="top"
+ android:layout_marginLeft="5dip"
+ android:layout_marginRight="3dip"
+ android:paddingLeft="10dip"
+ android:paddingRight="10dip"
+ android:layout_weight="1"
+ android:visibility="gone"
+ android:background="@android:color/transparent"
+ android:src="?attr/asMicButtonImg"
+ android:scaleType="center"/>
+
+ <!-- Quick Add Task -->
+ <EditText android:id="@+id/quickAddText"
+ android:layout_width="wrap_content"
+ android:layout_height="39dip"
+ android:layout_marginRight="8dip"
+ android:layout_marginLeft="5dip"
+ android:layout_marginBottom="2dip"
+ android:layout_weight="100"
+ android:paddingLeft="5dip"
+ android:background="@drawable/edit_title_background"
+ android:hint="@string/TLA_quick_add_hint"
+ android:textSize="16sp"
+ android:autoText="true"
+ android:textColor="@android:color/black"
+ android:capitalize="sentences"/>
+
+ <!-- Extended Add Button -->
+ <ImageButton android:id="@+id/quickAddButton"
+ android:layout_width="39dip"
+ android:layout_height="39dip"
+ android:layout_gravity="top"
+ android:layout_marginRight="5dip"
+ android:layout_weight="1"
+ android:background="@android:color/transparent"
+ android:src="?attr/asAddButtonImg"
+ android:scaleType="center"/>
+
+ </LinearLayout>
+
+
+
+ <LinearLayout
+ android:id="@+id/taskListQuickaddControlsContainer"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:layout_marginBottom="5dip"
+ android:visibility="gone">
+
+ <LinearLayout
+ android:id="@+id/taskListQuickaddControls"
+ android:layout_width="fill_parent"
+ android:layout_height="50dip"
+ android:orientation="horizontal">
+
+ <View
+ android:layout_height="fill_parent"
+ android:layout_width="1px"
+ android:background="?attr/asSeparatorBackground"/>
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+</merge>
@@ -21,92 +21,12 @@
<!-- Body goes here -->
<!-- Footer -->
- <LinearLayout
+ <com.todoroo.astrid.ui.QuickAddBar
android:id="@+id/taskListFooter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
- style="@style/Content">
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:minHeight="50dip"
- android:padding="3dip"
- android:paddingBottom="0dip"
- android:gravity="center_vertical"
- android:orientation="horizontal">
-
- <!-- Voice Add Button -->
- <ImageButton android:id="@+id/voiceAddButton"
- android:layout_width="39dip"
- android:layout_height="39dip"
- android:layout_gravity="top"
- android:layout_marginLeft="5dip"
- android:layout_marginRight="3dip"
- android:paddingLeft="10dip"
- android:paddingRight="10dip"
- android:layout_weight="1"
- android:visibility="gone"
- android:background="@android:color/transparent"
- android:src="?attr/asMicButtonImg"
- android:scaleType="center"/>
-
- <!-- Quick Add Task -->
- <EditText android:id="@+id/quickAddText"
- android:layout_width="wrap_content"
- android:layout_height="39dip"
- android:layout_marginRight="8dip"
- android:layout_marginLeft="5dip"
- android:layout_marginBottom="2dip"
- android:layout_weight="100"
- android:paddingLeft="5dip"
- android:background="@drawable/edit_title_background"
- android:hint="@string/TLA_quick_add_hint"
- android:textSize="16sp"
- android:autoText="true"
- android:textColor="@android:color/black"
- android:capitalize="sentences"/>
-
- <!-- Extended Add Button -->
- <ImageButton android:id="@+id/quickAddButton"
- android:layout_width="39dip"
- android:layout_height="39dip"
- android:layout_gravity="top"
- android:layout_marginRight="5dip"
- android:layout_weight="1"
- android:background="@android:color/transparent"
- android:src="?attr/asAddButtonImg"
- android:scaleType="center"/>
-
- </LinearLayout>
-
-
-
- <LinearLayout
- android:id="@+id/taskListQuickaddControlsContainer"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_marginBottom="5dip"
- android:visibility="gone">
-
- <LinearLayout
- android:id="@+id/taskListQuickaddControls"
- android:layout_width="fill_parent"
- android:layout_height="50dip"
- android:orientation="horizontal">
-
- <View
- android:layout_height="fill_parent"
- android:layout_width="1px"
- android:background="?attr/asSeparatorBackground"/>
-
- </LinearLayout>
-
- </LinearLayout>
-
- </LinearLayout>
+ style="@style/Content" />
</LinearLayout>
@@ -52,7 +52,7 @@ protected void onPostResume() {
if (!handled) {
Intent callerIntent = getIntent();
- Task task = tlf.quickAddTask(subject, false);
+ Task task = tlf.quickAddBar.quickAddTask(subject, false);
task.setValue(Task.NOTES, callerIntent.getStringExtra(Intent.EXTRA_TEXT));
taskService.save(task);
handled = true;
@@ -805,7 +805,7 @@ protected void loadItem(Intent intent) {
} catch (Exception e) {
// oops, can't serialize
}
- model = TaskListFragment.createWithValues(values, null,
+ model = TaskService.createWithValues(values, null,
taskService, metadataService);
}
Oops, something went wrong.

0 comments on commit 3d02188

Please sign in to comment.