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
public class NMPrivilegeDeserializer implements JsonDeserializer<NMPrivilege> { | |
@Override | |
public NMPrivilege deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { | |
NMPrivilege fromJson = new Gson().fromJson(json, NMPrivilege.class); | |
JsonObject jsonObject = json.getAsJsonObject(); | |
if (jsonObject.has("privilege_card")) { | |
JsonArray privilege_card = jsonObject.getAsJsonArray("privilege_card"); | |
if (privilege_card != null && privilege_card.size() > 0) { | |
for (int i = 0; i < privilege_card.size(); i++) { |
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
1.publishing点击顺序 | |
build目录->双击assembleRelease : 打release 包 | |
publishing目录->双击generatePomFileForAarPublication : 生成 pom.xml 文件 | |
publishing目录->双击artifactoryPublish :上传 | |
避免遗忘 | |
thanks | |
https://tiimor.cn/Artifactory%E6%90%AD%E5%BB%BA%E6%9C%AC%E5%9C%B0JFrog%E7%9A%84Library%E4%BB%93%E5%BA%93/ | |
2. |
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
hdpi 72x72 | |
mdpi 48x48 | |
xhdpi 96x96 | |
xxhdpi 144x144 | |
xxxhdpi 192x192 | |
android中的dp在渲染前会将dp转为px,计算公式: | |
px = density * dp; | |
density = dpi / 160; |
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
thanks: | |
https://medium.com/@rygel/stop-repeating-yourself-and-create-custom-views-on-android-with-kotlin-f5b3fc581c0e | |
https://medium.com/@elye.project/building-custom-component-with-kotlin-fc082678b080 | |
https://medium.com/@mmlodawski/https-medium-com-mmlodawski-do-not-always-trust-jvmoverloads-5251f1ad2cfe | |
1. | |
constructor(context: Context) : super(context) { | |
init(context) | |
} | |
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { |
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
private void disAppBarScroll() { | |
try { | |
CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) apl_module.getLayoutParams(); | |
AppBarLayout.Behavior behavior = (AppBarLayout.Behavior) layoutParams.getBehavior(); | |
if (behavior != null) { | |
behavior.setDragCallback(new AppBarLayout.Behavior.DragCallback() { | |
@Override | |
public boolean canDrag(@NonNull AppBarLayout appBarLayout) { | |
return false; | |
} |
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
Bitmap too large to be uploaded into a texture (1080x4153, max=4096x4096) | |
thanks: | |
https://medium.com/digio-australia/custom-image-manipulation-crop-and-translate-at-load-time-with-glide-on-android-cb556f5a5aae | |
https://github.com/mantel-digio/GlideCropper/blob/master/app/src/main/java/au/com/digio/glidecropper/widget/CroppedImageView.kt | |
https://developer.android.com/topic/performance/graphics/load-bitmap | |
吐槽: | |
csdn 上的技术博文大大大大大部分质量真是差劲 一点验证意识都没有。 |
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
1.NestedScrollView RecyclerView recyclerView always scroll top | |
add | |
recyclerView.isFocusableInTouchMode = false | |
recyclerView.requestFocus() | |
its working! | |
2.addItemDecoration | |
if (recyclerView.itemDecorationCount > 0) { | |
val itemDecorationAt = recyclerView.getItemDecorationAt(0) | |
if (itemDecorationAt == null) { |
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
Intent getAlbum = new Intent(Intent.ACTION_GET_CONTENT); | |
getAlbum.setType("image/*"); | |
startActivityForResult(getAlbum, REQUEST_CODE_PICK_IMAGE); | |
xiaomi M4 not working | |
replace | |
Intent intent = new Intent(Intent.ACTION_PICK, | |
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); | |
startActivityForResult(intent, REQUEST_CODE_PICK_IMAGE); |
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
/** | |
* thanks https://stackoverflow.com/questions/36093384/stop-nestedscrollview-inside-viewpager-to-process-horizontal-scrolls | |
*/ | |
public class VerticalOnlyNestedScrollView extends NestedScrollView { | |
public VerticalOnlyNestedScrollView(Context context) { | |
super(context); | |
} |
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
thanks: | |
[Manage touch events in a ViewGroup](https://developer.android.com/training/gestures/viewgroup) | |
https://medium.com/@suragch/how-touch-events-are-delivered-in-android-eee3b607b038 | |
焦点问题遇到的比较少 特此记录一下 加深理解和记忆 |