You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by ia...@apache.org on 2015/06/25 12:00:26 UTC
[2/6] incubator-taverna-mobile git commit: integrated myexperiment
API for reading workflows
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/app/build/outputs/logs/manifest-merger-debug-report.txt
----------------------------------------------------------------------
diff --git a/app/build/outputs/logs/manifest-merger-debug-report.txt b/app/build/outputs/logs/manifest-merger-debug-report.txt
index 714baf8..7f33f8a 100644
--- a/app/build/outputs/logs/manifest-merger-debug-report.txt
+++ b/app/build/outputs/logs/manifest-merger-debug-report.txt
@@ -63,56 +63,58 @@ activity#org.apache.taverna.mobile.activities.DashboardMainActivity
ADDED from AndroidManifest.xml:45:9
android:label
ADDED from AndroidManifest.xml:47:13
+ android:launchMode
+ ADDED from AndroidManifest.xml:48:13
android:name
ADDED from AndroidManifest.xml:46:13
intent-filter#android.intent.action.SEARCH
-ADDED from AndroidManifest.xml:48:13
+ADDED from AndroidManifest.xml:49:13
action#android.intent.action.SEARCH
-ADDED from AndroidManifest.xml:49:17
+ADDED from AndroidManifest.xml:50:17
android:name
- ADDED from AndroidManifest.xml:49:25
+ ADDED from AndroidManifest.xml:50:25
meta-data#android.app.searchable
-ADDED from AndroidManifest.xml:52:13
+ADDED from AndroidManifest.xml:53:13
android:resource
- ADDED from AndroidManifest.xml:54:17
+ ADDED from AndroidManifest.xml:55:17
android:name
- ADDED from AndroidManifest.xml:53:17
+ ADDED from AndroidManifest.xml:54:17
activity#org.apache.taverna.mobile.activities.WorkflowDetailActivity
-ADDED from AndroidManifest.xml:56:9
+ADDED from AndroidManifest.xml:57:9
android:label
- ADDED from AndroidManifest.xml:58:13
- android:parentActivityName
ADDED from AndroidManifest.xml:59:13
+ android:parentActivityName
+ ADDED from AndroidManifest.xml:60:13
android:name
- ADDED from AndroidManifest.xml:57:13
+ ADDED from AndroidManifest.xml:58:13
meta-data#android.support.PARENT_ACTIVITY
-ADDED from AndroidManifest.xml:60:13
+ADDED from AndroidManifest.xml:61:13
android:value
- ADDED from AndroidManifest.xml:62:17
+ ADDED from AndroidManifest.xml:63:17
android:name
- ADDED from AndroidManifest.xml:61:17
+ ADDED from AndroidManifest.xml:62:17
receiver#org.apache.taverna.mobile.broadcastreceivers.WorkflowDownloadReceiver
-ADDED from AndroidManifest.xml:65:9
+ADDED from AndroidManifest.xml:66:9
android:enabled
- ADDED from AndroidManifest.xml:67:13
- android:exported
ADDED from AndroidManifest.xml:68:13
+ android:exported
+ ADDED from AndroidManifest.xml:69:13
android:name
- ADDED from AndroidManifest.xml:66:13
+ ADDED from AndroidManifest.xml:67:13
intent-filter#android.intent.action.DOWNLOAD_COMPLETE
-ADDED from AndroidManifest.xml:69:13
+ADDED from AndroidManifest.xml:70:13
action#android.intent.action.DOWNLOAD_COMPLETE
-ADDED from AndroidManifest.xml:70:17
+ADDED from AndroidManifest.xml:71:17
android:name
- ADDED from AndroidManifest.xml:70:25
+ ADDED from AndroidManifest.xml:71:25
activity#org.apache.taverna.mobile.activities.SettingsActivity
-ADDED from AndroidManifest.xml:74:9
+ADDED from AndroidManifest.xml:75:9
android:label
- ADDED from AndroidManifest.xml:76:13
- android:parentActivityName
ADDED from AndroidManifest.xml:77:13
+ android:parentActivityName
+ ADDED from AndroidManifest.xml:78:13
android:name
- ADDED from AndroidManifest.xml:75:13
+ ADDED from AndroidManifest.xml:76:13
uses-sdk
INJECTED from AndroidManifest.xml:0:0 reason: use-sdk injection requested
MERGED from com.android.support:appcompat-v7:22.0.0:20:5
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/app/libs/simple-xml-2.7.1.jar
----------------------------------------------------------------------
diff --git a/app/libs/simple-xml-2.7.1.jar b/app/libs/simple-xml-2.7.1.jar
new file mode 100644
index 0000000..913725d
Binary files /dev/null and b/app/libs/simple-xml-2.7.1.jar differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/app/libs/sjxp-2.2.jar
----------------------------------------------------------------------
diff --git a/app/libs/sjxp-2.2.jar b/app/libs/sjxp-2.2.jar
new file mode 100644
index 0000000..67960bc
Binary files /dev/null and b/app/libs/sjxp-2.2.jar differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/app/src/main/AndroidManifest.xml
----------------------------------------------------------------------
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 5d1c634..bd49514 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -44,7 +44,8 @@ limitations under the License.
</activity>
<activity
android:name=".activities.DashboardMainActivity"
- android:label="@string/title_activity_dashboard_main" >
+ android:label="@string/title_activity_dashboard_main"
+ android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/app/src/main/java/org/apache/taverna/mobile/activities/LoginActivity.java
----------------------------------------------------------------------
diff --git a/app/src/main/java/org/apache/taverna/mobile/activities/LoginActivity.java b/app/src/main/java/org/apache/taverna/mobile/activities/LoginActivity.java
index 98ece01..fd6ecb2 100644
--- a/app/src/main/java/org/apache/taverna/mobile/activities/LoginActivity.java
+++ b/app/src/main/java/org/apache/taverna/mobile/activities/LoginActivity.java
@@ -25,6 +25,7 @@ package org.apache.taverna.mobile.activities;
* under the License.
*/
+import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
@@ -48,7 +49,9 @@ import android.widget.Toast;
import org.apache.taverna.mobile.R;
import org.apache.taverna.mobile.tavernamobile.TavernaPlayerAPI;
+import org.apache.taverna.mobile.tavernamobile.User;
import org.apache.taverna.mobile.tavernamobile.Workflow;
+import org.apache.taverna.mobile.utils.HttpUtil;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@@ -134,6 +137,7 @@ public class LoginActivity extends ActionBarActivity {
}
}
+
private class LoginTask extends AsyncTask<String, Void, String>{
private Context context;
private ProgressDialog pd;
@@ -147,59 +151,62 @@ public class LoginActivity extends ActionBarActivity {
@Override
protected void onPreExecute() {
super.onPreExecute();
+ pd.setCancelable(false);
pd.show();
}
@Override
protected String doInBackground(String... strings) {
//http://sandbox.myexperiment.org/users
- try {
- //for password protected urls use the user's credentials:new TavernaPlayerAPI(this.context).PLAYER_BASE_URL
- Authenticator.setDefault(new TavernaPlayerAPI.Authenticator("taverna", "taverna"));
-
- URL workflowurl = new URL(TavernaPlayerAPI.getSERVER_BASE_URL(this.context));
- HttpURLConnection connection = (HttpURLConnection) workflowurl.openConnection();
- String userpass = strings[0] + ":" + strings[1];
- String basicAuth = "Basic " + Base64.encodeToString(userpass.getBytes(), Base64.DEFAULT);
- //new String(Base64.encode(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
- int responseCode = connection.getResponseCode();
- Log.i("RESPONSE Code", "" + responseCode);
- 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);
+
+ String whoAmI = "http://www.myexperiment.org/whoami.xml";
+ Object response = null;
+ String responseMessage = null;
+ User loggedUser;
+
+ response = new HttpUtil().doGetRequestResponse(whoAmI, User.class,strings[0], strings[1]);
+ if(response instanceof User){
+ //user is successfully authenticated
+ loggedUser = (User) response;
+ //TODO save login state at this level,
+
+ //TODO set any cookies necessary
+
+ //TODO save remember user login at this level
+
+ }else{
+ if (response instanceof String){
+ responseMessage = (String) response;
+ if (responseMessage.equals("Unauthorized request")) {
+ responseMessage = "Invalid username or password";
+ }
}
- dis.close();
- br.close();
- return ""+responseCode;
- } catch ( IOException e) {
- e.printStackTrace();
}
- return "0";
+ return responseMessage;
}
@Override
- protected void onPostExecute(String s) {
- Log.i("RESULTS", ""+s);
+ protected void onPostExecute(String response) {
+ Log.i("RESULTS", ""+response);
pd.dismiss();
- if(TextUtils.isDigitsOnly(s) && Integer.parseInt(s) == 200) {
+ String responseMessage = response;
+ if(responseMessage != null) {
+ if (responseMessage.equals("Unauthorized request")) {
+ responseMessage = "Invalid username or password";
+ Toast.makeText(this.context, responseMessage, Toast.LENGTH_SHORT).show();
+ }else{
+ Toast.makeText(this.context, responseMessage, Toast.LENGTH_SHORT).show();
+ }
+ }else{
+ //TODO: save user profile at this stage
+
this.context.startActivity(new Intent(this.context, DashboardMainActivity.class));
+ getActivity().overridePendingTransition(R.anim.abc_slide_in_bottom, R.anim.abc_slide_out_top);
getActivity().finish();
- }else{
- Toast.makeText(this.context, "Invalid username or password",Toast.LENGTH_SHORT).show();
}
+ this.context.startActivity(new Intent(this.context, DashboardMainActivity.class));
+ getActivity().overridePendingTransition(R.anim.abc_slide_in_bottom, R.anim.abc_slide_out_top);
+ getActivity().finish();
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/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 4fa4030..b2c17f4 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
@@ -31,6 +31,7 @@ import android.net.Uri;
import android.preference.PreferenceManager;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
+import android.text.util.Linkify;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -57,13 +58,13 @@ import java.util.Date;
import java.util.List;
/**
- * Created by root on 6/8/15.
+ * Created by Larry Akah on 6/8/15.
*/
-public class WorkflowAdapter extends RecyclerView.Adapter<WorkflowAdapter.ViewHolder> implements View.OnClickListener{
+public class WorkflowAdapter extends RecyclerView.Adapter<WorkflowAdapter.ViewHolder>{
private Context context;
- private List<Workflow> workflow;
+ private List<Workflow> workflow; //workflow data to bind to the UI
private WorkflowAdapter.ViewHolder mViewHolder;
- public static final String WORKFLOW_FAVORITE_KEY = "WORKFLOW_FAVORITES";
+ public static final String WORKFLOW_FAVORITE_KEY = "WORKFLOW_FAVORITES"; //workflow key used to save workflows when marked as favorites
public Workflow_DB favDB;
public WorkflowAdapter(Context c, List<Workflow> wk) {
@@ -105,18 +106,19 @@ public class WorkflowAdapter extends RecyclerView.Adapter<WorkflowAdapter.ViewHo
//save current workflow as favorite
mfav.add(wid); mfav.add(author);mfav.add(title);mfav.add(desc_full); mfav.add(SimpleDateFormat.getDateTimeInstance().format(new Date()).toString());
- if(description.length() > 80) description = description.substring(0, 79);
+// if(description.length() > 80) description = description.substring(0, 79);
viewHolder.author_name.setText(author);
viewHolder.wk_title.setText(title);
viewHolder.wk_description.setText( description+" ... ");
+ Linkify.addLinks(viewHolder.wk_description, Linkify.WEB_URLS);
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("author", workflow.get(i).getWorkflow_author());
+ /*it.putExtra("author", workflow.get(i).getWorkflow_author());
it.putExtra("title",title);
it.putExtra("description",desc_full);
- it.putExtra("url", wkflow_url);
+ it.putExtra("url", wkflow_url);*/
WorkflowdetailFragment.WORKFLO_ID = workflow.get(i).getId();
viewHolder.btn_view_workflow.setOnClickListener(new View.OnClickListener() {
@@ -177,6 +179,9 @@ public class WorkflowAdapter extends RecyclerView.Adapter<WorkflowAdapter.ViewHo
}
}
+ public void setData(List<Workflow> workflowList){
+ this.workflow = workflowList;
+ }
@Override
public long getItemId(int i) {
return workflow.get(i).getId();
@@ -195,13 +200,6 @@ public class WorkflowAdapter extends RecyclerView.Adapter<WorkflowAdapter.ViewHo
workflow.add(wk);
}
- @Override
- public void onClick(View view) {
- int i = view.getId();
- if (i == R.id.button_mark_workflow) {
- }
- }
-
public static class ViewHolder extends RecyclerView.ViewHolder {
public final ImageView author_profile;
public final TextView author_name, wk_title,wk_showmore,wk_description;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/app/src/main/java/org/apache/taverna/mobile/fragments/FavoriteFragment.java
----------------------------------------------------------------------
diff --git a/app/src/main/java/org/apache/taverna/mobile/fragments/FavoriteFragment.java b/app/src/main/java/org/apache/taverna/mobile/fragments/FavoriteFragment.java
index 5a9cf32..77d8831 100644
--- a/app/src/main/java/org/apache/taverna/mobile/fragments/FavoriteFragment.java
+++ b/app/src/main/java/org/apache/taverna/mobile/fragments/FavoriteFragment.java
@@ -25,31 +25,32 @@ package org.apache.taverna.mobile.fragments;
* under the License.
*/
-import android.app.Activity;
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.ContextMenu;
import android.view.LayoutInflater;
+import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
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.adapters.FavoriteWorkflowAdapter;
+import org.apache.taverna.mobile.adapters.WorkflowAdapter;
+import org.apache.taverna.mobile.utils.Workflow_DB;
+import org.json.JSONException;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
/**
* Created by Larry Akah on 6/6/15.
*/
-public class FavoriteFragment extends Fragment implements AdapterView.OnItemClickListener{
+public class FavoriteFragment extends Fragment implements RecyclerView.OnCreateContextMenuListener, RecyclerView.OnClickListener{
/**
* The fragment argument representing the section number for this
* fragment.
@@ -57,7 +58,8 @@ public class FavoriteFragment extends Fragment implements AdapterView.OnItemClic
private static final String ARG_SECTION_NUMBER = "SECTION_NUMBER";
private FavoriteWorkflowAdapter favoriteAdapter;
private RecyclerView wFavoriteListView;
- private FavoriteItemSelected favItemListener;
+ // private FavoriteItemSelected favItemListener;
+ public Workflow_DB myWorkflowDb;
/**
* Returns a new instance of this fragment for the given section
@@ -77,27 +79,17 @@ public class FavoriteFragment extends Fragment implements AdapterView.OnItemClic
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
-
- //TODO : Collect data through API (ICEBASE)
- //create a sample list of data. future data come s from an API on local storage
- List<String[]> sampledata = new ArrayList<String[]>();
- sampledata.add(new String[]{"Larry", "Prokaryotic symbiosis",
- new SimpleDateFormat().format(new Date()),
- new SimpleDateFormat().format(new Date()),
- new SimpleDateFormat().format(new Date()),
- new SimpleDateFormat().format(new Date())});
- sampledata.add(new String[]{"Meeze Ball", "Fluid Traffic analysis",
- new SimpleDateFormat().format(new Date()),
- new SimpleDateFormat().format(new Date()),
- new SimpleDateFormat().format(new Date()),
- new SimpleDateFormat().format(new Date())});
- sampledata.add(new String[]{"Halway Law", "Photosynthetic tissue disengagement",
- new SimpleDateFormat().format(new Date()),
- new SimpleDateFormat().format(new Date()),
- new SimpleDateFormat().format(new Date()),
- new SimpleDateFormat().format(new Date())});
-
- favoriteAdapter = new FavoriteWorkflowAdapter(getActivity(), sampledata);
+ myWorkflowDb = new Workflow_DB(getActivity(), WorkflowAdapter.WORKFLOW_FAVORITE_KEY);
+//TODO Add support for loading all the favorites and adding to the required list
+ // try {
+ // List<ArrayList<Object>> mydata = myWorkflowDb.get();
+ // ArrayList<Object> m = mydata.get(0);
+ List<String[]> sampledata = new ArrayList<String[]>();
+ sampledata.add(new String[]{"test fav","test data", "test"});//new String[]{(String) m.get(1), (String) m.get(2)});
+ favoriteAdapter = new FavoriteWorkflowAdapter(getActivity(), sampledata);
+ // } catch (JSONException e) {
+ // e.printStackTrace();
+ // }
}
@Override
@@ -112,16 +104,81 @@ public class FavoriteFragment extends Fragment implements AdapterView.OnItemClic
return rootView;
}
+ /**
+ * Called when a context menu for the {@code view} is about to be shown.
+ * Unlike {@link #onCreateOptionsMenu}, this will be called every
+ * time the context menu is about to be shown and should be populated for
+ * the view (or item inside the view for {@link android.widget.AdapterView} subclasses,
+ * this can be found in the {@code menuInfo})).
+ * <p/>
+ * Use {@link #onContextItemSelected(android.view.MenuItem)} to know when an
+ * item has been selected.
+ * <p/>
+ * The default implementation calls up to
+ * {@link android.app.Activity#onCreateContextMenu Activity.onCreateContextMenu}, though
+ * you can not call this implementation if you don't want that behavior.
+ * <p/>
+ * It is not safe to hold onto the context menu after this method returns.
+ * {@inheritDoc}
+ *
+ * @param menu
+ * @param v
+ * @param menuInfo
+ */
@Override
- public void onAttach(Activity activity) {
- super.onAttach(activity);
- try {
- favItemListener = (FavoriteItemSelected) activity;
- ((DashboardMainActivity) activity).onSectionAttached(
- getArguments().getInt(ARG_SECTION_NUMBER));
- }catch (ClassCastException ex){
- ex.printStackTrace();
- }
+ public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
+ super.onCreateContextMenu(menu, v, menuInfo);
+ menu.add("Select");
+ menu.add("Comment ...");
+ menu.add("Delete");
+ menu.setHeaderIcon(R.mipmap.ic_launcher);
+ }
+
+ /**
+ * This hook is called whenever an item in a context menu is selected. The
+ * default implementation simply returns false to have the normal processing
+ * happen (calling the item's Runnable or sending a message to its Handler
+ * as appropriate). You can use this method for any items for which you
+ * would like to do processing without those other facilities.
+ * <p/>
+ * Use {@link android.view.MenuItem#getMenuInfo()} to get extra information set by the
+ * View that added this menu item.
+ * <p/>
+ * Derived classes should call through to the base class for it to perform
+ * the default menu handling.
+ *
+ * @param item The context menu item that was selected.
+ * @return boolean Return false to allow normal context menu processing to
+ * proceed, true to consume it here.
+ */
+ @Override
+ public boolean onContextItemSelected(MenuItem item) {
+ String title = (String) item.getTitle();
+ if(title.equals("Select")){
+ Toast.makeText(getActivity(),"Selected", Toast.LENGTH_SHORT).show();
+ return true;
+ }else if (title.equals("Comment ...")){
+ Toast.makeText(getActivity(),"Commenting", Toast.LENGTH_SHORT).show();
+ return true;
+ }else if (title.equals("Delete")){
+ Toast.makeText(getActivity(),"Deleted", Toast.LENGTH_SHORT).show();
+ return true;
+ }else
+ return super.onContextItemSelected(item);
+ }
+
+ /**
+ * 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();
+// wFavoriteListView.setKeepScreenOn();
+ wFavoriteListView.setOnClickListener(this);
+ registerForContextMenu(wFavoriteListView);
}
/**
@@ -131,12 +188,6 @@ public class FavoriteFragment extends Fragment implements AdapterView.OnItemClic
@Override
public void onDetach() {
super.onDetach();
- favItemListener = null;
- }
-
- @Override
- public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
- favItemListener.onFavoriteItemSelected(i);
}
/**
@@ -149,8 +200,8 @@ public class FavoriteFragment extends Fragment implements AdapterView.OnItemClic
}
}
- public interface FavoriteItemSelected{
- //implemented by activity when sending click events to this fragments views
- public void onFavoriteItemSelected(int position);
+ @Override
+ public void onClick(View view) {
+ Toast.makeText(getActivity(),"Clicked", Toast.LENGTH_SHORT).show();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/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 a54565b..4457366 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
@@ -35,6 +35,8 @@ import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
+import android.util.Log;
+import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@@ -50,6 +52,7 @@ import org.apache.taverna.mobile.R;
import org.apache.taverna.mobile.activities.DashboardMainActivity;
import org.apache.taverna.mobile.adapters.WorkflowAdapter;
import org.apache.taverna.mobile.tavernamobile.Workflow;
+import org.apache.taverna.mobile.utils.WorkflowDataCallback;
import org.apache.taverna.mobile.utils.WorkflowLoader;
import java.util.ArrayList;
@@ -62,23 +65,23 @@ import java.util.List;
* with a GridView.
* <p/>
*/
-public class WorkflowItemFragment extends Fragment implements android.app.LoaderManager.LoaderCallbacks<List<Workflow>>, SwipeRefreshLayout.OnRefreshListener {
+public class WorkflowItemFragment extends Fragment implements android.app.LoaderManager.LoaderCallbacks<List<Workflow>>,
+ SwipeRefreshLayout.OnRefreshListener, SearchView.OnQueryTextListener {
- // 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 Animation in;
private ProgressDialog mProgressDialog; //progressbar used to indicate the state of the workflow loaders
- // TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
/**
* The fragment's ListView/GridView.
*/
- private RecyclerView mListView;
+ private static RecyclerView mListView;
private SwipeRefreshLayout swipeRefreshLayout;
/**
@@ -86,9 +89,10 @@ public class WorkflowItemFragment extends Fragment implements android.app.Loader
* Views.
*/
private WorkflowAdapter workflowAdapter;
+ private static WorkflowAdapter searchAdpater;
+ private View rootView;
+ public static Context cx;
-
- // TODO: Rename and change types of parameters
public static WorkflowItemFragment newInstance(String param1, String param2) {
WorkflowItemFragment fragment = new WorkflowItemFragment();
Bundle args = new Bundle();
@@ -109,36 +113,30 @@ public class WorkflowItemFragment extends Fragment implements android.app.Loader
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
-
+ cx = getActivity();
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
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(),"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"));
*/
workflowAdapter = new WorkflowAdapter(getActivity(), mlist );
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
- View view = inflater.inflate(R.layout.fragment_item, container, false);
- swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.refresh);
+ rootView = inflater.inflate(R.layout.fragment_item, container, false);
+ swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.refresh);
swipeRefreshLayout.setOnRefreshListener(this);
// Set the adapter
- mListView = (RecyclerView) view.findViewById(android.R.id.list);
+ mListView = (RecyclerView) rootView.findViewById(android.R.id.list);
mListView.setHasFixedSize(true);
mListView.setLayoutManager(new LinearLayoutManager(getActivity()));
- if(workflowAdapter.getItemCount() == 0){
- setEmptyText("No Workflows available");
- mListView.swapAdapter(workflowAdapter, true);
- }else {
- mListView.swapAdapter(workflowAdapter,true);
- mListView.setAnimation(in);
- }
- return view;
+ mListView.setAnimation(in);
+ return rootView;
}
@Override
@@ -154,6 +152,21 @@ public class WorkflowItemFragment extends Fragment implements android.app.Loader
}
/**
+ * Called when the view previously created by {@link #onCreateView} has
+ * been detached from the fragment. The next time the fragment needs
+ * to be displayed, a new view will be created. This is called
+ * after {@link #onStop()} and before {@link #onDestroy()}. It is called
+ * <em>regardless</em> of whether {@link #onCreateView} returned a
+ * non-null view. Internally it is called after the view's state has
+ * been saved but before it has been removed from its parent.
+ */
+ @Override
+ public void onDestroyView() {
+ super.onDestroyView();
+ rootView = null;
+ }
+
+ /**
* 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
@@ -162,15 +175,16 @@ public class WorkflowItemFragment extends Fragment implements android.app.Loader
@Override
public void onResume() {
super.onResume();
- //Handle search actions from a system sent intent
+ /* //Handle search actions from a system sent intent
Intent searchIntent = getActivity().getIntent();
if(searchIntent != null && Intent.ACTION_SEARCH.equals(searchIntent.getAction())){
//retrieve and process query then display results
String query = searchIntent.getStringExtra(SearchManager.QUERY);
//Toast.makeText(getActivity(), "Query = " + query, Toast.LENGTH_SHORT).show();
performSearch(workflowAdapter,query);
- }else
- getActivity().getLoaderManager().initLoader(0,null,this);
+ }else*/
+ new WorkflowLoader(getActivity(),mListView,swipeRefreshLayout).execute();
+ // getActivity().getLoaderManager().initLoader(0,null,this).forceLoad();
}
/**
@@ -197,6 +211,8 @@ public class WorkflowItemFragment extends Fragment implements android.app.Loader
//assuming this activity is the searchable activity
searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName()));
searchView.setSubmitButtonEnabled(true);
+ searchView.setOnQueryTextListener(this);
+// searchView.setOnSearchClickListener(this);
// searchView.setIconifiedByDefault(false);
MenuItem mit = menu.add("Refresh");
mit.setIcon(android.R.drawable.stat_notify_sync);
@@ -223,8 +239,8 @@ public class WorkflowItemFragment extends Fragment implements android.app.Loader
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getTitle().equals("Refresh")){
-
- getActivity().getLoaderManager().restartLoader(0, null, this);
+ new WorkflowLoader(getActivity(), mListView, swipeRefreshLayout).execute();
+// getActivity().getLoaderManager().restartLoader(0, null, this).forceLoad();
return true;
}
return super.onOptionsItemSelected(item);
@@ -248,48 +264,70 @@ public class WorkflowItemFragment extends Fragment implements android.app.Loader
}
}
- private void performSearch(WorkflowAdapter adapter, String search){
+ private void performSearch(String search){
WorkflowAdapter ladapter = new WorkflowAdapter(getActivity());
+ WorkflowAdapter wk = WorkflowItemFragment.searchAdpater;//workflowAdapter;
- for(int i=0; i<adapter.getItemCount(); i++) {
- Workflow workflow = adapter.getItem(i);
- if(search.contains(workflow.getWorkflow_author()) || search.contains(workflow.getWorkflow_title())){
+ Log.i("Count", ""+wk.getItemCount());
+ for(int i=0; i< wk.getItemCount(); i++) {
+ Workflow workflow = wk.getItem(i);
+ if(search.toLowerCase().contains(workflow.getWorkflow_author().toLowerCase())
+ || search.contains(workflow.getWorkflow_title().toLowerCase())){
ladapter.addWorkflow(workflow);
}
}
mListView.swapAdapter(ladapter, true);
+ /// Toast.makeText(getActivity(), "Query = " + search, Toast.LENGTH_SHORT).show();
}
- /**
- * Instantiate and return a new Loader for the given ID.
- *
- * @param id The ID whose loader is to be created.
- * @param args Any arguments supplied by the caller.
- * @return Return a new Loader instance that is ready to start loading.
- */
@Override
public android.content.Loader<List<Workflow>> onCreateLoader(int id, Bundle args) {
swipeRefreshLayout.setRefreshing(true);
- return new WorkflowLoader(getActivity());
+ return null;
+ //return new WorkflowLoader(getActivity());
}
@Override
public void onLoadFinished(android.content.Loader<List<Workflow>> loader, List<Workflow> workflows) {
swipeRefreshLayout.setRefreshing(false);
- workflowAdapter = new WorkflowAdapter(getActivity(), workflows);
- mListView.swapAdapter(workflowAdapter, true);
-
+ Toast.makeText(getActivity(), "loader finished", Toast.LENGTH_SHORT).show();
+ workflowAdapter= new WorkflowAdapter(getActivity(), workflows);
+ WorkflowItemFragment.searchAdpater = workflowAdapter;
+ //mListView.swapAdapter(workflowAdapter, true);
}
@Override
public void onLoaderReset(android.content.Loader<List<Workflow>> listLoader) {
- //listLoader.reset();
+ listLoader.reset();
// mListView.swapAdapter(null, true);
}
@Override
public void onRefresh() {
- getActivity().getLoaderManager().restartLoader(0, null, this);
+
+ new WorkflowLoader(getActivity(), mListView, swipeRefreshLayout).execute();
+ //getActivity().getLoaderManager().restartLoader(0, null, this).forceLoad();
+ }
+
+ @Override
+ public boolean onQueryTextSubmit(String query) {
+ performSearch(query);
+ return true;
+ }
+
+ @Override
+ public boolean onQueryTextChange(String s) {
+ return false;
}
+ public static void updateWorkflowUI(final List<Workflow> data) {
+
+ ((Activity)cx).runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ WorkflowItemFragment.mListView.setAdapter(new WorkflowAdapter(cx, data));
+ }
+ });
+
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/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 3068791..f90354f 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
@@ -170,7 +170,7 @@ public class WorkflowdetailFragment extends Fragment implements View.OnClickList
@Override
public void onResume() {
super.onResume();
- getActivity().getLoaderManager().initLoader(0, null, this);
+ getActivity().getLoaderManager().initLoader(1, null, this);
}
@@ -208,8 +208,8 @@ public class WorkflowdetailFragment extends Fragment implements View.OnClickList
}
//create and return a new TextView
- public TextView createTextView(Context mcontetx, String placeholder){
- TextView tv = new TextView(mcontetx);
+ public TextView createTextView(Context mcontext, String placeholder){
+ TextView tv = new TextView(mcontext);
tv.setText(placeholder);
tv.setMinLines(2);
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/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 388dc2d..63d3b06 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,12 +1,35 @@
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.preference.PreferenceManager;
import java.net.PasswordAuthentication;
/**
- * Created by root on 6/13/15.
+ * Created by Larry Akah on 6/13/15.
*/
public class TavernaPlayerAPI {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/app/src/main/java/org/apache/taverna/mobile/tavernamobile/User.java
----------------------------------------------------------------------
diff --git a/app/src/main/java/org/apache/taverna/mobile/tavernamobile/User.java b/app/src/main/java/org/apache/taverna/mobile/tavernamobile/User.java
new file mode 100644
index 0000000..fa61075
--- /dev/null
+++ b/app/src/main/java/org/apache/taverna/mobile/tavernamobile/User.java
@@ -0,0 +1,129 @@
+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.graphics.Bitmap;
+import org.simpleframework.xml.Element;
+
+import java.util.List;
+
+/**
+ * Created by root on 6/18/15.
+ */
+public class User {
+
+ public User() {
+ super();
+ }
+ private static final long serialVersionUID = 3467195671046297377L;
+ @Element(required = false)
+ protected String id;
+ @Element(name = "created-at", required = false)
+ protected String created_at;
+ @Element(required = false)
+ protected String name;
+ @Element(required = false)
+ protected String description;
+ @Element(required = false)
+ protected String email;
+ @Element(required = false)
+ protected Bitmap avatar;
+ @Element(required = false)
+ protected String city;
+ @Element(required = false)
+ protected String country;
+ @Element(required = false)
+ protected String website;
+
+ protected List<Workflow> user_workflows; //a list of workflows owned by this user
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getCreated_at() {
+ return created_at;
+ }
+
+ public void setCreated_at(String created_at) {
+ this.created_at = created_at;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public Bitmap getAvatar() {
+ return avatar;
+ }
+
+ public void setAvatar(Bitmap avatar) {
+ this.avatar = avatar;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ public String getWebsite() {
+ return website;
+ }
+
+ public void setWebsite(String website) {
+ this.website = website;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/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 1d2d6e0..6beada5 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
@@ -44,17 +44,39 @@ public class Workflow {
private String workflow_datecreated, workflow_datemodified;
private Bitmap workflow_author_bitmap;
private WorkflowComponent workflowComponent;
- private String workflow_remote_url;
+ private String workflow_remote_url; //provides a link to download the workflow. Equivalent to content-uri in the xml form
+ private String workflow_web_url; //a string containing the workflow resource that can be loaded in browser
private List<Runs> workflow_runs;
private int workflow_input;
private long id;
+ private String workflow_uploader;//indicate the user who uploaded the workflow
+ private String workflow_Type; //describes whether it is a type 1 or 2 workflow
+ private String workflow_preview; //a url to a preview image of the workflow
+ private String workflow_thumb_big; //a url to a full scale image of the workflow. I Will usually an SVG because the it is available for most of the workflows
+ private String workflow_licence_type; //describes a type of licensing for the workflow
+ private String workflow_content_type;//specifies a content type for the workflow;
+ private List<String> workflow_tags;//provides a list of string tags that could be used to index the workflow for searches
+ private String workflow_versions;//a list of version for the workflow uploaded over time
+ private List<String> workflow_credits;//key contributors to the workflow
public static enum workflow_input_type{ TYPE_INT, TYPE_STRING, TYPE_OBJECT};
+ public Workflow() {
+ }
+
public Workflow(Context context) {
this.context = context;
this.workflow_runs = new ArrayList<Runs>();
}
+ public Workflow(String author, String description, long id, String url){
+ this.workflow_author = author;
+ this.workflow_author_bitmap = null;//BitmapFactory.decodeResource(getResources(), R.drawable.ic_userprofile);
+ this.workflow_description =description;
+ this.workflow_input=1;
+ this.id = id;
+ this.workflow_remote_url = url;
+ this.workflow_runs = new ArrayList<Runs>();
+ }
public Workflow(Context ctx, String title, String author, String description, long id, String url){
this.context = ctx;
@@ -69,7 +91,7 @@ public class Workflow {
}
public long getId() {
- return id;
+ return this.id;
}
public void setId(long id) {
@@ -89,7 +111,7 @@ public class Workflow {
}
public String getPolicy() {
- return policy;
+ return this.policy;
}
public void setPolicy(String policy) {
@@ -97,7 +119,7 @@ public class Workflow {
}
public String getAbout() {
- return about;
+ return this.about;
}
public void setAbout(String about) {
@@ -179,6 +201,86 @@ public class Workflow {
public void setWorkflowComponent(WorkflowComponent workflowComponent) {
this.workflowComponent = workflowComponent;
}
+
+ public String getWorkflow_web_url() {
+ return workflow_web_url;
+ }
+
+ public void setWorkflow_web_url(String workflow_web_url) {
+ this.workflow_web_url = workflow_web_url;
+ }
+
+ public String getWorkflow_uploader() {
+ return workflow_uploader;
+ }
+
+ public void setWorkflow_uploader(String workflow_uploader) {
+ this.workflow_uploader = workflow_uploader;
+ }
+
+ public String getWorkflow_Type() {
+ return workflow_Type;
+ }
+
+ public void setWorkflow_Type(String workflow_Type) {
+ this.workflow_Type = workflow_Type;
+ }
+
+ public String getWorkflow_preview() {
+ return workflow_preview;
+ }
+
+ public void setWorkflow_preview(String workflow_preview) {
+ this.workflow_preview = workflow_preview;
+ }
+
+ public String getWorkflow_thumb_big() {
+ return workflow_thumb_big;
+ }
+
+ public void setWorkflow_thumb_big(String workflow_thumb_big) {
+ this.workflow_thumb_big = workflow_thumb_big;
+ }
+
+ public String getWorkflow_licence_type() {
+ return workflow_licence_type;
+ }
+
+ public void setWorkflow_licence_type(String workflow_licence_type) {
+ this.workflow_licence_type = workflow_licence_type;
+ }
+
+ public String getWorkflow_content_type() {
+ return workflow_content_type;
+ }
+
+ public void setWorkflow_content_type(String workflow_content_type) {
+ this.workflow_content_type = workflow_content_type;
+ }
+
+ public List<String> getWorkflow_tags() {
+ return workflow_tags;
+ }
+
+ public void setWorkflow_tags(List<String> workflow_tags) {
+ this.workflow_tags = workflow_tags;
+ }
+
+ public String getWorkflow_versions() {
+ return workflow_versions;
+ }
+
+ public void setWorkflow_versions(String workflow_versions) {
+ this.workflow_versions = workflow_versions;
+ }
+
+ public List<String> getWorkflow_credits() {
+ return workflow_credits;
+ }
+
+ public void setWorkflow_credits(List<String> workflow_credits) {
+ this.workflow_credits = workflow_credits;
+ }
}
/* Use the sample code if it becomes necessary to pass this objects amongst activities
/ simple class that just has one member property as an example
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/app/src/main/java/org/apache/taverna/mobile/tavernamobile/WorkflowComponent.java
----------------------------------------------------------------------
diff --git a/app/src/main/java/org/apache/taverna/mobile/tavernamobile/WorkflowComponent.java b/app/src/main/java/org/apache/taverna/mobile/tavernamobile/WorkflowComponent.java
index 71f30ae..dab4775 100644
--- a/app/src/main/java/org/apache/taverna/mobile/tavernamobile/WorkflowComponent.java
+++ b/app/src/main/java/org/apache/taverna/mobile/tavernamobile/WorkflowComponent.java
@@ -24,7 +24,8 @@ package org.apache.taverna.mobile.tavernamobile;
* under the License.
*/
/**
- * Created by root on 6/8/15.
+ * Created by Larry Akah on 6/8/15.
+ * the component elements that make up a workflow's dataflow (e.g. Taverna has sources, sinks, processors, links and coordinations)
*/
public class WorkflowComponent {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/app/src/main/java/org/apache/taverna/mobile/utils/DB_Utility.java
----------------------------------------------------------------------
diff --git a/app/src/main/java/org/apache/taverna/mobile/utils/DB_Utility.java b/app/src/main/java/org/apache/taverna/mobile/utils/DB_Utility.java
index 2ed6b19..86b3666 100644
--- a/app/src/main/java/org/apache/taverna/mobile/utils/DB_Utility.java
+++ b/app/src/main/java/org/apache/taverna/mobile/utils/DB_Utility.java
@@ -1,5 +1,28 @@
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 java.util.ArrayList;
import java.util.Arrays;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/app/src/main/java/org/apache/taverna/mobile/utils/HttpUtil.java
----------------------------------------------------------------------
diff --git a/app/src/main/java/org/apache/taverna/mobile/utils/HttpUtil.java b/app/src/main/java/org/apache/taverna/mobile/utils/HttpUtil.java
new file mode 100644
index 0000000..141b1a5
--- /dev/null
+++ b/app/src/main/java/org/apache/taverna/mobile/utils/HttpUtil.java
@@ -0,0 +1,103 @@
+package org.apache.taverna.mobile.utils;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.auth.BasicScheme;
+import org.apache.http.impl.client.AbstractHttpClient;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.util.EntityUtils;
+import org.apache.taverna.mobile.tavernamobile.User;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.net.CookieStore;
+import java.net.HttpURLConnection;
+/**
+ * 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.
+ */
+/**
+ * Created by Larry Akah on 6/18/15.
+ */
+public class HttpUtil {
+
+ public <T> Object doPostAuthenticate(){
+ User muser = new User();
+
+ return muser;
+ }
+
+ public <T> Object doGetRequestResponse(String uri, Class<T> classType, String username, String password){
+ Object dataObject = null;
+
+ HttpClient httpClient = new DefaultHttpClient();
+ HttpGet httpGet = new HttpGet(uri);
+ HttpResponse httpResponse = null;
+ try {
+ ((AbstractHttpClient) httpClient).setCookieStore((org.apache.http.client.CookieStore) CookieStore.class.newInstance());
+ httpGet.addHeader(BasicScheme.authenticate(new UsernamePasswordCredentials(username,password), "UTF-8", false));
+ httpResponse = httpClient.execute(httpGet);
+
+ if(isSuccess(httpResponse, HttpURLConnection.HTTP_OK)){
+ HttpEntity entity = httpResponse.getEntity();
+ if(entity != null){
+ String responseString = EntityUtils.toString(entity);
+ dataObject = this.deSerialize(classType, responseString);
+ }
+ }
+ } catch (InstantiationException e) {
+ e.printStackTrace();
+ return e.getMessage();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ return e.getMessage();
+ } catch (ClientProtocolException e) {
+ e.printStackTrace();
+ return e.getMessage();
+ } catch (IOException e) {
+ e.printStackTrace();
+ return e.getMessage();
+ }
+
+ return dataObject;
+
+ }
+
+ //de-serializes xml data to target class
+ private <T> Object deSerialize(Class<T> classType, String responseString) {
+ //TODO deserialize data and return the appropriate object
+ // ObjectInputStream ori = new ObjectInputStream(new DataInputStream(responseString)) ;
+
+ return null;
+ }
+
+ private boolean isSuccess(HttpResponse httpResponse, int httpOk) {
+
+ return httpResponse.getStatusLine().getStatusCode() == httpOk;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/app/src/main/java/org/apache/taverna/mobile/utils/MyExperimentXmlParser.java
----------------------------------------------------------------------
diff --git a/app/src/main/java/org/apache/taverna/mobile/utils/MyExperimentXmlParser.java b/app/src/main/java/org/apache/taverna/mobile/utils/MyExperimentXmlParser.java
new file mode 100644
index 0000000..26893f7
--- /dev/null
+++ b/app/src/main/java/org/apache/taverna/mobile/utils/MyExperimentXmlParser.java
@@ -0,0 +1,168 @@
+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.text.util.Linkify;
+
+import com.thebuzzmedia.sjxp.XMLParser;
+import com.thebuzzmedia.sjxp.rule.DefaultRule;
+
+import org.apache.taverna.mobile.tavernamobile.Workflow;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by Larry Akah on 6/23/15.
+ */
+public class MyExperimentXmlParser {
+
+ //parse a single workflow from myexperiment
+ public static final class WorkflowItemRule extends DefaultRule{
+
+ /**
+ * Create a new rule with the given values.
+ *
+ * @param type The type of the rule.
+ * @param locationPath The location path of the element to target in the XML.
+ * @param attributeNames An optional list of attribute names to parse values for if the
+ * type of this rule is {@link com.thebuzzmedia.sjxp.rule.IRule.Type#ATTRIBUTE}.
+ * @throws IllegalArgumentException if <code>type</code> is <code>null</code>, if
+ * <code>locationPath</code> is <code>null</code> or empty, if
+ * <code>type</code> is {@link com.thebuzzmedia.sjxp.rule.IRule.Type#ATTRIBUTE} and
+ * <code>attributeNames</code> is <code>null</code> or empty or
+ * if <code>type</code> is {@link com.thebuzzmedia.sjxp.rule.IRule.Type#CHARACTER} and
+ * <code>attributeNames</code> <strong>is not</strong>
+ * <code>null</code> or empty.
+ */
+ public WorkflowItemRule(Type type, String locationPath, String... attributeNames) throws IllegalArgumentException {
+ super(Type.CHARACTER, "http://www.myexperiment.org/workflows.xml", "workflow");
+ }
+
+ /**
+ * Default no-op implementation. Please override with your own logic.
+ *
+ * @param parser
+ * @param index
+ * @param value
+ * @param userObject
+ * @see com.thebuzzmedia.sjxp.rule.IRule#handleParsedAttribute(com.thebuzzmedia.sjxp.XMLParser, int, String, Object)
+ */
+ @Override
+ public void handleParsedAttribute(XMLParser parser, int index, String value, Object userObject) {
+ switch(index){
+ case 0:
+ break;
+ case 1:
+ break;
+ case 2:
+ break;
+ case 3:
+ break;
+
+ }
+ }
+ }
+
+ /**
+ * parse workflows from myExperiment
+ */
+ public final static class WorkflowRule extends DefaultRule{
+ Workflow workflow;
+ List<Workflow> wlist;
+ static String uri,version,desc;
+ static String url=uri=version=desc="";
+ static long id = 0;
+ /**
+ * Create a new rule with the given values.
+ *
+ * @param type The type of the rule.
+ * @param locationPath The location path of the element to target in the XML.
+ * @param attributeNames An optional list of attribute names to parse values for if the
+ * type of this rule is {@link com.thebuzzmedia.sjxp.rule.IRule.Type#ATTRIBUTE}.
+ * @throws IllegalArgumentException if <code>type</code> is <code>null</code>, if
+ * <code>locationPath</code> is <code>null</code> or empty, if
+ * <code>type</code> is {@link com.thebuzzmedia.sjxp.rule.IRule.Type#ATTRIBUTE} and
+ * <code>attributeNames</code> is <code>null</code> or empty or
+ * if <code>type</code> is {@link com.thebuzzmedia.sjxp.rule.IRule.Type#CHARACTER} and
+ * <code>attributeNames</code> <strong>is not</strong>
+ * <code>null</code> or empty.
+ */
+ public WorkflowRule(Type type, String locationPath, String... attributeNames) throws IllegalArgumentException {
+ super(type, locationPath, attributeNames);
+ this.workflow = new Workflow();
+ wlist = new ArrayList<>();
+ }
+ //instantiated to parse xml data for a given workflow
+ public WorkflowRule(Type type, String path, int id, String attributenames){
+ super(type,path,attributenames);
+ }
+
+ @Override
+ public void handleParsedAttribute(XMLParser parser, int index, String value, Object userObject) {
+
+ switch(index){
+ case 0:
+ System.out.println("Workflow Resource: "+value); url = value;
+ desc = "To view workflow on the web, click "+value;
+// this.workflow.setWorkflow_web_url(value);
+// this.workflow.setWorkflow_description("To view workflow on the web, click "+value);
+ break;
+ case 1:
+ System.out.println("Workflow uri: "+value); //uri for detailed workflow
+ uri = value;
+// this.workflow.setWorkflow_remote_url(value);
+ break;
+ case 2:
+ System.out.println("Workflow id: "+value);
+ id = Integer.parseInt(value);
+// this.workflow.setId(Integer.parseInt(value));
+ break;
+ case 3:
+ System.out.println("Workflow version: "+value);
+ version = value;
+ // this.workflow.setWorkflow_versions(value);
+ break;
+ }
+
+ }
+
+ @Override
+ public void handleParsedCharacters(XMLParser parser, String text, Object workflowListObject) {
+ //add the title to the workflow and add it to the workflow list
+ this.workflow = new Workflow("", desc, id, url);
+ this.workflow.setWorkflow_title(text);
+ this.workflow.setWorkflow_author("");
+ wlist.add(this.workflow);
+ WorkflowLoader.loadedWorkflows.add(this.workflow);
+ System.out.println("static Workflow Count: " + WorkflowLoader.loadedWorkflows.size());
+ ((List<Workflow>)workflowListObject).add(this.workflow);
+ this.workflow = null;
+
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/app/src/main/java/org/apache/taverna/mobile/utils/WorkflowDataCallback.java
----------------------------------------------------------------------
diff --git a/app/src/main/java/org/apache/taverna/mobile/utils/WorkflowDataCallback.java b/app/src/main/java/org/apache/taverna/mobile/utils/WorkflowDataCallback.java
new file mode 100644
index 0000000..a8fbbe5
--- /dev/null
+++ b/app/src/main/java/org/apache/taverna/mobile/utils/WorkflowDataCallback.java
@@ -0,0 +1,14 @@
+package org.apache.taverna.mobile.utils;
+
+import org.apache.taverna.mobile.tavernamobile.Workflow;
+
+import java.util.List;
+
+/**
+ * Callback for when data is ready to be put into the workflow adapter
+ * Created by root on 6/24/15.
+ */
+public interface WorkflowDataCallback {
+
+ public void onWorkflowDataReady(List<Workflow> data);
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/app/src/main/java/org/apache/taverna/mobile/utils/WorkflowLoader.java
----------------------------------------------------------------------
diff --git a/app/src/main/java/org/apache/taverna/mobile/utils/WorkflowLoader.java b/app/src/main/java/org/apache/taverna/mobile/utils/WorkflowLoader.java
index 569ed29..3071f88 100644
--- a/app/src/main/java/org/apache/taverna/mobile/utils/WorkflowLoader.java
+++ b/app/src/main/java/org/apache/taverna/mobile/utils/WorkflowLoader.java
@@ -24,12 +24,18 @@ package org.apache.taverna.mobile.utils;
* under the License.
*/
import android.app.Activity;
-import android.content.AsyncTaskLoader;
import android.content.Context;
+import android.os.AsyncTask;
+import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.RecyclerView;
import android.util.Base64;
import android.util.Log;
+import com.thebuzzmedia.sjxp.XMLParser;
+import com.thebuzzmedia.sjxp.rule.DefaultRule;
+import com.thebuzzmedia.sjxp.rule.IRule;
+
+import org.apache.taverna.mobile.adapters.WorkflowAdapter;
import org.apache.taverna.mobile.tavernamobile.TavernaPlayerAPI;
import org.apache.taverna.mobile.tavernamobile.Workflow;
import org.json.JSONArray;
@@ -40,9 +46,9 @@ 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.ProtocolException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
@@ -50,28 +56,46 @@ import java.util.List;
/**
* Created by Larry Akah on 6/13/15.
*/
-public class WorkflowLoader extends AsyncTaskLoader<List<Workflow>> {
+public class WorkflowLoader extends AsyncTask<Object, Object, Object>{ //WorkflowLoaderMain {
private Context ctx;
private List<Workflow> userWorkflows;
+ public static List<Workflow> loadedWorkflows;
+ private RecyclerView recyclerView;
+ private SwipeRefreshLayout refreshLayout;
- public WorkflowLoader(Context context) {
+ /* public WorkflowLoader(Context context) {
super(context);
ctx = context;
+ loadedWorkflows = new ArrayList<Workflow>();
+ userWorkflows = new ArrayList<Workflow>();
+ }*/
+
+ public WorkflowLoader(Context context, RecyclerView rc, SwipeRefreshLayout sw) {
+ this.ctx = context;
+ this.recyclerView = rc;
+ this.refreshLayout = sw;
+ this.userWorkflows = new ArrayList<Workflow>();
+ loadedWorkflows = new ArrayList<Workflow>();
+ }
+
+ @Override
+ protected void onPreExecute() {
+ super.onPreExecute();
+ refreshLayout.setRefreshing(true);
}
@Override
- public List<Workflow> loadInBackground() {
- userWorkflows = new ArrayList<Workflow>();
+ public List<Workflow> doInBackground(Object[] objects) {
//start a network request to fetch user's workflows
- try {
+ /*try {
//for password protected urls use the user's credentials
- Authenticator.setDefault(new TavernaPlayerAPI.Authenticator("taverna","taverna"));
+ //Authenticator.setDefault(new TavernaPlayerAPI.Authenticator("taverna","taverna"));
URL workflowurl = new URL(new TavernaPlayerAPI(ctx).PLAYER_WORKFLOW_URL);
HttpURLConnection connection = (HttpURLConnection) workflowurl.openConnection();
String userpass = "icep603@gmail.com" + ":" + "creationfox";
- String basicAuth = "Basic " + Base64.encodeToString(userpass.getBytes(),Base64.DEFAULT);
+ String basicAuth = "Basic " + Base64.encodeToString(userpass.getBytes(), Base64.DEFAULT);
//new String(Base64.encode(userpass.getBytes(),Base64.DEFAULT));
connection.setRequestProperty ("Authorization", basicAuth);
@@ -104,14 +128,40 @@ public class WorkflowLoader extends AsyncTaskLoader<List<Workflow>> {
long id = js.getLong("id");
userWorkflows.add(new Workflow(ctx,title,">"+authorJson.getString("name"),description,id,url));
}
-
+ return userWorkflows;
} catch (JSONException | IOException e) {
e.printStackTrace();
- }
+ }*/
+ IRule wkflowRule = new MyExperimentXmlParser.WorkflowRule(IRule.Type.ATTRIBUTE, "/workflows/workflow", "resource", "uri","id", "version");
+ IRule workflowNameRule = new MyExperimentXmlParser.WorkflowRule(IRule.Type.CHARACTER, "/workflows/workflow");
+ WorkflowParser xmlParser = new WorkflowParser(new IRule[]{wkflowRule, workflowNameRule}, recyclerView, this.ctx);
+ try {
+ URL workflowurl = new URL("http://www.myexperiment.org/workflows.xml");
+ HttpURLConnection connection = (HttpURLConnection) workflowurl.openConnection();
+ connection.setRequestMethod("GET");
+ connection.connect(); //send request
- return userWorkflows;
+ Log.i("RESPONSE Code", ""+connection.getResponseCode());
+ Log.i("RESPONSE Messsage", ""+connection.getResponseMessage());
+
+ InputStream dis = connection.getInputStream();
+ xmlParser.parse(dis, this.userWorkflows);
+ Thread.sleep(4000);//4sec delay so that parsing completes
+
+ }catch (MalformedURLException e) {
+ e.printStackTrace();
+ } catch (ProtocolException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ // return WorkflowLoader.loadedWorkflows;
+ return this.userWorkflows;
}
+/*
@Override
public void onCanceled(List<Workflow> data) {
super.onCanceled(data);
@@ -125,7 +175,6 @@ public class WorkflowLoader extends AsyncTaskLoader<List<Workflow>> {
@Override
protected void onStartLoading() {
//if there is data available, deliver it at once
- ((Activity)ctx).setProgressBarIndeterminateVisibility(true);
if(userWorkflows != null)
deliverResult(userWorkflows);
else{
@@ -137,6 +186,7 @@ public class WorkflowLoader extends AsyncTaskLoader<List<Workflow>> {
public void deliverResult(List<Workflow> data) {
if(isStarted()){
super.deliverResult(data);
+
}
}
@@ -144,5 +194,89 @@ public class WorkflowLoader extends AsyncTaskLoader<List<Workflow>> {
protected void onStopLoading() {
cancelLoad();
}
+*/
+
+ @Override
+ protected void onPostExecute(Object o) {
+ refreshLayout.setRefreshing(false);
+ System.out.println("Workflow Count: "+this.userWorkflows.size());
+ // recyclerView.setAdapter(new WorkflowAdapter(this.ctx, (List<Workflow>) o));
+ }
+
+ class WorkflowRule extends DefaultRule {
+ Workflow workflow;
+ /**
+ * Create a new rule with the given values.
+ *
+ * @param type The type of the rule.
+ * @param locationPath The location path of the element to target in the XML.
+ * @param attributeNames An optional list of attribute names to parse values for if the
+ * type of this rule is {@link com.thebuzzmedia.sjxp.rule.IRule.Type#ATTRIBUTE}.
+ * @throws IllegalArgumentException if <code>type</code> is <code>null</code>, if
+ * <code>locationPath</code> is <code>null</code> or empty, if
+ * <code>type</code> is {@link com.thebuzzmedia.sjxp.rule.IRule.Type#ATTRIBUTE} and
+ * <code>attributeNames</code> is <code>null</code> or empty or
+ * if <code>type</code> is {@link com.thebuzzmedia.sjxp.rule.IRule.Type#CHARACTER} and
+ * <code>attributeNames</code> <strong>is not</strong>
+ * <code>null</code> or empty.
+ */
+ public WorkflowRule(Type type, String locationPath, String... attributeNames) throws IllegalArgumentException {
+ super(type, locationPath, attributeNames);
+ workflow = new Workflow();
+ }
+ //instantiated to parse xml data for a given workflow
+ public WorkflowRule(Type type, String path, int id, String attributenames){
+ super(type,path,attributenames);
+ }
+
+ /**
+ * Default no-op implementation. Please override with your own logic.
+ *
+ * @param parser
+ * @param index
+ * @param value
+ * @param userObject
+ * @see com.thebuzzmedia.sjxp.rule.IRule#handleParsedAttribute(com.thebuzzmedia.sjxp.XMLParser, int, String, Object)
+ */
+ @Override
+ public void handleParsedAttribute(XMLParser parser, int index, String value, Object userObject) {
+ switch(index){
+ case 0:
+ System.out.println("Workflow Resource: "+value);
+ workflow.setWorkflow_web_url(value);
+ workflow.setWorkflow_description("To view workflow on the web, click "+value);
+ break;
+ case 1:
+ System.out.println("Workflow uri: "+value); //uri for detailed workflow
+ workflow.setWorkflow_remote_url(value);
+ break;
+ case 2:
+ System.out.println("Workflow id: "+value);
+ workflow.setId(Integer.parseInt(value));
+ break;
+ case 3:
+ System.out.println("Workflow version: "+value);
+ workflow.setWorkflow_versions(value);
+ break;
+ }
+ }
+
+ /**
+ * Default no-op implementation. Please override with your own logic.
+ *
+ * @param parser
+ * @param text
+ * @param workflowListObject
+ * @see com.thebuzzmedia.sjxp.rule.IRule#handleParsedCharacters(com.thebuzzmedia.sjxp.XMLParser, String, Object)
+ */
+ @Override
+ public void handleParsedCharacters(XMLParser parser, String text, Object workflowListObject) {
+ //add the title to the workflow and add it to the workflow list
+ workflow.setWorkflow_title(text);
+ workflow.setWorkflow_author("");
+ workflow = new Workflow();
+ ((List<Workflow>)workflowListObject).add(workflow);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/app/src/main/java/org/apache/taverna/mobile/utils/WorkflowLoaderMain.java
----------------------------------------------------------------------
diff --git a/app/src/main/java/org/apache/taverna/mobile/utils/WorkflowLoaderMain.java b/app/src/main/java/org/apache/taverna/mobile/utils/WorkflowLoaderMain.java
new file mode 100644
index 0000000..41c650d
--- /dev/null
+++ b/app/src/main/java/org/apache/taverna/mobile/utils/WorkflowLoaderMain.java
@@ -0,0 +1,44 @@
+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 org.apache.taverna.mobile.tavernamobile.Workflow;
+
+import java.util.List;
+
+/**
+ * Created by root on 6/23/15.
+ */
+public abstract class WorkflowLoaderMain extends AsyncTaskLoader<List<Workflow>> {
+
+ public WorkflowLoaderMain(Context context) {
+ super(context);
+ }
+
+ public abstract List<Workflow> loadInBackground();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/app/src/main/java/org/apache/taverna/mobile/utils/WorkflowParser.java
----------------------------------------------------------------------
diff --git a/app/src/main/java/org/apache/taverna/mobile/utils/WorkflowParser.java b/app/src/main/java/org/apache/taverna/mobile/utils/WorkflowParser.java
new file mode 100644
index 0000000..cc74955
--- /dev/null
+++ b/app/src/main/java/org/apache/taverna/mobile/utils/WorkflowParser.java
@@ -0,0 +1,50 @@
+package org.apache.taverna.mobile.utils;
+
+import android.content.Context;
+import android.support.v7.widget.RecyclerView;
+
+import com.thebuzzmedia.sjxp.XMLParser;
+import com.thebuzzmedia.sjxp.XMLParserException;
+import com.thebuzzmedia.sjxp.rule.IRule;
+
+import org.apache.taverna.mobile.adapters.WorkflowAdapter;
+import org.apache.taverna.mobile.fragments.WorkflowItemFragment;
+import org.apache.taverna.mobile.tavernamobile.Workflow;
+
+import java.util.List;
+
+/**
+ * Workflow end document class for detecting when the complete list of workflows have been read out
+ * Created by Larry Akah on 6/24/15.
+ */
+public class WorkflowParser extends XMLParser implements WorkflowDataCallback{
+
+ private RecyclerView recyclerView;
+ private Context mcontext;
+
+ public WorkflowParser(IRule[] rules) throws IllegalArgumentException, XMLParserException {
+ super(rules);
+ }
+
+ public WorkflowParser(IRule[] rules, RecyclerView recyclerv, Context c){
+ super(rules);
+ this.recyclerView = recyclerv;
+ this.mcontext = c;
+ }
+
+ @Override
+ protected void doEndDocument(Object userObject) {
+ // super.doEndDocument(userObject);
+ //bind workflows to the adapter;
+// onWorkflowDataReady((List<Workflow>) userObject);
+ WorkflowItemFragment.updateWorkflowUI((List<Workflow>) userObject);
+ }
+
+ @Override
+ public void onWorkflowDataReady(List<Workflow> data) {
+ // this.recyclerView.setAdapter(new WorkflowAdapter(mcontext, data));
+ for(Workflow w:data){
+ System.out.println(w.getId());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/app/src/main/res/layout/fragment_workflow_about.xml
----------------------------------------------------------------------
diff --git a/app/src/main/res/layout/fragment_workflow_about.xml b/app/src/main/res/layout/fragment_workflow_about.xml
index 1f7b676..865241f 100644
--- a/app/src/main/res/layout/fragment_workflow_about.xml
+++ b/app/src/main/res/layout/fragment_workflow_about.xml
@@ -27,7 +27,6 @@ limitations under the License.
android:text="@string/hello_blank_fragment"
android:elevation="5sp"
android:layout_margin="2dp"
- android:background="@color/accent_material_dark"
android:backgroundTintMode="screen"
android:ellipsize="start"
android:id="@+id/aboutworkflowTextView"
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/app/src/main/res/layout/fragment_workflow_licence.xml
----------------------------------------------------------------------
diff --git a/app/src/main/res/layout/fragment_workflow_licence.xml b/app/src/main/res/layout/fragment_workflow_licence.xml
index f239737..05f408b 100644
--- a/app/src/main/res/layout/fragment_workflow_licence.xml
+++ b/app/src/main/res/layout/fragment_workflow_licence.xml
@@ -28,7 +28,6 @@ limitations under the License.
android:text="@string/hello_blank_fragment"
android:elevation="5sp"
android:layout_margin="2dp"
- android:background="@color/accent_material_dark"
android:scrollbars="vertical"
android:fadeScrollbars="true"
android:id="@+id/workflowpolicyTextView"
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/build/intermediates/dex-cache/cache.xml
----------------------------------------------------------------------
diff --git a/build/intermediates/dex-cache/cache.xml b/build/intermediates/dex-cache/cache.xml
index 9dea02b..ab3a83d 100644
--- a/build/intermediates/dex-cache/cache.xml
+++ b/build/intermediates/dex-cache/cache.xml
@@ -2,18 +2,25 @@
<items version="2" >
<item
- jar="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/exploded-aar/com.android.support/support-v4/22.0.0/classes.jar"
+ jar="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/exploded-aar/com.android.support/support-v4/22.0.0/libs/internal_impl-22.0.0.jar"
jumboMode="false"
revision="21.1.2"
- sha1="4e86306289ace4aa0cfec44a05ed2b410d36989d">
- <dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/classes-be9904e841d6b70d2ec429ffa7d3732bb544b8ab.jar" />
+ sha1="b5b92f469d515a13d778900f6d50c03d12f35504">
+ <dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/internal_impl-22.0.0-ab39a2263976cb0fd278360818acc6d173a8d8e0.jar" />
</item>
<item
- jar="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/exploded-aar/com.android.support/cardview-v7/22.0.0/classes.jar"
+ jar="/root/Desktop/android-studio/sdk/extras/android/m2repository/com/android/support/support-annotations/22.0.0/support-annotations-22.0.0.jar"
jumboMode="false"
revision="21.1.2"
- sha1="11842de6a309c447b3a3d60d73ad637a87c58994">
- <dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/classes-2dbcae8b037134953fc4e3eb3645a66e2931661a.jar" />
+ sha1="685d0b2c590447e85284ed84712cb363ba04eff8">
+ <dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/support-annotations-22.0.0-2f3cb2807dead79ef0327bdd9269035b879fdd27.jar" />
+ </item>
+ <item
+ jar="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/exploded-aar/com.android.support/support-v4/22.0.0/classes.jar"
+ jumboMode="false"
+ revision="21.1.2"
+ sha1="4e86306289ace4aa0cfec44a05ed2b410d36989d">
+ <dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/classes-be9904e841d6b70d2ec429ffa7d3732bb544b8ab.jar" />
</item>
<item
jar="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/22.0.0/classes.jar"
@@ -23,18 +30,18 @@
<dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/classes-ebdf15783ac01747301cff830c2f3174571cec96.jar" />
</item>
<item
- jar="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/exploded-aar/com.android.support/support-v4/22.0.0/libs/internal_impl-22.0.0.jar"
+ jar="/root/Desktop/AndroidLab/TavernaMobile2/app/libs/sjxp-2.2.jar"
jumboMode="false"
revision="21.1.2"
- sha1="b5b92f469d515a13d778900f6d50c03d12f35504">
- <dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/internal_impl-22.0.0-ab39a2263976cb0fd278360818acc6d173a8d8e0.jar" />
+ sha1="d7072ec248612a8f861f895a950eb7cc480de9c0">
+ <dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/sjxp-2.2-0d4fc236477cdd67ed93ea2414c2be9703cf2dce.jar" />
</item>
<item
- jar="/root/Desktop/android-studio/sdk/extras/android/m2repository/com/android/support/support-annotations/22.0.0/support-annotations-22.0.0.jar"
+ jar="/root/Desktop/AndroidLab/TavernaMobile2/app/libs/simple-xml-2.7.1.jar"
jumboMode="false"
revision="21.1.2"
- sha1="685d0b2c590447e85284ed84712cb363ba04eff8">
- <dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/support-annotations-22.0.0-2f3cb2807dead79ef0327bdd9269035b879fdd27.jar" />
+ sha1="083623424bcfa03bd598e709765bad0816c2375d">
+ <dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/simple-xml-2.7.1-0337a02c2c7a819ce7d4f1cb9e7af39ace3fc996.jar" />
</item>
<item
jar="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.0.0/classes.jar"
@@ -43,5 +50,12 @@
sha1="d84409890828e07d344a3b9b1da545dba9897b51">
<dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/classes-cb13d360204b697dbd760e7e80b4357b182d723b.jar" />
</item>
+ <item
+ jar="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/exploded-aar/com.android.support/cardview-v7/22.0.0/classes.jar"
+ jumboMode="false"
+ revision="21.1.2"
+ sha1="11842de6a309c447b3a3d60d73ad637a87c58994">
+ <dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/classes-2dbcae8b037134953fc4e3eb3645a66e2931661a.jar" />
+ </item>
</items>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/build/intermediates/model_data.bin
----------------------------------------------------------------------
diff --git a/build/intermediates/model_data.bin b/build/intermediates/model_data.bin
index e4d3f90..31c35f8 100644
Binary files a/build/intermediates/model_data.bin and b/build/intermediates/model_data.bin differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/045fab50/settings.gradle
----------------------------------------------------------------------
diff --git a/settings.gradle b/settings.gradle
index e7b4def..c37e6ca 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1 @@
-include ':app'
+include ':app', ':simple-xml-2.7.1'