Fix customtab-toolbarcolor deprecation

This commit is contained in:
Xcreen
2022-03-10 19:00:04 +01:00
parent 83f7af947f
commit 4770cc8400
2 changed files with 13 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import androidx.browser.customtabs.CustomTabColorSchemeParams
import androidx.fragment.app.Fragment
import androidx.browser.customtabs.CustomTabsIntent
@@ -14,11 +15,15 @@ class AboutMeFragment : Fragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val rootView = inflater.inflate(R.layout.fragment_about_me, container, false)
val customTabColorSchemeParams = CustomTabColorSchemeParams.Builder()
.setToolbarColor(resources.getColor(R.color.colorDarkBlack, null))
.setNavigationBarColor(resources.getColor(R.color.colorDarkBlack, null))
.build()
val donateBtn = rootView.findViewById<Button>(R.id.about_me_donate_btn)
donateBtn.setOnClickListener { v ->
val builder = CustomTabsIntent.Builder()
builder.setToolbarColor(resources.getColor(R.color.colorDarkBlack, null))
builder.setDefaultColorSchemeParams(customTabColorSchemeParams)
val customTabsIntent = builder.build()
if (context != null) {
//Open Paypal Website
@@ -29,7 +34,7 @@ class AboutMeFragment : Fragment() {
val githubBtn = rootView.findViewById<Button>(R.id.about_me_github_btn)
githubBtn.setOnClickListener { v->
val builder = CustomTabsIntent.Builder()
builder.setToolbarColor(resources.getColor(R.color.colorDarkBlack, null))
builder.setDefaultColorSchemeParams(customTabColorSchemeParams)
val customTabsIntent = builder.build()
if (context != null) {
//Open Github Website

View File

@@ -10,6 +10,7 @@ import android.widget.AdapterView.OnItemClickListener
import android.widget.ArrayAdapter
import android.widget.ListView
import android.widget.TextView
import androidx.browser.customtabs.CustomTabColorSchemeParams
import androidx.browser.customtabs.CustomTabsIntent
import androidx.fragment.app.Fragment
import net.xcreen.restsms.R
@@ -30,8 +31,12 @@ class AboutThirdPartyLibrarysFragment : Fragment() {
val listView = rootView.findViewById<ListView>(R.id.about_third_party_list_view)
listView.adapter = thirdPartyLibraryCustomListViewAdapter
listView.onItemClickListener = OnItemClickListener { _, _, position, _ ->
val customTabColorSchemeParams = CustomTabColorSchemeParams.Builder()
.setToolbarColor(resources.getColor(R.color.colorDarkBlack, null))
.setNavigationBarColor(resources.getColor(R.color.colorDarkBlack, null))
.build()
val builder = CustomTabsIntent.Builder()
builder.setToolbarColor(resources.getColor(R.color.colorDarkBlack, null))
builder.setDefaultColorSchemeParams(customTabColorSchemeParams)
val customTabsIntent = builder.build()
//Open Library Website
val url = thirdPartyLibraryDataModels[position].url