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