From 756545d49104594c5f56b50a7511cb0e7ce8328d Mon Sep 17 00:00:00 2001 From: Doug Keen Date: Wed, 2 Nov 2016 18:34:42 -0700 Subject: [PATCH] Add swap button to route form --- .../AbstractRouteSelectionFragment.java | 12 ++++++++++++ .../ic_action_action_swap_vert.png | Bin 0 -> 514 bytes .../ic_action_action_swap_vert.png | Bin 0 -> 310 bytes .../ic_action_action_swap_vert.png | Bin 0 -> 575 bytes .../ic_action_action_swap_vert.png | Bin 0 -> 924 bytes .../ic_action_action_swap_vert.png | Bin 0 -> 1328 bytes app/src/main/res/layout/route_form.xml | 16 ++++++++++++---- 7 files changed, 24 insertions(+), 4 deletions(-) create mode 100755 app/src/main/res/drawable-hdpi/ic_action_action_swap_vert.png create mode 100755 app/src/main/res/drawable-mdpi/ic_action_action_swap_vert.png create mode 100755 app/src/main/res/drawable-xhdpi/ic_action_action_swap_vert.png create mode 100755 app/src/main/res/drawable-xxhdpi/ic_action_action_swap_vert.png create mode 100755 app/src/main/res/drawable-xxxhdpi/ic_action_action_swap_vert.png diff --git a/app/src/main/java/com/dougkeen/bart/activities/AbstractRouteSelectionFragment.java b/app/src/main/java/com/dougkeen/bart/activities/AbstractRouteSelectionFragment.java index 0834ef8..a23c9e0 100644 --- a/app/src/main/java/com/dougkeen/bart/activities/AbstractRouteSelectionFragment.java +++ b/app/src/main/java/com/dougkeen/bart/activities/AbstractRouteSelectionFragment.java @@ -14,6 +14,8 @@ import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; import android.view.View; import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.ImageButton; import android.widget.Spinner; import android.widget.Toast; @@ -80,6 +82,16 @@ public abstract class AbstractRouteSelectionFragment extends DialogFragment { .findViewById(R.id.destination_spinner); destinationSpinner.setAdapter(destinationSpinnerAdapter); destinationSpinner.setSelection(lastSelectedDestinationPosition); + + final ImageButton swapButton = (ImageButton) dialog.findViewById(R.id.swap_button); + swapButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + int destinationSelection = destinationSpinner.getSelectedItemPosition(); + destinationSpinner.setSelection(originSpinner.getSelectedItemPosition()); + originSpinner.setSelection(destinationSelection); + } + }); } @NonNull diff --git a/app/src/main/res/drawable-hdpi/ic_action_action_swap_vert.png b/app/src/main/res/drawable-hdpi/ic_action_action_swap_vert.png new file mode 100755 index 0000000000000000000000000000000000000000..b38e01303f7bf78f4dd5e2cbda336a0f6e13aa2d GIT binary patch literal 514 zcmV+d0{#7oP)TC0-%Ua+rt(*l{XfPwl4( z5!v^QbI`CL04Fx<9#1_<8K+QyDPYlw%{Z_GOaf29CGcY5)WnsDJbJ)39ufple~K|? z!e)LBxCMG5^4xee0XGx?E!w{@V2n}Q)4(Y320Vy}2}sSCTe3ySS~>t`fjeNkjeU|E zKtFD+ZuA1+yNOe6^kTp<@Z$y@b^~g1#yL*k*I$uC4dC-GF96?Esg+IqCk+^5>PK#E z`n6}Sj@;TiSIvL$kvo|I+w^P!YaWJ9fy0mQ2V1;Bw&6WTj#&)mw-uWSGg#5`~#B5EP}$_fy@ z+5r<3fD~12GG{T+q*^J)76U1&+GNgRph>k-jP1OE4`SNjF~W!|mH+?%07*qoM6N<$ Ef==YuoB#j- literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/ic_action_action_swap_vert.png b/app/src/main/res/drawable-mdpi/ic_action_action_swap_vert.png new file mode 100755 index 0000000000000000000000000000000000000000..a150679afe9429a481371988811324cd0abdc617 GIT binary patch literal 310 zcmV-60m=S}P)@#TSM00OWhdF%_33NZHY34pzaEdcx)1j)-=0ouhS8Nk86=OhgvG?EOY07#nJ zJd&pzq9Oop=DsyKW=aC|+M169cu^fG&MX5~TwTTXuK-;YJ{W+caD&R;f=2@-T674& zYa(<>l>lhp2)(Z9Fo0WVA?%9Y<~&r20Oa)k=eZT28mI>T0J2AeAzLcLKmY&$07*qo IM6N<$g4P%$!*1-$)_G4XPCjHrJf+RB8Fia%UPzh##5X#Shd6(LL1+R1zZ( z=FCCOg&fvT7z9r5^L*=iLs7CpGUYx?Qh@ammJLsZ?^$QtC?3h)}Ip=2y9_067N1ys7?tf0oV#t#ikr7Sj?sR_C&d7^NpB7U69$8)tDnm{r-UW| DZKvm} literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_action_swap_vert.png b/app/src/main/res/drawable-xxhdpi/ic_action_action_swap_vert.png new file mode 100755 index 0000000000000000000000000000000000000000..b926188046baf4ba3d3af86819c231fd4a7ec152 GIT binary patch literal 924 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7Ro>U{3aQaSW-5dppOs`-+1=+x<_E z9QpsLpYQ6r-}Jy$ziGjXE)9(zjf?CLu3og_#G;CC@@pUMO<53r+|X0q^lI$O5ARH4 zLtj3B`D#h}4ABqzQyN;r(hCC|J}50<;Nnmdh?ytrz<7|Q>GWo14TTvF1(jtCtSrJD zdgu8TG$b$`e0q~nM8HR3hmCauQxhl4^mO(B2ZP23pWZ+;*KLzsuxD&1C1=LB4Pns-Ch~lAW+>@AP6dZLq7zR)Uf?7ev$k`TttV zmGR8MozZl9wYx6Yf`0S*d`cFar<*L$50 zJTP5O?fCJ!mIK!>JP37V6fu}}V9mA#7t7~Lp5XhSlzGOP(XAjZQRIQ^r5Wu^JrDLA z(m2q)#E_p=;$SbYcSC#I`hAoB+$vwd{2^H*!lkZv@ATZ`raz@tt>R~txn1_j_Tzn* zCv^+&{9l?IbRbJ?Rh9Sw$@GA$^?$CfX;676*3j)Ic?*L(r{ah3@AvlrMdccT zkNpg}Uv|y9Ops|(3p<0K&z-(ib_KiNtTywf#_N#2E zD|dvo`kT%ZuQ{WOw=V1!59nR8Q2^+z%GSUJanEEqE`z4eT#Fg>Cmpj9Nnm*{>c$wS z(p#xFVdQ&MBb@06YGYjsO4v literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxxhdpi/ic_action_action_swap_vert.png b/app/src/main/res/drawable-xxxhdpi/ic_action_action_swap_vert.png new file mode 100755 index 0000000000000000000000000000000000000000..1236129d162bd01d84ec4ccefa6764dbad2c9fb5 GIT binary patch literal 1328 zcmb`HSyWR85QgW5n}r}4R?(UQQ4UBG6spK#A&CJC8Y7jmC_)4gFi|){STxidkj;e( z91&bFijB4`Mk`SiG*y%w5v6K0#;UO{fOwT)8V@4S^trD-%>SSHX8tp8Q@Lv8GF$2_ zDgf9(4%)PW-WK%p`Oe1X00ZACaV23$Y z7E4Llj_RIU#S@6qhtZ+l;48|np9eQ?I&lL@25YRgvZEP%cWcJah_=rZKxa&FwHM+J zxR2UpL04WbHZ&`si-2TYl-?`xf_sa^+lYkz+%W}N01A=LL`CI8qx|WOFfGHCTk&Z& zfi^!nOVYi(XPDuTd}s+py#S1tyHy`&@m{X3)spo;i4$=fPW!|2U`rS3kc(Fy@qmI6 z=lJYCrV4+UbcH!wnEod+2p=4N=~#p3XW;)VYLCLh$#ScBgOXXMf8VbkK9Kg^duA}u zg-OR3#x+mawRT-r#D1Q(N*;iC)A%`2I6<3~y!xA9woH%8*$eyTwcEsOFXFdulVAmx z%)Z!*N_1*sVT&n`g($JXk<2xpk4JQ-E;haBceWq8GD*SPUrtN$%JL~ChR zS#T1%%lVsT8#6t#!e6RxY)mzeP}$O(y8U~}d_`kmKt#{6Glzcut#B?Q`SqIIHc28u z`J6z8L~?eXub<;^Cn@_`iZQiw3!-DjUe6OgFwfw4g2(*~vSRa5U=~U!>)+)G^=51K z@q|15b_bP3gncAoR7l1Rv$a~?Gii;>XFm3VnFB?0^qd@(07gNRN#^TA5e>M1NQths zAb-U5Lj3)6xFco+rmCdC_%=ZrzhB#XDfMp74$lQ~Ev3JgU!*I9w zyF*=b6YVQx746Ze3##5KaY~s3RL0t;#Sq_C#TBD$&W7H#v@dvM2NE>KI$C{VX@cbw NLS*<#UK>|f{4Y6+F)IK7 literal 0 HcmV?d00001 diff --git a/app/src/main/res/layout/route_form.xml b/app/src/main/res/layout/route_form.xml index 4f99219..552ffbd 100644 --- a/app/src/main/res/layout/route_form.xml +++ b/app/src/main/res/layout/route_form.xml @@ -38,16 +38,25 @@ android:text="@string/origin" android:textSize="15sp"> + +