Redesign About dialog

This commit is contained in:
Torsten Grote 2023-03-06 14:40:24 -03:00 committed by Chirayu Desai
parent 0e147786b4
commit 9ae32a9bac
4 changed files with 154 additions and 158 deletions

View file

@ -6,21 +6,15 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
import com.stevesoltys.seedvault.R
import com.stevesoltys.seedvault.transport.backup.PackageService
import org.koin.android.ext.android.inject
class AboutDialogFragment : DialogFragment() {
class AboutDialogFragment : Fragment() {
private val packageService: PackageService by inject()
private lateinit var versionView: TextView
private lateinit var licenseView: TextView
private lateinit var authorView: TextView
private lateinit var designView: TextView
private lateinit var sponsorView: TextView
companion object {
internal val TAG = AboutDialogFragment::class.java.simpleName
}
@ -32,24 +26,22 @@ class AboutDialogFragment : DialogFragment() {
): View {
val v: View = inflater.inflate(R.layout.fragment_about, container, false)
versionView = v.findViewById(R.id.versionView)
licenseView = v.findViewById(R.id.licenseView)
authorView = v.findViewById(R.id.authorView)
designView = v.findViewById(R.id.designView)
sponsorView = v.findViewById(R.id.sponsorView)
val versionName = packageService.getVersionName(requireContext().packageName) ?: "???"
val versionView: TextView = v.findViewById(R.id.versionView)
versionView.text = getString(R.string.about_version, versionName)
val linkMovementMethod = LinkMovementMethod.getInstance()
val contributorsView = v.findViewById<TextView>(R.id.contributorView)
val orgsView = v.findViewById<TextView>(R.id.about_contributing_organizations_content)
contributorsView.movementMethod = linkMovementMethod
orgsView.movementMethod = linkMovementMethod
return v
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
val linkMovementMethod = LinkMovementMethod.getInstance()
licenseView.movementMethod = linkMovementMethod
authorView.movementMethod = linkMovementMethod
designView.movementMethod = linkMovementMethod
sponsorView.movementMethod = linkMovementMethod
override fun onStart() {
super.onStart()
activity?.setTitle(R.string.about_title)
}
}

View file

@ -192,7 +192,10 @@ class SettingsFragment : PreferenceFragmentCompat() {
true
}
R.id.action_about -> {
AboutDialogFragment().show(parentFragmentManager, AboutDialogFragment.TAG)
parentFragmentManager.beginTransaction()
.replace(R.id.fragment, AboutDialogFragment())
.addToBackStack(AboutDialogFragment.TAG)
.commit()
true
}
else -> super.onOptionsItemSelected(item)

View file

@ -1,147 +1,149 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/logoView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/ic_launcher"
tools:ignore="ContentDescription" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/appNameView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:text="@string/app_name"
android:textColor="?android:textColorPrimary"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/backupNameView"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/logoView" />
<ImageView
android:id="@+id/logoView"
android:layout_width="128dp"
android:layout_height="128dp"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/ic_launcher"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/backupNameView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:text="@string/backup"
android:textColor="?android:textColorPrimary"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/appNameView"
app:layout_constraintTop_toBottomOf="@+id/logoView" />
<TextView
android:id="@+id/appNameView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:text="@string/app_name"
android:textColor="?android:textColorPrimary"
android:textSize="26sp"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/backupNameView"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/logoView" />
<TextView
android:id="@+id/summaryView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:gravity="center_horizontal"
android:text="@string/about_summary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/appNameView" />
<TextView
android:id="@+id/backupNameView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:text="@string/backup"
android:textColor="?android:textColorPrimary"
android:textSize="26sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/appNameView"
app:layout_constraintTop_toBottomOf="@+id/logoView" />
<TextView
android:id="@+id/versionView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:text="@string/about_version"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/summaryView" />
<TextView
android:id="@+id/versionView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:gravity="center_horizontal"
android:text="@string/about_version"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/appNameView" />
<TextView
android:id="@+id/licenseView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:text="@string/about_license"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/versionView" />
<TextView
android:id="@+id/summaryView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:text="@string/about_summary"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/versionView" />
<TextView
android:id="@+id/authorView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:text="@string/about_author"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/licenseView" />
<TextView
android:id="@+id/contributorHeadline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:text="@string/about_contributor_headline"
android:textColor="?android:textColorPrimary"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/summaryView" />
<TextView
android:id="@+id/designView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:text="@string/about_design"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/authorView" />
<TextView
android:id="@+id/contributorView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:lineSpacingExtra="8dp"
android:text="@string/about_contributor_content"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/contributorHeadline" />
<TextView
android:id="@+id/sponsorView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:text="@string/about_sponsor"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/designView" />
<TextView
android:id="@+id/about_contributing_organizations_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:text="@string/about_contributing_organizations_title"
android:textColor="?android:textColorPrimary"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/contributorView" />
<TextView
android:id="@+id/sourceCodeView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:autoLink="web"
android:text="@string/about_source_code"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/sponsorView"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/about_contributing_organizations_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:lineSpacingExtra="8dp"
android:text="@string/about_contributing_organizations_content"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/about_contributing_organizations_title"
app:layout_constraintVertical_bias="0.0" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

View file

@ -203,12 +203,11 @@
<!-- About -->
<string name="about_title">About</string>
<string name="about_summary">A backup application using Android\'s internal backup API.</string>
<string name="about_summary">A backup application using Android\'s internal backup API. It is Free Software, released under Apache 2 license.\n\nLike all software, Seedvault may contain bugs or vulnerabilities.</string>
<string name="about_version">Version: %s</string>
<string name="about_license">License: <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache2</a></string>
<string name="about_author">Written by: <a href="https://github.com/stevesoltys">Steve Soltys</a> and <a href="https://blog.grobox.de">Torsten Grote</a></string>
<string name="about_design">Design by: <a href="https://www.glennsorrentino.com/">Glenn Sorrentino</a></string>
<string name="about_sponsor">Sponsored by: <a href="https://www.calyxinstitute.org">Calyx Institute</a> for use in <a href="https://calyxos.org">CalyxOS</a></string>
<string name="about_source_code">Source code: https://github.com/seedvault-app/seedvault</string>
<string name="about_contributor_headline">Contributors</string>
<string name="about_contributor_content">Please see GitHub for a <a href="https://github.com/seedvault-app/seedvault/graphs/contributors">list of contributors</a>.</string>
<string name="about_contributing_organizations_title">Contributing Organizations</string>
<string name="about_contributing_organizations_content"><a href="https://www.calyxinstitute.org">Calyx Institute</a> for use in <a href="https://calyxos.org">CalyxOS</a>\n<a href="https://nlnet.nl/project/Seedvault/">NGI0 PET Fund by NLnet</a></string>
</resources>