Common Android design patterns -- Proxy Pattern
1. Preface
First, let's take a look at Baidu Encyclopedia's introduction to the agency model:
Definition of Proxy Pattern: provide a proxy for other objects to control access to this object. In some cases, one object is not suitable or cannot directly reference another object, and the proxy object can act as an intermediary between the ...
Posted by sebmaurer on Sun, 21 Nov 2021 10:08:00 +0100
Flutter imitates Netease cloud music: play the interface, and you can find a job after reading it
[external chain picture transfer failed. The source station may have anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-xxv5rz2b-1631251709878)( https://user-gold-cdn.xitu.io/2019/1/8/1682c515f06f92b1?imageslim )]
thinking
This interface is actually relatively simple to implement, which can be roughl ...
Posted by gtrufitt on Sun, 21 Nov 2021 02:26:09 +0100
Design pattern notes - agent pattern
Design pattern notes - agent pattern
Introduction to agent mode
The proxy mode is usually an intermediary system between the requester and the provider. The requester is the party who sends the request, and the provider is the party who provides the corresponding resources according to the request
The proxy server in the Web is an example. T ...
Posted by McInfo on Sun, 21 Nov 2021 01:39:07 +0100
The audio and video decoding of FFmpeg is synchronized with the audio and video, which is shared by the Android community
//Obtain video file information, such as the width and height of the video
//The second parameter is a dictionary, which indicates what information you need to obtain, such as video metadata
if (avformat_find_stream_info(pFormatCtx, NULL) < 0) {
LOGE("%s", "Unable to get video file information");
return;
}
//Gets the index lo ...
Posted by aggrav8d on Sun, 21 Nov 2021 00:50:41 +0100
Design mode - memo mode
summary
Memo pattern: (Memo design pattern) captures the internal state of an object without violating the encapsulation principle, and saves the state outside the object, so as to restore the object to its previous state later.
This mode is easy to understand and master. The code implementation is flexible, and the application scenarios are ...
Posted by matt72 on Sat, 20 Nov 2021 13:01:55 +0100
Design mode: Singleton mode
reference resources Singleton pattern of JAVA design pattern
Singleton mode
Type: create type
Ensure that there is at most one instance of a class and provide a global access point The singleton mode has the following characteristics:
A singleton class can only have one instance.A singleton class must create its own unique instance.A sing ...
Posted by Joopy on Fri, 19 Nov 2021 20:03:52 +0100
Singleton of design pattern
There are six principles and twenty-three design patterns in the design pattern. The six principles are: single responsibility principle, opening and closing principle, Richter substitution principle, dependency inversion principle, interface isolation principle and Dimitri principle. Twenty three design patterns: Singleton pattern, Builder pat ...
Posted by amethyst42 on Fri, 19 Nov 2021 08:47:36 +0100
I still don't understand Android's touch feedback mechanism
Recommended by Haowen: Author: riane
Let's analyze in detail what our fingers have experienced from touching various views on the screen to the end of this click event.
Event type
There are three types of touch events:
int action = MotionEventCompat.getActionMasked(event);
switch(action) {
case MotionEvent.ACTION_DOWN:
...
Posted by ricta on Thu, 18 Nov 2021 14:22:33 +0100
Explain 23 design patterns (based on Java) - creator pattern (II / V)
The notes of this article are from the dark horse video https://www.bilibili.com/video/BV1Np4y1z7BU , relevant information can be obtained in the comments area.
2. Creator mode (5)
The main focus of creation mode is "how to create objects?", and its main feature is "separating the creation and use of objects". Thi ...
Posted by phpr0ck5 on Fri, 12 Nov 2021 17:40:23 +0100
Abstract Factory design pattern
First, let's consider a user interface toolkit that supports the look and feel standard, such as Motif and Presentation Manager. In order to ensure the consistency of look and feel, an application should not hard code its window components for a specific look and feel. Because this will make it difficult to change the appearance of the window i ...
Posted by Cronikeys on Fri, 12 Nov 2021 07:44:09 +0100