Migrate some older Kotlin
This commit is contained in:
parent
4534946314
commit
20fad6b917
|
@ -109,8 +109,8 @@ class UserSelectorActivity : BaseActivity(), OnItemClickListener, LoaderManager.
|
|||
|
||||
override fun onCreateLoader(id: Int, args: Bundle?): Loader<List<ParcelableUser>> {
|
||||
val accountKey = args?.getParcelable<UserKey>(EXTRA_ACCOUNT_KEY)!!
|
||||
val query = args?.getString(EXTRA_QUERY).orEmpty()
|
||||
val fromCache = args?.getBoolean(EXTRA_FROM_CACHE)
|
||||
val query = args.getString(EXTRA_QUERY).orEmpty()
|
||||
val fromCache = args.getBoolean(EXTRA_FROM_CACHE)
|
||||
if (!fromCache) {
|
||||
showProgress()
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ class StatusDetailsAdapter(
|
|||
inflater = LayoutInflater.from(context)
|
||||
cardBackgroundColor = ThemeUtils.getCardBackgroundColor(context!!,
|
||||
preferences[themeBackgroundOptionKey], preferences[themeBackgroundAlphaKey])
|
||||
val listener = StatusAdapterLinkClickHandler<List<ParcelableStatus>>(context!!, preferences)
|
||||
val listener = StatusAdapterLinkClickHandler<List<ParcelableStatus>>(context, preferences)
|
||||
listener.setAdapter(this)
|
||||
twidereLinkify = TwidereLinkify(listener)
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ class ColorPickerDialogFragment : BaseDialogFragment(), DialogInterface.OnClickL
|
|||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
if (controller != null) {
|
||||
outState!!.putInt(EXTRA_COLOR, controller!!.color)
|
||||
outState.putInt(EXTRA_COLOR, controller!!.color)
|
||||
}
|
||||
super.onSaveInstanceState(outState)
|
||||
}
|
||||
|
|
|
@ -667,7 +667,7 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener,
|
|||
actionBarShadowColor = 0xA0000000.toInt()
|
||||
val args = arguments
|
||||
val accountKey = args?.getParcelable<UserKey?>(EXTRA_ACCOUNT_KEY) ?: run {
|
||||
activity?.finish()
|
||||
activity.finish()
|
||||
return
|
||||
}
|
||||
val userKey = args.getParcelable<UserKey?>(EXTRA_USER_KEY)
|
||||
|
|
|
@ -253,7 +253,7 @@ class AddEditItemFragment : BaseDialogFragment() {
|
|||
Toast.LENGTH_SHORT).show()
|
||||
} else {
|
||||
val idWhere = Expression.equals(Filters._ID, rowId).sql
|
||||
resolver?.update(uri, values, idWhere, null)
|
||||
resolver.update(uri, values, idWhere, null)
|
||||
}
|
||||
} else {
|
||||
resolver?.insert(uri, values)
|
||||
|
|
|
@ -238,7 +238,7 @@ class MessageNewConversationFragment : BaseFragment(), LoaderCallbacks<List<Parc
|
|||
}
|
||||
|
||||
private fun createOrOpenConversation() {
|
||||
val account = this.account ?: return
|
||||
val account = this.account
|
||||
val context = context ?: return
|
||||
val activity = activity ?: return
|
||||
val selected = this.selectedRecipients
|
||||
|
|
|
@ -80,7 +80,7 @@ abstract class AbsStatusDialogFragment : BaseDialogFragment() {
|
|||
|
||||
val dialog = builder.create()
|
||||
dialog.onShow {
|
||||
val context = it.context ?: return@onShow
|
||||
val context = it.context
|
||||
it.applyTheme()
|
||||
|
||||
val am = AccountManager.get(context)
|
||||
|
|
|
@ -241,7 +241,7 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
|||
})
|
||||
adapter = StatusDetailsAdapter(this)
|
||||
layoutManager = StatusListLinearLayoutManager(context, recyclerView)
|
||||
mItemDecoration = StatusDividerItemDecoration(context, adapter, layoutManager.orientation)?.apply {
|
||||
mItemDecoration = StatusDividerItemDecoration(context, adapter, layoutManager.orientation).apply {
|
||||
recyclerView.addItemDecoration(this)
|
||||
}
|
||||
layoutManager.recycleChildrenOnDetach = true
|
||||
|
|
|
@ -111,7 +111,7 @@ class ExtensionsListLoader(
|
|||
|
||||
constructor(info: ApplicationInfo, pm: PackageManager) : this(
|
||||
info.packageName,
|
||||
info.loadLabel(pm) ?: info.packageName,
|
||||
info.loadLabel(pm),
|
||||
info.loadDescription(pm),
|
||||
info.loadIcon(pm),
|
||||
info.metaData?.getString(METADATA_KEY_EXTENSION_PERMISSIONS)?.split('|')?.filterNot(String::isEmpty)?.toTypedArray(),
|
||||
|
|
|
@ -122,7 +122,7 @@ class ColorPickerPreference(context: Context, attrs: AttributeSet? = null) :
|
|||
val preference = preference as ColorPickerPreference
|
||||
val alertDialog = dialog as AlertDialog
|
||||
alertDialog.applyTheme()
|
||||
val windowView = alertDialog.window!!.decorView ?: return
|
||||
val windowView = alertDialog.window!!.decorView
|
||||
controller = ColorPickerDialog.Controller(context, windowView)
|
||||
controller.setAlphaEnabled(preference.isAlphaSliderEnabled)
|
||||
for (presetColor in PRESET_COLORS) {
|
||||
|
|
|
@ -103,9 +103,9 @@ object HttpClientFactory {
|
|||
"[HOST]" -> url.host()
|
||||
"[PORT]" -> url.port()
|
||||
"[AUTHORITY]" -> url.authority()
|
||||
"[PATH]" -> url.encodedPath()?.removePrefix("/").orEmpty()
|
||||
"[PATH]" -> url.encodedPath().removePrefix("/")
|
||||
"[/PATH]" -> url.encodedPath().orEmpty()
|
||||
"[PATH_ENCODED]" -> url.encodedPath()?.removePrefix("/")?.urlEncoded()
|
||||
"[PATH_ENCODED]" -> url.encodedPath().removePrefix("/").urlEncoded()
|
||||
"[QUERY]" -> url.encodedQuery().orEmpty()
|
||||
"[?QUERY]" -> url.encodedQuery()?.prefix("?").orEmpty()
|
||||
"[QUERY_ENCODED]" -> url.encodedQuery()?.urlEncoded()
|
||||
|
|
|
@ -34,7 +34,7 @@ class RecyclerViewScrollHandler<A>(contentListSupport: ContentListSupport<A>, vi
|
|||
}
|
||||
|
||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||
val scrollState = recyclerView!!.scrollState
|
||||
val scrollState = recyclerView.scrollState
|
||||
scrollHandler.handleScroll(dy, scrollState, oldState, RecyclerView.SCROLL_STATE_IDLE)
|
||||
oldState = scrollState
|
||||
}
|
||||
|
|
|
@ -46,7 +46,6 @@ class RoundedRectTransformation(
|
|||
val height = source.height
|
||||
|
||||
val bitmap = bitmapPool.get(width, height, Bitmap.Config.ARGB_8888)
|
||||
?: Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
|
||||
|
||||
val canvas = Canvas(bitmap)
|
||||
val paint = Paint()
|
||||
|
|
Loading…
Reference in New Issue