summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByteHamster <ByteHamster@users.noreply.github.com>2024-03-29 13:39:45 +0100
committerGitHub <noreply@github.com>2024-03-29 13:39:45 +0100
commit0c8c9a89a371d6515c34d1c4f7417c26059ee969 (patch)
treebe7b961ba1cbf0e3e688a0e9f1e8f2ce7808bcd1
parentf9dd837362921df3fbcea424f9e064ecc696f367 (diff)
downloadAntennaPod-0c8c9a89a371d6515c34d1c4f7417c26059ee969.zip
Move about screen to :ui:preferences (#7039)
-rw-r--r--app/build.gradle12
-rw-r--r--app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java3
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/preferences/MainPreferencesFragment.java2
-rw-r--r--ui/preferences/build.gradle15
-rw-r--r--ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/about/AboutFragment.java (renamed from app/src/main/java/de/danoeh/antennapod/fragment/preferences/about/AboutFragment.java)28
-rw-r--r--ui/preferences/src/main/res/layout/settings_activity.xml (renamed from app/src/main/res/layout/settings_activity.xml)3
6 files changed, 40 insertions, 23 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 02031b9e1..1f813d092 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -15,18 +15,6 @@ android {
versionCode 3030095
versionName "3.3.0"
- def commit = ""
- try {
- def hashStdOut = new ByteArrayOutputStream()
- exec {
- commandLine "git", "rev-parse", "--short", "HEAD"
- standardOutput = hashStdOut
- }
- commit = hashStdOut.toString().trim()
- } catch (Exception ignore) {
- }
- buildConfigField "String", "COMMIT_HASH", ('"' + (commit.isEmpty() ? "Unknown commit" : commit) + '"')
-
javaCompileOptions {
annotationProcessorOptions {
arguments = [eventBusIndex: 'de.danoeh.antennapod.ApEventBusIndex']
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java
index 8d6ac965f..aa3b05715 100644
--- a/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java
@@ -21,7 +21,7 @@ import com.bytehamster.lib.preferencesearch.SearchPreferenceResultListener;
import com.google.android.material.snackbar.Snackbar;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.ui.common.ThemeSwitcher;
-import de.danoeh.antennapod.databinding.SettingsActivityBinding;
+
import de.danoeh.antennapod.event.MessageEvent;
import de.danoeh.antennapod.fragment.preferences.ImportExportPreferencesFragment;
import de.danoeh.antennapod.fragment.preferences.MainPreferencesFragment;
@@ -32,6 +32,7 @@ import de.danoeh.antennapod.fragment.preferences.UserInterfacePreferencesFragmen
import de.danoeh.antennapod.ui.preferences.screen.AutoDownloadPreferencesFragment;
import de.danoeh.antennapod.ui.preferences.screen.NotificationPreferencesFragment;
import de.danoeh.antennapod.ui.preferences.screen.synchronization.SynchronizationPreferencesFragment;
+import de.danoeh.antennapod.ui.preferences.databinding.SettingsActivityBinding;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/MainPreferencesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/MainPreferencesFragment.java
index bf30700bf..50d201f39 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/MainPreferencesFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/MainPreferencesFragment.java
@@ -16,7 +16,7 @@ import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.BugReportActivity;
import de.danoeh.antennapod.activity.PreferenceActivity;
import de.danoeh.antennapod.core.util.IntentUtils;
-import de.danoeh.antennapod.fragment.preferences.about.AboutFragment;
+import de.danoeh.antennapod.ui.preferences.screen.about.AboutFragment;
public class MainPreferencesFragment extends PreferenceFragmentCompat {
diff --git a/ui/preferences/build.gradle b/ui/preferences/build.gradle
index b91158fb9..c1f56854f 100644
--- a/ui/preferences/build.gradle
+++ b/ui/preferences/build.gradle
@@ -6,6 +6,20 @@ apply from: "../../playFlavor.gradle"
android {
namespace "de.danoeh.antennapod.ui.preferences"
+
+ defaultConfig {
+ def commit = ""
+ try {
+ def hashStdOut = new ByteArrayOutputStream()
+ exec {
+ commandLine "git", "rev-parse", "--short", "HEAD"
+ standardOutput = hashStdOut
+ }
+ commit = hashStdOut.toString().trim()
+ } catch (Exception ignore) {
+ }
+ buildConfigField "String", "COMMIT_HASH", ('"' + (commit.isEmpty() ? "Unknown commit" : commit) + '"')
+ }
}
dependencies {
@@ -23,6 +37,7 @@ dependencies {
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
implementation "androidx.appcompat:appcompat:$appcompatVersion"
+ implementation "androidx.fragment:fragment:$fragmentVersion"
implementation "com.google.android.material:material:$googleMaterialVersion"
implementation "androidx.preference:preference:$preferenceVersion"
implementation "androidx.work:work-runtime:$workManagerVersion"
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/about/AboutFragment.java b/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/about/AboutFragment.java
index 0b17da3e6..ad956ed71 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/about/AboutFragment.java
+++ b/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/about/AboutFragment.java
@@ -1,18 +1,18 @@
-package de.danoeh.antennapod.fragment.preferences.about;
+package de.danoeh.antennapod.ui.preferences.screen.about;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
+import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.PreferenceFragmentCompat;
import com.google.android.material.snackbar.Snackbar;
-import de.danoeh.antennapod.BuildConfig;
-import de.danoeh.antennapod.R;
-import de.danoeh.antennapod.activity.PreferenceActivity;
import de.danoeh.antennapod.core.util.IntentUtils;
-import de.danoeh.antennapod.ui.preferences.screen.about.ContributorsPagerFragment;
-import de.danoeh.antennapod.ui.preferences.screen.about.LicensesFragment;
+import de.danoeh.antennapod.ui.preferences.BuildConfig;
+import de.danoeh.antennapod.ui.preferences.R;
public class AboutFragment extends PreferenceFragmentCompat {
@@ -20,8 +20,20 @@ public class AboutFragment extends PreferenceFragmentCompat {
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.preferences_about);
+ String versionName = "?";
+ try {
+ PackageInfo packageInfo = getContext().getPackageManager().getPackageInfo(getContext().getPackageName(), 0);
+ versionName = packageInfo.versionName;
+ } catch (PackageManager.NameNotFoundException e) {
+ e.printStackTrace();
+ }
+ //noinspection ConstantValue
+ if ("free".equals(BuildConfig.FLAVOR)) {
+ versionName += "f";
+ }
+
findPreference("about_version").setSummary(String.format(
- "%s (%s)", BuildConfig.VERSION_NAME, BuildConfig.COMMIT_HASH));
+ "%s (%s)", versionName, BuildConfig.COMMIT_HASH));
findPreference("about_version").setOnPreferenceClickListener((preference) -> {
ClipboardManager clipboard = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText(getString(R.string.bug_report_title),
@@ -53,6 +65,6 @@ public class AboutFragment extends PreferenceFragmentCompat {
@Override
public void onStart() {
super.onStart();
- ((PreferenceActivity) getActivity()).getSupportActionBar().setTitle(R.string.about_pref);
+ ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(R.string.about_pref);
}
}
diff --git a/app/src/main/res/layout/settings_activity.xml b/ui/preferences/src/main/res/layout/settings_activity.xml
index 91fe40373..58aeb7f60 100644
--- a/app/src/main/res/layout/settings_activity.xml
+++ b/ui/preferences/src/main/res/layout/settings_activity.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<androidx.fragment.app.FragmentContainerView xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.fragment.app.FragmentContainerView
+ xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/settingsContainer"
android:layout_width="match_parent"
android:layout_height="match_parent" />