This file contains hidden or 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 hidden or 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 hidden or 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
| Application | |
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { | |
| StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); | |
| StrictMode.setVmPolicy(builder.build()); | |
| } | |
| Uri uri; | |
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { |
This file contains hidden or 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 var audioManager: AudioManager? = null | |
| audioManager = getSystemService(Context.AUDIO_SERVICE) as AudioManager | |
| override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { | |
| when (keyCode) { | |
| KeyEvent.KEYCODE_BACK -> { | |
| } | |
| KeyEvent.KEYCODE_VOLUME_DOWN -> { | |
| audioManager?.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER, AudioManager.FLAG_SHOW_UI) |
This file contains hidden or 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
| 遇到的问题 | |
| https://stackoverflow.com/questions/17630336/space-between-keyboard-and-edittext-in-android/25400043 | |
| 1.edittext 试着加paddingBottom 是有用的 但是edittext字体sp != dp 不太好写布局 | |
| 2.stateHidden|adjustResize 或者 adjustPan 选一种 前者是页面允许压缩 但是我的页面比较紧凑不太合适 所以只有用 adjustPan | |
| 3.接着想是不是监听键盘展开收起 试着ConstraintLayout外层添加滑动布局让其滑动到一定的高度呢? | |
| ScrollView scrollto (0,height) 不管用 试了很久 忽然想到 是不是ScrollView android:layout_height="match_parent" 导致的? | |
| 又尝试了很久。。。 |
This file contains hidden or 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.AndroidX migrate dependency / libraries | |
| I solved this issue by deleting .idea folder and syncing project again. | |
| https://stackoverflow.com/questions/52518935/androidx-migrate-dependency-libraries | |
| 2.After migrating to androidx: Didn't find class “androidx.constraintlayout.ConstraintLayout” on path: DexPathList | |
| https://stackoverflow.com/questions/54757911/after-migrating-to-androidx-didnt-find-class-androidx-constraintlayout-constr | |
| 3.Databinding kotlin |
This file contains hidden or 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
| override fun getItemCount(): Int { | |
| return Int.MAX_VALUE | |
| } | |
| override fun onBindViewHolder(holder: CustomPlanViewHolder, position: Int) { | |
| if (list.isNotEmpty()) { | |
| holder.bind(list[position % list.size]) | |
| } | |
| } |
This file contains hidden or 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
| fun RecyclerView.attachSnapHelperWithListener( | |
| snapHelper: SnapHelper, | |
| onSnapPositionChangeListener: Utils.OnSnapPositionChangeListener) { | |
| snapHelper.attachToRecyclerView(this) | |
| val snapOnScrollListener = SnapOnScrollListener(snapHelper, onSnapPositionChangeListener) | |
| addOnScrollListener(snapOnScrollListener) | |
| } | |
| fun SnapHelper.getSnapPosition(recyclerView: RecyclerView): Int { | |
| val layoutManager = recyclerView.layoutManager ?: return RecyclerView.NO_POSITION |
This file contains hidden or 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
| class SnapOnScrollListener( | |
| private val snapHelper: SnapHelper, | |
| var onSnapPositionChangeListener: Utils.OnSnapPositionChangeListener? = null | |
| ) : RecyclerView.OnScrollListener() { | |
| private var snapPosition = RecyclerView.NO_POSITION | |
| override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { | |
| /*val snapPosition = snapHelper.getSnapPosition(recyclerView) | |
| val snapPositionChanged = this.snapPosition != snapPosition |
This file contains hidden or 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
| class CenterZoomLinearLayoutManager(context: Context) | |
| : LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false) { | |
| override fun onLayoutCompleted(state: RecyclerView.State?) { | |
| super.onLayoutCompleted(state) | |
| scaleChildren() | |
| } | |
| override fun scrollHorizontallyBy(dx: Int, recycler: RecyclerView.Recycler?, state: RecyclerView.State?): Int { | |
| return if (orientation == HORIZONTAL) { |