Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

Commit

Permalink
Add About page
Browse files Browse the repository at this point in the history
  • Loading branch information
cyb3rko committed Jun 9, 2021
1 parent e9acba5 commit 8572692
Show file tree
Hide file tree
Showing 10 changed files with 167 additions and 37 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
124 changes: 124 additions & 0 deletions app/src/main/java/com/cyb3rko/cavedroid/fragments/AboutFragment.kt
Original file line number Diff line number Diff line change
@@ -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)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
26 changes: 2 additions & 24 deletions app/src/main/java/com/cyb3rko/cavedroid/fragments/HomeFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Binary file added app/src/main/res/drawable/_ic_libraries.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/_ic_question.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 4 additions & 12 deletions app/src/main/res/menu/topbar_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,6 @@
android:id="@+id/profile_name_dialog"
android:title="Change Profile" />

<item
android:id="@+id/icon_credits"
android:title="Icon Credits" />

<item
android:id="@+id/library_credits"
android:title="Library Credits" />

<item
android:id="@+id/animation_credits"
android:title="Animation Credits" />

<item
android:id="@+id/feedback"
android:title="Feedback / Bug Report" />
Expand All @@ -33,4 +21,8 @@
android:id="@+id/end_user_consent"
android:title="End User Consent" />

<item
android:id="@+id/about"
android:title="About" />

</menu>
6 changes: 6 additions & 0 deletions app/src/main/res/navigation/mobile_navigation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
android:label="Preferences">
</fragment>

<fragment
android:id="@+id/navigation_about"
android:name="com.cyb3rko.cavedroid.fragments.AboutFragment"
android:label="About">
</fragment>

<fragment
android:id="@+id/navigation_about_icons"
android:name="com.cyb3rko.cavedroid.fragments.AboutIconsFragment"
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/res/values/about_icons.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
<item>https://www.flaticon.com/free-icon/history_2277956?term=history</item>
</string-array>

<string-array name="ic_libraries">
<item>Freepik</item>
<item>flaticon.com</item>
<item>https://www.flaticon.com/free-icon/books-stack-of-three_29302</item>
</string-array>

<string-array name="ic_offers">
<item>Freepik</item>
<item>flaticon.com</item>
Expand All @@ -50,6 +56,12 @@
<item>https://www.flaticon.com/free-icon/user_1077114</item>
</string-array>

<string-array name="ic_question">
<item>Freepik</item>
<item>flaticon.com</item>
<item>https://www.flaticon.com/free-icon/information_906794</item>
</string-array>

<string-array name="ic_ranking">
<item>Freepik</item>
<item>flaticon.com</item>
Expand Down
17 changes: 17 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,21 @@
<string name="end_user_consent_2_button_2">Revoke</string>

<string name="preferences_deletion_done">Deletion done</string>

<string name="about">About</string>
<string name="about_element_version">Version %1$s (%2$d) — Changelog</string>
<string name="about_description">The Unofficial Mobile Client for the Cavetale Server</string>
<string name="about_changelog_link" translatable="false">https://github.com/cyb3rko/cavedroid/releases</string>
<string name="about_group_legal">Legal</string>
<string name="about_element_libraries">Used Libraries</string>
<string name="about_element_icons">Used Icons</string>
<string name="about_element_animations">Used Animations</string>
<string name="about_group_connect">Connect with me</string>
<string name="about_element_feedback_text">Visit and give feedback on GitHub</string>
<string name="about_element_email_text">Contact me</string>
<!-- <string name="about_element_website_value" translatable="false">https://cyb3rko.de</string>-->
<!-- <string name="about_element_website_text">Visit my website</string>-->
<string name="about_element_youtube_text">Watch my tutorial videos (in German)</string>
<string name="about_element_github_text">Take a look at my other projects</string>
<string name="about_element_instagram_text">Follow me</string>
</resources>

0 comments on commit 8572692

Please sign in to comment.