Repository: incubator-taverna-mobile
Updated Branches:
  refs/heads/ian_licence_dialog_web_view [created] df8cb041f


HTML web view for licences in a dialog fragment


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/bcdba791
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/tree/bcdba791
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/diff/bcdba791

Branch: refs/heads/ian_licence_dialog_web_view
Commit: bcdba791c6d3f5acc65471c495d628e4a1db5b3e
Parents: f33900e
Author: Ian Dunlop <ian.dun...@manchester.ac.uk>
Authored: Wed Nov 2 16:15:54 2016 +0000
Committer: Ian Dunlop <ian.dun...@manchester.ac.uk>
Committed: Wed Nov 2 16:15:54 2016 +0000

----------------------------------------------------------------------
 app/src/main/assets/licences.html               | 333 +++++++++++++++++++
 .../taverna/mobile/ui/DashboardActivity.java    |  11 +-
 .../ui/adapter/LicenceRecyclerViewAdapter.java  |  88 -----
 .../mobile/ui/licence/LicenceFragment.java      |  84 +----
 app/src/main/res/layout/fragment_licence.xml    |  83 +----
 5 files changed, 364 insertions(+), 235 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/bcdba791/app/src/main/assets/licences.html
----------------------------------------------------------------------
diff --git a/app/src/main/assets/licences.html 
b/app/src/main/assets/licences.html
new file mode 100644
index 0000000..166bbcd
--- /dev/null
+++ b/app/src/main/assets/licences.html
@@ -0,0 +1,333 @@
+<html>
+
+<head>
+    <style>
+        body {
+            font-family: sans-serif;
+        }
+        pre {
+            background-color: #eeeeee;
+            padding: 1em;
+            white-space: pre-wrap;
+        }
+    </style>
+</head>
+
+<body>
+
+<b>Glide</b>
+    <pre>
+License for everything not in third_party and not otherwise marked:
+
+Copyright 2014 Google, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without 
modification, are
+permitted provided that the following conditions are met:
+
+   1. Redistributions of source code must retain the above copyright notice, 
this list of
+         conditions and the following disclaimer.
+
+   2. Redistributions in binary form must reproduce the above copyright 
notice, this list
+         of conditions and the following disclaimer in the documentation 
and/or other materials
+         provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY GOOGLE, INC. ``AS IS'' AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE, 
INC. OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
(INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+The views and conclusions contained in the software and documentation are 
those of the
+authors and should not be interpreted as representing official policies, 
either expressed
+or implied, of Google, Inc.
+---------------------------------------------------------------------------------------------
+License for third_party/disklrucache:
+
+Copyright 2012 Jake Wharton
+Copyright 2011 The Android Open Source Project
+
+Licensed 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.
+---------------------------------------------------------------------------------------------
+License for third_party/gif_decoder:
+
+Copyright (c) 2013 Xcellent Creations, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+---------------------------------------------------------------------------------------------
+License for third_party/gif_encoder/AnimatedGifEncoder.java and
+third_party/gif_encoder/LZWEncoder.java:
+
+No copyright asserted on the source code of this class. May be used for any
+purpose, however, refer to the Unisys LZW patent for restrictions on use of
+the associated LZWEncoder class. Please forward any corrections to
+kwei...@fmsware.com.
+
+-----------------------------------------------------------------------------
+License for third_party/gif_encoder/NeuQuant.java
+
+Copyright (c) 1994 Anthony Dekker
+
+NEUQUANT Neural-Net quantization algorithm by Anthony Dekker, 1994. See
+"Kohonen neural networks for optimal colour quantization" in "Network:
+Computation in Neural Systems" Vol. 5 (1994) pp 351-367. for a discussion of
+the algorithm.
+
+Any party obtaining a copy of these files from the author, directly or
+indirectly, is granted, free of charge, a full and unrestricted irrevocable,
+world-wide, paid up, royalty-free, nonexclusive right and license to deal in
+this software and documentation files (the "Software"), including without
+limitation the rights to use, copy, modify, merge, publish, distribute,
+sublicense, and/or sell copies of the Software, and to permit persons who
+receive copies from any such party to do so, with the only requirement being
+that this copyright notice remain intact.
+</pre>
+
+<b>appcompat</b>, <b>cardview</b>, <b>recyclerview</b>, <b>support</b>, 
<b>design</b>, <b>multidex</b>, <b>Gson</b>
+    <pre>
+Copyright 2008 Google, Inc.
+
+Licensed 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.
+</pre>
+
+<b>Retrofit</b>, <b>RXJava Adapter</b>
+    <pre>
+Copyright 2013 Square, Inc.
+
+Licensed 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.
+</pre>
+
+<b>OKHttp</b>, <b>Logging Interceptor</b>, <b>Simple XML Converter</b>
+    <pre>
+Copyright 2014 Square, Inc.
+
+Licensed 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.
+</pre>
+<b>Butterknife</b>, <b>Butterknife Compiler</b>
+    <pre>
+Copyright 2013 Jake Wharton
+
+Licensed 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.
+</pre>
+<b>RxAndroid</b>
+    <pre>
+Copyright 2015 The RxAndroid authors
+
+Licensed 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.
+</pre>
+<b>RxJava</b>
+    <pre>
+Copyright 2013 Netflix, Inc.
+
+Licensed 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.
+</pre>
+<b>Simple XML</b>
+    <pre>
+Copyright unknown
+
+Licensed 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.
+</pre>
+<b>Android SVG</b>
+    <pre>
+Copyright unknown
+
+Licensed 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.
+</pre>
+
+<b>Photo View</b>
+    <pre>
+Copyright 2016 Chris Banes
+
+Licensed 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.
+</pre>
+
+<b>Steps View</b>
+    <pre>
+Copyright 2015 Anton Nurdin Tuhadiansyah
+
+Licensed 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.
+</pre>
+
+<b>DBFlow</b>, <b>DBFlow Processor</b>, <b>DBDlow Core</b>
+    <pre>
+Copyright (c) 2014 Raizlabs
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+</pre>
+<b>Stetho</b>, <b>Stetho OKHttp</b>
+    <pre>
+Copyright (c) 2015, Facebook, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without 
modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+ * Neither the name Facebook nor the names of its contributors may be used to
+   endorse or promote products derived from this software without specific
+   prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 
FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+</pre>
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/bcdba791/app/src/main/java/org/apache/taverna/mobile/ui/DashboardActivity.java
----------------------------------------------------------------------
diff --git 
a/app/src/main/java/org/apache/taverna/mobile/ui/DashboardActivity.java 
b/app/src/main/java/org/apache/taverna/mobile/ui/DashboardActivity.java
index a546498..7d84074 100644
--- a/app/src/main/java/org/apache/taverna/mobile/ui/DashboardActivity.java
+++ b/app/src/main/java/org/apache/taverna/mobile/ui/DashboardActivity.java
@@ -18,7 +18,10 @@
  */
 package org.apache.taverna.mobile.ui;
 
+import android.app.AlertDialog;
 import android.app.Dialog;
+import android.app.FragmentManager;
+import android.app.FragmentTransaction;
 import android.content.Intent;
 import android.os.Bundle;
 import android.support.design.widget.NavigationView;
@@ -28,8 +31,10 @@ import android.support.v4.widget.DrawerLayout;
 import android.support.v7.app.ActionBar;
 import android.support.v7.app.AppCompatActivity;
 import android.support.v7.widget.Toolbar;
+import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuItem;
+import android.webkit.WebView;
 import android.widget.TableLayout;
 
 import org.apache.taverna.mobile.R;
@@ -178,13 +183,15 @@ public class DashboardActivity extends AppCompatActivity {
                                 return true;
 
                             case R.id.os_licences:
+                                WebView view = (WebView) 
getLayoutInflater().inflate(R.layout.fragment_licence, navigationView, false);
+                                
view.loadUrl("file:///android_asset/licences.html");
 
+                                LicenceFragment dialog = 
LicenceFragment.newInstance();
+                                dialog.show(getSupportFragmentManager(), 
"LicenceDialog");
                                 
ActivityUtils.addFragmentToActivity(getSupportFragmentManager(),
                                         LicenceFragment.newInstance(), 
R.id.frame_container);
 
-                                menuItem.setChecked(true);
                                 mDrawerLayout.closeDrawers();
-                                
toolbar.setTitle(R.string.title_nav_os_licences);
                                 return true;
 
                             case R.id.nav_settings:

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/bcdba791/app/src/main/java/org/apache/taverna/mobile/ui/adapter/LicenceRecyclerViewAdapter.java
----------------------------------------------------------------------
diff --git 
a/app/src/main/java/org/apache/taverna/mobile/ui/adapter/LicenceRecyclerViewAdapter.java
 
b/app/src/main/java/org/apache/taverna/mobile/ui/adapter/LicenceRecyclerViewAdapter.java
deleted file mode 100644
index 0a17dcf..0000000
--- 
a/app/src/main/java/org/apache/taverna/mobile/ui/adapter/LicenceRecyclerViewAdapter.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.taverna.mobile.ui.adapter;
-
-import android.support.v7.widget.RecyclerView;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-
-import org.apache.taverna.mobile.R;
-import org.apache.taverna.mobile.data.model.licence.LicenceContent;
-
-import java.util.List;
-
-/**
- * {@link RecyclerView.Adapter} that can display a {@link LicenceContent}
- */
-public class LicenceRecyclerViewAdapter extends 
RecyclerView.Adapter<LicenceRecyclerViewAdapter
-        .ViewHolder> {
-
-    private final List<LicenceContent> mValues;
-
-    public LicenceRecyclerViewAdapter(List<LicenceContent> items) {
-        mValues = items;
-    }
-
-    @Override
-    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
-        View view = LayoutInflater.from(parent.getContext())
-                .inflate(R.layout.fragment_licence, parent, false);
-        return new ViewHolder(view);
-    }
-
-    @Override
-    public void onBindViewHolder(final ViewHolder holder, int position) {
-
-
-        holder.mLicenceNameView.setText(mValues.get(position).getName());
-        holder.mLicenceVersionView.setText(mValues.get(position).getVersion());
-        holder.mLicenceLicenceView.setText(mValues.get(position).getLicence());
-
-
-    }
-
-    @Override
-    public int getItemCount() {
-        return mValues.size();
-    }
-
-    public class ViewHolder extends RecyclerView.ViewHolder {
-
-        private final TextView mLicenceNameView;
-        private final TextView mLicenceVersionView;
-        private final TextView mLicenceLicenceView;
-
-
-        public ViewHolder(View view) {
-            super(view);
-            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() + " " + mLicenceNameView.getText() + " " +
-                    mLicenceVersionView.getText() + " " + 
mLicenceLicenceView.getText();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/bcdba791/app/src/main/java/org/apache/taverna/mobile/ui/licence/LicenceFragment.java
----------------------------------------------------------------------
diff --git 
a/app/src/main/java/org/apache/taverna/mobile/ui/licence/LicenceFragment.java 
b/app/src/main/java/org/apache/taverna/mobile/ui/licence/LicenceFragment.java
index 19ac78f..4bfefee 100644
--- 
a/app/src/main/java/org/apache/taverna/mobile/ui/licence/LicenceFragment.java
+++ 
b/app/src/main/java/org/apache/taverna/mobile/ui/licence/LicenceFragment.java
@@ -18,88 +18,38 @@
  */
 package org.apache.taverna.mobile.ui.licence;
 
-import android.content.Context;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.DialogInterface;
 import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
-import android.util.Log;
+import android.support.annotation.NonNull;
+import android.support.v4.app.DialogFragment;
 import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import com.google.gson.Gson;
-import com.google.gson.reflect.TypeToken;
+import android.webkit.WebView;
 
 import org.apache.taverna.mobile.R;
-import org.apache.taverna.mobile.data.model.licence.LicenceContent;
-import org.apache.taverna.mobile.ui.adapter.LicenceRecyclerViewAdapter;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
 
 /**
- * A fragment representing a list of Licence Items.
+ * A fragment displaying a dialog with the licence info.
  */
-public class LicenceFragment extends Fragment {
-
-
-    private static final String TAG = LicenceFragment.class.getSimpleName();
+public class LicenceFragment extends DialogFragment {
 
-    private Gson gson;
 
     public static LicenceFragment newInstance() {
 
         return new LicenceFragment();
     }
 
+    @NonNull
     @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        gson = new Gson();
-    }
-
-    @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-                             Bundle savedInstanceState) {
-        return inflater.inflate(R.layout.fragment_licence_list, container, 
false);
-    }
-
-    @Override
-    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
-        super.onViewCreated(view, savedInstanceState);
-
-        if (view instanceof RecyclerView) {
-
-            Context context = view.getContext();
-            RecyclerView recyclerView = (RecyclerView) view;
-            recyclerView.setLayoutManager(new LinearLayoutManager(context));
-            recyclerView.setAdapter(new 
LicenceRecyclerViewAdapter(loadJSONFromAsset()));
-        }
+    public Dialog onCreateDialog(Bundle savedInstanceState) {
+        WebView view = (WebView) 
LayoutInflater.from(getActivity()).inflate(R.layout.fragment_licence, null);
+        view.loadUrl("file:///android_asset/licences.html");
+        return new AlertDialog.Builder(getActivity(), 
R.style.Theme_AppCompat_Light_Dialog_Alert)
+                .setTitle(getString(R.string.title_nav_os_licences))
+                .setView(view)
+                .setPositiveButton(android.R.string.ok, null)
+                .create();
     }
 
-    private List<LicenceContent> loadJSONFromAsset() {
-        String json = null;
-        List<LicenceContent> itemList = null;
-        try {
-            InputStream is = getActivity().getAssets().open("licences.json");
-            int size = is.available();
-            byte[] buffer = new byte[size];
-            is.read(buffer);
-            is.close();
-            json = new String(buffer, "UTF-8");
-        } catch (IOException ex) {
-            Log.i(TAG, IOException.class.getSimpleName());
-            return null;
-        }
-        TypeToken<List<LicenceContent>> typeToken = new 
TypeToken<List<LicenceContent>>() {
-        };
-        itemList = gson.fromJson(json, typeToken.getType());
-
-        return itemList;
-    }
-
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/bcdba791/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 a69f60d..df78320 100644
--- a/app/src/main/res/layout/fragment_licence.xml
+++ b/app/src/main/res/layout/fragment_licence.xml
@@ -15,81 +15,8 @@
    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";
-    xmlns:tools="http://schemas.android.com/tools";
-    android:id="@+id/card_view"
-    android:layout_width="fill_parent"
-    android:layout_height="wrap_content"
-    android:layout_marginBottom="@dimen/announcementCardMarginVertical"
-    android:layout_marginRight="@dimen/announcementCardMarginHorizontal"
-    android:layout_marginTop="@dimen/announcementCardMarginVertical"
-    android:paddingBottom="5dp"
-    card_view:cardCornerRadius="2dp"
-    card_view:cardElevation="2pt">
-
-    <LinearLayout
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:orientation="vertical">
-
-        <TextView
-            android:id="@+id/licence_name"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center_horizontal"
-            android:textAppearance="?attr/textAppearanceListItem"
-            android:textStyle="bold"
-            android:paddingBottom="5dp"/>
-
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:orientation="horizontal"
-            android:paddingLeft="10dp">
-            <LinearLayout
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_weight="2"
-                android:orientation="vertical">
-                <TextView
-                    android:id="@+id/licence_version_text_holder"
-                    android:text="@string/os_licence_version_text"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:textAppearance="?attr/textAppearanceListItem"
-                    android:textSize="14sp"
-                    android:textStyle="bold" />
-                <TextView
-                    android:id="@+id/licence_version"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:textAppearance="?attr/textAppearanceListItem" />
-            </LinearLayout>
-
-            <LinearLayout
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_weight="2"
-                android:orientation="vertical">
-
-                <TextView
-                    android:id="@+id/licence_licence_text_holder"
-                    android:text="@string/os_licence_licence_text"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:textAppearance="?attr/textAppearanceListItem"
-                    android:textSize="14sp"
-                    android:textStyle="bold" />
-
-                <TextView
-                    android:id="@+id/licence_licence"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:textAppearance="?attr/textAppearanceListItem" />
-            </LinearLayout>
-
-        </LinearLayout>
-    </LinearLayout>
-</android.support.v7.widget.CardView>
\ No newline at end of file
+<WebView
+    xmlns:android="http://schemas.android.com/apk/res/android";
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    />
\ No newline at end of file

Reply via email to