OkHttp3 source code, detailed cache strategy, worship

//If the current cache does not meet the requirements, close it if (cacheCandidate != null && cacheResponse == null) { closeQuietly(cacheCandidate.body()); // The cache candidate wasn't applicable. Close it. } // If the network cannot be used and there is no qualified cache, a 504 error will be thrown directly if (networkReques ...

Posted by ozman26 on Mon, 06 Sep 2021 14:08:08 -0700

[Correct] Use Kotlin Flow for search optimization, kotlin interview questions

If you don't understand it yet, look at the simplified code below: // Article Error Code🙅Simplification for (i in 0..100) { // Simulate Generated Data flow<Int> { emit(i) }.debounce(500) // This is an invalid limit because emit of flow only executes once... .collect { println("----------------- ...

Posted by langer on Mon, 06 Sep 2021 12:24:35 -0700

Design pattern --- singleton pattern

Application scenario Only one instance is required. In terms of code and memory, only one instance is required Key points First, the construction method is designed to be private          Unable to new Second: provide a method to obtain an instance Related concepts 1.class.forName("") can ...

Posted by D on Sun, 05 Sep 2021 15:18:13 -0700

The tailor in Canvas explains and practices, and summarizes the interview

public boolean clipRect(float left, float top, float right, float bottom) public boolean clipRect(int left, int top, int right, int bottom) public boolean clipRect(@NonNull Rect rect) public boolean clipRect(@NonNull RectF rect) 2,clipOutPath public boolean clipOutPath(@NonNull Path path) Description: only the canvas area outside the pat ...

Posted by dspeer on Sun, 05 Sep 2021 15:06:21 -0700

Construction and debugging of fluent development environment, and real questions for interview

Installation of simulatorRun the fluent project to the simulator and real machineFlutter common commands Construction of development environment 1. Download the fluent SDK The fleet SDK consists of two parts, one is the Dart SDK, and the other is the fleet SDK, because the fleet is based on Dart. You can download it in two ways: one is Git d ...

Posted by AutomatikStudio on Sun, 05 Sep 2021 14:41:31 -0700

Flutter Animation: use flutter to realize a clapping animation, "golden three silver four" spring move guide

Add and animate these small widget s. Let's slowly increase the learning curve one by one. First of all, we need to know some basic knowledge about fluent animation. Understand the components of basic animation in fluent Animation is just some values that change over time. For example, when we click a button, we want to use animation to make ...

Posted by garrywinkler on Sun, 05 Sep 2021 12:58:44 -0700

LiveData overview, kotlin interview questions

Typically, LiveData provides updates only when the data changes and only when the observer is active. An exception to this behavior is that observers also receive updates when they change from inactive to active. In addition, if the observer changes from inactive to active for the second time, it will receive an update only if the value has c ...

Posted by Anim9or on Fri, 03 Sep 2021 20:20:09 -0700

Memo mode - game Archive

Introduction Xiaoshuai works in a game company. Recently, the leader asked him to design the automatic archiving function of the game. Every time the player wants to challenge the boss, the system should be able to realize automatic archiving. If the player fails the challenge and the game is over, he can return to the state before the cha ...

Posted by tuurlijk on Fri, 03 Sep 2021 13:51:10 -0700

RecyclerView event distribution principle, practical analysis, Android interview questions

Recently, when solving the problem of RecyclerView sliding conflict, we encountered a scenario where the problem cannot be solved by using OnItemTouchLister. This article will focus on the following problems in combination with actual cases: Brief analysis of RecyclerView event distribution execution process Why can't adding OnItemTouchListe ...

Posted by jeaker on Thu, 02 Sep 2021 21:29:51 -0700

VirtualAPK detailed explanation and use, really cow

3.1 basic principles ClassLoader that combines host and plug-in It should be noted that classes in plug-ins cannot be duplicated with the hostMerge plug-in and host resources Reset the packageId of the plug-in resource and merge the plug-in resource and the host resourceRemove the reference of the plug-in package to the host During constructi ...

Posted by mospeed on Thu, 02 Sep 2021 18:31:29 -0700