From f78494f88291d789244c5a43a7bb82b1378481d6 Mon Sep 17 00:00:00 2001 From: Sylvia van Os Date: Sun, 3 Oct 2021 22:43:51 +0200 Subject: [PATCH] Cleanups --- CHANGELOG.md | 5 ++ .../protect/card_locker/AboutActivity.java | 68 +++++++++---------- .../protect/card_locker/MainActivity.java | 14 ---- app/src/main/res/layout/about_activity.xml | 47 +++++++------ app/src/main/res/menu/main_menu.xml | 4 -- app/src/main/res/values/strings.xml | 7 +- 6 files changed, 67 insertions(+), 78 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a96d37fce..767a43337 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## Unreleased + +- Improved Android 12 support +- Improved about screen + ## v2.6.1 - 84 (2021-09-25) - Minor bugfixes and improvements diff --git a/app/src/main/java/protect/card_locker/AboutActivity.java b/app/src/main/java/protect/card_locker/AboutActivity.java index b58fcb084..739d5ef24 100644 --- a/app/src/main/java/protect/card_locker/AboutActivity.java +++ b/app/src/main/java/protect/card_locker/AboutActivity.java @@ -98,16 +98,16 @@ public class AboutActivity extends CatimaAppCompatActivity implements View.OnCli Log.w(TAG, "Package name not found", e); } - TextView copyright = findViewById(R.id.copyright); + TextView copyright = findViewById(R.id.credits_sub); copyright.setText(String.format(getString(R.string.app_copyright_fmt), year)); - TextView vHistory = findViewById(R.id.history); + TextView vHistory = findViewById(R.id.version_history_sub); vHistory.setText(String.format(getString(R.string.debug_version_fmt), version)); setTitle(String.format(getString(R.string.about_title_fmt), appName)); version_history = findViewById(R.id.version_history); translate = findViewById(R.id.translate); - license = findViewById(R.id.License); + license = findViewById(R.id.license); repo = findViewById(R.id.repo); privacy = findViewById(R.id.privacy); error = findViewById(R.id.report_error); @@ -123,8 +123,14 @@ public class AboutActivity extends CatimaAppCompatActivity implements View.OnCli 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)); + contributorInfo.append(HtmlCompat.fromHtml(String.format(getString(R.string.app_contributors), contributors.toString()), HtmlCompat.FROM_HTML_MODE_COMPACT)); + contributorInfo.append("\n\n"); + contributorInfo.append(getString(R.string.app_copyright_old)); + contributorInfo.append("\n\n"); + contributorInfo.append(HtmlCompat.fromHtml(String.format(getString(R.string.app_libraries), libs.toString()), HtmlCompat.FROM_HTML_MODE_COMPACT)); + contributorInfo.append("\n\n"); + contributorInfo.append(HtmlCompat.fromHtml(String.format(getString(R.string.app_resources), resources.toString()), HtmlCompat.FROM_HTML_MODE_COMPACT)); + credits.setOnClickListener(view -> new AlertDialog.Builder(this) .setTitle(R.string.credits) .setMessage(contributorInfo.toString()) @@ -144,36 +150,30 @@ public class AboutActivity extends CatimaAppCompatActivity implements View.OnCli @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); + int id = view.getId(); + + String url; + if (id == R.id.version_history) { + url = "https://catima.app/changelog/"; + } else if (id == R.id.translate) { + url = "https://hosted.weblate.org/engage/catima/"; + } else if (id == R.id.license) { + url = "https://github.com/TheLastProject/Catima/blob/master/LICENSE"; + } else if (id == R.id.repo) { + url = "https://github.com/TheLastProject/Catima/"; + } else if (id == R.id.privacy) { + url = "https://catima.app/privacy-policy/"; + } else if (id == R.id.report_error) { + url = "https://github.com/TheLastProject/Catima/issues"; + } else if (id == R.id.rate) { + url = "https://play.google.com/store/apps/details?id=me.hackerchick.catima"; + } else { + return; } + + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse(url)); + startActivity(intent); } } diff --git a/app/src/main/java/protect/card_locker/MainActivity.java b/app/src/main/java/protect/card_locker/MainActivity.java index 1d144925f..879806087 100644 --- a/app/src/main/java/protect/card_locker/MainActivity.java +++ b/app/src/main/java/protect/card_locker/MainActivity.java @@ -460,14 +460,6 @@ public class MainActivity extends CatimaAppCompatActivity implements LoyaltyCard groupsTabLayout.setVisibility(View.VISIBLE); } - private void openPrivacyPolicy() { - Intent browserIntent = new Intent( - Intent.ACTION_VIEW, - Uri.parse("https://catima.app/privacy-policy") - ); - startActivity(browserIntent); - } - @Override public boolean onCreateOptionsMenu(Menu inputMenu) { @@ -580,12 +572,6 @@ public class MainActivity extends CatimaAppCompatActivity implements LoyaltyCard return true; } - if(id == R.id.action_privacy_policy) - { - openPrivacyPolicy(); - return true; - } - if (id == R.id.action_about) { Intent i = new Intent(getApplicationContext(), AboutActivity.class); diff --git a/app/src/main/res/layout/about_activity.xml b/app/src/main/res/layout/about_activity.xml index b6b68934d..699b35dea 100644 --- a/app/src/main/res/layout/about_activity.xml +++ b/app/src/main/res/layout/about_activity.xml @@ -40,7 +40,7 @@ android:padding="8dp"> + app:layout_constraintTop_toBottomOf="@id/version_history_main" /> + app:layout_constraintTop_toBottomOf="@id/credits_main" /> + app:layout_constraintTop_toBottomOf="@id/license_main"/> + app:layout_constraintTop_toBottomOf="@id/repo_main" /> + app:layout_constraintTop_toBottomOf="@id/privacy_main" /> + app:layout_constraintTop_toBottomOf="@id/rate_main" /> + - diff --git a/app/src/main/res/menu/main_menu.xml b/app/src/main/res/menu/main_menu.xml index f60a58893..1706c1a53 100644 --- a/app/src/main/res/menu/main_menu.xml +++ b/app/src/main/res/menu/main_menu.xml @@ -27,10 +27,6 @@ android:id="@+id/action_settings" android:title="@string/settings" app:showAsAction="never"/> - Use another app About - Copyright © 2019–%d Sylvia van Os. - Based on Loyalty Card Keychain\ncopyright © 2016–2020 Branden Archer. - Copylefted libre software, licensed GPLv3+. + Copyright © 2019–%d Sylvia van Os + Based on Loyalty Card Keychain\ncopyright © 2016–2020 Branden Archer + Copylefted libre software, licensed GPLv3+ About %s Version: %s Revision Info: %s @@ -260,7 +260,6 @@ License Source Repository on Github - Privacy Statement and data usage Rate this app on Google Play