Android drag and drop startDragAndDrop drag and drop Glide to flexibly load stacked rounded corners, Kotlin (6)

Android drag and drop startDragAndDrop drag and drop Glide to flexibly load stacked rounded corners, Kotlin (6) Android drag and drop startDragAndDrop drag and drop Glide to load stacked rounded corners, Kotlin (5) – CSDN blog article has been read 1.3k times. Android DynamicGrid: Drag to swap positions. Android DynamicGrid is a third-party open source […]

The first IDE developed by AOSP in history (supports Java/Kotlin/C++/Jni/Native/Shell/Python)

ASFP Study The first IDE developed by AOSP in history (supports Java/Kotlin/C++/Jni/Native/Shell/Python) Similar to Android Studio, it can be used to develop Android system source code. Android studio for platform, referred to as asfp (Falling in Love with a Rich Woman). Background & amp;Download & amp;Use Background Because the Android system source code is too […]

Core understanding of Kotlin coroutines

1. What is a coroutine? 1.1 Understanding of basic concepts We know that the implementation of threads in the JVM is determined by the operating system it runs on. The JVM only encapsulates the API in the upper layer, including common threaded startup methods and state management. For example: Java abstracts 6 types of threads. […]

Testing Kotlin data flows on Android

Article directory 1. Create a fictitious data provider 2. Assert that the data stream is emitted in the test Collect continuously during testing 3. Test StateFlow StateFlow created using stateIn Reprinted from: https://developer.android.google.cn/kotlin/flow/test?hl=zh-cn#producer How a unit or module that communicates with a data stream is tested depends on whether the object under test uses the […]

Stripping the pants of Kotlin intrinsic functions by looking at bytecode instructions

Exposing Kotlin intrinsic functions by looking at bytecode instructions There are many articles on the Internet about Kotlin inline functions. Most of them tell you the conclusion. Just use the xxx keyword and forget about it after a while. This article will guide you. From the JVM bytecode, I will take you step by step […]

Kotlin data flow overview

Article directory 1. What is data flow? 2. Create data flow 3. Modify data flow 4. Collect from data streams 5. Data flow capture exception 6. Execute in different CoroutineContext 7. Data flow in Jetpack library 8. Convert callback-based APIs into data streams 1 What is data flow Dataflows are built on coroutines and can […]

Kotlin coroutine best practices

Article directory Reprinted from official documentation 1. Inject the scheduler 2. Suspended functions should be able to be safely called from the main thread Three ViewModel should create coroutines 4. Don’t expose mutable types 5. The data layer and business layer should expose suspend functions and data flows Create coroutines in the business layer and […]

Kotlin lambda-Capturing vs Non-Capturing Lambdas

Overview I believe that many people are confused when they see Capturing/non-capturing lambdas. What is this? It seems that they have not seen this in actual use. In fact, we encounter this thing every day in actual development, but we are not very familiar with this concept. Today I will talk about this thing. After […]

The difference between suspension and blocking of Kotlin coroutines

1. Introduction Kotlin coroutines introduce a very powerful asynchronous programming model to achieve concurrent operations by suspending instead of blocking. Here is a detailed introduction to Kotlin coroutine hanging and blocking: Suspending: Suspend means that the execution of a coroutine can be paused and resumed without blocking the thread. The suspend function is a special […]