From 5f6d7d8e1f7eb18bdc0748442222139f85220bd7 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Wed, 22 Aug 2018 11:41:47 +0200 Subject: [PATCH] Added About activity --- app/src/main/AndroidManifest.xml | 7 ++- app/src/main/assets/about.html | 22 +++++++ app/src/main/assets/open_source_licenses.html | 58 +++++++++++++++++++ .../client/ui/activities/AboutActivity.java | 58 +++++++++++++++++++ .../client/ui/activities/MainActivity.java | 5 ++ .../main/res/drawable/activity_about_bg.xml | 9 +++ app/src/main/res/layout/activity_about.xml | 51 ++++++++++++++++ app/src/main/res/menu/main_menu.xml | 5 ++ app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values/strings.xml | 4 ++ 10 files changed, 219 insertions(+), 1 deletion(-) create mode 100644 app/src/main/assets/about.html create mode 100644 app/src/main/assets/open_source_licenses.html create mode 100644 app/src/main/java/org/communiquons/android/comunic/client/ui/activities/AboutActivity.java create mode 100644 app/src/main/res/drawable/activity_about_bg.xml create mode 100644 app/src/main/res/layout/activity_about.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f724c69..bc1ee4f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -32,7 +32,7 @@ + android:label="@string/activity_create_account_label" /> + + + \ No newline at end of file diff --git a/app/src/main/assets/about.html b/app/src/main/assets/about.html new file mode 100644 index 0000000..7905904 --- /dev/null +++ b/app/src/main/assets/about.html @@ -0,0 +1,22 @@ + + + + + + + +

Comunic is an OpenSource social network built by Pierre HUBERT since 2014. The + purpose of this project is to offer a social network that respect the privacy of its + users.

+ +

The OpenSource Android Application development started on 2017.

+ +

This project is licensed under the MIT License. You can retrieve the source code + of this application and all the Comunic components on + GitHub

+ + \ No newline at end of file diff --git a/app/src/main/assets/open_source_licenses.html b/app/src/main/assets/open_source_licenses.html new file mode 100644 index 0000000..250f964 --- /dev/null +++ b/app/src/main/assets/open_source_licenses.html @@ -0,0 +1,58 @@ + + + + + + + +

Comunic for Android has been built using the following projects :

+ +
+
+FontAwesome 4.7.0 (MIT Licence) and FontAwesome 5.x :
+
+Font Awesome Free License
+-------------------------
+
+Font Awesome Free is free, open source, and GPL friendly. You can use it for
+commercial projects, open source projects, or really almost whatever you want.
+Full Font Awesome Free license: https://fontawesome.com/license.
+
+# Icons: CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/)
+In the Font Awesome Free download, the CC BY 4.0 license applies to all icons
+packaged as SVG and JS file types.
+
+# Fonts: SIL OFL 1.1 License (https://scripts.sil.org/OFL)
+In the Font Awesome Free download, the SIL OLF license applies to all icons
+packaged as web and desktop font files.
+
+# Code: MIT License (https://opensource.org/licenses/MIT)
+In the Font Awesome Free download, the MIT license applies to all non-font and
+non-icon files.
+
+# Attribution
+Attribution is required by MIT, SIL OLF, and CC BY licenses. Downloaded Font
+Awesome Free files already contain embedded comments with sufficient
+attribution, so you shouldn't need to do anything additional when using these
+files normally.
+
+We've kept attribution comments terse, so we ask that you do not actively work
+to remove them from files, especially code. They're a great way for folks to
+learn about Font Awesome.
+
+# Brand Icons
+All brand icons are trademarks of their respective owners. The use of these
+trademarks does not indicate endorsement of the trademark holder by Font
+Awesome, nor vice versa. **Please do not use brand logos for any purpose except
+to represent the company, product, or service to which they refer.**
+
+
+
+
+ + + \ No newline at end of file diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/AboutActivity.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/AboutActivity.java new file mode 100644 index 0000000..6c24903 --- /dev/null +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/AboutActivity.java @@ -0,0 +1,58 @@ +package org.communiquons.android.comunic.client.ui.activities; + +import android.app.Dialog; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.MenuItem; +import android.view.View; +import android.webkit.WebView; +import android.widget.Button; + +import org.communiquons.android.comunic.client.R; + +/** + * About activity + * + * @author Pierre HUBERT + */ +public class AboutActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_about); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + + WebView view = findViewById(R.id.webview); + view.loadUrl("file:///android_asset/about.html"); + + //Make ope + findViewById(R.id.opensource_btn).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + openOpenSourceLicenses(); + } + }); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + + if(item.getItemId() == android.R.id.home) + finish(); + + return super.onOptionsItemSelected(item); + } + + public void openOpenSourceLicenses(){ + Dialog dialog = new Dialog(AboutActivity.this, + android.R.style.Theme_Holo_Light); + + WebView webView = new WebView(AboutActivity.this); + webView.loadUrl("file:///android_asset/open_source_licenses.html"); + dialog.setContentView(webView); + dialog.setTitle(R.string.dialog_open_source_licenses_title); + dialog.show(); + } +} diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/MainActivity.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/MainActivity.java index 6c02288..678abff 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/MainActivity.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/MainActivity.java @@ -207,6 +207,11 @@ public class MainActivity extends AppCompatActivity implements return true; } + //To learn more about the application + if(id == R.id.action_about){ + startActivity(new Intent(this, AboutActivity.class)); + } + //Check for logout request if (id == R.id.action_logout) { confirmUserLogout(); diff --git a/app/src/main/res/drawable/activity_about_bg.xml b/app/src/main/res/drawable/activity_about_bg.xml new file mode 100644 index 0000000..e7a8088 --- /dev/null +++ b/app/src/main/res/drawable/activity_about_bg.xml @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml new file mode 100644 index 0000000..6bc8bcb --- /dev/null +++ b/app/src/main/res/layout/activity_about.xml @@ -0,0 +1,51 @@ + + + + + +