mirror of https://github.com/BOINC/boinc.git
Task expansion view to match what is shown in the mockups
This commit is contained in:
parent
0f4457e4f7
commit
fcb381b507
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 465 B |
Binary file not shown.
After Width: | Height: | Size: 810 B |
|
@ -20,6 +20,7 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white_smoke"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<ListView
|
||||
|
|
|
@ -20,57 +20,90 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:clickable="true"
|
||||
android:padding="10dp" >
|
||||
android:clickable="false"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<TextView android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:id="@+id/taskHeader"
|
||||
<ImageView
|
||||
android:id="@+id/projectIcon"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_margin="10dip"
|
||||
android:layout_marginLeft="10dip"
|
||||
android:background="@drawable/shape_blue_border"
|
||||
android:contentDescription="@drawable/shape_blue_border"
|
||||
android:padding="1dp"
|
||||
android:scaleType="fitCenter" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:singleLine="true">
|
||||
</TextView>
|
||||
android:layout_marginBottom="5dip"
|
||||
android:layout_marginTop="12dip"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dip"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/taskHeader"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/projectName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dip"
|
||||
android:progressDrawable="@drawable/progressbar_paused" />
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/taskStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_below="@+id/progressBar"
|
||||
android:layout_alignLeft="@+id/progressBar" />
|
||||
|
||||
<TextView android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:id="@+id/taskProgress"
|
||||
android:singleLine="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/progressBar"
|
||||
android:layout_centerInParent="true" />
|
||||
android:textColor="@color/black" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/taskTime"
|
||||
android:id="@+id/taskProgress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dip"
|
||||
android:ems="5"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_below="@+id/progressBar"
|
||||
android:layout_alignRight="@+id/progressBar" />
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/expandCollapse"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:src="@drawable/collapse"
|
||||
android:contentDescription="@drawable/collapse" />
|
||||
</RelativeLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/expansion"
|
||||
layout="@layout/tasks_layout_listitem_expansion" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -17,84 +17,159 @@
|
|||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="false"
|
||||
android:orientation="vertical"
|
||||
android:paddingRight="5dip" >
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/projectName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/tasks_header_project_name"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/taskName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/tasks_header_name"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/deadline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/tasks_header_deadline"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/taskButtons"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical" >
|
||||
android:gravity="right"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/abortTask"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:clickable="true"
|
||||
android:background="@android:color/black"
|
||||
android:contentDescription="@string/tasks_button_abort"
|
||||
android:src="@drawable/abortw24" />
|
||||
|
||||
<ImageButton
|
||||
<ImageView
|
||||
android:id="@+id/suspendResumeTask"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:clickable="true"
|
||||
android:background="@android:color/black"
|
||||
android:contentDescription="@string/tasks_button_resume"
|
||||
android:src="@drawable/playw24" />
|
||||
android:contentDescription="@drawable/resumetask"
|
||||
android:paddingLeft="5dip"
|
||||
android:paddingRight="5dip"
|
||||
android:src="@drawable/resumetask" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/abortTask"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true"
|
||||
android:contentDescription="@drawable/aborttask"
|
||||
android:paddingLeft="5dip"
|
||||
android:paddingRight="5dip"
|
||||
android:src="@drawable/aborttask" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/requestPendingWrapper"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@id/taskButtons"
|
||||
android:layout_alignLeft="@id/taskButtons"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignTop="@id/taskButtons"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone" >
|
||||
android:visibility="visible" >
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/request_progressBar"
|
||||
style="?android:attr/progressBarStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"/>
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="5dp" />
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toLeftOf="@+id/taskButtons" >
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dip"
|
||||
android:layout_marginLeft="10dip"
|
||||
android:layout_marginRight="10dip"
|
||||
android:progressDrawable="@drawable/progressbar_paused" />
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/taskTimeLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="5dp"
|
||||
android:text="@string/tasks_header_elapsed_time"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold|italic" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/taskTime"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="italic" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/taskNameLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="5dp"
|
||||
android:text="@string/tasks_header_name"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold|italic" />
|
||||
<TextView
|
||||
android:id="@+id/taskName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="italic" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/deadlineLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="5dp"
|
||||
android:text="@string/tasks_header_deadline"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold|italic" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/deadline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="italic" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -211,7 +211,8 @@
|
|||
|
||||
<!-- tasks tab strings -->
|
||||
<string name="tasks_loading">Reading tasks…</string>
|
||||
<string name="tasks_header_name">ID:</string>
|
||||
<string name="tasks_header_name">Task Name:</string>
|
||||
<string name="tasks_header_elapsed_time">Elapsed time:</string>
|
||||
<string name="tasks_header_project_name">Project:</string>
|
||||
<string name="tasks_header_project_paused">(suspended)</string>
|
||||
<string name="tasks_header_deadline">Deadline:</string>
|
||||
|
|
|
@ -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<TaskData>{
|
||||
|
@ -60,6 +61,15 @@ public class TasksListAdapter extends ArrayAdapter<TaskData>{
|
|||
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<TaskData>{
|
|||
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<TaskData>{
|
|||
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,29 +147,34 @@ public class TasksListAdapter extends ArrayAdapter<TaskData>{
|
|||
// 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) {
|
||||
|
||||
//read status
|
||||
|
|
Loading…
Reference in New Issue