android-ktx
android-ktx copied to clipboard
A set of Kotlin extensions for Android app development.
Add extensions of Uri for ContentUris
The current bundle creation method (`bundleOf`) accepts an array of `Pair`. Although the implementation takes care of resolving the value type at runtime, the API is 'unsafe' at compile time...
As they're effectively public as far as binary compatibility is concerned. Example: https://github.com/android/android-ktx/pull/447
Cast param extension function suggestion `inline fun View.getParams() = this.layoutParams as T` Get get param like this ``` private lateinit var paramsGlHorizontal: ConstraintLayout.LayoutParams override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main)...
What about extensions for RemoteViews? PR with tests. ```java inline fun RemoteViews.setEnabled(@IdRes viewId: Int, enabled: Boolean) = setBoolean(viewId, "setEnabled", enabled) ``` Usage: ```java remoteView.setEnabled(R.id.test_imageView, false) remoteView.setBackgroundResource(R.id.test_textView, R.drawable.box) remoteView.setTextViewPaintFlags(R.id.test_textView, Paint.UNDERLINE_TEXT_FLAG) remoteView.setBackgroundColor(R.id.test_imageView,...
Make creation of intents easier. Covers #166. In case if intent is implicit or don't require any application component: ```kotlin val intent = intentOf( action = "action", data = Uri.parse(...),...
add wrappers for SuperscriptSpan, SubscriptSpan, TypefaceSpan and URLSpan
@romainguy
```kotlin fun Intent.chooser(title: String) = Intent.createChooser(this, title) ```
Add versions of post/postDelayed which accept View as receiver in block. It is helpful when you want to apply some changes from another thread: ```kotlin val refreshLayout: SwipeRefreshLayout = ......