From d120436d280cd952b6fb2ba3659a7c91ef24129d Mon Sep 17 00:00:00 2001 From: Bnyro Date: Fri, 1 Jul 2022 10:30:29 +0200 Subject: [PATCH] convert aboutfragment --- .../libretube/preferences/AboutFragment.kt | 25 +++++++------------ 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/com/github/libretube/preferences/AboutFragment.kt b/app/src/main/java/com/github/libretube/preferences/AboutFragment.kt index 4e6219386..cfd62721b 100644 --- a/app/src/main/java/com/github/libretube/preferences/AboutFragment.kt +++ b/app/src/main/java/com/github/libretube/preferences/AboutFragment.kt @@ -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(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(R.id.website) - website.setOnClickListener { + binding.website.setOnClickListener { openLinkFromHref(WEBSITE_URL) } - val authors = view.findViewById(R.id.authors) - authors.setOnClickListener { + binding.authors.setOnClickListener { openLinkFromHref(AUTHORS_URL) } - val piped = view.findViewById(R.id.piped) - piped.setOnClickListener { + binding.piped.setOnClickListener { openLinkFromHref(PIPED_GITHUB_URL) } - val donate = view.findViewById(R.id.donate) - donate.setOnClickListener { + binding.donate.setOnClickListener { openLinkFromHref(DONATE_URL) } - val contributing = view.findViewById(R.id.contributing) - contributing.setOnClickListener { + binding.contributing.setOnClickListener { openLinkFromHref(CONTRIBUTING_URL) } - val license = view.findViewById(R.id.license) - license.setOnClickListener { + binding.license.setOnClickListener { val licenseString = view.context.assets .open("gpl3.html").bufferedReader().use { it.readText()