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
| git init # 初始化本地git仓库(创建新仓库) | |
| git config --global user.name "xxx" # 配置用户名 | |
| git config --global user.email "xxx@xxx.com" # 配置邮件 | |
| git config --global color.ui true # git status等命令自动着色 | |
| git config --global color.status auto | |
| git config --global color.diff auto | |
| git config --global color.branch auto | |
| git config --global color.interactive auto | |
| git config --global --unset http.proxy # remove proxy configuration on git | |
| git clone git+ssh://git@192.168.53.168/VT.git # clone远程仓库 |
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
| var snapHelper: LinearSnapHelper = object : LinearSnapHelper() { | |
| override fun findTargetSnapPosition(layoutManager: RecyclerView.LayoutManager?, velocityX: Int, velocityY: Int): Int { | |
| val centerView = findSnapView(layoutManager!!) ?: return RecyclerView.NO_POSITION | |
| val position = layoutManager.getPosition(centerView) | |
| var targetPosition = -1 | |
| if (layoutManager.canScrollHorizontally()) { | |
| targetPosition = if (velocityX < 0) { | |
| position - 1 | |
| } else { | |
| position + 1 |
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) { |
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
| 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
| 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
| 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
| 遇到的问题 | |
| 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
| 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
| 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) { |
OlderNewer