fixed some deprecations
This commit is contained in:
parent
e9b416b7e2
commit
a7da340fb0
|
@ -35,7 +35,7 @@ allprojects {
|
||||||
subprojects {
|
subprojects {
|
||||||
buildscript {
|
buildscript {
|
||||||
ext {
|
ext {
|
||||||
kotlinVersion = '1.1.2-5'
|
kotlinVersion = '1.1.3-2'
|
||||||
pluginVersions = [
|
pluginVersions = [
|
||||||
AndroidSvgDrawable: '3.0.0',
|
AndroidSvgDrawable: '3.0.0',
|
||||||
Fabric : '1.22.1',
|
Fabric : '1.22.1',
|
||||||
|
|
|
@ -23,7 +23,6 @@ import android.content.Context
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.support.annotation.DrawableRes
|
import android.support.annotation.DrawableRes
|
||||||
import android.support.v4.content.ContextCompat
|
import android.support.v4.content.ContextCompat
|
||||||
import android.support.v4.view.MenuItemCompat
|
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.SubMenu
|
import android.view.SubMenu
|
||||||
|
@ -63,14 +62,12 @@ fun Menu.setMenuItemTitle(id: Int, title: Int) {
|
||||||
fun Menu.setMenuItemShowAsActionFlags(id: Int, flags: Int) {
|
fun Menu.setMenuItemShowAsActionFlags(id: Int, flags: Int) {
|
||||||
val item = findItem(id) ?: return
|
val item = findItem(id) ?: return
|
||||||
item.setShowAsActionFlags(flags)
|
item.setShowAsActionFlags(flags)
|
||||||
MenuItemCompat.setShowAsAction(item, flags)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Menu.findSubmenu(id: Int): SubMenu? {
|
fun Menu.findSubmenu(id: Int): SubMenu? {
|
||||||
return findItem(id)?.subMenu
|
return findItem(id)?.subMenu
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun MenuItem.setActionIcon(context: Context, @DrawableRes iconRes: Int) {
|
fun MenuItem.setActionIcon(context: Context, @DrawableRes iconRes: Int) {
|
||||||
val oldIcon = this.icon
|
val oldIcon = this.icon
|
||||||
if (oldIcon is ActionIconDrawable) {
|
if (oldIcon is ActionIconDrawable) {
|
||||||
|
|
|
@ -249,9 +249,9 @@ class BrowserSignInActivity : BaseActivity() {
|
||||||
webSettings.applyDefault()
|
webSettings.applyDefault()
|
||||||
webView.webViewClient = object : WebViewClient() {
|
webView.webViewClient = object : WebViewClient() {
|
||||||
@Suppress("OverridingDeprecatedMember")
|
@Suppress("OverridingDeprecatedMember")
|
||||||
override fun shouldOverrideUrlLoading(view: WebView?, url: String?) = false
|
override fun shouldOverrideUrlLoading(wv: WebView?, url: String?) = false
|
||||||
|
|
||||||
override fun shouldOverrideUrlLoading(view: WebView?, request: WebResourceRequest?) = false
|
override fun shouldOverrideUrlLoading(wv: WebView?, request: WebResourceRequest?) = false
|
||||||
}
|
}
|
||||||
webView.webChromeClient = object : WebChromeClient() {
|
webView.webChromeClient = object : WebChromeClient() {
|
||||||
override fun onCloseWindow(window: WebView) {
|
override fun onCloseWindow(window: WebView) {
|
||||||
|
|
|
@ -1516,7 +1516,7 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
private fun discardTweet() {
|
private fun discardTweet() {
|
||||||
val context = applicationContext
|
val context = applicationContext
|
||||||
val media = mediaList
|
val media = mediaList
|
||||||
task { media.forEach { media -> Utils.deleteMedia(context, Uri.parse(media.uri)) } }
|
task { media.forEach { Utils.deleteMedia(context, Uri.parse(it.uri)) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getStatusUpdate(checkLength: Boolean): ParcelableStatusUpdate {
|
private fun getStatusUpdate(checkLength: Boolean): ParcelableStatusUpdate {
|
||||||
|
|
|
@ -426,7 +426,7 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
||||||
errorText.spannable = errorInfo.message
|
errorText.spannable = errorInfo.message
|
||||||
errorIcon.setImageResource(errorInfo.icon)
|
errorIcon.setImageResource(errorInfo.icon)
|
||||||
}
|
}
|
||||||
activity.supportInvalidateOptionsMenu()
|
activity.invalidateOptionsMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onLoaderReset(loader: Loader<SingleResponse<ParcelableStatus>>) {
|
override fun onLoaderReset(loader: Loader<SingleResponse<ParcelableStatus>>) {
|
||||||
|
|
|
@ -50,8 +50,9 @@ abstract class ExceptionHandlingAbstractTask<Params, Result, TaskException : Exc
|
||||||
override final fun doLongOperation(params: Params): SingleResponse<Result> {
|
override final fun doLongOperation(params: Params): SingleResponse<Result> {
|
||||||
try {
|
try {
|
||||||
return SingleResponse(onExecute(params))
|
return SingleResponse(onExecute(params))
|
||||||
} catch (tr: TaskException) {
|
} catch (tr: Exception) {
|
||||||
return SingleResponse(tr)
|
if (exceptionClass.isInstance(tr)) return SingleResponse(tr)
|
||||||
|
throw tr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,11 @@
|
||||||
package org.mariotaku.twidere.util.view
|
package org.mariotaku.twidere.util.view
|
||||||
|
|
||||||
import android.util.FloatProperty
|
import android.util.FloatProperty
|
||||||
|
import android.util.Property
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
|
||||||
object ViewProperties {
|
object ViewProperties {
|
||||||
val TRANSLATION_X_RELATIVE = object : FloatProperty<View>("xRelative") {
|
val TRANSLATION_X_RELATIVE: Property<View, Float> = object : FloatProperty<View>("xRelative") {
|
||||||
override fun setValue(obj: View, value: Float) {
|
override fun setValue(obj: View, value: Float) {
|
||||||
obj.translationX = value * obj.width
|
obj.translationX = value * obj.width
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue