From 5f5db9c5262d6db3d394a27897a52e0843cd7943 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 12 Jul 2026 09:29:22 +0000 Subject: [PATCH] Add an "About the app" item to the main overflow menu A Material dialog with the app icon, name, and version (surfaces the version in-app, related to #113), a brief description of what the app does, developer credit, the free-and-open-source / Apache 2.0 license line, and a short note that battery figures are device-provided estimates and the app ships as-is without warranty. A neutral button opens the project's GitHub page. New strings translated in values-ar. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_013sJMWbdZpssHRUSbY9ANTC --- .../ui/MainActivity.java | 37 +++++++++ app/src/main/res/layout/dialog_about.xml | 79 +++++++++++++++++++ app/src/main/res/menu/menu_main.xml | 5 ++ app/src/main/res/values-ar/strings.xml | 11 +++ app/src/main/res/values/strings.xml | 12 +++ 5 files changed, 144 insertions(+) create mode 100644 app/src/main/res/layout/dialog_about.xml diff --git a/app/src/main/java/com/almothafar/simplebatterynotifier/ui/MainActivity.java b/app/src/main/java/com/almothafar/simplebatterynotifier/ui/MainActivity.java index 5f4098b..13465b0 100644 --- a/app/src/main/java/com/almothafar/simplebatterynotifier/ui/MainActivity.java +++ b/app/src/main/java/com/almothafar/simplebatterynotifier/ui/MainActivity.java @@ -15,6 +15,7 @@ import android.util.Log; import android.view.Menu; import android.view.MenuItem; +import android.view.View; import android.widget.TextView; import android.widget.Toast; import com.almothafar.simplebatterynotifier.ui.fragment.BatteryDetailsFragment; @@ -103,6 +104,10 @@ public boolean onOptionsItemSelected(final MenuItem item) { showFeedbackChooser(); return true; } + if (id == R.id.action_about) { + showAboutDialog(); + return true; + } return super.onOptionsItemSelected(item); } @@ -458,6 +463,38 @@ private void openBatteryInsights() { startActivity(intent); } + /** + * Show the "About the app" dialog: what the app is, the current version, developer credit, + * the open-source license, and a short accuracy/warranty note. + */ + private void showAboutDialog() { + final View content = getLayoutInflater().inflate(R.layout.dialog_about, null); + + final TextView versionView = content.findViewById(R.id.aboutVersion); + versionView.setText(getString(R.string.about_version, appVersionName())); + + final TextView developerView = content.findViewById(R.id.aboutDeveloper); + developerView.setText(getString(R.string.about_developer, getString(R.string.developer_name))); + + new MaterialAlertDialogBuilder(this) + .setView(content) + .setPositiveButton(android.R.string.ok, null) + .setNeutralButton(R.string.about_view_github, (dialog, which) -> openProjectPage()) + .show(); + } + + /** + * Open the project's GitHub page in a browser. + */ + private void openProjectPage() { + final Uri uri = Uri.parse(getString(R.string.about_github_url)); + try { + startActivity(new Intent(Intent.ACTION_VIEW, uri)); + } catch (ActivityNotFoundException e) { + Toast.makeText(this, R.string.no_browser_found, Toast.LENGTH_SHORT).show(); + } + } + /** * Show the feedback chooser: report on GitHub, or email the developer. */ diff --git a/app/src/main/res/layout/dialog_about.xml b/app/src/main/res/layout/dialog_about.xml new file mode 100644 index 0000000..436e8ea --- /dev/null +++ b/app/src/main/res/layout/dialog_about.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index ead2393..9392e35 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -13,4 +13,9 @@ android:orderInCategory="200" android:title="@string/action_send_feedback" app:showAsAction="never" /> + diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 165c1dd..7555a55 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -238,6 +238,17 @@ ملاحظات حول تطبيق منبّه البطارية البسيط (v%1$s) لا يوجد تطبيق بريد + + حول التطبيق + + الإصدار %1$s + تطبيق خفيف يُبقيك على اطّلاع على حالة بطاريتك — تنبيهات عند المستويين التحذيري والحرج، وإشعارات اكتمال الشحن وارتفاع الحرارة، وسرعة الشحن، ومعلومات عن صحة البطارية. بلا حشو ولا حيل «توفير طاقة» — مجرّد تنبيهات بطارية بسيطة. + + طوّره %1$s + برنامج حر ومفتوح المصدر، مرخَّص بموجب رخصة Apache 2.0. + قراءات البطارية وأرقام الصحة والشحن مصدرها جهازك وهي تقديرية — اعتبرها إرشادية لا قياسات دقيقة. يُقدَّم هذا التطبيق «كما هو» دون أي ضمان من أي نوع. + عرض على GitHub + اللغة لغة التطبيق diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0f325b8..c9fe05a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -248,6 +248,18 @@ Simple Battery Notifier feedback (v%1$s) No email app found + + About the app + + Version %1$s + A lightweight app that keeps you informed about your battery — alerts at warning and critical levels, full-charge and high-temperature notifications, charging speed, and battery health insights. No bloat, no “power saver” gimmicks — just simple battery notifications. + + Developed by %1$s + Free and open-source software, licensed under the Apache License 2.0. + Battery readings, health and charging figures come from your device and are estimates — treat them as guidance, not exact measurements. This app is provided “as is”, without warranty of any kind. + View on GitHub + https://github.com/almothafar/SimpleBatteryNotifier + Language App language