convert aboutfragment

This commit is contained in:
Bnyro 2022-07-01 10:30:29 +02:00
parent 92993db5c7
commit d120436d28

View File

@ -8,14 +8,13 @@ import android.text.Html
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.TextView
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import com.github.libretube.AUTHORS_URL import com.github.libretube.AUTHORS_URL
import com.github.libretube.CONTRIBUTING_URL import com.github.libretube.CONTRIBUTING_URL
import com.github.libretube.DONATE_URL import com.github.libretube.DONATE_URL
import com.github.libretube.PIPED_GITHUB_URL import com.github.libretube.PIPED_GITHUB_URL
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.SettingsActivity
import com.github.libretube.WEBSITE_URL import com.github.libretube.WEBSITE_URL
import com.github.libretube.databinding.FragmentAboutBinding import com.github.libretube.databinding.FragmentAboutBinding
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
@ -34,31 +33,25 @@ class AboutFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
val topBarText = activity?.findViewById<TextView>(R.id.topBar_textView) val settingsActivity = activity as SettingsActivity
topBarText?.text = getString(R.string.about) settingsActivity.binding.topBarTextView.text = getString(R.string.about)
val website = view.findViewById<LinearLayout>(R.id.website) binding.website.setOnClickListener {
website.setOnClickListener {
openLinkFromHref(WEBSITE_URL) openLinkFromHref(WEBSITE_URL)
} }
val authors = view.findViewById<LinearLayout>(R.id.authors) binding.authors.setOnClickListener {
authors.setOnClickListener {
openLinkFromHref(AUTHORS_URL) openLinkFromHref(AUTHORS_URL)
} }
val piped = view.findViewById<LinearLayout>(R.id.piped) binding.piped.setOnClickListener {
piped.setOnClickListener {
openLinkFromHref(PIPED_GITHUB_URL) openLinkFromHref(PIPED_GITHUB_URL)
} }
val donate = view.findViewById<LinearLayout>(R.id.donate) binding.donate.setOnClickListener {
donate.setOnClickListener {
openLinkFromHref(DONATE_URL) openLinkFromHref(DONATE_URL)
} }
val contributing = view.findViewById<LinearLayout>(R.id.contributing) binding.contributing.setOnClickListener {
contributing.setOnClickListener {
openLinkFromHref(CONTRIBUTING_URL) openLinkFromHref(CONTRIBUTING_URL)
} }
val license = view.findViewById<LinearLayout>(R.id.license) binding.license.setOnClickListener {
license.setOnClickListener {
val licenseString = view.context.assets val licenseString = view.context.assets
.open("gpl3.html").bufferedReader().use { .open("gpl3.html").bufferedReader().use {
it.readText() it.readText()