From fcc9f2ba21e1f48c3ef6e256b41a73088a595d40 Mon Sep 17 00:00:00 2001 From: Doug Keen Date: Sun, 24 Mar 2013 18:38:06 -0700 Subject: [PATCH] Reordering of favorites list --- project.properties | 1 + res/drawable-hdpi/drag_handle.png | Bin 0 -> 506 bytes res/drawable-mdpi/drag_handle.png | Bin 0 -> 429 bytes res/drawable-xhdpi/drag_handle.png | Bin 0 -> 586 bytes res/layout/favorite_listing.xml | 12 +++++++- res/layout/main.xml | 17 +++++++++-- .../bart/activities/RoutesListActivity.java | 28 ++++++++++++++++-- .../bart/data/FavoritesArrayAdapter.java | 5 ++++ src/com/dougkeen/bart/model/StationPair.java | 7 +++++ 9 files changed, 65 insertions(+), 5 deletions(-) create mode 100755 res/drawable-hdpi/drag_handle.png create mode 100755 res/drawable-mdpi/drag_handle.png create mode 100755 res/drawable-xhdpi/drag_handle.png diff --git a/project.properties b/project.properties index 695b950..04798d9 100644 --- a/project.properties +++ b/project.properties @@ -13,3 +13,4 @@ android.library.reference.1=../ActionBarSherlock/library android.library.reference.2=../HoloEverywhere/library android.library.reference.3=../NineOldAndroids/library android.library.reference.4=../android-numberpicker/library +android.library.reference.5=../drag-sort-listview/library diff --git a/res/drawable-hdpi/drag_handle.png b/res/drawable-hdpi/drag_handle.png new file mode 100755 index 0000000000000000000000000000000000000000..9b255483ff270997d272dbf7469f5b656ad2de42 GIT binary patch literal 506 zcmeAS@N?(olHy`uVBq!ia0vp^20-k=!3HEZ6qjiODYhhUcNd2LAh=-f^2tCE&H|6f zVg?3oVGw3ym^DWND9B#o>FdgVmq}1qnDNKVRnHh07~4Hv978hhy`2@CeaJz;_56y^ zEeqCOuoLN-P?Jos$ho#&3uux#6}=SaZTwSRfo&He3SE+?0VvMxAsit`Iu$*yc``TJ(^tM zRMW41VBMBg5&7mFr_QeV>b@~ey4KU}RH|aoxrXCDOIU&?ep+8KqjQS0s~02Op$mQX n`0Tnksr)9Rd}q}{-}UwqN=Y^k`09LsvBco%>gTe~DWM4f9b3%n literal 0 HcmV?d00001 diff --git a/res/drawable-mdpi/drag_handle.png b/res/drawable-mdpi/drag_handle.png new file mode 100755 index 0000000000000000000000000000000000000000..b85828de4e889badc99ce8da8bb23cd0a27c4597 GIT binary patch literal 429 zcmeAS@N?(olHy`uVBq!ia0vp^3P5bY!3HD?)>PyJDYhhUcNd2LAh=-f^2tCE&H|6f zVg?3oVGw3ym^DWND9B#o>FdgVmq}2VpHslJzLSB0(aO`sF(l&f+v)z^haCit*85-f z;Oz)?VX^)3*M35He$s(3m)`nW>!!0zTl%K&R#0o@^bH2aHfF}}&vGfW6ma^SeC&9s z#->GJ*?~;O<1bFXO2&s8w+JjZ^(Q!$-0h4anEWD7?14aH24CDt|U6WD!=jgfaz zkYwKC=~vvHOc?pNEgdfj_wDc5$iD7cMr~K?64xutyag#QW?wU6J)7WRxku$Wn}zX= zz}HSsSmrdO^4xEmc=Dm~)k^2TNj-I^Y791?z@=&3f}$6lJA*k=N-y!mfX5= zUAsVEum0j_ZbnHrqrD5O43U)2MkySPgg&ebxsLQ0DhFG$p8QV literal 0 HcmV?d00001 diff --git a/res/drawable-xhdpi/drag_handle.png b/res/drawable-xhdpi/drag_handle.png new file mode 100755 index 0000000000000000000000000000000000000000..6a3450ef28d3bff6716fb7c57502806b029acbbd GIT binary patch literal 586 zcmeAS@N?(olHy`uVBq!ia0vp^4nUm1!3HGP9xZtRq}Y|gW!U_%O?XxI14-? ziy0WWg+Z8+Vb&Z8pdfpRr>`sfT_!^|>i&+`(-`H>_MPuyFgtLZ`Fae4e%G@sric#*lp7eBI1~`X z0p~M+DjoQ9xR1SQuyJkhKM;Cw#$j89{H_VxB$9g!pOp*S^Ba9u{jlW4y+4*pyW;1b zIg{{)D>P)GvrEn@u7%GJta{*_yR2!|ZR6*v$?B_2?>Cx@yQ*r%a(A93cl8AaJ^`rP}u+Z`IXXz*XlnV-i2<}5BcKq z(>~z_Y4xiZ-goU2WPaQo@@?*arW)-Tr*(~wNhC`d<@e~U__^O%abJlO)zz|Bg= z_up5|yv6djXVzJ%T9=qm#x*Ol!`^7Gn07$>)vkb4hWfY9pC@^sdI{*czF9v%H<+6K p7qR^kwu|wHm#_4@ZKVzJ2X18i3|?~k12EPZJYD@<);T3K0RUMp>RbQ- literal 0 HcmV?d00001 diff --git a/res/layout/favorite_listing.xml b/res/layout/favorite_listing.xml index fe0e94e..5230a96 100644 --- a/res/layout/favorite_listing.xml +++ b/res/layout/favorite_listing.xml @@ -6,6 +6,15 @@ android:paddingLeft="5dp" android:paddingRight="5dp" > + + diff --git a/res/layout/main.xml b/res/layout/main.xml index b520d0b..aa2918c 100644 --- a/res/layout/main.xml +++ b/res/layout/main.xml @@ -1,15 +1,28 @@ - + android:layout_margin="3dp" + android:layout_weight="1" + android:dividerHeight="1dp" + android:padding="3dp" + app:collapsed_height="1dp" + app:drag_enabled="true" + app:drag_handle_id="@id/dragHandle" + app:drag_scroll_start="0.33" + app:drag_start_mode="onDown" + app:float_alpha="0.6" + app:remove_enabled="true" + app:remove_mode="flingRemove" + app:slide_shuffle_speed="0.3" /> { } } + public void move(StationPair object, int to) { + super.remove(object); + super.insert(object, to); + } + @Override public void clear() { super.clear(); diff --git a/src/com/dougkeen/bart/model/StationPair.java b/src/com/dougkeen/bart/model/StationPair.java index c1fcd79..d927be7 100644 --- a/src/com/dougkeen/bart/model/StationPair.java +++ b/src/com/dougkeen/bart/model/StationPair.java @@ -43,6 +43,7 @@ public class StationPair implements Parcelable { private Station origin; private Station destination; private String fare; + private long fareLastUpdated; private int averageTripLength; private int averageTripSampleCount; @@ -126,6 +127,12 @@ public class StationPair implements Parcelable { return true; } + @Override + public String toString() { + return "StationPair [origin=" + origin + ", destination=" + destination + + "]"; + } + @Override public int describeContents() { return 0;