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