From 371d59d4882792f6110478f146cf4505af5cdb64 Mon Sep 17 00:00:00 2001 From: Toni500git Date: Wed, 25 Dec 2024 00:55:55 +0100 Subject: [PATCH] android app: refactor the app (useless rn) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit is useless af, just wanted to make this for wishsing everyone an 🎄 happy and joyful christmas 🎅 hoho --- android/app/src/main/AndroidManifest.xml | 5 +- .../{SettingsActivity.kt => MainActivity.kt} | 22 +----- .../src/main/res/drawable/round_border.xml | 6 ++ .../app/src/main/res/layout/activity_main.xml | 77 +++++++++++++++++++ .../app/src/main/res/layout/customfetch.xml | 2 +- .../src/main/res/layout/settings_activity.xml | 9 --- .../src/main/res/values-night-v31/themes.xml | 2 +- .../app/src/main/res/values-night/themes.xml | 2 +- .../app/src/main/res/values-v31/colors.xml | 5 ++ .../app/src/main/res/values-v31/themes.xml | 2 +- android/app/src/main/res/values/themes.xml | 10 +-- .../app/src/main/res/xml/root_preferences.xml | 35 --------- 12 files changed, 103 insertions(+), 74 deletions(-) rename android/app/src/main/java/org/toni/customfetch_android/{SettingsActivity.kt => MainActivity.kt} (85%) create mode 100644 android/app/src/main/res/drawable/round_border.xml create mode 100644 android/app/src/main/res/layout/activity_main.xml delete mode 100644 android/app/src/main/res/layout/settings_activity.xml create mode 100644 android/app/src/main/res/values-v31/colors.xml delete mode 100644 android/app/src/main/res/xml/root_preferences.xml diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 4320bb8..f89cc68 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -12,7 +12,7 @@ android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" - android:theme="@style/Theme.Settings_testing" + android:theme="@style/Theme.MainActivity" tools:targetApi="31"> - diff --git a/android/app/src/main/java/org/toni/customfetch_android/SettingsActivity.kt b/android/app/src/main/java/org/toni/customfetch_android/MainActivity.kt similarity index 85% rename from android/app/src/main/java/org/toni/customfetch_android/SettingsActivity.kt rename to android/app/src/main/java/org/toni/customfetch_android/MainActivity.kt index 4827cde..437e1c5 100644 --- a/android/app/src/main/java/org/toni/customfetch_android/SettingsActivity.kt +++ b/android/app/src/main/java/org/toni/customfetch_android/MainActivity.kt @@ -10,26 +10,18 @@ import android.util.Log import android.view.View import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity -import androidx.preference.PreferenceFragmentCompat import java.io.File import java.io.FileOutputStream import java.io.IOException import java.nio.file.Files import kotlin.io.path.Path - -class SettingsActivity : AppCompatActivity() { +class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setContentView(R.layout.settings_activity) - if (savedInstanceState == null) { - supportFragmentManager - .beginTransaction() - .replace(R.id.settings, SettingsFragment()) - .commit() - } - supportActionBar?.setDisplayHomeAsUpEnabled(true) + setContentView(R.layout.activity_main) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { if (!Environment.isExternalStorageManager()) { val alert = AlertDialog.Builder(this) @@ -45,7 +37,7 @@ class SettingsActivity : AppCompatActivity() { } .setIcon(R.drawable.icon_alert_yellow) - val view: View = layoutInflater.inflate(R.layout.grant_perm, null, false); + val view: View = layoutInflater.inflate(R.layout.grant_perm, null, false) alert.setView(view) alert.show() } @@ -63,12 +55,6 @@ class SettingsActivity : AppCompatActivity() { .setIcon(android.R.drawable.ic_dialog_info) .show() } - - class SettingsFragment : PreferenceFragmentCompat() { - override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { - setPreferencesFromResource(R.xml.root_preferences, rootKey) - } - } } const val TAG: String = "AssetCopy" diff --git a/android/app/src/main/res/drawable/round_border.xml b/android/app/src/main/res/drawable/round_border.xml new file mode 100644 index 0000000..49d670d --- /dev/null +++ b/android/app/src/main/res/drawable/round_border.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/layout/activity_main.xml b/android/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..98273b0 --- /dev/null +++ b/android/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/res/layout/customfetch.xml b/android/app/src/main/res/layout/customfetch.xml index a5fd060..f350c3a 100644 --- a/android/app/src/main/res/layout/customfetch.xml +++ b/android/app/src/main/res/layout/customfetch.xml @@ -4,7 +4,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/widget_root" - android:theme="@style/Theme.Settings_testing.AppWidgetContainer"> + android:theme="@style/Theme.MainActivity.AppWidgetContainer"> - - - \ No newline at end of file diff --git a/android/app/src/main/res/values-night-v31/themes.xml b/android/app/src/main/res/values-night-v31/themes.xml index 65d0428..eebc67a 100644 --- a/android/app/src/main/res/values-night-v31/themes.xml +++ b/android/app/src/main/res/values-night-v31/themes.xml @@ -3,7 +3,7 @@ - diff --git a/android/app/src/main/res/values-night/themes.xml b/android/app/src/main/res/values-night/themes.xml index b169dc6..e54c2a7 100644 --- a/android/app/src/main/res/values-night/themes.xml +++ b/android/app/src/main/res/values-night/themes.xml @@ -1,6 +1,6 @@ - diff --git a/android/app/src/main/res/values/themes.xml b/android/app/src/main/res/values/themes.xml index b58bb7f..0fddf92 100644 --- a/android/app/src/main/res/values/themes.xml +++ b/android/app/src/main/res/values/themes.xml @@ -1,9 +1,9 @@ - - - diff --git a/android/app/src/main/res/xml/root_preferences.xml b/android/app/src/main/res/xml/root_preferences.xml deleted file mode 100644 index 7124ab7..0000000 --- a/android/app/src/main/res/xml/root_preferences.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - -