diff --git a/app/build.gradle b/app/build.gradle index 67f9887..a92192c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -100,6 +100,7 @@ dependencies { implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5' implementation 'androidx.navigation:navigation-ui-ktx:2.3.5' implementation "dev.kord:kord-core:0.7.0-RC2" + implementation 'io.github.medyo:android-about-page:2.0.0' implementation 'me.ibrahimyilmaz:kiel:1.1.0' implementation 'org.jsoup:jsoup:1.13.1' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3' diff --git a/app/src/main/java/com/cyb3rko/cavedroid/fragments/AboutFragment.kt b/app/src/main/java/com/cyb3rko/cavedroid/fragments/AboutFragment.kt new file mode 100644 index 0000000..12dac82 --- /dev/null +++ b/app/src/main/java/com/cyb3rko/cavedroid/fragments/AboutFragment.kt @@ -0,0 +1,124 @@ +package com.cyb3rko.cavedroid.fragments + +import android.content.Intent +import android.net.Uri +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import androidx.navigation.fragment.findNavController +import com.cyb3rko.cavedroid.BuildConfig +import com.cyb3rko.cavedroid.R +import com.mikepenz.aboutlibraries.LibsBuilder +import mehdi.sakout.aboutpage.AboutPage +import mehdi.sakout.aboutpage.Element + +class AboutFragment : Fragment() { + + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { + + return AboutPage(context) + .setImage(R.mipmap.ic_launcher_foreground) + .setDescription(getString(R.string.about_description)) + .addItem( + Element().setTitle(String.format(getString(R.string.about_element_version), BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE)) + .setIconDrawable(R.drawable.about_icon_github).setOnClickListener(showChangelog()) + ) + .addGroup(getString(R.string.about_group_legal)) + .addItem( + Element().setTitle(getString(R.string.about_element_libraries)).setIconDrawable(R.drawable._ic_libraries) + .setOnClickListener(showLibraries()) + ) + .addItem( + Element().setTitle(getString(R.string.about_element_icons)).setIconDrawable(R.drawable._ic_question).setOnClickListener(showIcons()) + ) + .addItem( + Element().setTitle(getString(R.string.about_element_animations)).setIconDrawable(R.drawable._ic_question) + .setOnClickListener(showAnimations()) + ) + .addGroup(getString(R.string.about_group_connect)) + .addItem( + Element().setTitle(getString(R.string.about_element_feedback_text)).setIconDrawable(R.drawable.about_icon_github) + .setOnClickListener(openGithubFeedback()) + ) + .addItem( + Element().setTitle(getString(R.string.about_element_email_text)).setIconDrawable(R.drawable.about_icon_email) + .setOnClickListener(writeEmail()) + ) +// .addWebsite(getString(R.string.about_element_website_value), getString(R.string.about_element_website_text)) + .addItem( + Element().setTitle(getString(R.string.about_element_youtube_text)).setIconDrawable(R.drawable.about_icon_youtube) + .setIconTint(R.color.about_youtube_color).setOnClickListener(openYouTubeProfile()) + ) + .addItem( + Element().setTitle(getString(R.string.about_element_github_text)) + .setIconDrawable(R.drawable.about_icon_github).setOnClickListener(openGithubProfile()) + ) + .addItem( + Element().setTitle(getString(R.string.about_element_instagram_text)).setIconDrawable(R.drawable.about_icon_instagram) + .setIconTint(R.color.about_instagram_color).setOnClickListener(openInstaPage()) + ) + .create() + } + + private fun openYouTubeProfile(): View.OnClickListener { + return View.OnClickListener { startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://youtube.com/channel/UCue_SZXdF8yZByavetBU1ZQ"))) } + } + + private fun showChangelog(): View.OnClickListener { + return View.OnClickListener { startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.about_changelog_link)))) } + } + + private fun showLibraries(): View.OnClickListener { + return View.OnClickListener { + context?.let { trueContext -> + LibsBuilder() + .withShowLoadingProgress(true) + .withAboutVersionShownCode(false) + .withAboutVersionShownName(false) + .withAutoDetect(true) + .withAboutIconShown(false) + .withAboutVersionShown(false) + .withVersionShown(true) + .withLicenseDialog(true) + .withLicenseShown(true) + .withCheckCachedDetection(true) + .withSortEnabled(true) + .start(trueContext) + } + } + } + + private fun showIcons(): View.OnClickListener { + return View.OnClickListener { findNavController().navigate(R.id.navigation_about_icons) } + } + + private fun showAnimations(): View.OnClickListener { + return View.OnClickListener { findNavController().navigate(R.id.navigation_about_animations) } + } + + private fun openGithubFeedback(): View.OnClickListener { + return View.OnClickListener { startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/cyb3rko/cavedroid/"))) } + } + + private fun openGithubProfile(): View.OnClickListener { + return View.OnClickListener { startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/cyb3rko/"))) } + } + + private fun openInstaPage(): View.OnClickListener { + return View.OnClickListener { startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://instagram.com/_u/cyb3rko"))) } + } + + private fun writeEmail(): View.OnClickListener { + return View.OnClickListener { + val intent = Intent().apply { + this.action = Intent.ACTION_SENDTO + this.type = "text/plain" + this.data = Uri.parse("mailto:") + this.putExtra(Intent.EXTRA_EMAIL, arrayOf("niko@cyb3rko.de")) + } + startActivity(intent) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/cyb3rko/cavedroid/fragments/AnimationCreditsFragment.kt b/app/src/main/java/com/cyb3rko/cavedroid/fragments/AnimationCreditsFragment.kt index a599a82..3cc3556 100644 --- a/app/src/main/java/com/cyb3rko/cavedroid/fragments/AnimationCreditsFragment.kt +++ b/app/src/main/java/com/cyb3rko/cavedroid/fragments/AnimationCreditsFragment.kt @@ -37,7 +37,7 @@ class AnimationCreditsFragment : Fragment() { startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(it.third))) } } - spannableString.setSpan(clickableSpan, 1, 1 + it.first.length, Spanned.SPAN_INCLUSIVE_INCLUSIVE) + spannableString.setSpan(clickableSpan, 0, it.first.length, Spanned.SPAN_INCLUSIVE_INCLUSIVE) textView.text = spannableString textView.movementMethod = LinkMovementMethod.getInstance() linearLayout.addView(textView) diff --git a/app/src/main/java/com/cyb3rko/cavedroid/fragments/HomeFragment.kt b/app/src/main/java/com/cyb3rko/cavedroid/fragments/HomeFragment.kt index 35b78ba..09961db 100644 --- a/app/src/main/java/com/cyb3rko/cavedroid/fragments/HomeFragment.kt +++ b/app/src/main/java/com/cyb3rko/cavedroid/fragments/HomeFragment.kt @@ -304,30 +304,8 @@ class HomeFragment : Fragment() { true } - menu.findItem(R.id.icon_credits).setOnMenuItemClickListener { - findNavController().navigate(R.id.navigation_about_icons) - true - } - - menu.findItem(R.id.library_credits).setOnMenuItemClickListener { - LibsBuilder() - .withShowLoadingProgress(true) - .withAboutVersionShownCode(false) - .withAboutVersionShownName(false) - .withAutoDetect(true) - .withAboutIconShown(false) - .withAboutVersionShown(false) - .withVersionShown(true) - .withLicenseDialog(true) - .withLicenseShown(true) - .withCheckCachedDetection(true) - .withSortEnabled(true) - .start(requireContext()) - true - } - - menu.findItem(R.id.animation_credits).setOnMenuItemClickListener { - findNavController().navigate(R.id.navigation_about_animations) + menu.findItem(R.id.about).setOnMenuItemClickListener { + findNavController().navigate(R.id.navigation_about) true } diff --git a/app/src/main/res/drawable/_ic_libraries.png b/app/src/main/res/drawable/_ic_libraries.png new file mode 100644 index 0000000..8ddfb0f Binary files /dev/null and b/app/src/main/res/drawable/_ic_libraries.png differ diff --git a/app/src/main/res/drawable/_ic_question.png b/app/src/main/res/drawable/_ic_question.png new file mode 100644 index 0000000..9abc87c Binary files /dev/null and b/app/src/main/res/drawable/_ic_question.png differ diff --git a/app/src/main/res/menu/topbar_menu.xml b/app/src/main/res/menu/topbar_menu.xml index ef1eb91..de9d206 100644 --- a/app/src/main/res/menu/topbar_menu.xml +++ b/app/src/main/res/menu/topbar_menu.xml @@ -13,18 +13,6 @@ android:id="@+id/profile_name_dialog" android:title="Change Profile" /> - - - - - - @@ -33,4 +21,8 @@ android:id="@+id/end_user_consent" android:title="End User Consent" /> + + \ No newline at end of file diff --git a/app/src/main/res/navigation/mobile_navigation.xml b/app/src/main/res/navigation/mobile_navigation.xml index 17a8d6d..9f94187 100644 --- a/app/src/main/res/navigation/mobile_navigation.xml +++ b/app/src/main/res/navigation/mobile_navigation.xml @@ -84,6 +84,12 @@ android:label="Preferences"> + + + https://www.flaticon.com/free-icon/history_2277956?term=history + + Freepik + flaticon.com + https://www.flaticon.com/free-icon/books-stack-of-three_29302 + + Freepik flaticon.com @@ -50,6 +56,12 @@ https://www.flaticon.com/free-icon/user_1077114 + + Freepik + flaticon.com + https://www.flaticon.com/free-icon/information_906794 + + Freepik flaticon.com diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index defedfd..263bb70 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -134,4 +134,21 @@ Revoke Deletion done + + About + Version %1$s (%2$d) — Changelog + The Unofficial Mobile Client for the Cavetale Server + https://github.com/cyb3rko/cavedroid/releases + Legal + Used Libraries + Used Icons + Used Animations + Connect with me + Visit and give feedback on GitHub + Contact me + + + Watch my tutorial videos (in German) + Take a look at my other projects + Follow me \ No newline at end of file