diff --git a/app/build.gradle b/app/build.gradle index 4c65cee..5988d60 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,6 +1,7 @@ plugins { id 'com.android.application' id 'org.jetbrains.kotlin.android' + id 'com.mikepenz.aboutlibraries.plugin' version '10.10.0' } android { @@ -50,5 +51,6 @@ dependencies { androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' implementation 'com.caverock:androidsvg-aar:1.4' + implementation "com.mikepenz:aboutlibraries:10.10.0" } \ No newline at end of file diff --git a/app/src/main/java/net/helcel/beendroid/activity/AboutFragment.kt b/app/src/main/java/net/helcel/beendroid/activity/AboutFragment.kt new file mode 100644 index 0000000..1f9bffd --- /dev/null +++ b/app/src/main/java/net/helcel/beendroid/activity/AboutFragment.kt @@ -0,0 +1,32 @@ +package net.helcel.beendroid.activity + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import net.helcel.beendroid.R +import net.helcel.beendroid.databinding.FragmentAboutBinding + +class AboutFragment: Fragment() { + private var _binding: FragmentAboutBinding? = null + + // This property is only valid between onCreateView and + // onDestroyView. + private val binding get() = _binding!! + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + _binding = FragmentAboutBinding.inflate(inflater, container, false) + + return binding.root + } + + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } +} \ No newline at end of file diff --git a/app/src/main/java/net/helcel/beendroid/activity/FoldingListAdapter.kt b/app/src/main/java/net/helcel/beendroid/activity/FoldingListAdapter.kt index a1e0b6c..44581de 100644 --- a/app/src/main/java/net/helcel/beendroid/activity/FoldingListAdapter.kt +++ b/app/src/main/java/net/helcel/beendroid/activity/FoldingListAdapter.kt @@ -92,7 +92,7 @@ class FoldingListAdapter( textView.setTypeface(null, Typeface.BOLD) val colorGrayTyped = TypedValue() - ctx.theme.resolveAttribute(android.R.attr.textColorTertiary, colorGrayTyped, true) + ctx.theme.resolveAttribute(android.R.attr.panelColorBackground, colorGrayTyped, true) val color = Color.valueOf(colorGrayTyped.data) textView.setBackgroundColor(Color.valueOf(color.red(), color.green(), color.blue(), 0.5f).toArgb()) checkBox.visibility = View.INVISIBLE diff --git a/app/src/main/java/net/helcel/beendroid/activity/LicenseFragment.kt b/app/src/main/java/net/helcel/beendroid/activity/LicenseFragment.kt new file mode 100644 index 0000000..b1ad05f --- /dev/null +++ b/app/src/main/java/net/helcel/beendroid/activity/LicenseFragment.kt @@ -0,0 +1,45 @@ +package net.helcel.beendroid.activity + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.MenuItem +import android.view.View +import android.view.ViewGroup +import androidx.appcompat.app.ActionBar +import androidx.appcompat.widget.Toolbar +import androidx.fragment.app.Fragment +import com.mikepenz.aboutlibraries.Libs +import net.helcel.beendroid.R +import net.helcel.beendroid.databinding.FragmentLicenseBinding +import com.mikepenz.aboutlibraries.LibsBuilder + +class LicenseFragment: Fragment() { + private var _binding: FragmentLicenseBinding? = null + + // This property is only valid between onCreateView and + // onDestroyView. + private val binding get() = _binding!! + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + _binding = FragmentLicenseBinding.inflate(inflater, container, false) + + val librariesFragment = LibsBuilder() + .withLicenseShown(true) + .supportFragment() + + requireActivity().supportFragmentManager.beginTransaction() + .replace(R.id.license_fragment_view, librariesFragment) + .commit() + + return binding.root + } + + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } +} \ No newline at end of file diff --git a/app/src/main/java/net/helcel/beendroid/activity/SettingsActivity.kt b/app/src/main/java/net/helcel/beendroid/activity/SettingsActivity.kt index 168899b..693f6ab 100644 --- a/app/src/main/java/net/helcel/beendroid/activity/SettingsActivity.kt +++ b/app/src/main/java/net/helcel/beendroid/activity/SettingsActivity.kt @@ -8,6 +8,7 @@ import android.util.TypedValue import android.view.MenuItem import androidx.activity.addCallback import androidx.appcompat.app.AppCompatActivity +import androidx.navigation.findNavController import net.helcel.beendroid.R class SettingsActivity: AppCompatActivity() { @@ -27,13 +28,39 @@ class SettingsActivity: AppCompatActivity() { // Populate activity with settings fragment supportFragmentManager.beginTransaction() - .replace(R.id.fragment_view, SettingsFragment()) + .replace(R.id.fragment_view, SettingsFragment(), getString(R.string.action_settings)) .commit() + + // Change title in action bar according to current fragment + supportFragmentManager.addFragmentOnAttachListener { _, _ -> + supportActionBar?.title = supportFragmentManager.findFragmentById(R.id.fragment_view).let { + when (it) { + is LicenseFragment -> getString(R.string.licenses) + is AboutFragment -> getString(R.string.about) + else -> getString(R.string.action_settings) + } + } + } } override fun onOptionsItemSelected(item: MenuItem): Boolean { // Configure on back pressed - finish() + supportFragmentManager.findFragmentById(R.id.fragment_view).let { + when (it) { + is LicenseFragment, is AboutFragment -> { + supportFragmentManager.beginTransaction() + .remove(it) + .commit() + supportFragmentManager.beginTransaction() + .replace(R.id.fragment_view, SettingsFragment(), getString(R.string.action_settings)) + .commit() + supportActionBar?.title = getString(R.string.action_settings) + } + else -> { + finish() + } + } + } return super.onOptionsItemSelected(item) } } \ No newline at end of file diff --git a/app/src/main/java/net/helcel/beendroid/activity/SettingsFragment.kt b/app/src/main/java/net/helcel/beendroid/activity/SettingsFragment.kt index ba3c155..7746282 100644 --- a/app/src/main/java/net/helcel/beendroid/activity/SettingsFragment.kt +++ b/app/src/main/java/net/helcel/beendroid/activity/SettingsFragment.kt @@ -6,6 +6,7 @@ import android.os.Bundle import android.util.TypedValue import androidx.appcompat.app.AppCompatDelegate import androidx.preference.ListPreference +import androidx.preference.Preference import androidx.preference.PreferenceFragmentCompat import net.helcel.beendroid.R @@ -22,6 +23,23 @@ class SettingsFragment: PreferenceFragmentCompat() { setTheme(requireContext(), key as String) } + val aboutPreference = findPreference(getString(R.string.about)) + aboutPreference?.setOnPreferenceClickListener { + requireActivity().supportFragmentManager.beginTransaction() + .replace(R.id.fragment_view, AboutFragment(), getString(R.string.about)) + .commit() + + true + } + + val licensesPreference = findPreference(getString(R.string.licenses)) + licensesPreference?.setOnPreferenceClickListener { + requireActivity().supportFragmentManager.beginTransaction() + .replace(R.id.fragment_view, LicenseFragment(), getString(R.string.licenses)) + .commit() + true + } + } companion object { diff --git a/app/src/main/java/net/helcel/beendroid/svg/PSVGWrapper.kt b/app/src/main/java/net/helcel/beendroid/svg/PSVGWrapper.kt index 0afbdcd..8471add 100644 --- a/app/src/main/java/net/helcel/beendroid/svg/PSVGWrapper.kt +++ b/app/src/main/java/net/helcel/beendroid/svg/PSVGWrapper.kt @@ -21,7 +21,7 @@ class PSVGWrapper(ctx: Context) { init { val colorSecondaryTyped = TypedValue() - ctx.theme.resolveAttribute(android.R.attr.textColorTertiary, colorSecondaryTyped, true) + ctx.theme.resolveAttribute(android.R.attr.panelColorBackground, colorSecondaryTyped, true) colorForeground = "\"#${Integer.toHexString(colorSecondaryTyped.data).subSequence(2, 8)}\"" val colorBackgroundTyped = TypedValue() diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml index 2b068d1..c92c40d 100644 --- a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -1,30 +1,14 @@ - - - - - - - - + android:width="12dp" + android:height="12dp" + android:viewportWidth="1600" + android:viewportHeight="1600" > + \ No newline at end of file diff --git a/app/src/main/res/drawable/checklist.xml b/app/src/main/res/drawable/checklist.xml new file mode 100644 index 0000000..1ecc582 --- /dev/null +++ b/app/src/main/res/drawable/checklist.xml @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml index 07d5da9..01d1b63 100644 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -2,169 +2,9 @@ + android:viewportWidth="960" + android:viewportHeight="960"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:fillColor="#FF0187FF" + android:pathData="M0,0h960v960h-960z" /> diff --git a/app/src/main/res/drawable/info.xml b/app/src/main/res/drawable/info.xml new file mode 100644 index 0000000..9cd6750 --- /dev/null +++ b/app/src/main/res/drawable/info.xml @@ -0,0 +1,13 @@ + + + + + diff --git a/app/src/main/res/drawable/palette.xml b/app/src/main/res/drawable/palette.xml index e9875e0..7585f6d 100644 --- a/app/src/main/res/drawable/palette.xml +++ b/app/src/main/res/drawable/palette.xml @@ -6,6 +6,9 @@ xmlns:android="http://schemas.android.com/apk/res/android" > + diff --git a/app/src/main/res/layout/fragment_about.xml b/app/src/main/res/layout/fragment_about.xml new file mode 100644 index 0000000..6ca9d0e --- /dev/null +++ b/app/src/main/res/layout/fragment_about.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_license.xml b/app/src/main/res/layout/fragment_license.xml new file mode 100644 index 0000000..0df3bbf --- /dev/null +++ b/app/src/main/res/layout/fragment_license.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml index c963af1..4ea58db 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -2,7 +2,7 @@ diff --git a/app/src/main/res/values/en.xml b/app/src/main/res/values/en.xml index e75bafd..e82a8ab 100644 --- a/app/src/main/res/values/en.xml +++ b/app/src/main/res/values/en.xml @@ -1,12 +1,19 @@ BeenDroid + 1.0 Settings Edit Welcome! Change language App theme - Same as system - Light theme - Dark theme + System + Light + Dark + Licenses + About + BeenDroid is free and open source software, licensed under the GNU General Public License (version 3 or later) + Project repository: https://git.helcel.net/helcel/beendroid\n Feel free to report issues or contribute to the project. + Free and open source dependencies and licenses + About the BeenDroid application \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index cfa9139..db354af 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -2,7 +2,7 @@ diff --git a/app/src/main/res/xml/fragment_settings.xml b/app/src/main/res/xml/fragment_settings.xml index 82d5a5c..2f6b780 100644 --- a/app/src/main/res/xml/fragment_settings.xml +++ b/app/src/main/res/xml/fragment_settings.xml @@ -13,5 +13,19 @@ app:entryValues="@array/entries_theme" app:defaultValue="@string/system" /> + + + + \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 34c822e..9377a07 100644 --- a/settings.gradle +++ b/settings.gradle @@ -14,5 +14,5 @@ dependencyResolutionManagement { maven { url 'https://jitpack.io' } } } -rootProject.name = "beendroid" +rootProject.name = "BeenDroid" include ':app'