http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/313a541b/app/build/intermediates/symbols/debug/R.txt ---------------------------------------------------------------------- diff --git a/app/build/intermediates/symbols/debug/R.txt b/app/build/intermediates/symbols/debug/R.txt index 1b05e38..f315ebb 100644 --- a/app/build/intermediates/symbols/debug/R.txt +++ b/app/build/intermediates/symbols/debug/R.txt @@ -379,7 +379,7 @@ int drawable round_shape 0x7f020041 int drawable sliding_header 0x7f020042 int drawable tavernalogo 0x7f020043 int id aboutworkflowTextView 0x7f0b0063 -int id actionLayout 0x7f0b0066 +int id actionLayout 0x7f0b006b int id action_bar 0x7f0b0031 int id action_bar_activity_content 0x7f0b0000 int id action_bar_container 0x7f0b0030 @@ -393,16 +393,16 @@ int id action_menu_presenter 0x7f0b0003 int id action_mode_bar 0x7f0b002e int id action_mode_bar_stub 0x7f0b002d int id action_mode_close_button 0x7f0b0020 -int id action_search 0x7f0b0078 -int id action_settings 0x7f0b0079 +int id action_search 0x7f0b0085 +int id action_settings 0x7f0b0086 int id activity_chooser_view_content 0x7f0b0021 int id always 0x7f0b0016 int id author 0x7f0b0049 int id author_profile_image 0x7f0b004b int id beginning 0x7f0b0013 -int id button_download_workflow 0x7f0b0075 -int id button_mark_workflow 0x7f0b0076 -int id button_view_workflow 0x7f0b0074 +int id button_download_workflow 0x7f0b007a +int id button_mark_workflow 0x7f0b007b +int id button_view_workflow 0x7f0b0079 int id checkbox 0x7f0b0029 int id collapseActionView 0x7f0b0017 int id container 0x7f0b0042 @@ -413,7 +413,7 @@ int id decor_content_parent 0x7f0b002f int id default_activity_button 0x7f0b0024 int id dialog 0x7f0b001b int id disableHome 0x7f0b000c -int id download_wk 0x7f0b0068 +int id download_wk 0x7f0b006d int id drawer_layout 0x7f0b003f int id dropdown 0x7f0b001c int id editTextUsername 0x7f0b005a @@ -428,20 +428,21 @@ int id homeAsUp 0x7f0b000d int id icon 0x7f0b0026 int id ifRoom 0x7f0b0018 int id image 0x7f0b0023 +int id imageButtonState 0x7f0b0083 int id imageView 0x7f0b0044 int id imageView2 0x7f0b0045 int id imageView3 0x7f0b005f int id imageView4 0x7f0b0060 -int id layoutinfo 0x7f0b0071 +int id layoutinfo 0x7f0b0076 int id linearlayout_workflow_info 0x7f0b004a int id listMode 0x7f0b0009 int id list_item 0x7f0b0025 int id loginbutton 0x7f0b005d int id loginlayout 0x7f0b0057 int id logo 0x7f0b0055 -int id mark_wk 0x7f0b0069 -int id menuIcon 0x7f0b006b -int id menuItemText 0x7f0b006c +int id mark_wk 0x7f0b006e +int id menuIcon 0x7f0b0070 +int id menuItemText 0x7f0b0071 int id middle 0x7f0b0015 int id navigation_drawer 0x7f0b0043 int id navigation_drawer_listview 0x7f0b0061 @@ -454,8 +455,11 @@ int id progressBar 0x7f0b0048 int id progress_circular 0x7f0b0005 int id progress_horizontal 0x7f0b0006 int id radio 0x7f0b002b -int id recycler_list 0x7f0b0077 -int id run_wk 0x7f0b0067 +int id recycler_list 0x7f0b007c +int id run_wk 0x7f0b006c +int id runfinished 0x7f0b0082 +int id runstarted 0x7f0b007f +int id runtitle 0x7f0b007d int id scrollView 0x7f0b0065 int id search_badge 0x7f0b0035 int id search_bar 0x7f0b0034 @@ -471,14 +475,18 @@ int id shortcut 0x7f0b002a int id showCustom 0x7f0b000f int id showHome 0x7f0b0010 int id showTitle 0x7f0b0011 -int id show_more 0x7f0b0070 +int id show_more 0x7f0b0075 int id split_action_bar 0x7f0b0007 int id submit_area 0x7f0b003c int id tabMode 0x7f0b000b +int id textState 0x7f0b0084 int id textView 0x7f0b0046 int id textView10 0x7f0b004e int id textView11 0x7f0b0050 int id textView12 0x7f0b0052 +int id textView13 0x7f0b007e +int id textView14 0x7f0b0080 +int id textView15 0x7f0b0081 int id textView2 0x7f0b0047 int id textView3 0x7f0b0056 int id textView4 0x7f0b0058 @@ -490,16 +498,21 @@ int id textView9 0x7f0b004c int id title 0x7f0b0027 int id up 0x7f0b0008 int id useLogo 0x7f0b0012 +int id wcreatedat 0x7f0b0067 +int id wdescription 0x7f0b0069 int id withText 0x7f0b001a int id wkf_author 0x7f0b0064 -int id wkll 0x7f0b006d -int id workflow_author 0x7f0b006e -int id workflow_brief_description 0x7f0b0072 -int id workflow_image 0x7f0b0073 +int id wkf_image 0x7f0b006a +int id wkll 0x7f0b0072 +int id workflow_author 0x7f0b0073 +int id workflow_brief_description 0x7f0b0077 +int id workflow_image 0x7f0b0078 int id workflow_pb 0x7f0b0054 -int id workflow_title 0x7f0b006f -int id workflowpolicyTextView 0x7f0b006a +int id workflow_title 0x7f0b0074 +int id workflowpolicyTextView 0x7f0b006f int id wrap_content 0x7f0b001d +int id wtitle 0x7f0b0066 +int id wupdatedat 0x7f0b0068 int integer abc_config_activityDefaultDur 0x7f0c0000 int integer abc_config_activityShortDur 0x7f0c0001 int integer abc_max_action_buttons 0x7f0c0002 @@ -531,7 +544,7 @@ int layout activity_login 0x7f040018 int layout activity_workflow_detail 0x7f040019 int layout favorite_item_layout 0x7f04001a int layout fragment_dashboard_main 0x7f04001b -int layout fragment_item 0x7f040028 +int layout fragment_item 0x7f040029 int layout fragment_item_grid 0x7f04001c int layout fragment_item_list 0x7f04001d int layout fragment_login 0x7f04001e @@ -544,6 +557,7 @@ int layout menu_item_layout 0x7f040024 int layout support_simple_spinner_dropdown_item 0x7f040025 int layout workflow_item_layout 0x7f040026 int layout workflow_layout 0x7f040027 +int layout workflow_run_item 0x7f040028 int menu dashboard_main 0x7f0f0000 int menu global 0x7f0f0001 int menu menu_workflow_detail 0x7f0f0002 @@ -596,33 +610,34 @@ int string downloadprogress 0x7f0d0020 int string favorite_empty 0x7f0d0021 int string hello_blank_fragment 0x7f0d0022 int string hello_world 0x7f0d0023 -int string loginbutton 0x7f0d0024 -int string loginpassword 0x7f0d0025 -int string loginusername 0x7f0d0026 -int string marked 0x7f0d0027 -int string menu_search 0x7f0d0028 -int string modified 0x7f0d0029 -int string navigation_drawer_close 0x7f0d002a -int string navigation_drawer_open 0x7f0d002b -int string play_workflow 0x7f0d002c -int string search_hint 0x7f0d002d -int string seemore 0x7f0d002e -int string title_about 0x7f0d002f -int string title_activity_dashboard_main 0x7f0d0030 -int string title_activity_flash_screen 0x7f0d0031 -int string title_activity_workflow_detail 0x7f0d0032 -int string title_exit 0x7f0d0033 -int string title_explore 0x7f0d0034 -int string title_favorite 0x7f0d0035 -int string title_openworkflow 0x7f0d0036 -int string title_usage 0x7f0d0037 -int string wktitle 0x7f0d0038 -int string workflow_authorhint 0x7f0d0039 -int string workflow_component 0x7f0d003a -int string workflow_download 0x7f0d003b -int string workflow_empty 0x7f0d003c -int string workflow_mark 0x7f0d003d -int string workflow_read 0x7f0d003e +int string loading 0x7f0d0024 +int string loginbutton 0x7f0d0025 +int string loginpassword 0x7f0d0026 +int string loginusername 0x7f0d0027 +int string marked 0x7f0d0028 +int string menu_search 0x7f0d0029 +int string modified 0x7f0d002a +int string navigation_drawer_close 0x7f0d002b +int string navigation_drawer_open 0x7f0d002c +int string play_workflow 0x7f0d002d +int string search_hint 0x7f0d002e +int string seemore 0x7f0d002f +int string title_about 0x7f0d0030 +int string title_activity_dashboard_main 0x7f0d0031 +int string title_activity_flash_screen 0x7f0d0032 +int string title_activity_workflow_detail 0x7f0d0033 +int string title_exit 0x7f0d0034 +int string title_explore 0x7f0d0035 +int string title_favorite 0x7f0d0036 +int string title_openworkflow 0x7f0d0037 +int string title_usage 0x7f0d0038 +int string wktitle 0x7f0d0039 +int string workflow_authorhint 0x7f0d003a +int string workflow_component 0x7f0d003b +int string workflow_download 0x7f0d003c +int string workflow_empty 0x7f0d003d +int string workflow_mark 0x7f0d003e +int string workflow_read 0x7f0d003f int style Animation_AppCompat_DropDownUp 0x7f0e0000 int style AppTheme 0x7f0e0001 int style Base_Animation_AppCompat_DropDownUp 0x7f0e0002
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/313a541b/app/build/outputs/apk/app-debug-unaligned.apk ---------------------------------------------------------------------- diff --git a/app/build/outputs/apk/app-debug-unaligned.apk b/app/build/outputs/apk/app-debug-unaligned.apk index 54e813d..99cb290 100644 Binary files a/app/build/outputs/apk/app-debug-unaligned.apk and b/app/build/outputs/apk/app-debug-unaligned.apk differ http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/313a541b/app/build/outputs/apk/app-debug.apk ---------------------------------------------------------------------- diff --git a/app/build/outputs/apk/app-debug.apk b/app/build/outputs/apk/app-debug.apk index e972a82..d548086 100644 Binary files a/app/build/outputs/apk/app-debug.apk and b/app/build/outputs/apk/app-debug.apk differ http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/313a541b/app/src/main/java/org/apache/taverna/mobile/activities/DashboardMainActivity.java ---------------------------------------------------------------------- diff --git a/app/src/main/java/org/apache/taverna/mobile/activities/DashboardMainActivity.java b/app/src/main/java/org/apache/taverna/mobile/activities/DashboardMainActivity.java index 92fc7c9..35a073d 100644 --- a/app/src/main/java/org/apache/taverna/mobile/activities/DashboardMainActivity.java +++ b/app/src/main/java/org/apache/taverna/mobile/activities/DashboardMainActivity.java @@ -37,7 +37,6 @@ import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.app.FragmentTransaction; -import android.support.v4.os.EnvironmentCompat; import android.support.v4.view.ViewPager; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBar; http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/313a541b/app/src/main/java/org/apache/taverna/mobile/activities/WorkflowDetailActivity.java ---------------------------------------------------------------------- diff --git a/app/src/main/java/org/apache/taverna/mobile/activities/WorkflowDetailActivity.java b/app/src/main/java/org/apache/taverna/mobile/activities/WorkflowDetailActivity.java index d4b20ba..5fffc27 100644 --- a/app/src/main/java/org/apache/taverna/mobile/activities/WorkflowDetailActivity.java +++ b/app/src/main/java/org/apache/taverna/mobile/activities/WorkflowDetailActivity.java @@ -34,6 +34,7 @@ import android.support.v7.app.ActionBarActivity; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; +import android.view.Window; import org.apache.taverna.mobile.R; import org.apache.taverna.mobile.fragments.workflowdetails.WorkflowAboutFragment; @@ -62,6 +63,7 @@ public class WorkflowDetailActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { + supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); setContentView(R.layout.activity_workflow_detail); // Create the adapter that will return a fragment for each of the three @@ -71,7 +73,6 @@ public class WorkflowDetailActivity extends ActionBarActivity { // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); - } @Override @@ -140,6 +141,8 @@ public class WorkflowDetailActivity extends ActionBarActivity { } return ""; } + + } } http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/313a541b/app/src/main/java/org/apache/taverna/mobile/adapters/FavoriteWorkflowAdapter.java ---------------------------------------------------------------------- diff --git a/app/src/main/java/org/apache/taverna/mobile/adapters/FavoriteWorkflowAdapter.java b/app/src/main/java/org/apache/taverna/mobile/adapters/FavoriteWorkflowAdapter.java index ea5586b..29b5e92 100644 --- a/app/src/main/java/org/apache/taverna/mobile/adapters/FavoriteWorkflowAdapter.java +++ b/app/src/main/java/org/apache/taverna/mobile/adapters/FavoriteWorkflowAdapter.java @@ -1,4 +1,28 @@ package org.apache.taverna.mobile.adapters; +/** + * Apache Taverna Mobile + * Copyright 2015 The Apache Software Foundation + + * This product includes software developed at + * The Apache Software Foundation (http://www.apache.org/). + + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ import android.content.Context; import android.support.v7.widget.RecyclerView; http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/313a541b/app/src/main/java/org/apache/taverna/mobile/adapters/RunAdapter.java ---------------------------------------------------------------------- diff --git a/app/src/main/java/org/apache/taverna/mobile/adapters/RunAdapter.java b/app/src/main/java/org/apache/taverna/mobile/adapters/RunAdapter.java new file mode 100644 index 0000000..6302c12 --- /dev/null +++ b/app/src/main/java/org/apache/taverna/mobile/adapters/RunAdapter.java @@ -0,0 +1,149 @@ +package org.apache.taverna.mobile.adapters; +/** + * Apache Taverna Mobile + * Copyright 2015 The Apache Software Foundation + + * This product includes software developed at + * The Apache Software Foundation (http://www.apache.org/). + + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import android.content.Context; +import android.support.v7.widget.RecyclerView; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageButton; +import android.widget.TextView; + +import org.apache.taverna.mobile.R; +import org.apache.taverna.mobile.tavernamobile.Runs; + +import java.util.List; + + +/** + * Created by root on 6/14/15. + */ +public class RunAdapter extends RecyclerView.Adapter<RunAdapter.RunHolder> { + private Context context; + private List<Runs> runList; + + public RunAdapter(Context context, List<Runs> runs) { + this.context = context; + this.runList = runs; + } + + /** + * Called when RecyclerView needs a new {@link android.support.v7.widget.RecyclerView.ViewHolder} of the given type to represent + * an item. + * <p/> + * This new ViewHolder should be constructed with a new View that can represent the items + * of the given type. You can either create a new View manually or inflate it from an XML + * layout file. + * <p/> + * The new ViewHolder will be used to display items of the adapter using + * . Since it will be re-used to display different + * items in the data set, it is a good idea to cache references to sub views of the View to + * avoid unnecessary {@link android.view.View#findViewById(int)} calls. + * + * @param parent The ViewGroup into which the new View will be added after it is bound to + * an adapter position. + * @param viewType The view type of the new View. + * @return A new ViewHolder that holds a View of the given view type. + * @see #getItemViewType(int) + */ + @Override + public RunHolder onCreateViewHolder(ViewGroup parent, int viewType) { + View v = LayoutInflater.from(context).inflate(R.layout.workflow_run_item,parent, false); + return new RunHolder(v); + } + + /** + * Called by RecyclerView to display the data at the specified position. This method + * should update the contents of the {@link android.support.v7.widget.RecyclerView.ViewHolder#itemView} to reflect the item at + * the given position. + * <p/> + * Note that unlike {@link android.widget.ListView}, RecyclerView will not call this + * method again if the position of the item changes in the data set unless the item itself + * is invalidated or the new position cannot be determined. For this reason, you should only + * use the <code>position</code> parameter while acquiring the related data item inside this + * method and should not keep a copy of it. If you need the position of an item later on + * (e.g. in a click listener), use {@link android.support.v7.widget.RecyclerView.ViewHolder#getAdapterPosition()} which will have + * the updated adapter position. + * + * @param holder The ViewHolder which should be updated to represent the contents of the + * item at the given position in the data set. + * @param position The position of the item within the adapter's data set. + */ + @Override + public void onBindViewHolder(RunHolder holder, int position) { + Runs lRun = runList.get(position); + holder.runtitle.setText(lRun.getRun_name()); + holder.runstarted.setText(lRun.getRun_started_date()); + holder.runfinished.setText(lRun.getRun_ended_date()); + + switch(lRun.getState()){ + case RUNNING: + holder.runStatus.setImageResource(android.R.drawable.presence_busy); + holder.textState.setText("Running"); + break; + case FINISHED: + holder.runStatus.setImageResource(android.R.drawable.presence_online); + holder.textState.setText("Finished"); + break; + case FAILED: + holder.runStatus.setImageResource(android.R.drawable.presence_offline); + holder.textState.setText("Failed"); + break; + } + + } + + public List<Runs> getRunList(){ + return this.runList; + } + + public void setRunList(List<Runs> runList) { + this.runList = runList; + } + + /** + * Returns the total number of items in the data set hold by the adapter. + * + * @return The total number of items in this adapter. + */ + @Override + public int getItemCount() { + return runList.size(); + } + + public static class RunHolder extends RecyclerView.ViewHolder { + public final TextView runtitle, runstarted, runfinished,textState; + public final ImageButton runStatus; + + public RunHolder(View itemView) { + super(itemView); + runtitle = (TextView) itemView.findViewById(R.id.runtitle); + runstarted = (TextView) itemView.findViewById(R.id.runstarted); + runfinished = (TextView) itemView.findViewById(R.id.runfinished); + runStatus = (ImageButton) itemView.findViewById(R.id.imageButtonState); + textState = (TextView) itemView.findViewById(R.id.textState); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/313a541b/app/src/main/java/org/apache/taverna/mobile/adapters/SliderMenuAdapter.java ---------------------------------------------------------------------- diff --git a/app/src/main/java/org/apache/taverna/mobile/adapters/SliderMenuAdapter.java b/app/src/main/java/org/apache/taverna/mobile/adapters/SliderMenuAdapter.java index a3eb2e5..9a68189 100644 --- a/app/src/main/java/org/apache/taverna/mobile/adapters/SliderMenuAdapter.java +++ b/app/src/main/java/org/apache/taverna/mobile/adapters/SliderMenuAdapter.java @@ -1,4 +1,28 @@ package org.apache.taverna.mobile.adapters; +/** + * Apache Taverna Mobile + * Copyright 2015 The Apache Software Foundation + + * This product includes software developed at + * The Apache Software Foundation (http://www.apache.org/). + + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ import android.content.Context; import android.view.LayoutInflater; http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/313a541b/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 16599f0..0f983bf 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 @@ -28,7 +28,6 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; import android.net.Uri; -import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v7.widget.RecyclerView; import android.text.Html; @@ -79,17 +78,21 @@ public class WorkflowAdapter extends RecyclerView.Adapter<WorkflowAdapter.ViewHo public void onBindViewHolder(final ViewHolder viewHolder, int i) { final int j = i; //position of workflow item that has workflow data final Context c = this.context; + String title = workflow.get(i).getWorkflow_title(); String description = workflow.get(i).getWorkflow_description(); + String desc_full = description; if(description.length() > 80) description = description.substring(0, 79); viewHolder.author_name.setText(workflow.get(i).getWorkflow_author()); - viewHolder.wk_title.setText(workflow.get(i).getWorkflow_title()); - // viewHolder.wk_modified.append(workflow.get(i).getWorkflow_datemodified()); - // viewHolder.wk_created.append(workflow.get(i).getWorkflow_datecreated()); + viewHolder.wk_title.setText(title); viewHolder.wk_description.setText( description+" ... "); - //viewHolder.author_profile.setImageBitmap(workflow[i].getWorkflow_author_bitmap()); + final String wkflow_url = workflow.get(j).getWorkflow_remote_url(); final Intent it = new Intent(); it.setClass(context, WorkflowDetailActivity.class); it.putExtra("workflowid", workflow.get(i).getId()); + it.putExtra("title",title); + it.putExtra("description",desc_full); + it.putExtra("url", wkflow_url); + viewHolder.btn_view_workflow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { @@ -103,7 +106,7 @@ public class WorkflowAdapter extends RecyclerView.Adapter<WorkflowAdapter.ViewHo viewHolder.btn_download_workflow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - String wkflow_url = workflow.get(j).getWorkflow_remote_url(); + try { String workflow_name = Uri.parse(wkflow_url).getLastPathSegment(); http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/313a541b/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 ddb2d49..798cbf2 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 @@ -117,6 +117,8 @@ public class WorkflowItemFragment extends Fragment implements android.app.Loader } in = AnimationUtils.loadAnimation(getActivity(),android.R.anim.slide_in_left); List<Workflow> mlist = new ArrayList<Workflow>(); + /* mlist.add(new Workflow(getActivity(),"Testing title","Larry","Ok testing",0,"http://127.0.0.1")); + mlist.add(new Workflow(getActivity(),"Testing title","Larry","Ok testing",0,"http://127.0.0.1")); /* mlist.add(new Workflow(getActivity(), null)); mlist.add(new Workflow(getActivity(), null)); @@ -233,7 +235,7 @@ public class WorkflowItemFragment extends Fragment implements android.app.Loader */ @Override public android.content.Loader<List<Workflow>> onCreateLoader(int id, Bundle args) { - // if (null != wpb) + if (null != wpb) wpb.setVisibility(View.VISIBLE); return new WorkflowLoader(getActivity()); } @@ -241,14 +243,14 @@ public class WorkflowItemFragment extends Fragment implements android.app.Loader @Override public void onLoadFinished(android.content.Loader<List<Workflow>> loader, List<Workflow> workflows) { // getActivity().setProgressBarIndeterminateVisibility(false); - // if (null != wpb) + if (null != wpb) wpb.setVisibility(View.GONE); loader.stopLoading(); workflowAdapter = new WorkflowAdapter(getActivity(), workflows); if(workflows.size() > 0) mListView.swapAdapter(workflowAdapter, true); else { - mListView.setVisibility(View.GONE); + // mListView.setVisibility(View.GONE); // setEmptyText("No views available"); } } http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/313a541b/app/src/main/java/org/apache/taverna/mobile/fragments/workflowdetails/WorkflowRunHistoryFragment.java ---------------------------------------------------------------------- diff --git a/app/src/main/java/org/apache/taverna/mobile/fragments/workflowdetails/WorkflowRunHistoryFragment.java b/app/src/main/java/org/apache/taverna/mobile/fragments/workflowdetails/WorkflowRunHistoryFragment.java index 68fefae..8c0d9c9 100644 --- a/app/src/main/java/org/apache/taverna/mobile/fragments/workflowdetails/WorkflowRunHistoryFragment.java +++ b/app/src/main/java/org/apache/taverna/mobile/fragments/workflowdetails/WorkflowRunHistoryFragment.java @@ -24,24 +24,39 @@ package org.apache.taverna.mobile.fragments.workflowdetails; * under the License. */ +import android.app.LoaderManager; +import android.app.ProgressDialog; +import android.content.Loader; import android.os.Bundle; import android.support.v4.app.Fragment; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import org.apache.taverna.mobile.R; +import org.apache.taverna.mobile.adapters.RunAdapter; +import org.apache.taverna.mobile.tavernamobile.Runs; +import org.apache.taverna.mobile.tavernamobile.Workflow; +import org.apache.taverna.mobile.utils.DetailsLoader; + +import java.util.ArrayList; +import java.util.List; /** * A simple {@link Fragment} subclass. * Use the {@link WorkflowRunHistoryFragment#newInstance} factory method to * create an instance of this fragment. */ -public class WorkflowRunHistoryFragment extends Fragment { +public class WorkflowRunHistoryFragment extends Fragment implements LoaderManager.LoaderCallbacks<Workflow>{ // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; + private ProgressDialog progressDialog; + private RecyclerView mRecyclerView; + private RunAdapter runAdapter; // TODO: Rename and change types of parameters private String mParam1; @@ -72,6 +87,19 @@ public class WorkflowRunHistoryFragment extends Fragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + List<Runs> runsList = new ArrayList<Runs>(); +/* runsList.add(new Runs("Test Run1 ", + SimpleDateFormat.getDateTimeInstance().format(new Date()).toString() + ,SimpleDateFormat.getDateTimeInstance().format(new Date()).toString(),"failed")); + runsList.add(new Runs("Test Run2 ", + SimpleDateFormat.getDateTimeInstance().format(new Date()).toString() + ,SimpleDateFormat.getDateTimeInstance().format(new Date()).toString(),"finished")); + */ + progressDialog = new ProgressDialog(getActivity()); + progressDialog.setMessage(getActivity().getResources().getString(R.string.loading)); + progressDialog.setCancelable(true); + + runAdapter = new RunAdapter(getActivity(),runsList ); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); @@ -82,10 +110,50 @@ public class WorkflowRunHistoryFragment extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_workflow_run_history, container, false); + View rootView =inflater.inflate(R.layout.fragment_workflow_run_history, container, false); + mRecyclerView = (RecyclerView) rootView.findViewById(android.R.id.list); + mRecyclerView.setHasFixedSize(true); + mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); + getActivity().getLoaderManager().initLoader(1,null,this); + return rootView; } + + /** + * Called when the fragment is visible to the user and actively running. + * This is generally + * tied to {@link android.app.Activity#onResume() Activity.onResume} of the containing + * Activity's lifecycle. + */ + @Override + public void onResume() { + super.onResume(); + mRecyclerView.setAdapter(runAdapter); + mRecyclerView.setScrollingTouchSlop(RecyclerView.TOUCH_SLOP_PAGING); + + } + @Override public void onDetach() { super.onDetach(); } + + @Override + public Loader<Workflow> onCreateLoader(int i, Bundle bundle) { + progressDialog.show(); + return new DetailsLoader(getActivity(), + DetailsLoader.LOAD_TYPE.TYPE_RUN_HISTORY, + 1); + } + + @Override + public void onLoadFinished(Loader<Workflow> workflowLoader, Workflow workflow) { + runAdapter.setRunList(workflow.getWorkflow_runs()); + mRecyclerView.swapAdapter(runAdapter, false); + progressDialog.dismiss(); + } + + @Override + public void onLoaderReset(Loader<Workflow> workflowLoader) { + workflowLoader.reset(); + } } http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/313a541b/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 5c6f7fb..bb7e0df 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 @@ -24,23 +24,35 @@ package org.apache.taverna.mobile.fragments.workflowdetails; * under the License. */ +import android.app.Activity; import android.app.DownloadManager; +import android.app.LoaderManager; +import android.app.ProgressDialog; import android.content.Context; +import android.content.Intent; +import android.content.Loader; import android.database.Cursor; +import android.media.Image; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.preference.PreferenceManager; +import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; +import android.widget.ImageView; +import android.widget.TextView; import android.widget.Toast; import org.apache.taverna.mobile.R; import org.apache.taverna.mobile.activities.DashboardMainActivity; +import org.apache.taverna.mobile.tavernamobile.Workflow; +import org.apache.taverna.mobile.utils.DetailsLoader; import org.apache.taverna.mobile.utils.WorkflowDownloadManager; +import org.w3c.dom.Text; import java.io.File; import java.util.prefs.PreferenceChangeEvent; @@ -48,14 +60,15 @@ import java.util.prefs.PreferenceChangeEvent; /** * Created by Larry Akah on 6/9/15. */ -public class WorkflowdetailFragment extends Fragment implements View.OnClickListener{ +public class WorkflowdetailFragment extends Fragment implements View.OnClickListener, LoaderManager.LoaderCallbacks<Workflow>{ /** * The fragment argument representing the section number for this * fragment. */ private static final String ARG_SECTION_NUMBER = "section_number"; private DownloadManager downloadManager; - private boolean isDownloading = false; + View rootView; + private ProgressDialog progressDialog; /** * Returns a new instance of this fragment for the given section @@ -75,14 +88,29 @@ public class WorkflowdetailFragment extends Fragment implements View.OnClickList @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View rootView = inflater.inflate(R.layout.fragment_workflow_detail, container, false); + + rootView = inflater.inflate(R.layout.fragment_workflow_detail, container, false); + progressDialog = new ProgressDialog(getActivity()); + progressDialog.setMessage(getActivity().getResources().getString(R.string.loading)); + progressDialog.setCancelable(true); + Button download = (Button) rootView.findViewById(R.id.download_wk); download.setOnClickListener(this); downloadManager = (DownloadManager) getActivity().getSystemService(Context.DOWNLOAD_SERVICE); - return rootView; } + /** + * Called when a fragment is first attached to its activity. + * {@link #onCreate(android.os.Bundle)} will be called after this. + * + * @param activity + */ + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + } + @Override public void onClick(View view) { switch(view.getId()){ @@ -116,9 +144,39 @@ public class WorkflowdetailFragment extends Fragment implements View.OnClickList @Override public void onResume() { super.onResume(); - if (getActivity().getIntent() != null) { - long id = getActivity().getIntent().getLongExtra("workflowid", 0); - Toast.makeText(getActivity(), "Workflow id ="+id, Toast.LENGTH_LONG).show(); - } + getActivity().getLoaderManager().initLoader(0, null, this); + + } + + @Override + public Loader<Workflow> onCreateLoader(int i, Bundle bundle) { + // progressDialog = ProgressDialog.show(getActivity(),"",getActivity().getResources().getString(R.string.loading)); + progressDialog.show(); + return new DetailsLoader(getActivity(), + DetailsLoader.LOAD_TYPE.TYPE_WORKFLOW_DETAIL, + getActivity().getIntent().getLongExtra("workflowid", 0)); + } + + @Override + public void onLoadFinished(Loader<Workflow> workflowLoader, Workflow workflow) { + TextView author = (TextView) rootView.findViewById(R.id.wkf_author); + author.setText(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())); + // progressDialog.cancel(); + progressDialog.dismiss(); + } + + @Override + public void onLoaderReset(Loader<Workflow> workflowLoader) { + workflowLoader.reset(); } } http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/313a541b/app/src/main/java/org/apache/taverna/mobile/tavernamobile/Runs.java ---------------------------------------------------------------------- diff --git a/app/src/main/java/org/apache/taverna/mobile/tavernamobile/Runs.java b/app/src/main/java/org/apache/taverna/mobile/tavernamobile/Runs.java index 2a62b2a..199f008 100644 --- a/app/src/main/java/org/apache/taverna/mobile/tavernamobile/Runs.java +++ b/app/src/main/java/org/apache/taverna/mobile/tavernamobile/Runs.java @@ -5,4 +5,72 @@ package org.apache.taverna.mobile.tavernamobile; * Workflow runs for a given workflow */ public class Runs { + private long run_id; + private long run_workflow_id; + private String run_name; + private String run_started_date; + private String run_ended_date; + private String state; + public static enum RUN_STATE { FAILED,FINISHED,RUNNING}; + + + public Runs(String run_name, String run_started_date, String run_ended_date, String state) { + this.run_name = run_name; + this.run_started_date = run_started_date; + this.run_ended_date = run_ended_date; + this.state=state; + } + + public long getRun_id() { + return run_id; + } + + public void setRun_id(long run_id) { + this.run_id = run_id; + } + + public long getRun_workflow_id() { + return run_workflow_id; + } + + public void setRun_workflow_id(long run_workflow_id) { + this.run_workflow_id = run_workflow_id; + } + + public RUN_STATE getState() { + if(state.equalsIgnoreCase("finished")) + return RUN_STATE.FINISHED; + else if (state.equalsIgnoreCase("failed")) + return RUN_STATE.FAILED; + else + return RUN_STATE.RUNNING; + } + + public void setState(String state) { + this.state = state; + } + + public String getRun_name() { + return run_name; + } + + public void setRun_name(String run_name) { + this.run_name = run_name; + } + + public String getRun_started_date() { + return run_started_date; + } + + public void setRun_started_date(String run_started_date) { + this.run_started_date = run_started_date; + } + + public String getRun_ended_date() { + return run_ended_date; + } + + public void setRun_ended_date(String run_ended_date) { + this.run_ended_date = run_ended_date; + } } http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/313a541b/app/src/main/java/org/apache/taverna/mobile/tavernamobile/TavernaPlayerAPI.java ---------------------------------------------------------------------- diff --git a/app/src/main/java/org/apache/taverna/mobile/tavernamobile/TavernaPlayerAPI.java b/app/src/main/java/org/apache/taverna/mobile/tavernamobile/TavernaPlayerAPI.java index 1329566..d3e1e40 100644 --- a/app/src/main/java/org/apache/taverna/mobile/tavernamobile/TavernaPlayerAPI.java +++ b/app/src/main/java/org/apache/taverna/mobile/tavernamobile/TavernaPlayerAPI.java @@ -1,16 +1,18 @@ package org.apache.taverna.mobile.tavernamobile; -import java.net.Authenticator; import java.net.PasswordAuthentication; /** * Created by root on 6/13/15. */ public class TavernaPlayerAPI { + public static final String PLAYER_BASE_URL = "http://heater.cs.man.ac.uk:3000/"; public static final String SERVER_BASE_URL = "http://heater.cs.man.ac.uk:8090/taverna-2.5.4/"; public static final String PLAYER_WORKFLOW_URL = PLAYER_BASE_URL+"workflows/"; public static final String PLAYER_RUN_URL = PLAYER_BASE_URL+"runs/"; + public static final String PLAYER_RUN_IMAGE_URL = PLAYER_RUN_URL+"new?workflow_id="; //returns a json 'framework' used for creating runs for the given workflow + public TavernaPlayerAPI() { } http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/313a541b/app/src/main/java/org/apache/taverna/mobile/tavernamobile/Workflow.java ---------------------------------------------------------------------- diff --git a/app/src/main/java/org/apache/taverna/mobile/tavernamobile/Workflow.java b/app/src/main/java/org/apache/taverna/mobile/tavernamobile/Workflow.java index fb791c1..1d2d6e0 100644 --- a/app/src/main/java/org/apache/taverna/mobile/tavernamobile/Workflow.java +++ b/app/src/main/java/org/apache/taverna/mobile/tavernamobile/Workflow.java @@ -1,4 +1,28 @@ package org.apache.taverna.mobile.tavernamobile; +/** + * Apache Taverna Mobile + * Copyright 2015 The Apache Software Foundation + + * This product includes software developed at + * The Apache Software Foundation (http://www.apache.org/). + + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ import android.content.Context; import android.graphics.Bitmap; @@ -6,9 +30,7 @@ import android.graphics.BitmapFactory; import org.apache.taverna.mobile.R; -import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Date; import java.util.List; /** @@ -18,7 +40,7 @@ public class Workflow { private Context context; private String workflow_author; private String workflow_title; - private String workflow_description; + private String workflow_description, about, policy; private String workflow_datecreated, workflow_datemodified; private Bitmap workflow_author_bitmap; private WorkflowComponent workflowComponent; @@ -29,6 +51,11 @@ public class Workflow { public static enum workflow_input_type{ TYPE_INT, TYPE_STRING, TYPE_OBJECT}; + public Workflow(Context context) { + this.context = context; + this.workflow_runs = new ArrayList<Runs>(); + } + public Workflow(Context ctx, String title, String author, String description, long id, String url){ this.context = ctx; this.workflow_author = author; @@ -39,8 +66,6 @@ public class Workflow { this.id = id; this.workflow_remote_url = url; this.workflow_runs = new ArrayList<Runs>(); - this.setWorkflow_datecreated(SimpleDateFormat.getDateTimeInstance().format(new Date())); - this.setWorkflow_datemodified(SimpleDateFormat.getDateTimeInstance().format(new Date())); } public long getId() { @@ -63,6 +88,22 @@ public class Workflow { this.workflow_remote_url = workflow_remote_url; } + public String getPolicy() { + return policy; + } + + public void setPolicy(String policy) { + this.policy = policy; + } + + public String getAbout() { + return about; + } + + public void setAbout(String about) { + this.about = about; + } + public void setWorkflow_datecreated(String workflow_datecreated) { this.workflow_datecreated = workflow_datecreated; } @@ -83,6 +124,10 @@ public class Workflow { this.workflow_runs = workflow_runs; } + public void addWorkflowRun(Runs runs){ //adds a run to this workflow + this.workflow_runs.add(runs); + } + public int getWorkflow_input() { return this.workflow_input; } http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/313a541b/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 new file mode 100644 index 0000000..e18acc7 --- /dev/null +++ b/app/src/main/java/org/apache/taverna/mobile/utils/DetailsLoader.java @@ -0,0 +1,191 @@ +package org.apache.taverna.mobile.utils; +/** + * Apache Taverna Mobile + * Copyright 2015 The Apache Software Foundation + + * This product includes software developed at + * The Apache Software Foundation (http://www.apache.org/). + + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import android.content.AsyncTaskLoader; +import android.content.Context; +import android.util.Base64; +import android.util.Log; + +import org.apache.taverna.mobile.tavernamobile.Runs; +import org.apache.taverna.mobile.tavernamobile.TavernaPlayerAPI; +import org.apache.taverna.mobile.tavernamobile.Workflow; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.Authenticator; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; + +import static org.apache.taverna.mobile.utils.DetailsLoader.LOAD_TYPE.*; + +/** + * Created by root on 6/14/15. + */ +public class DetailsLoader extends AsyncTaskLoader<Workflow> { + + public static enum LOAD_TYPE {TYPE_WORKFLOW_DETAIL, TYPE_RUN_HISTORY, TYPE_POLICY, TYPE_ABOUT_WORKFLOW}; + private LOAD_TYPE lt; + private long wid; + private Workflow workflow; + private Context context; + + public DetailsLoader(Context context, LOAD_TYPE load_type, long id) { + super(context); + this.context = context; + this.lt = load_type; + this.wid = id; + } + + @Override + public Workflow loadInBackground() { + //start a network request to fetch user's workflow details + try { + //for password protected urls use the user's credentials + Authenticator.setDefault(new TavernaPlayerAPI.Authenticator("taverna", "taverna")); + URL workflowurl; + + switch (this.lt){ + case TYPE_WORKFLOW_DETAIL: + workflowurl = new URL(TavernaPlayerAPI.PLAYER_WORKFLOW_URL+this.wid); + break; + case TYPE_RUN_HISTORY: + workflowurl = new URL(TavernaPlayerAPI.PLAYER_RUN_URL); + break; + case TYPE_POLICY: + workflowurl = new URL(TavernaPlayerAPI.SERVER_BASE_URL); + break; + case TYPE_ABOUT_WORKFLOW: + workflowurl = new URL(TavernaPlayerAPI.PLAYER_WORKFLOW_URL); + break; + default: + workflowurl = new URL(TavernaPlayerAPI.PLAYER_WORKFLOW_URL); + break; + } + HttpURLConnection connection = (HttpURLConnection) workflowurl.openConnection(); + String userpass = "icep...@gmail.com" + ":" + "creationfox"; + String basicAuth = "Basic " + Base64.encodeToString(userpass.getBytes(), Base64.DEFAULT); + + connection.setRequestProperty ("Authorization", basicAuth); + connection.setRequestProperty("Accept", "application/json"); + connection.setRequestMethod("GET"); + // connection.setDoInput(true); + // connection.setDoOutput(true); + connection.connect(); //send request + Log.i("RESPONSE Code", "" + connection.getResponseCode()); + Log.i("RESPONSE Messsage", ""+connection.getResponseMessage()); + Log.i("Authorization ", ""+connection.getRequestProperty("Authorization")); + + InputStream dis = connection.getInputStream(); + BufferedReader br = new BufferedReader(new InputStreamReader(dis)); + StringBuffer sb = new StringBuffer(); + String jsonData = ""; + while((jsonData = br.readLine()) != null){ + sb.append(jsonData); + } + dis.close(); + br.close(); + switch(this.lt) { + case TYPE_WORKFLOW_DETAIL: { + JSONObject js = new JSONObject(sb.toString()); + Log.i("JSON ", js.toString(2)); + String created_at = js.getString("created_at"); + String updated_at = js.getString("updated_at"); + workflow = new Workflow(this.context, js.getString("title"), + "", + js.getString("description"), + js.getInt("id"), + js.getString("url")); + workflow.setWorkflow_datecreated(created_at); + workflow.setWorkflow_datemodified(updated_at); + } + return workflow; + case TYPE_RUN_HISTORY:{ + workflow = new Workflow(this.context); + JSONArray jsonArray = new JSONArray(sb.toString()); + Log.i("JSON ", jsonArray.toString(2)); + for(int j=0; j< jsonArray.length();j++){ + JSONObject jsonObject = jsonArray.getJSONObject(j); + long id = jsonObject.getLong("id"); + long workflow_id = jsonObject.getLong("workflow_id"); + String name = jsonObject.getString("name"); + String started = jsonObject.getString("start_time"); + String ended = jsonObject.getString("finish_time"); + String state = jsonObject.getString("state"); + + if(workflow_id == this.wid) { + Runs mrun = new Runs(name,started,ended,state); + mrun.setRun_id(id); + mrun.setRun_workflow_id(workflow_id); + + workflow.addWorkflowRun(mrun); + } + } + + } + return workflow; + case TYPE_POLICY:{ + + } + return workflow; + case TYPE_ABOUT_WORKFLOW:{ + + } + return workflow; + default: + return workflow; + } + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } catch (JSONException e) { + e.printStackTrace(); + } + return workflow; + } + + @Override + protected void onStartLoading() { + if(workflow != null){ + deliverResult(workflow); + }else{ + forceLoad(); + } + } + + @Override + public void deliverResult(Workflow data) { + if(isStarted()){ + super.deliverResult(data); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/313a541b/app/src/main/res/layout/fragment_workflow_detail.xml ---------------------------------------------------------------------- diff --git a/app/src/main/res/layout/fragment_workflow_detail.xml b/app/src/main/res/layout/fragment_workflow_detail.xml index 3f9c56b..ffd3313 100644 --- a/app/src/main/res/layout/fragment_workflow_detail.xml +++ b/app/src/main/res/layout/fragment_workflow_detail.xml @@ -21,27 +21,70 @@ limitations under the License. xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:paddingLeft="@dimen/activity_horizontal_margin" - android:paddingRight="@dimen/activity_horizontal_margin" - android:paddingTop="@dimen/activity_vertical_margin" - android:paddingBottom="@dimen/activity_vertical_margin" tools:context="org.apache.taverna.mobile.activities.WorkflowDetailActivity$PlaceholderFragment" - android:orientation="vertical"> + android:orientation="vertical" + android:padding="5dp"> <TextView android:id="@+id/wkf_author" android:layout_width="match_parent" android:layout_height="wrap_content" - android:hint="@string/detail_title_section1" android:typeface="serif" android:textStyle="italic" - android:text="@string/workflow_authorhint" android:textSize="20sp" /> <ScrollView android:layout_width="match_parent" android:layout_height="0dp" android:id="@+id/scrollView" - android:layout_weight="1" /> + android:layout_weight="1" > + + <LinearLayout + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAppearance="?android:attr/textAppearanceLarge" + android:id="@+id/wtitle" + android:layout_marginTop="5dp" + android:hint="@string/detail_title_section1" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAppearance="?android:attr/textAppearanceMedium" + android:id="@+id/wcreatedat" + android:layout_marginTop="5dp" + android:text="@string/created" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAppearance="?android:attr/textAppearanceMedium" + android:id="@+id/wupdatedat" + android:layout_marginTop="5dp" + android:text="@string/modified" /> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textAppearance="?android:attr/textAppearanceLarge" + android:id="@+id/wdescription" + android:layout_marginTop="5dp" + android:minLines="3" /> + + <ImageView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:id="@+id/wkf_image" + android:src="@mipmap/ic_viewworkflow" + android:backgroundTint="@color/accent_material_light" + android:backgroundTintMode="src_atop" /> + + </LinearLayout> + </ScrollView> <LinearLayout android:orientation="horizontal" @@ -54,7 +97,7 @@ limitations under the License. android:layout_height="wrap_content" android:textStyle="normal" android:layout_weight="0.33" - android:background="#ddd" + android:background="#33b5e5" style="android:buttonBarButtonStyle" android:text="@string/play_workflow" android:drawableLeft="@android:drawable/ic_menu_edit" @@ -64,7 +107,7 @@ limitations under the License. android:layout_height="wrap_content" android:textStyle="normal" android:layout_weight="0.33" - android:background="#ddd" + android:background="#33b5e5" style="android:buttonBarButtonStyle" android:text="@string/workflow_download" android:drawableLeft="@drawable/download" @@ -76,7 +119,7 @@ limitations under the License. android:layout_height="wrap_content" android:textStyle="normal" android:layout_weight="0.33" - android:background="#ddd" + android:background="#33b5e5" style="android:buttonBarButtonStyle" android:text="@string/workflow_mark" android:drawableLeft="@android:drawable/btn_star_big_off" http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/313a541b/app/src/main/res/layout/fragment_workflow_run_history.xml ---------------------------------------------------------------------- diff --git a/app/src/main/res/layout/fragment_workflow_run_history.xml b/app/src/main/res/layout/fragment_workflow_run_history.xml index 33b66f7..924df05 100644 --- a/app/src/main/res/layout/fragment_workflow_run_history.xml +++ b/app/src/main/res/layout/fragment_workflow_run_history.xml @@ -22,8 +22,23 @@ limitations under the License. android:layout_height="match_parent" tools:context="org.apache.taverna.mobile.fragments.workflowdetails.WorkflowRunHistoryFragment"> - <!-- TODO: Update blank fragment layout --> - <TextView android:layout_width="match_parent" android:layout_height="match_parent" - android:text="@string/hello_blank_fragment" /> + <android.support.v7.widget.RecyclerView + xmlns:recycler_view="http://schemas.android.com/apk/res-auto" + android:id="@android:id/list" + android:theme="@style/Theme.AppCompat.Light" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@color/button_material_light" + > + + </android.support.v7.widget.RecyclerView> + + <TextView + android:id="@android:id/empty" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center" + android:visibility="gone" + android:text="@string/workflow_empty"/> </FrameLayout> http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/313a541b/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 1bbdec6..84ef427 100644 --- a/app/src/main/res/layout/workflow_item_layout.xml +++ b/app/src/main/res/layout/workflow_item_layout.xml @@ -131,7 +131,7 @@ limitations under the License. android:layout_weight="0.33" style="android:buttonBarButtonStyle" android:text="@string/workflow_read" - android:background="#ddd" + android:background="#33b5e5" android:drawableLeft="@android:drawable/ic_menu_view" /> <Button android:id="@+id/button_download_workflow" @@ -139,7 +139,7 @@ limitations under the License. android:layout_height="wrap_content" android:textStyle="normal" android:layout_weight="0.33" - android:background="#ddd" + android:background="#33b5e5" style="android:buttonBarButtonStyle" android:text="@string/workflow_download" android:drawableLeft="@drawable/download" @@ -151,7 +151,7 @@ limitations under the License. android:layout_height="wrap_content" android:textStyle="normal" android:layout_weight="0.33" - android:background="#ddd" + android:background="#33b5e5" android:text="@string/workflow_mark" android:drawableLeft="@android:drawable/btn_star_big_off" style="android:buttonBarButtonStyle"/> http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/313a541b/app/src/main/res/layout/workflow_run_item.xml ---------------------------------------------------------------------- diff --git a/app/src/main/res/layout/workflow_run_item.xml b/app/src/main/res/layout/workflow_run_item.xml new file mode 100644 index 0000000..048ec6e --- /dev/null +++ b/app/src/main/res/layout/workflow_run_item.xml @@ -0,0 +1,130 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Apache Taverna Mobile +Copyright 2015 The Apache Software Foundation +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at +http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +<android.support.v7.widget.CardView + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:card_view="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent" + card_view:cardElevation="5dp" + card_view:cardBackgroundColor="@color/background_floating_material_light" + card_view:cardCornerRadius="2dp" + card_view:paddingEnd="2dp" + card_view:paddingStart="2dp" > + + <LinearLayout + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAppearance="?android:attr/textAppearanceLarge" + android:text="runtitile" + android:id="@+id/runtitle" + android:layout_gravity="center_horizontal" /> + + <LinearLayout + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_margin="5dp"> + + <LinearLayout + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:layout_weight="1"> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textAppearance="?android:attr/textAppearanceLarge" + android:text="Started" + android:id="@+id/textView13" + android:layout_gravity="center_vertical" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAppearance="?android:attr/textAppearanceMedium" + android:text="now" + android:id="@+id/runstarted" /> + </LinearLayout> + + <TextView + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:textAppearance="?android:attr/textAppearanceLarge" + android:text="|" + android:id="@+id/textView14" + android:layout_weight="1" + android:background="#111" /> + + <LinearLayout + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:layout_weight="1"> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textAppearance="?android:attr/textAppearanceLarge" + android:text="Finished" + android:id="@+id/textView15" + android:layout_weight="1" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAppearance="?android:attr/textAppearanceMedium" + android:text="later" + android:id="@+id/runfinished" + android:layout_weight="1" /> + </LinearLayout> + </LinearLayout> + + <LinearLayout + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <ImageButton + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/imageButtonState" + android:layout_margin="5dp" + android:src="@android:drawable/presence_online" + android:background="#fff" /> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textAppearance="?android:attr/textAppearanceLarge" + android:text="State" + android:id="@+id/textState" /> + </LinearLayout> + </LinearLayout> + +</android.support.v7.widget.CardView> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/313a541b/app/src/main/res/values/strings.xml ---------------------------------------------------------------------- diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e7bc714..309ad1c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -59,8 +59,8 @@ limitations under the License. <string name="workflow_empty"> No <b>Workflows</b> Available. Check your Connection to the Internet</string> <string name="wktitle">TITLE</string> <string name="marked">Marked On</string> - <string name="created">Workflow Created On:</string> - <string name="modified">Modified On:</string> + <string name="created">Created :</string> + <string name="modified">Modified :</string> <string name="description">Workflow Description</string> <string name="title_activity_workflow_detail">Workflow Detail</string> @@ -77,5 +77,6 @@ limitations under the License. <string name="downloadduplicate">Already Downloading</string> <string name="downloadcomplete"> download complete</string> <string name="seemore"> See more &raquo</string> + <string name="loading">Loading details</string> </resources>