Use 3 text views for licence info

Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/commit/d7600246
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/tree/d7600246
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/diff/d7600246

Branch: refs/heads/ian_licence_data
Commit: d76002461d9792a90c581c9e6132503e3339e690
Parents: 398f0c4
Author: Ian Dunlop <ian.dun...@manchester.ac.uk>
Authored: Wed Oct 12 11:11:54 2016 +0100
Committer: Ian Dunlop <ian.dun...@manchester.ac.uk>
Committed: Wed Oct 12 11:11:54 2016 +0100

----------------------------------------------------------------------
 .../ui/licences/LicenceRecyclerViewAdapter.java | 14 ++++--
 .../ui/licences/licence/LicenceContent.java     | 28 +++++++++--
 app/src/main/res/layout/fragment_licence.xml    | 50 ++++++++++++--------
 3 files changed, 63 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/d7600246/app/src/main/java/org/apache/taverna/mobile/ui/licences/LicenceRecyclerViewAdapter.java
----------------------------------------------------------------------
diff --git 
a/app/src/main/java/org/apache/taverna/mobile/ui/licences/LicenceRecyclerViewAdapter.java
 
b/app/src/main/java/org/apache/taverna/mobile/ui/licences/LicenceRecyclerViewAdapter.java
index e3b66d3..cf1a980 100644
--- 
a/app/src/main/java/org/apache/taverna/mobile/ui/licences/LicenceRecyclerViewAdapter.java
+++ 
b/app/src/main/java/org/apache/taverna/mobile/ui/licences/LicenceRecyclerViewAdapter.java
@@ -36,7 +36,9 @@ public class LicenceRecyclerViewAdapter extends 
RecyclerView.Adapter<LicenceRecy
     @Override
     public void onBindViewHolder(final ViewHolder holder, int position) {
         holder.mItem = mValues.get(position);
-        holder.mContentView.setText(mValues.get(position).toString());
+        holder.mLicenceNameView.setText(mValues.get(position).getName());
+        holder.mLicenceVersionView.setText(mValues.get(position).getVersion());
+        holder.mLicenceLicenceView.setText("Unknown");
 
         holder.mView.setOnClickListener(new View.OnClickListener() {
             @Override
@@ -57,18 +59,22 @@ public class LicenceRecyclerViewAdapter extends 
RecyclerView.Adapter<LicenceRecy
 
     public class ViewHolder extends RecyclerView.ViewHolder {
         public final View mView;
-        public final TextView mContentView;
+        public final TextView mLicenceNameView;
+        public final TextView mLicenceVersionView;
+        public final TextView mLicenceLicenceView;
         public LicenceItem mItem;
 
         public ViewHolder(View view) {
             super(view);
             mView = view;
-            mContentView = (TextView) view.findViewById(R.id.content);
+            mLicenceNameView = (TextView) view.findViewById(R.id.licence_name);
+            mLicenceVersionView = (TextView) 
view.findViewById(R.id.licence_version);
+            mLicenceLicenceView = (TextView) 
view.findViewById(R.id.licence_licence);
         }
 
         @Override
         public String toString() {
-            return super.toString() + " '" + mContentView.getText() + "'";
+            return super.toString() + " " + mLicenceNameView.getText() + " " + 
mLicenceVersionView.getText() + " " + mLicenceLicenceView.getText();
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/d7600246/app/src/main/java/org/apache/taverna/mobile/ui/licences/licence/LicenceContent.java
----------------------------------------------------------------------
diff --git 
a/app/src/main/java/org/apache/taverna/mobile/ui/licences/licence/LicenceContent.java
 
b/app/src/main/java/org/apache/taverna/mobile/ui/licences/licence/LicenceContent.java
index e5131c4..adbca0d 100644
--- 
a/app/src/main/java/org/apache/taverna/mobile/ui/licences/licence/LicenceContent.java
+++ 
b/app/src/main/java/org/apache/taverna/mobile/ui/licences/licence/LicenceContent.java
@@ -32,7 +32,7 @@ public class LicenceContent {
                 JSONObject libraryDetails = licenceList.getJSONObject(i);
                 String libraryName = libraryDetails.getString("library");
                 String libraryVersion = libraryDetails.getString("version");
-                addItem(createLicenceItem(i, libraryName, libraryVersion));
+                addItem(createLicenceItem(i, libraryName, libraryVersion, ""));
             } catch (JSONException e) {
                 e.printStackTrace();
             }
@@ -43,8 +43,8 @@ public class LicenceContent {
         ITEMS.add(item);
     }
 
-    private static LicenceItem createLicenceItem(int position, String name, 
String version) {
-        return new LicenceItem(String.valueOf(position), name, version);
+    private static LicenceItem createLicenceItem(int position, String name, 
String version, String licence) {
+        return new LicenceItem(String.valueOf(position), name, version, 
licence);
     }
 
     /**
@@ -54,16 +54,34 @@ public class LicenceContent {
         public final String id;
         public final String name;
         public final String version;
+        public final String licence;
 
-        public LicenceItem(String id, String name, String version) {
+        public String getId() {
+            return id;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public String getVersion() {
+            return version;
+        }
+
+        public String getLicence() {
+            return licence;
+        }
+
+        public LicenceItem(String id, String name, String version, String 
licence) {
             this.id = id;
             this.name = name;
             this.version = version;
+            this.licence = licence;
         }
 
         @Override
         public String toString() {
-            return name + " " + version;
+            return name + " " + version + " " + licence;
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/d7600246/app/src/main/res/layout/fragment_licence.xml
----------------------------------------------------------------------
diff --git a/app/src/main/res/layout/fragment_licence.xml 
b/app/src/main/res/layout/fragment_licence.xml
index 9813018..c1fdb6a 100644
--- a/app/src/main/res/layout/fragment_licence.xml
+++ b/app/src/main/res/layout/fragment_licence.xml
@@ -1,25 +1,35 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
-    android:layout_width="wrap_content"
+    android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:orientation="horizontal">
 
-    <TextView
-        android:id="@+id/name"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_margin="@dimen/text_margin"
-        android:textAppearance="?attr/textAppearanceListItem" />
-    <TextView
-        android:id="@+id/version"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_margin="@dimen/text_margin"
-        android:textAppearance="?attr/textAppearanceListItem" />
-    <TextView
-        android:id="@+id/licence"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_margin="@dimen/text_margin"
-        android:textAppearance="?attr/textAppearanceListItem" />
-</LinearLayout>
+        <TextView
+            android:id="@+id/licence_name"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_margin="@dimen/text_margin"
+            android:layout_toLeftOf="@+id/licence_version"
+            android:layout_weight="40"
+            android:gravity="center_horizontal"
+            android:textAppearance="?attr/textAppearanceListItem" />
+
+        <TextView
+            android:id="@+id/licence_version"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_margin="@dimen/text_margin"
+            android:layout_toLeftOf="@+id/licence_licence"
+            android:layout_weight="20"
+            android:gravity="center_horizontal"
+            android:textAppearance="?attr/textAppearanceListItem" />
+
+        <TextView
+            android:id="@+id/licence_licence"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_margin="@dimen/text_margin"
+            android:layout_weight="20"
+            android:gravity="center_horizontal"
+            android:textAppearance="?attr/textAppearanceListItem" />
+</LinearLayout>
\ No newline at end of file

Reply via email to