implemented workflow run on player. Adjusted UI to indicate when no workflows exist or cannot be retrieved
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/commit/714c08c8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/tree/714c08c8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/diff/714c08c8 Branch: refs/heads/master Commit: 714c08c8c9cdfcdee35df3fdcf9ddcd8695dedb2 Parents: 6e20255 Author: larrytech7 <larrya...@gmail.com> Authored: Wed Jul 8 19:45:50 2015 +0100 Committer: larrytech7 <larrya...@gmail.com> Committed: Wed Jul 8 19:45:50 2015 +0100 ---------------------------------------------------------------------- .../mobile/fragments/WorkflowItemFragment.java | 21 ++++++++++++--- .../workflowdetails/WorkflowdetailFragment.java | 28 ++++++-------------- .../taverna/mobile/utils/DetailsLoader.java | 5 ++-- app/src/main/res/layout/fragment_item_grid.xml | 8 ++++-- app/src/main/res/layout/fragment_item_list.xml | 12 +++------ 5 files changed, 37 insertions(+), 37 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/714c08c8/app/src/main/java/org/apache/taverna/mobile/fragments/WorkflowItemFragment.java ---------------------------------------------------------------------- diff --git a/app/src/main/java/org/apache/taverna/mobile/fragments/WorkflowItemFragment.java b/app/src/main/java/org/apache/taverna/mobile/fragments/WorkflowItemFragment.java index cde2ab2..2927d76 100644 --- a/app/src/main/java/org/apache/taverna/mobile/fragments/WorkflowItemFragment.java +++ b/app/src/main/java/org/apache/taverna/mobile/fragments/WorkflowItemFragment.java @@ -108,6 +108,7 @@ public class WorkflowItemFragment extends Fragment implements SwipeRefreshLayout private static View rootView; public static Context cx; private static boolean STATE_ON = false; + private static TextView noDataText; public static WorkflowItemFragment newInstance(String param1, String param2) { WorkflowItemFragment fragment = new WorkflowItemFragment(); @@ -145,6 +146,7 @@ public class WorkflowItemFragment extends Fragment implements SwipeRefreshLayout @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.fragment_item, container, false); + noDataText = (TextView) rootView.findViewById(android.R.id.empty); swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.refresh); swipeRefreshLayout.setOnRefreshListener(this); // Set the adapter @@ -152,6 +154,7 @@ public class WorkflowItemFragment extends Fragment implements SwipeRefreshLayout mListView.setHasFixedSize(true); mListView.setLayoutManager(new LinearLayoutManager(getActivity())); mListView.setAnimation(in); + mListView.setAdapter(new WorkflowAdapter(getActivity())); return rootView; } @@ -188,6 +191,15 @@ public class WorkflowItemFragment extends Fragment implements SwipeRefreshLayout if(!STATE_ON) new WorkflowLoader(getActivity(), swipeRefreshLayout).execute(); + if(mListView.getAdapter().getItemCount() == 0){ + mListView.setVisibility(View.GONE); + noDataText.setVisibility(View.VISIBLE); + Toast.makeText(cx, cx.getResources().getString(R.string.err_workflow_conn), Toast.LENGTH_LONG).show(); + }else{ + mListView.setVisibility(View.VISIBLE); + noDataText.setVisibility(View.GONE); + } + } @Override @@ -288,10 +300,14 @@ public class WorkflowItemFragment extends Fragment implements SwipeRefreshLayout public void run() { WorkflowItemFragment.searchAdpater = new WorkflowAdapter(cx,data); WorkflowItemFragment.mListView.setAdapter(WorkflowItemFragment.searchAdpater); - if(data.size() == 0){ + if(WorkflowItemFragment.searchAdpater.getItemCount() == 0){ + mListView.setVisibility(View.GONE); + noDataText.setVisibility(View.VISIBLE); Toast.makeText(cx, cx.getResources().getString(R.string.err_workflow_conn), Toast.LENGTH_LONG).show(); + }else{ + mListView.setVisibility(View.VISIBLE); + noDataText.setVisibility(View.GONE); } - System.out.println("workflows: "+data.size()); } }); } @@ -302,7 +318,6 @@ public class WorkflowItemFragment extends Fragment implements SwipeRefreshLayout public void run() { synchronized (this) { new AvatarLoader().execute(author.getDetails_uri()); - System.out.println(author.getDetails_uri()); } } }); http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/714c08c8/app/src/main/java/org/apache/taverna/mobile/fragments/workflowdetails/WorkflowdetailFragment.java ---------------------------------------------------------------------- diff --git a/app/src/main/java/org/apache/taverna/mobile/fragments/workflowdetails/WorkflowdetailFragment.java b/app/src/main/java/org/apache/taverna/mobile/fragments/workflowdetails/WorkflowdetailFragment.java index 8e6419e..e0aa350 100644 --- a/app/src/main/java/org/apache/taverna/mobile/fragments/workflowdetails/WorkflowdetailFragment.java +++ b/app/src/main/java/org/apache/taverna/mobile/fragments/workflowdetails/WorkflowdetailFragment.java @@ -204,6 +204,7 @@ public class WorkflowdetailFragment extends Fragment implements View.OnClickList LOAD_STATE = true; } + @Override public Loader<Workflow> onCreateLoader(int i, Bundle bundle) { progressDialog.show(); @@ -214,21 +215,7 @@ public class WorkflowdetailFragment extends Fragment implements View.OnClickList @Override public void onLoadFinished(Loader<Workflow> workflowLoader, Workflow workflow) { - /* TextView author = (TextView) rootView.findViewById(R.id.wkf_author); - author.append("->" + workflow.getWorkflow_author()); - TextView title = (TextView) rootView.findViewById(R.id.wtitle); - title.setText(workflow.getWorkflow_title()); - TextView desc = (TextView) rootView.findViewById(R.id.wdescription); - desc.setText(workflow.getWorkflow_description()); - TextView createdat = (TextView) rootView.findViewById(R.id.wcreatedat); - createdat.append(workflow.getWorkflow_datecreated()); - TextView updated = (TextView) rootView.findViewById(R.id.wupdatedat); - updated.append(workflow.getWorkflow_datemodified()); - // ImageView preview = (ImageView) rootView.findViewById(R.id.wkf_image); - // preview.setImageURI(Uri.parse(workflow.getWorkflow_remote_url())); - download_url =workflow.getWorkflow_remote_url(); - // progressDialog.cancel(); - */ //progressDialog.dismiss(); + } @Override @@ -354,7 +341,7 @@ public class WorkflowdetailFragment extends Fragment implements View.OnClickList EditText edt; edt = new EditText(ctx); edt.setHint("Enter Value"); - edt.setMinLines(2); + edt.setMinLines(1); edt.setId(i); return edt; } @@ -458,7 +445,7 @@ public class WorkflowdetailFragment extends Fragment implements View.OnClickList json.put("inputs_attributes", attr_array); Log.i("RUN FRAMEWORK", json.toString(2)); //start a run task to execute the run. - // new RunTask(ctx).execute(json.toString()); + new RunTask(ctx).execute(json.toString()); } catch (JSONException e) { e.printStackTrace(); } @@ -628,7 +615,7 @@ public class WorkflowdetailFragment extends Fragment implements View.OnClickList DataOutputStream dos = new DataOutputStream(connection.getOutputStream()); dos.writeBytes(params[0]);//write post data which is a formatted json data representing inputs to a run - //dos.writeUTF(""); + dos.flush(); dos.close(); @@ -638,11 +625,12 @@ public class WorkflowdetailFragment extends Fragment implements View.OnClickList String jsonData = ""; while ((jsonData = br.readLine()) != null) { sb.append(jsonData); + // } dis.close(); br.close(); - Log.i("RESPONSE Code", "" + connection.getResponseCode()); - Log.i("RESPONSE Messsage", "" + connection.getResponseMessage()); + Log.i("Run RESPONSE Code", "" + connection.getResponseCode()); + Log.i("Run RESPONSE Messsage", "" + connection.getResponseMessage()); return sb.toString(); http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/714c08c8/app/src/main/java/org/apache/taverna/mobile/utils/DetailsLoader.java ---------------------------------------------------------------------- diff --git a/app/src/main/java/org/apache/taverna/mobile/utils/DetailsLoader.java b/app/src/main/java/org/apache/taverna/mobile/utils/DetailsLoader.java index 4be2542..9b36a7f 100644 --- a/app/src/main/java/org/apache/taverna/mobile/utils/DetailsLoader.java +++ b/app/src/main/java/org/apache/taverna/mobile/utils/DetailsLoader.java @@ -31,6 +31,7 @@ import android.util.Log; import com.thebuzzmedia.sjxp.rule.IRule; +import org.apache.taverna.mobile.tavernamobile.Runs; import org.apache.taverna.mobile.tavernamobile.TavernaPlayerAPI; import org.apache.taverna.mobile.tavernamobile.Workflow; import org.apache.taverna.mobile.utils.xmlparsers.MyExperimentXmlParserRules; @@ -156,15 +157,13 @@ public class DetailsLoader extends AsyncTaskLoader<Workflow> { String started = jsonObject.getString("start_time"); String ended = jsonObject.getString("finish_time"); String state = jsonObject.getString("state"); -/* - if(workflow_id == this.wid) { + if(workflow_id == Integer.parseInt(this.uri)) { Runs mrun = new Runs(name,started,ended,state); mrun.setRun_id(id); mrun.setRun_workflow_id(workflow_id); workflow.addWorkflowRun(mrun); } - */ } } http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/714c08c8/app/src/main/res/layout/fragment_item_grid.xml ---------------------------------------------------------------------- diff --git a/app/src/main/res/layout/fragment_item_grid.xml b/app/src/main/res/layout/fragment_item_grid.xml index ba85aa9..6ba0ef0 100644 --- a/app/src/main/res/layout/fragment_item_grid.xml +++ b/app/src/main/res/layout/fragment_item_grid.xml @@ -22,7 +22,8 @@ limitations under the License. <!-- <GridView android:id="@+id/gridlist" android:layout_width="match_parent" android:layout_height="match_parent" - android:numColumns="2">--> <android.support.v4.widget.SwipeRefreshLayout + android:numColumns="2">--> + <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/refresh" android:layout_height="match_parent" android:layout_width="match_parent"> @@ -42,6 +43,9 @@ limitations under the License. <TextView android:id="@android:id/empty" android:layout_width="match_parent" android:layout_height="match_parent" - android:gravity="center" /> + android:visibility="gone" + android:background="@drawable/ic_viewworkflow" + android:gravity="center" + android:text="@string/workflow_empty"/> </FrameLayout> http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/714c08c8/app/src/main/res/layout/fragment_item_list.xml ---------------------------------------------------------------------- diff --git a/app/src/main/res/layout/fragment_item_list.xml b/app/src/main/res/layout/fragment_item_list.xml index 92e0ff1..0acec8c 100644 --- a/app/src/main/res/layout/fragment_item_list.xml +++ b/app/src/main/res/layout/fragment_item_list.xml @@ -18,12 +18,6 @@ limitations under the License. android:layout_width="match_parent" android:layout_height="match_parent" tools:context="org.apache.taverna.mobile.fragments.WorkflowItemFragment"> - <ProgressBar - android:id="@+id/workflow_pb" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:visibility="gone"/> <!--<ListView android:id="@android:id/list" android:layout_width="match_parent"--> <!--android:layout_height="match_parent" />--> @@ -40,17 +34,17 @@ limitations under the License. android:background="@color/button_material_light" android:scrollbars="vertical" android:scrollbarStyle="insideOverlay" - android:fadeScrollbars="true" - > + android:fadeScrollbars="true"> </android.support.v7.widget.RecyclerView> </android.support.v4.widget.SwipeRefreshLayout> <TextView android:id="@android:id/empty" android:layout_width="match_parent" - android:layout_height="wrap_content" + android:layout_height="match_parent" android:gravity="center" android:visibility="gone" + android:background="@drawable/ic_viewworkflow" android:text="@string/workflow_empty"/> </FrameLayout>