Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core/util 下新建一个 callback包,下新建CallbackManager、IGlobalCallback、CallbackType; 更新PermissionCheckerDelegate、CameraHandler(注释)、AndroidManifest、UserProfileClickListener;
- Loading branch information
1 parent
5ed0d2d
commit 0dc55e7
Showing
9 changed files
with
210 additions
and
6 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
xiaoyun_core/src/main/java/com/lwp/xiaoyun_core/util/callback/CallbackManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.lwp.xiaoyun_core.util.callback; | ||
|
||
import java.util.WeakHashMap; | ||
|
||
/** | ||
* <pre> | ||
* author : 李蔚蓬(简书_凌川江雪) | ||
* time : 2020/3/5 6:22 | ||
* desc : 【回调机制】 | ||
* 集成本工具包,可以在任何位置设置回调!!! | ||
* </pre> | ||
*/ | ||
public class CallbackManager { | ||
|
||
//用来存储所有IGlobalCallback | ||
private static final WeakHashMap<Object, IGlobalCallback> CALLBACKS = new WeakHashMap<>(); | ||
|
||
//静态内部类型单例模式 | ||
private static class Holder { | ||
private static final CallbackManager INSTANCE = new CallbackManager(); | ||
} | ||
public static CallbackManager getInstance() { | ||
return Holder.INSTANCE; | ||
} | ||
|
||
public CallbackManager addCallback(Object tag, IGlobalCallback callback) { | ||
CALLBACKS.put(tag, callback); | ||
return this; | ||
} | ||
public IGlobalCallback getCallback(Object tag) { | ||
return CALLBACKS.get(tag); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
xiaoyun_core/src/main/java/com/lwp/xiaoyun_core/util/callback/CallbackType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.lwp.xiaoyun_core.util.callback; | ||
|
||
/** | ||
* <pre> | ||
* author : 李蔚蓬(简书_凌川江雪) | ||
* time : 2020/3/5 6:23 | ||
* desc : 为callback本包 提供枚举 | ||
* </pre> | ||
*/ | ||
public enum CallbackType { | ||
|
||
ON_CROP, | ||
TAG_OPEN_PUSH, | ||
TAG_STOP_PUSH, | ||
ON_SCAN, | ||
} |
16 changes: 16 additions & 0 deletions
16
xiaoyun_core/src/main/java/com/lwp/xiaoyun_core/util/callback/IGlobalCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.lwp.xiaoyun_core.util.callback; | ||
|
||
/** | ||
* <pre> | ||
* author : 李蔚蓬(简书_凌川江雪) | ||
* time : 2020/3/5 6:22 | ||
* desc : 全局回调 | ||
* </pre> | ||
*/ | ||
public interface IGlobalCallback<T> { | ||
|
||
//泛型接口,一般回调的时候需要给回调方法传递一些值, | ||
// 关于值的类型,这里 指为泛型 比 传入Object好很多, | ||
// 性能、可拓展性、健壮性提高很多 | ||
void executeCallback(T args); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters