fixed some deprecations

This commit is contained in:
Mariotaku Lee 2017-07-31 12:38:42 +08:00
parent e9b416b7e2
commit a7da340fb0
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
7 changed files with 10 additions and 11 deletions

View File

@ -35,7 +35,7 @@ allprojects {
subprojects {
buildscript {
ext {
kotlinVersion = '1.1.2-5'
kotlinVersion = '1.1.3-2'
pluginVersions = [
AndroidSvgDrawable: '3.0.0',
Fabric : '1.22.1',

View File

@ -23,7 +23,6 @@ import android.content.Context
import android.graphics.drawable.Drawable
import android.support.annotation.DrawableRes
import android.support.v4.content.ContextCompat
import android.support.v4.view.MenuItemCompat
import android.view.Menu
import android.view.MenuItem
import android.view.SubMenu
@ -63,14 +62,12 @@ fun Menu.setMenuItemTitle(id: Int, title: Int) {
fun Menu.setMenuItemShowAsActionFlags(id: Int, flags: Int) {
val item = findItem(id) ?: return
item.setShowAsActionFlags(flags)
MenuItemCompat.setShowAsAction(item, flags)
}
fun Menu.findSubmenu(id: Int): SubMenu? {
return findItem(id)?.subMenu
}
fun MenuItem.setActionIcon(context: Context, @DrawableRes iconRes: Int) {
val oldIcon = this.icon
if (oldIcon is ActionIconDrawable) {

View File

@ -249,9 +249,9 @@ class BrowserSignInActivity : BaseActivity() {
webSettings.applyDefault()
webView.webViewClient = object : WebViewClient() {
@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() {
override fun onCloseWindow(window: WebView) {

View File

@ -1516,7 +1516,7 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
private fun discardTweet() {
val context = applicationContext
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 {

View File

@ -426,7 +426,7 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
errorText.spannable = errorInfo.message
errorIcon.setImageResource(errorInfo.icon)
}
activity.supportInvalidateOptionsMenu()
activity.invalidateOptionsMenu()
}
override fun onLoaderReset(loader: Loader<SingleResponse<ParcelableStatus>>) {

View File

@ -50,8 +50,9 @@ abstract class ExceptionHandlingAbstractTask<Params, Result, TaskException : Exc
override final fun doLongOperation(params: Params): SingleResponse<Result> {
try {
return SingleResponse(onExecute(params))
} catch (tr: TaskException) {
return SingleResponse(tr)
} catch (tr: Exception) {
if (exceptionClass.isInstance(tr)) return SingleResponse(tr)
throw tr
}
}

View File

@ -20,10 +20,11 @@
package org.mariotaku.twidere.util.view
import android.util.FloatProperty
import android.util.Property
import android.view.View
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) {
obj.translationX = value * obj.width
}