Skip to content
Permalink
Browse files

Fix compile after compiling against SDK 29

  • Loading branch information...
chrisbanes committed Jun 7, 2019
1 parent 89da21c commit ed0169f6d697aef0792a954c34d644a3cbd9cb47
@@ -18,7 +18,7 @@ package app.tivi.inject

import android.content.Context
import android.content.SharedPreferences
import android.preference.PreferenceManager
import androidx.preference.PreferenceManager
import app.tivi.BuildConfig
import app.tivi.TiviApplication
import app.tivi.util.AppCoroutineDispatchers
@@ -28,15 +28,15 @@ class SettingsFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.preferences, rootKey)

findPreference<Preference>("privacy_policy").setOnPreferenceClickListener {
findPreference<Preference>("privacy_policy")?.setOnPreferenceClickListener {
CustomTabsIntent.Builder()
.setToolbarColor(requireContext().getColor(R.color.colorPrimaryDark))
.build()
.launchUrl(requireContext(), getString(R.string.privacy_policy_url).toUri())
true
}

findPreference<Preference>("version").apply {
findPreference<Preference>("version")?.apply {
summary = getString(R.string.settings_app_version_summary,
BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE)
}
@@ -102,29 +102,29 @@ class ColumnedChangeBounds : ViewChangeBounds() {

val parent = view.parent
if (parent is ViewGroup) {
parent.suppressLayout(true)
parent.suppressLayoutInternal(true)

addListener(object : TransitionListenerAdapter() {
private var canceled = false

override fun onTransitionCancel(transition: Transition) {
parent.suppressLayout(false)
parent.suppressLayoutInternal(false)
canceled = true
}

override fun onTransitionEnd(transition: Transition) {
if (!canceled) {
parent.suppressLayout(false)
parent.suppressLayoutInternal(false)
}
transition.removeListener(this)
}

override fun onTransitionPause(transition: Transition) {
parent.suppressLayout(false)
parent.suppressLayoutInternal(false)
}

override fun onTransitionResume(transition: Transition) {
parent.suppressLayout(false)
parent.suppressLayoutInternal(false)
}
})
}
@@ -82,29 +82,29 @@ open class ViewChangeBounds : Transition() {

val parent = view.parent
if (parent is ViewGroup) {
parent.suppressLayout(true)
parent.suppressLayoutInternal(true)

addListener(object : TransitionListenerAdapter() {
private var canceled = false

override fun onTransitionCancel(transition: Transition) {
parent.suppressLayout(false)
parent.suppressLayoutInternal(false)
canceled = true
}

override fun onTransitionEnd(transition: Transition) {
if (!canceled) {
parent.suppressLayout(false)
parent.suppressLayoutInternal(false)
}
transition.removeListener(this)
}

override fun onTransitionPause(transition: Transition) {
parent.suppressLayout(false)
parent.suppressLayoutInternal(false)
}

override fun onTransitionResume(transition: Transition) {
parent.suppressLayout(false)
parent.suppressLayoutInternal(false)
}
})
}
@@ -16,32 +16,32 @@

package app.tivi.ui.transitions

import android.util.Log
import android.view.ViewGroup
import timber.log.Timber
import java.lang.reflect.InvocationTargetException
import java.lang.reflect.Method

private var sSuppressLayoutMethod: Method? = null
private var sSuppressLayoutMethodFetched: Boolean = false

fun ViewGroup.suppressLayout(suppress: Boolean) {
fun ViewGroup.suppressLayoutInternal(suppress: Boolean) {
if (!sSuppressLayoutMethodFetched) {
try {
sSuppressLayoutMethod = ViewGroup::class.java.getDeclaredMethod("suppressLayout",
Boolean::class.javaPrimitiveType)
sSuppressLayoutMethod!!.isAccessible = true
} catch (e: NoSuchMethodException) {
Log.i("suppressLayout", "Failed to retrieve suppressLayout method", e)
Timber.i(e, "Failed to retrieve suppressLayout method")
}
sSuppressLayoutMethodFetched = true
}
if (sSuppressLayoutMethod != null) {
try {
sSuppressLayoutMethod!!.invoke(this, suppress)
} catch (e: IllegalAccessException) {
Log.i("suppressLayout", "Failed to invoke suppressLayout method", e)
Timber.i(e, "Failed to invoke suppressLayout method")
} catch (e: InvocationTargetException) {
Log.i("suppressLayout", "Error invoking suppressLayout method", e)
Timber.i(e, "Error invoking suppressLayout method")
}
}
}
@@ -47,7 +47,7 @@ object Libs {
val mockitoKotlin = "com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0"

object Google {
val material = "com.google.android.material:material:1.1.0-alpha06"
val material = "com.google.android.material:material:1.1.0-alpha07"
val firebaseCore = "com.google.firebase:firebase-core:16.0.8"
val crashlytics = "com.crashlytics.sdk.android:crashlytics:2.9.9"
val gmsGoogleServices = "com.google.gms:google-services:4.2.0"
@@ -70,7 +70,7 @@ object Libs {
}

object AndroidX {
val appcompat = "androidx.appcompat:appcompat:1.1.0-alpha05"
val appcompat = "androidx.appcompat:appcompat:1.1.0-beta01"
val browser = "androidx.browser:browser:1.0.0"
val palette = "androidx.palette:palette:1.0.0"
val recyclerview = "androidx.recyclerview:recyclerview:1.0.0"
@@ -84,7 +84,7 @@ object Libs {
}

object Fragment {
private const val version = "1.1.0-alpha06"
private const val version = "1.1.0-beta01"
val fragment = "androidx.fragment:fragment:$version"
val fragmentKtx = "androidx.fragment:fragment-ktx:$version"
}
@@ -106,7 +106,7 @@ object Libs {
val rxjava2 = "androidx.paging:paging-rxjava2:$version"
}

val preference = "androidx.preference:preference:1.1.0-alpha02"
val preference = "androidx.preference:preference:1.1.0-beta01"

val constraintlayout = "androidx.constraintlayout:constraintlayout:2.0.0-beta1"

@@ -121,7 +121,7 @@ object Libs {
}

object Room {
private const val version = "2.1.0-alpha07"
private const val version = "2.1.0-rc01"
val common = "androidx.room:room-common:$version"
val runtime = "androidx.room:room-runtime:$version"
val rxjava2 = "androidx.room:room-rxjava2:$version"

0 comments on commit ed0169f

Please sign in to comment.
You can’t perform that action at this time.