From 1b30dab9ee7c01af6f204f5fd0272526698ad846 Mon Sep 17 00:00:00 2001 From: Tim Su Date: Mon, 4 Oct 2010 19:16:56 -0700 Subject: [PATCH] Rudimentary task moving logic, smaller grabber icon --- .../com/commonsware/cwac/tlv/TouchListView.java | 4 ++-- .../astrid/gtasks/GtasksListActivity.java | 4 +++- .../astrid/gtasks/GtasksTaskListUpdater.java | 5 +---- astrid/res/drawable/grabber.png | Bin 550 -> 728 bytes 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/astrid/common-src/com/commonsware/cwac/tlv/TouchListView.java b/astrid/common-src/com/commonsware/cwac/tlv/TouchListView.java index 61ae83a6e..45c2a1722 100644 --- a/astrid/common-src/com/commonsware/cwac/tlv/TouchListView.java +++ b/astrid/common-src/com/commonsware/cwac/tlv/TouchListView.java @@ -346,7 +346,7 @@ public class TouchListView extends ListView { v.setImageBitmap(bm); mDragBitmap = bm; - mWindowManager = (WindowManager)getContext().getSystemService("window"); + mWindowManager = (WindowManager)getContext().getSystemService("window"); //$NON-NLS-1$ mWindowManager.addView(v, mWindowParams); mDragView = v; } @@ -373,7 +373,7 @@ public class TouchListView extends ListView { private void stopDragging() { if (mDragView != null) { - WindowManager wm = (WindowManager)getContext().getSystemService("window"); + WindowManager wm = (WindowManager)getContext().getSystemService("window"); //$NON-NLS-1$ wm.removeView(mDragView); mDragView.setImageDrawable(null); mDragView = null; diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksListActivity.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksListActivity.java index 263429577..3572042c7 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksListActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksListActivity.java @@ -53,7 +53,9 @@ public class GtasksListActivity extends DraggableTaskListActivity { private final TouchListView.DropListener dropListener = new DropListener() { @Override public void drop(int from, int to) { - // meep + long targetTaskId = taskAdapter.getItemId(from); + gtasksTaskListUpdater.move(listId, targetTaskId, to - from); + loadTaskListContent(true); } }; diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksTaskListUpdater.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksTaskListUpdater.java index 56f00bf11..30a463343 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksTaskListUpdater.java +++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksTaskListUpdater.java @@ -6,11 +6,9 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import android.text.TextUtils; -import android.widget.Toast; import com.todoroo.andlib.data.TodorooCursor; import com.todoroo.andlib.service.Autowired; -import com.todoroo.andlib.service.ContextManager; import com.todoroo.andlib.service.DependencyInjectionService; import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.astrid.api.Filter; @@ -79,7 +77,6 @@ public class GtasksTaskListUpdater { // if indenting is warranted, indent me and my children if(indent + delta <= previousIndent.get() + 1 && indent + delta >= 0) { targetTaskIndent.set(indent); - Toast.makeText(ContextManager.getContext(), "indent: " + (indent + delta), Toast.LENGTH_SHORT).show(); metadata.setValue(GtasksMetadata.INDENT, indent + delta); if(delta > 0) metadata.setValue(GtasksMetadata.PARENT_TASK, previousTask.get()); @@ -115,7 +112,7 @@ public class GtasksTaskListUpdater { * if moving up and first task in list or moving down and last, * indents to same as task that we swapped with. * - * @param delta -1 or 1 + * @param delta # of positions to move * */ public void move(String listId, final long targetTaskId, final int delta) { diff --git a/astrid/res/drawable/grabber.png b/astrid/res/drawable/grabber.png index 9169ae57b534fe790eb52c9cd4797c48e5a8141a..d31a62d2fd7770e607d1c217f5ef41e2278a3ca2 100644 GIT binary patch literal 728 zcmV;}0w?{6P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2igh+ z0tyi3!%_MG00LM^L_t(Y$L&?WYui8={XVH7NQ;fFHu7L(TvC#uICN4x*w|p}BD~cG z)09H!(4|BFgwlT?OP4HhyOdD>m`w3a#hbT!^I+qpLzGe*LO{X}y6aLGH4#J!NtgOf zr|+KL=Q!v0RT+Xyq1O-lt>7HPNxHgVZ2Es5)Z@S zu&gMG*6DP5gb)~wMmIAo6bdjNk1r8NqY)H~#dnEB;&D2i{uz(QowKvEN6~0BMJfI2 zC+??(eni7COhkMk2!i0PN25{4FpTMJHbVe_)zwu_DUD1f6UobCj3MW|Mk)PrQTv{s zp=p|%>+9%oS`FpOu6v8UdBL&)0Dw>^v=WQO)+&`sx!3E7i!K>splKTO)5f5AG#U*km&($=go_(i}aJSp_T`#f3o#7YMkmON20d1`S0000< KMNUMnLSTX@ZcHoy literal 550 zcmV+>0@?kEP)}Y&QG0+MCbkqv>=y0z<%)6_xY(+&e0V!{OU{y}lEN zqEe|;L{XHUFU5~Hh6WsgtVVBxBF4DpMij9=HW&=d%wdd~>U26iw`US-u$rcQ{tuV0 of%!_Jou3M$!l*DG?N5LK0DsKc6u0x}KL7v#07*qoM6N<$g2#*j@&Et;