Added About activity

This commit is contained in:
Pierre HUBERT 2018-08-22 11:41:47 +02:00
parent ff078e9550
commit 5f6d7d8e1f
10 changed files with 219 additions and 1 deletions

View File

@ -32,7 +32,7 @@
<!-- Create account activity --> <!-- Create account activity -->
<activity <activity
android:name=".ui.activities.CreateAccountActivity" android:name=".ui.activities.CreateAccountActivity"
android:label="@string/activity_create_account_label"/> android:label="@string/activity_create_account_label" />
<!-- Search user activity --> <!-- Search user activity -->
<activity <activity
@ -54,6 +54,11 @@
android:name=".ui.activities.SettingsActivity" android:name=".ui.activities.SettingsActivity"
android:label="@string/title_activity_settings" /> android:label="@string/title_activity_settings" />
<!-- About activity -->
<activity
android:name=".ui.activities.AboutActivity"
android:label="@string/activity_about_title"/>
</application> </application>
</manifest> </manifest>

View File

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body {
text-align: justify;
}
</style>
</head>
<body>
<p>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.</p>
<p>The OpenSource Android Application development started on 2017.</p>
<p>This project is licensed under the MIT License. You can retrieve the source code
of this application and all the Comunic components on
<a href="https://github.com/pierre42100">GitHub</a></p>
</body>
</html>

View File

@ -0,0 +1,58 @@
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body {
text-align: justify;
}
</style>
</head>
<body>
<p>Comunic for Android has been built using the following projects :</p>
<pre>
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.**
</pre>
</body>
</html>

View File

@ -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();
}
}

View File

@ -207,6 +207,11 @@ public class MainActivity extends AppCompatActivity implements
return true; return true;
} }
//To learn more about the application
if(id == R.id.action_about){
startActivity(new Intent(this, AboutActivity.class));
}
//Check for logout request //Check for logout request
if (id == R.id.action_logout) { if (id == R.id.action_logout) {
confirmUserLogout(); confirmUserLogout();

View File

@ -0,0 +1,9 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="135"
android:centerColor="#3f51b5"
android:endColor="#283593"
android:startColor="#7986cb"
android:type="linear" />
</shape>

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.activities.AboutActivity"
android:background="@drawable/activity_about_bg">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="@string/app_name"
android:textColor="@android:color/white"
android:textSize="30sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/opensource_btn"
style="@style/Base.TextAppearance.AppCompat.Widget.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:text="@string/btn_open_source_licences"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<WebView
android:id="@+id/webview"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toTopOf="@+id/opensource_btn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.6"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />
</android.support.constraint.ConstraintLayout>

View File

@ -12,6 +12,11 @@
android:id="@+id/action_settings" android:id="@+id/action_settings"
android:title="@string/action_settings"/> android:title="@string/action_settings"/>
<!-- About activity -->
<item
android:id="@+id/action_about"
android:title="@string/action_about"/>
<!-- Sign out --> <!-- Sign out -->
<item <item
android:id="@+id/action_logout" android:id="@+id/action_logout"

View File

@ -237,4 +237,5 @@
<string name="err_create_account_existing_email">Cette adresse est déjà associée à un compte Comunic existant !</string> <string name="err_create_account_existing_email">Cette adresse est déjà associée à un compte Comunic existant !</string>
<string name="err_create_account_too_many_requests">Trop de création de compte. Veuillez réessayer ultérieurement.</string> <string name="err_create_account_too_many_requests">Trop de création de compte. Veuillez réessayer ultérieurement.</string>
<string name="action_more">Plus</string> <string name="action_more">Plus</string>
<string name="action_about">A propos</string>
</resources> </resources>

View File

@ -236,4 +236,8 @@
<string name="err_create_account_existing_email">This email address is already associated with an account!</string> <string name="err_create_account_existing_email">This email address is already associated with an account!</string>
<string name="err_create_account_too_many_requests">Too many account creation requests. Please try again later…</string> <string name="err_create_account_too_many_requests">Too many account creation requests. Please try again later…</string>
<string name="action_more">More</string> <string name="action_more">More</string>
<string name="action_about">About</string>
<string name="activity_about_title">About</string>
<string name="dialog_open_source_licenses_title">Open Source Licenses</string>
<string name="btn_open_source_licences">Open Source Licences</string>
</resources> </resources>