Skip to content

Commit

Permalink
Clean up about screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Domi04151309 committed Dec 26, 2023
1 parent e9f5e76 commit 60ba9b2
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 161 deletions.
1 change: 0 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,4 @@ dependencies {
implementation("com.google.android.material:material:1.11.0")
implementation("androidx.preference:preference-ktx:1.2.1")
implementation("androidx.annotation:annotation:1.7.1")
implementation("com.android.volley:volley:1.2.1")
}
5 changes: 0 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@
android:label="@string/about"
android:launchMode="singleTop"
android:parentActivityName=".activities.SettingsActivity" />
<activity
android:name=".activities.ContributorActivity"
android:label="@string/about_contributors"
android:launchMode="singleTop"
android:parentActivityName=".activities.AboutActivity" />
<activity
android:name=".activities.LibraryActivity"
android:label="@string/about_libraries"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import io.github.domi04151309.powerapp.R

class AboutActivity : BaseActivity() {
companion object {
internal const val GITHUB_REPOSITORY: String = "Domi04151309/PowerApp"
private const val REPOSITORY_URL: String = "https://github.com/$GITHUB_REPOSITORY"
private const val REPOSITORY: String = "Domi04151309/PowerApp"
private const val BRANCH: String = "master"
private const val REPOSITORY_URL: String = "https://github.com/$REPOSITORY"
}

override fun onCreate(savedInstanceState: Bundle?) {
Expand Down Expand Up @@ -48,12 +49,17 @@ class AboutActivity : BaseActivity() {
}

@Suppress("SameReturnValue")
private fun onContributorsClicked(): Boolean {
private fun onExternalClicked(link: String): Boolean {
MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.about_privacy)
.setMessage(R.string.about_privacy_desc)
.setPositiveButton(android.R.string.ok) { _, _ ->
startActivity(Intent(requireContext(), ContributorActivity::class.java))
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse(link),
),
)
}
.setNegativeButton(android.R.string.cancel) { _, _ -> }
.setNeutralButton(R.string.about_privacy_policy) { _, _ ->
Expand Down Expand Up @@ -83,36 +89,23 @@ class AboutActivity : BaseActivity() {
BuildConfig.VERSION_CODE,
)
setOnPreferenceClickListener {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse("$REPOSITORY_URL/releases"),
),
)
true
onExternalClicked("$REPOSITORY_URL/releases")
}
}
findPreference<Preference>("github")?.apply {
summary = REPOSITORY_URL
setOnPreferenceClickListener {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(REPOSITORY_URL)))
true
onExternalClicked(REPOSITORY_URL)
}
}
findPreference<Preference>("license")?.setOnPreferenceClickListener {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse("$REPOSITORY_URL/blob/master/LICENSE"),
),
)
true
onExternalClicked("$REPOSITORY_URL/blob/$BRANCH/LICENSE")
}
findPreference<Preference>("icons")?.setOnPreferenceClickListener {
onIconsClicked()
}
findPreference<Preference>("contributors")?.setOnPreferenceClickListener {
onContributorsClicked()
onExternalClicked("$REPOSITORY_URL/graphs/contributors")
}
findPreference<Preference>("libraries")?.setOnPreferenceClickListener {
startActivity(Intent(requireContext(), LibraryActivity::class.java))
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ class LibraryActivity : BaseActivity() {
) {
addPreferencesFromResource(R.xml.pref_about_list)
preferenceScreen.removeAll()
resources.getStringArray(R.array.about_libraries).forEach {
val libraries = resources.getStringArray(R.array.about_libraries)
val licenses = resources.getStringArray(R.array.about_libraries_licenses)
if (libraries.size != licenses.size) error("Library array size does not match license array size.")
for (index in libraries.indices) {
preferenceScreen.addPreference(
Preference(requireContext()).apply {
icon =
Expand All @@ -32,7 +35,8 @@ class LibraryActivity : BaseActivity() {
R.drawable.ic_about_library,
requireContext().theme,
)
title = it
title = libraries[index]
summary = licenses[index]
},
)
}
Expand Down
7 changes: 0 additions & 7 deletions app/src/main/res/values-de/plurals.xml

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<string name="about_summary">Über die App</string>
<string name="about_app_version">App-Version</string>
<string name="about_privacy">Externe Inhalte</string>
<string name="about_privacy_desc">Mitwirkende werden von GitHub geladen. Lesen Sie deren Datenschutzrichtlinie für weitere Informationen.</string>
<string name="about_privacy_desc">Externe Inhalte werden von GitHub geladen. Lesen Sie deren Datenschutzrichtlinie für weitere Informationen.</string>
<string name="about_privacy_policy">Datenschutz-Bestimmungen</string>
<string name="about_contributors">Mitwirkende</string>
<string name="about_contributors_desc">Eine Liste der Mitwirkenden</string>
Expand Down
7 changes: 0 additions & 7 deletions app/src/main/res/values/plurals.xml

This file was deleted.

14 changes: 10 additions & 4 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<string name="about_app_version">App version</string>
<string name="about_app_version_desc" translatable="false">%1$s (%2$d)</string>
<string name="about_privacy">External Content</string>
<string name="about_privacy_desc">Contributors are loaded from GitHub. Read their privacy policy for further information.</string>
<string name="about_privacy_desc">External content will be loaded from GitHub. Read their privacy policy for further information.</string>
<string name="about_privacy_policy">Privacy Policy</string>
<string name="about_contributors">Contributors</string>
<string name="about_contributors_desc">A list of the contributors</string>
Expand All @@ -44,10 +44,16 @@
<string name="about_libraries_desc">A list of all used libraries</string>

<string-array name="about_libraries" translatable="false">
<item>Android AppCompat Library</item>
<item>Android Preferences KTX</item>
<item>Android Support Library Annotations</item>
<item>Volley</item>
<item>Annotation</item>
<item>AppCompat</item>
<item>Material Components For Android</item>
</string-array>
<string-array name="about_libraries_licenses" translatable="false">
<item>Apache 2.0</item>
<item>Apache 2.0</item>
<item>Apache 2.0</item>
<item>Apache 2.0</item>
</string-array>

<string-array name="about_icons_array" translatable="false">
Expand Down

0 comments on commit 60ba9b2

Please sign in to comment.