Use several simple cases to help you quickly understand kotlin delegation

kotlin entrustment On the introduction of delegation, I will explain the most commonly used ways to implement delegation with several examples of my own implementation. The description will be very clear and easy to understand. In particular, the Lazy initialization method of the inherited Lazy class in the ViewModel extension library in andr ...

Added by fantasticham on Mon, 24 Jan 2022 11:38:17 +0200

Drag and drop View floating on the page

1, Overview In the twinkling of an eye, it is 2022. Looking back, the first time I wrote on csdn was 2017, five years have passed. In the past five years, some people around them got married, some had children, some bought a house, some upgraded to management and no longer wrote code. And I have nothing to do with these. I'm still a dish. I ju ...

Added by 7khat on Sun, 23 Jan 2022 12:14:39 +0200

[deep kotlin] - lambda expressions and higher-order functions

Functional programming The function does not depend on the existence of any class (from the source code level, from the bytecode level, it still depends on the existence of the class). Typical examples are top-level functions. lambda expression lambda expressions are the same as java, which consists of two parts separated by the "arrow& ...

Added by Moon-Man.net on Mon, 17 Jan 2022 16:24:37 +0200

Analysis of OkHttp source code of Android network framework -- interceptor analysis

Android network framework -- OkHttp source code analysis This article is based on Kotlin language Previous article: Analysis of OkHttp source code of Android network framework (1) -- request process After explaining the request process of OkHttp, this article enters the second part - OkHttp interceptor analysis. Interceptor analysis of ...

Added by seriousdamage on Sat, 15 Jan 2022 11:46:01 +0200

Kotlin collaboration process III - data Flow

Kotlin collaboration series article navigation: Kotlin process I - Coroutine Kotlin collaboration process 2 - Channel Kotlin collaboration process III - data Flow Kotlin collaboration process IV -- Application of Flow and Channel Kotlin collaboration 5 - using kotlin collaboration in Android 1, Basic use of Flow Using the hang function in the ...

Added by jaymoore_299 on Fri, 14 Jan 2022 23:56:19 +0200

Use Jetpack DataStore for data storage

Welcome to jetpack DataStore, an improved new data storage solution designed to replace the original SharedPreferences. Jetpack DataStore is developed based on Kotlin collaboration and Flow, and provides two different implementations: proto DataStore and preferences DataStore. Proto DataStore can store objects with types (implemented with proto ...

Added by username123 on Wed, 12 Jan 2022 21:53:18 +0200

Kotlin's way of learning -- function definition and call

Function definition and call Make function calls better Named parameters Using object-oriented functions such as Java, we must often encounter function calls, such as: joinToString(list, "; ", "[", "]") When we call this function for the first time, we are confused. We don't know the meaning of each parameter, which causes unnecessary tro ...

Added by globetrottingmike on Sat, 08 Jan 2022 10:35:37 +0200

Introduction to Dart language simplification

Introduction to Dart language simplification 1. Introduction Dart should be designed with reference to both Java and JavaScript and kotlin object-oriented JIT & AOT: JIT (Just in Time) advantages: instant compilation, faster compilation during development and faster overloading; Disadvantages: compiling the code into machine code at ru ...

Added by DonelleJenae on Fri, 07 Jan 2022 10:34:21 +0200

It is said that this framework can solve Android MVI

Author: Yi Dong preface There is no perfect architecture, only the most appropriate architecture. Android application architecture changes: MVC, MVP, MVVM, MVI. There are numerous high-quality articles in the technology community on the concept, logic, implementation methods, advantages and disadvantages of these four architectures, ...

Added by Chris.P on Fri, 07 Jan 2022 09:00:06 +0200

Kotlin's Flow practice

Flow asynchronous flowknowcharacteristicBuilder and contextstart-upCancel and cancel detectionbufferOperatorTransition operatorEnd operatorcombinationFlattenabnormalexception handlingcompleteHow to represent multiple values?The suspend function can return a single value asynchronously, but how to return multiple calculated values asynchronously ...

Added by Mohit_Prog on Wed, 05 Jan 2022 19:11:37 +0200