From fcdde8303898bc62d7894b13b4727d9ab92ef3f1 Mon Sep 17 00:00:00 2001
From: Aditya Das <79566784+aditya3901@users.noreply.github.com>
Date: Mon, 4 Oct 2021 01:47:45 +0530
Subject: [PATCH] feature/About-Page (#440)
---
.../protect/card_locker/AboutActivity.java | 96 +++--
app/src/main/res/layout/about_activity.xml | 327 +++++++++++++++++-
app/src/main/res/values/strings.xml | 12 +
3 files changed, 402 insertions(+), 33 deletions(-)
diff --git a/app/src/main/java/protect/card_locker/AboutActivity.java b/app/src/main/java/protect/card_locker/AboutActivity.java
index 1cc63df9a..b58fcb084 100644
--- a/app/src/main/java/protect/card_locker/AboutActivity.java
+++ b/app/src/main/java/protect/card_locker/AboutActivity.java
@@ -1,11 +1,13 @@
package protect.card_locker;
+import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
+import android.net.Uri;
import android.os.Bundle;
-import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.view.MenuItem;
+import android.view.View;
import android.widget.TextView;
import java.io.BufferedReader;
@@ -17,12 +19,15 @@ import java.util.Calendar;
import java.util.List;
import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
+import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.text.HtmlCompat;
-public class AboutActivity extends CatimaAppCompatActivity
+public class AboutActivity extends CatimaAppCompatActivity implements View.OnClickListener
{
private static final String TAG = "Catima";
+ ConstraintLayout version_history, translate, license, repo, privacy, error, credits, rate;
@Override
protected void onCreate(Bundle savedInstanceState)
@@ -93,39 +98,82 @@ public class AboutActivity extends CatimaAppCompatActivity
Log.w(TAG, "Package name not found", e);
}
+ TextView copyright = findViewById(R.id.copyright);
+ copyright.setText(String.format(getString(R.string.app_copyright_fmt), year));
+ TextView vHistory = findViewById(R.id.history);
+ vHistory.setText(String.format(getString(R.string.debug_version_fmt), version));
+
setTitle(String.format(getString(R.string.about_title_fmt), appName));
- TextView aboutTextView = findViewById(R.id.aboutText);
- aboutTextView.setText(HtmlCompat.fromHtml(String.format(getString(R.string.debug_version_fmt), version) +
- "
" +
- String.format(getString(R.string.app_revision_fmt),
- "" +
- "GitHub" +
- "") +
- "
" +
- String.format(getString(R.string.app_copyright_fmt), year) +
- "
" +
- getString(R.string.app_copyright_old) +
- "
" +
- getString(R.string.app_license) +
- "
" +
- String.format(getString(R.string.app_contributors), contributors.toString()) +
- "
" +
- String.format(getString(R.string.app_libraries), libs.toString()) +
- "
" +
- String.format(getString(R.string.app_resources), resources.toString()), HtmlCompat.FROM_HTML_MODE_COMPACT));
- aboutTextView.setMovementMethod(LinkMovementMethod.getInstance());
+ version_history = findViewById(R.id.version_history);
+ translate = findViewById(R.id.translate);
+ license = findViewById(R.id.License);
+ repo = findViewById(R.id.repo);
+ privacy = findViewById(R.id.privacy);
+ error = findViewById(R.id.report_error);
+ credits = findViewById(R.id.credits);
+ rate = findViewById(R.id.rate);
+
+ version_history.setOnClickListener(this);
+ translate.setOnClickListener(this);
+ license.setOnClickListener(this);
+ repo.setOnClickListener(this);
+ privacy.setOnClickListener(this);
+ error.setOnClickListener(this);
+ rate.setOnClickListener(this);
+
+ StringBuilder contributorInfo = new StringBuilder();
+ contributorInfo.append(HtmlCompat.fromHtml(String.format(getString(R.string.app_contributors), contributors.toString()),
+ HtmlCompat.FROM_HTML_MODE_COMPACT));
+ credits.setOnClickListener(view -> new AlertDialog.Builder(this)
+ .setTitle(R.string.credits)
+ .setMessage(contributorInfo.toString())
+ .setPositiveButton(R.string.ok, (dialogInterface, i) -> {})
+ .show());
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
int id = item.getItemId();
-
if (id == android.R.id.home) {
finish();
}
-
return super.onOptionsItemSelected(item);
}
+
+ @Override
+ public void onClick(View view) {
+ Intent intent = new Intent(Intent.ACTION_VIEW);
+ if (R.id.version_history == view.getId()) {
+ String url = "https://catima.app/changelog/";
+ intent.setData(Uri.parse(url));
+ startActivity(intent);
+ } else if (R.id.translate == view.getId()) {
+ String translateUrl = "https://hosted.weblate.org/engage/catima/";
+ intent.setData(Uri.parse(translateUrl));
+ startActivity(intent);
+ } else if (R.id.License == view.getId()) {
+ String licenseUrl = "https://github.com/TheLastProject/Catima/blob/master/LICENSE";
+ intent.setData(Uri.parse(licenseUrl));
+ startActivity(intent);
+ } else if (R.id.repo == view.getId()) {
+ String repo = "https://github.com/TheLastProject/Catima/";
+ intent.setData(Uri.parse(repo));
+ startActivity(intent);
+ } else if (R.id.privacy == view.getId()) {
+ String privacy = "https://catima.app/privacy-policy/";
+ intent.setData(Uri.parse(privacy));
+ startActivity(intent);
+ } else if (R.id.report_error == view.getId()) {
+ String errorUrl = "https://github.com/TheLastProject/Catima/issues";
+ intent.setData(Uri.parse(errorUrl));
+ startActivity(intent);
+ } else if (R.id.rate == view.getId()) {
+ String rateUrl = "https://play.google.com/store/apps/details?id=me.hackerchick.catima";
+ intent.setData(Uri.parse(rateUrl));
+ startActivity(intent);
+ }
+ }
+
}
diff --git a/app/src/main/res/layout/about_activity.xml b/app/src/main/res/layout/about_activity.xml
index 949a16f88..b6b68934d 100644
--- a/app/src/main/res/layout/about_activity.xml
+++ b/app/src/main/res/layout/about_activity.xml
@@ -22,21 +22,330 @@
-
-
+ android:orientation="vertical">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 55a4afd16..5bf6dcddf 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -253,4 +253,16 @@
Balance
Reverse
Sort by
+ Version History
+ ]]>
+ Credits
+ Help translate this app
+ License
+ Source Repository
+ on Github
+ Privacy Statement
+ and data usage
+ Rate this app
+ on Google Play
+ Report Error