implementing workflow run creation functionality
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/c87abf82 Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/tree/c87abf82 Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/diff/c87abf82 Branch: refs/heads/master Commit: c87abf82fd04562eea64f692d45135ef70250e43 Parents: e664260 Author: larrytech7 <larrya...@gmail.com> Authored: Sat Jul 4 02:05:41 2015 +0100 Committer: larrytech7 <larrya...@gmail.com> Committed: Sat Jul 4 02:05:41 2015 +0100 ---------------------------------------------------------------------- .../mobile/adapters/WorkflowAdapter.java | 4 ++-- .../workflowdetails/WorkflowdetailFragment.java | 16 ++++++++++---- .../main/res/layout/workflow_item_layout.xml | 22 +++++++++++++------- 3 files changed, 29 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/c87abf82/app/src/main/java/org/apache/taverna/mobile/adapters/WorkflowAdapter.java ---------------------------------------------------------------------- diff --git a/app/src/main/java/org/apache/taverna/mobile/adapters/WorkflowAdapter.java b/app/src/main/java/org/apache/taverna/mobile/adapters/WorkflowAdapter.java index 2b40cc9..c18d60c 100644 --- a/app/src/main/java/org/apache/taverna/mobile/adapters/WorkflowAdapter.java +++ b/app/src/main/java/org/apache/taverna/mobile/adapters/WorkflowAdapter.java @@ -122,8 +122,8 @@ public class WorkflowAdapter extends RecyclerView.Adapter<WorkflowAdapter.ViewHo mfav.add(wid); mfav.add(author);mfav.add(title);mfav.add(desc_full); mfav.add(SimpleDateFormat.getDateTimeInstance().format(new Date()).toString()); mfav.add(uri); if(description.length() > 80) description = description.substring(0, 79); - viewHolder.author_name.setText(author); - viewHolder.wk_title.setText(title); + viewHolder.author_name.setHint(author); + viewHolder.wk_title.setHint(title); viewHolder.wk_description.setText( description+" ... "); Linkify.addLinks(viewHolder.wk_description, Linkify.WEB_URLS); final String wkflow_url = workflow.get(j).getWorkflow_remote_url(); http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/c87abf82/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 a1b42ab..5e6594e 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 @@ -519,22 +519,30 @@ public class WorkflowdetailFragment extends Fragment implements View.OnClickList bufferedReader.close(); wconn.disconnect(); - String data = "{\"document\":\"data:application/octet-stream;base64,"+Base64.encodeToString(sb.toString().getBytes(), Base64.DEFAULT)+"\"}"; + // Base64.encodeToString(sb.toString().getBytes("UTF-8"), Base64.DEFAULT) + String data = "{\"document\":\"data:application/octet-stream;base64," + + "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHM6c2N1ZmwgeG1sbnM6cz0iaHR0cDovL29yZy5lbWJsLmViaS5lc2NpZW5jZS94c2N1ZmwvMC4xYWxwaGEiIHZlcnNpb249IjAuMiIgbG9nPSIwIj4KICA8czp3b3JrZmxvd2Rlc2NyaXB0aW9uIGxzaWQ9InVybjpsc2lkOnd3dy5teWdyaWQub3JnLnVrOm9wZXJhdGlvbjpLNlpDRzZJV05TMCIgYXV0aG9yPSIiIHRpdGxlPSIiIC8+CiAgPHM6cHJvY2Vzc29yIG5hbWU9IlN0cmluZ19Db25zdGFudCIgYm9yaW5nPSJ0cnVlIj4KICAgIDxzOnN0cmluZ2NvbnN0YW50Pmh0dHA6Ly93d3cuY3MubWFuLmFjLnVrL35nb2RlcmlzYS9QaG90by5qcGc8L3M6c3RyaW5nY29uc3RhbnQ+CiAgPC9zOnByb2Nlc3Nvcj4KICA8czpwcm9jZXNzb3IgbmFtZT0iR2V0X2ltYWdlX2Zyb21fVVJMIj4KICAgIDxzOmxvY2FsPm9yZy5lbWJsLmViaS5lc2NpZW5jZS5zY3VmbHdvcmtlcnMuamF2YS5XZWJJbWFnZUZldGNoZXI8L3M6bG9jYWw+CiAgPC9zOnByb2Nlc3Nvcj4KICA8czpsaW5rIHNvdXJjZT0iU3RyaW5nX0NvbnN0YW50OnZhbHVlIiBzaW5rPSJHZXRfaW1hZ2VfZnJvbV9VUkw6dXJsIiAvPgogIDxzOmxpbmsgc291cmNlPSJHZXRfaW1hZ2VfZnJvbV9VUkw6aW1hZ2UiIHNpbms9InZpeiIgLz4KICA8czpzaW5rIG5hbWU9InZpeiIgLz4KPC9zOnNjdWZsPgoKCg=="+"\"}"; String post = "{\"workflow\":"+data+"}"; //clear sb so that we can use it again to fetch results from this post request sb.delete(0,sb.length()-1); System.out.println("BODY=>"+post); + connection.setRequestMethod("POST"); connection.setRequestProperty("Authorization", basicAuth); connection.setRequestProperty("Accept", "*/*"); + // connection.setRequestProperty("Content-Length", "10165"); connection.setRequestProperty("Content-Type", "application/json"); - connection.setRequestMethod("POST"); + connection.setRequestProperty("Content-Language", "en-US"); + connection.setRequestProperty("Accept-Charset", "UTF-8"); + connection.setUseCaches (false); + connection.setDoOutput(true); + // connection.setDoInput(true); connection.connect(); //send request - /* DataOutputStream dos = new DataOutputStream(connection.getOutputStream()); + DataOutputStream dos = new DataOutputStream(connection.getOutputStream()); dos.writeBytes(post);//write post data which is a formatted json data representing body of workflow dos.flush(); - dos.close();*/ + dos.close(); /* InputStream dis = connection.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(dis)); http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/c87abf82/app/src/main/res/layout/workflow_item_layout.xml ---------------------------------------------------------------------- diff --git a/app/src/main/res/layout/workflow_item_layout.xml b/app/src/main/res/layout/workflow_item_layout.xml index 26b30f6..2a88905 100644 --- a/app/src/main/res/layout/workflow_item_layout.xml +++ b/app/src/main/res/layout/workflow_item_layout.xml @@ -39,14 +39,18 @@ limitations under the License. android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> + <FrameLayout android:id="@+id/mframe" + android:layout_height="wrap_content" + android:layout_width="match_parent"> <ImageView android:id="@+id/author_profile_image" - android:layout_width="wrap_content" - android:layout_height="wrap_content" + android:layout_width="match_parent" + android:layout_height="match_parent" android:elevation="5dp" android:src="@mipmap/icuserprofiles" - android:background="@drawable/round_shape" - android:contentDescription="@string/workflow_authorhint" /> + + android:contentDescription="@string/workflow_authorhint" + android:scaleType="fitEnd" /> <LinearLayout android:id="@+id/linearlayout_workflow_info" @@ -56,15 +60,17 @@ limitations under the License. android:showDividers="middle|beginning" android:divider="@color/background_material_dark" android:dividerPadding="2dp" - android:layout_marginLeft="2dp"> + android:layout_marginLeft="2dp" + android:layout_marginTop="50dp" + android:background="@android:color/transparent"> <TextView android:id="@+id/workflow_author" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="@string/workflow_authorhint" android:capitalize="characters" android:textColor="#000" - android:textSize="22dp" /> + android:textSize="22dp" + android:hint="@string/workflow_authorhint" /> <TextView android:layout_width="wrap_content" @@ -82,6 +88,8 @@ limitations under the License. android:typeface="serif" android:background="@color/material_deep_teal_200" /> </LinearLayout> + </FrameLayout> + </LinearLayout> <LinearLayout android:layout_width="match_parent"