From fcb381b507a067b7353ca8ddf49c5d00dcdabc43 Mon Sep 17 00:00:00 2001 From: Keith Uplinger Date: Mon, 3 Jun 2013 23:51:28 -0500 Subject: [PATCH] Task expansion view to match what is shown in the mockups --- android/BOINC/res/drawable/aborttask.png | Bin 0 -> 1281 bytes android/BOINC/res/drawable/collapse.png | Bin 0 -> 1897 bytes android/BOINC/res/drawable/expand.png | Bin 0 -> 1837 bytes android/BOINC/res/drawable/pausetask.png | Bin 0 -> 465 bytes android/BOINC/res/drawable/resumetask.png | Bin 0 -> 810 bytes android/BOINC/res/layout/tasks_layout.xml | 1 + .../res/layout/tasks_layout_listitem.xml | 125 ++++++---- .../tasks_layout_listitem_expansion.xml | 219 ++++++++++++------ android/BOINC/res/values/strings.xml | 3 +- .../boinc/adapter/TasksListAdapter.java | 51 ++-- 10 files changed, 263 insertions(+), 136 deletions(-) create mode 100644 android/BOINC/res/drawable/aborttask.png create mode 100644 android/BOINC/res/drawable/collapse.png create mode 100644 android/BOINC/res/drawable/expand.png create mode 100644 android/BOINC/res/drawable/pausetask.png create mode 100644 android/BOINC/res/drawable/resumetask.png diff --git a/android/BOINC/res/drawable/aborttask.png b/android/BOINC/res/drawable/aborttask.png new file mode 100644 index 0000000000000000000000000000000000000000..552a2002244e31b6054814a81d14446dcddeccf2 GIT binary patch literal 1281 zcmV+c1^)VpP)Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RY1_Kl?D8mP2Bme*elSxEDR9M69 znB9w1WgN%9zvn!2&Y9Pp-Eq}b(>2s2L$@L$GKfluBB&cL1uwb??}Pq^RRKmZZwsR9`&cYNG(?T7!;QiV%312Y)YAV3;AQ<|9h z;!tjSir9ZeHzuyPE`Iyt;_NvZ=;4C_#hc!LW7pvWmTRjpGWY4m(+&V4S~zsleriAf zn4MCw2&=WTUmsOr3?dki#il=bd&4`gk;R^#QyUlqZKNW`>Q@&|ee=D5w-T|O=h7SB z-K&*0PzD-cG$J4atsyleKpbgjq5y(Z%uVlq%K${wcA&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fzimOrK@A%RiIU%QD6T84#zhd%|xM*00000NkvXXu0mjfB4}pw literal 0 HcmV?d00001 diff --git a/android/BOINC/res/drawable/collapse.png b/android/BOINC/res/drawable/collapse.png new file mode 100644 index 0000000000000000000000000000000000000000..0a5aa48ac946945a79c9a7f26a75f887d26eca62 GIT binary patch literal 1897 zcmV-v2bTDWP)Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RY1_Kl@C=Oj}x&QzM`$7S*pM-W6S+cKjNHHRkvu;2TMt~@? zgdmLjfc3y8;0mAv?6CP8xKrlo(GjpZ3+W2r8sY0eR|0#1UtxY*4 z$EL_rf-qhTz5}?`XczV`CHMg0>wt~G8tiRI4-{GQTB{u+F=9%IycvLnT?>yVX380F`_kaVyokfJQ$7P zi;6cRBAF$Wc}lB291Y+u;Qcn=Y=zOnYCoDq4z%NsS)|xMDf9G4y)+;Q<4*xgF{csp zuzy$N>5D--q8P)Q-JWiR@n;0z27XXv$zwC-K;wZRj4wre4*T!G&xc+-8Zrg232`^@ zU8F~YFkV)3r{_D$JRRbN;8ExBN8%}9 zgW+UFGG9{}5uaCN39TN)F0)}Mfu0n)9J6w)L@=QNP3R1l3l;%SS8y6TN!Qt`cB%i2 zy}{x%NRmD*IctUS{4z^>SFOWm|J5*G(u&48(}GYC#(k>lo5RMPZeENnb`?yDJVogD zm`{K)?z8!baMo%^{S~pJo}4SPWIy;d%&MRrEu1z7Y~F4A661qqmY$rnVrPvJiGknP z`ZNZ_yRdFRdOQf@zHZo!&hL8F^7%;TOrON^0!a%nho@R4Hb#_rdK!7Fq|et(?H9fU zc(_-VX`p3uSkP}gf7%Af2$&~vs#_N(y=qJg^#eCb!j%dUvn zxF55nQfC3YA$YLJk`zGF*g|ENN;+IcYnlcWd3r*y8@Qm=j#gGMiYG4qD$n<0?zQ-0 zz4a#eXGNCYRo7NyUOoupB^DP0yNfJ2Iz1t4$ONwl-juY4UNStQcB)mmABZKsRU`PA z?OzmGdS~N=B2UH?Ps3G$J}T#p%e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O+gl~RUKaT?QAm+J@dk7f&K>N( z8dwXgu{~XA2(i`X@m4cCFa~ty18)IVgO`E+34XxV&s)vx_=OCfu;K1#{Kg?!g7q$o z<+A4kXONz=*$+Nib(6C}*Vw)abW-xuplz6KWi#9RUmNa@HK87U{9|5=SO{JSnr%E- zy?IXA92D$A-ecI^s>YH1$m@Re=$wUq)f`B byu9)swfb*0uDjKu00000NkvXXu0mjfOoD7W literal 0 HcmV?d00001 diff --git a/android/BOINC/res/drawable/pausetask.png b/android/BOINC/res/drawable/pausetask.png new file mode 100644 index 0000000000000000000000000000000000000000..9b77ba37b75fa35f5638b7dfc09c37d66b3e2830 GIT binary patch literal 465 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1SD@H`sfT{dPBL(>umb0wgjWKS2zkch)?Z`gY=JBqM`=VrED7tv1J*UMxX)GUIF!W8 zdA>bejNR+e+^=i*o{c*CW9Eq+x4)lxdO6qNg)@tai`KH5n0%he6`NR6L~cLNTmARj ztE3{9n|FKPe*Sy-q)*SSv!{~{Ui9m)u6w$sE}$mn$%}W3?&j`nklC+zONDPy!7sPE zLkt`#yVN?IW*@nKJ+ORclgJVUR!tAEqy9;HcuYHCd0fFW=~`j+yO?7>DrYwxTDi~V zoXpaI$!U>cJSFxlmCJ6vo?{m?-PV4-_8-yDa%?{j@mt&M+`s9i%5*^)wQVs!UuEO2Ww+xX78$(|*4|e4N$LF_abOHEc)I$ztaD0e F0s!Q-#6Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RY1_Kl_Cfm~`KL7v%yh%hsR9M69 z*jq>xQ5XmC|F<(cGp=DOm7BI0X+~CRnGXqtl~e=?(Zz?L3);mJ3Zh2r86X2>fDF)#1bHW*`oY-r0QtQ68S7%BW8wFP!^9ywF}N>eclExr8<*xd$3}-n z2SEf7h$074Qz7{y-XTFo&$NiZ1Gm>>^Zq9nah(>dPavw zT!Y{^T})a)Me7S~@m9u|WENK>rLIZI5T)q$zE1dkFmVw(_C&-O1CY63aoM(mcS|ak zB&9+g53$li>O({XfH4+liP^Dg!@VPyO1Bolr@-%vWMd3Om7cihT*2Y`(yHWnHhA3H zqSB{R2TXC6nC)44&Bw15=kI|c!|#vS=m?lNlPN7B`SQ*a_G4G($0uMyj@T>bJrOamNtQ*B)~2q^ zvZYNC#OtnMj1dumK=62#+b^3>HB`CATo9!H4Pszm|0?Oz_b+Ffs&BP6fj5Jj>W_GR zg8>16dqRHvzWu1Z{IhEaf*903yk6N%2BWH~b8O_|gSr}r9lSYMjXt2i*#JLfcWdvP z5_|c;a4&=?ZNs0}MZ*~D|2A~>$(_oFbue)dEt)svLp@DIKjiV2p0}qPD!cmML5vFV zR>X(WYyfnR4Aeevtax-2stU;xdI4wy5rAJFx8uW$^Y?Fbe0&8#1aH>md}sj)Jpb{l zv$mzN%3)VLzadCEUh;znnZ^1JM_XU#v#vI995}O%8UUo_Nl#Uw`oZz~QbHK6L}Ais oE$Z-4jMonXWPl8i0h$@0KOwUP9UXyqZ2$lO07*qoM6N<$f*m(+4*&oF literal 0 HcmV?d00001 diff --git a/android/BOINC/res/layout/tasks_layout.xml b/android/BOINC/res/layout/tasks_layout.xml index 266a8dbcd8..76c257d3b9 100644 --- a/android/BOINC/res/layout/tasks_layout.xml +++ b/android/BOINC/res/layout/tasks_layout.xml @@ -20,6 +20,7 @@ + android:clickable="false" + android:orientation="horizontal" > + + - - - - - - - - - - + + + + + android:orientation="vertical" > + + + + + + + + + + + + + - - - - - + + + + + + diff --git a/android/BOINC/res/layout/tasks_layout_listitem_expansion.xml b/android/BOINC/res/layout/tasks_layout_listitem_expansion.xml index 0cfe00ba3b..36e4023420 100644 --- a/android/BOINC/res/layout/tasks_layout_listitem_expansion.xml +++ b/android/BOINC/res/layout/tasks_layout_listitem_expansion.xml @@ -17,84 +17,159 @@ You should have received a copy of the GNU Lesser General Public License along with BOINC. If not, see . --> - + android:orientation="vertical" + android:paddingRight="5dip" > + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + diff --git a/android/BOINC/res/values/strings.xml b/android/BOINC/res/values/strings.xml index 2fe7e1272b..aeff889f94 100644 --- a/android/BOINC/res/values/strings.xml +++ b/android/BOINC/res/values/strings.xml @@ -211,7 +211,8 @@ Reading tasks… - ID: + Task Name: + Elapsed time: Project: (suspended) Deadline: diff --git a/android/BOINC/src/edu/berkeley/boinc/adapter/TasksListAdapter.java b/android/BOINC/src/edu/berkeley/boinc/adapter/TasksListAdapter.java index 9819b2ffb8..9cd8ffa97f 100644 --- a/android/BOINC/src/edu/berkeley/boinc/adapter/TasksListAdapter.java +++ b/android/BOINC/src/edu/berkeley/boinc/adapter/TasksListAdapter.java @@ -23,11 +23,13 @@ import java.util.ArrayList; import edu.berkeley.boinc.R; import edu.berkeley.boinc.TasksActivity.TaskData; +import edu.berkeley.boinc.client.Monitor; import edu.berkeley.boinc.rpc.RpcClient; import edu.berkeley.boinc.utils.BOINCDefs; import android.app.Activity; import android.content.Context; +import android.graphics.Bitmap; import android.text.format.DateFormat; import android.util.Log; import android.view.LayoutInflater; @@ -37,7 +39,6 @@ import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; -import android.widget.RelativeLayout; import android.widget.TextView; public class TasksListAdapter extends ArrayAdapter{ @@ -60,6 +61,15 @@ public class TasksListAdapter extends ArrayAdapter{ v = vi.inflate(R.layout.tasks_layout_listitem, null); v.setOnClickListener(entries.get(position).taskClickListener); + ImageView ivIcon = (ImageView)v.findViewById(R.id.projectIcon); + Bitmap icon = getIcon(position); + // if available set icon, if not boinc logo + if(icon == null) { + ivIcon.setImageDrawable(getContext().getResources().getDrawable(R.drawable.boinc)); + } else { + ivIcon.setImageBitmap(icon); + } + ProgressBar pb = (ProgressBar) v.findViewById(R.id.progressBar); TextView header = (TextView) v.findViewById(R.id.taskHeader); TextView status = (TextView) v.findViewById(R.id.taskStatus); @@ -75,6 +85,16 @@ public class TasksListAdapter extends ArrayAdapter{ String headerT = listItem.result.app.getName(); header.setText(headerT); + // set project name + String tempProjectName = listItem.result.project_url; + if(listItem.result.project != null) { + tempProjectName = listItem.result.project.getName(); + if(listItem.result.project_suspended_via_gui) { + tempProjectName = tempProjectName + " " + getContext().getString(R.string.tasks_header_project_paused); + } + } + ((TextView) v.findViewById(R.id.projectName)).setText(tempProjectName); + Float fraction = Float.valueOf((float) 1.0); // default is 100 (e.g. abort show full red progress bar) if(!listItem.result.active_task && listItem.result.ready_to_report) { //fraction not available progress.setVisibility(View.GONE); @@ -95,30 +115,22 @@ public class TasksListAdapter extends ArrayAdapter{ else elapsedTime = (int) listItem.result.final_elapsed_time; time.setText(String.format("%02d:%02d:%02d", elapsedTime/3600, (elapsedTime/60)%60, elapsedTime%60)); - RelativeLayout ll = (RelativeLayout) v.findViewById(R.id.expansion); + LinearLayout ll = (LinearLayout) v.findViewById(R.id.expansion); if (listItem.expanded) { + ((ImageView)v.findViewById(R.id.expandCollapse)).setImageResource(R.drawable.expand); ll.setVisibility(View.VISIBLE); // update resume/suspend state (button state) // set deadline String deadline = (String) DateFormat.format("E d MMM yyyy hh:mm:ss aa", new Date(listItem.result.report_deadline*1000)); - ((TextView) v.findViewById(R.id.deadline)).setText(getContext().getString(R.string.tasks_header_deadline) + " " + deadline); - // set project name - String tempProjectName = listItem.result.project_url; - if(listItem.result.project != null) { - tempProjectName = listItem.result.project.getName(); - if(listItem.result.project_suspended_via_gui) { - tempProjectName = tempProjectName + " " + getContext().getString(R.string.tasks_header_project_paused); - } - } - ((TextView) v.findViewById(R.id.projectName)).setText(getContext().getString(R.string.tasks_header_project_name) + " " + tempProjectName); + ((TextView) v.findViewById(R.id.deadline)).setText(deadline); // set application friendly name if(listItem.result.app != null) { - ((TextView) v.findViewById(R.id.taskName)).setText(getContext().getString(R.string.tasks_header_name) + " " + listItem.result.name); + ((TextView) v.findViewById(R.id.taskName)).setText(listItem.result.name); } if(listItem.determineState() == BOINCDefs.PROCESS_ABORTED) { //dont show buttons for aborted task ((LinearLayout)v.findViewById(R.id.requestPendingWrapper)).setVisibility(View.GONE); - ((LinearLayout)v.findViewById(R.id.taskButtons)).setVisibility(View.GONE); + ((LinearLayout)v.findViewById(R.id.taskButtons)).setVisibility(View.INVISIBLE); } else { ImageView suspendResume = (ImageView) v.findViewById(R.id.suspendResumeTask); @@ -135,28 +147,33 @@ public class TasksListAdapter extends ArrayAdapter{ // checking what suspendResume button should be shown if(listItem.result.suspended_via_gui) { // show play suspendResume.setVisibility(View.VISIBLE); - suspendResume.setImageResource(R.drawable.playw24); + suspendResume.setImageResource(R.drawable.resumetask); suspendResume.setTag(RpcClient.RESULT_RESUME); // tag on button specified operation triggered in iconClickListener } else if (listItem.determineState() == BOINCDefs.PROCESS_EXECUTING){ // show pause suspendResume.setVisibility(View.VISIBLE); - suspendResume.setImageResource(R.drawable.pausew24); + suspendResume.setImageResource(R.drawable.pausetask); suspendResume.setTag(RpcClient.RESULT_SUSPEND); // tag on button specified operation triggered in iconClickListener } else { // show nothing suspendResume.setVisibility(View.GONE); } } else { - ((LinearLayout)v.findViewById(R.id.taskButtons)).setVisibility(View.GONE); + ((LinearLayout)v.findViewById(R.id.taskButtons)).setVisibility(View.INVISIBLE); ((LinearLayout)v.findViewById(R.id.requestPendingWrapper)).setVisibility(View.VISIBLE); } } } else { + ((ImageView)v.findViewById(R.id.expandCollapse)).setImageResource(R.drawable.collapse); ll.setVisibility(View.GONE); } return v; } + + public Bitmap getIcon(int position) { + return Monitor.getClientStatus().getProjectIcon(entries.get(position).id); + } private String determineStatusText(TaskData tmp) {