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 checkout 你的分支名 | |
| git checkout -b feat/only-config | |
| git ls-files -z | grep -zvE '\.(json|yml|yaml|env|conf|ini|properties)$' | xargs -0I{} git checkout develop -- {} 2>/dev/null | |
| git add . | |
| git commit -m "chore: 仅配置改动,代码恢复到 develop" | |
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 diff develop --name-only | grep -vE "\.(java|kt)$" | xargs git checkout develop -- | |
| # 查看你改的 Java + Kotlin 文件 | |
| git diff develop --name-only --diff-filter=AM | grep -E "\.(java|kt)$" | |
| # 导出到文件夹 | |
| mkdir my-changes | |
| git diff develop --name-only --diff-filter=AM | grep -E "\.(java|kt)$" | xargs cp -t my-changes/ |
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 checkout 你的分支名 | |
| # 新建纯配置分支 | |
| git checkout -b feat/only-config | |
| # 把【除配置外的所有文件】恢复成 develop(配置不动) | |
| git checkout develop -- $(git ls-files | grep -vE '\.(json|yml|yaml|env|conf|ini|properties)$') | |
| # 提交 |
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 checkout 你的分支名 | |
| # 新建纯代码分支 | |
| git checkout -b feat/only-code | |
| # 把【所有配置文件】恢复成 develop 的版本(代码不动) | |
| git checkout develop -- $(git ls-files | grep -E '\.(json|yml|yaml|env|conf|ini|properties)$') | |
| # 提交 |
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
| #!/bin/bash | |
| set -euo pipefail | |
| # ============================================================================== | |
| # 功能: | |
| # 1. 使用 git worktree 完全隔离环境,不污染原仓库 | |
| # 2. 保留完整 commit 历史、信息、作者、时间 | |
| # 3. 自动拆分为「代码分支」+「配置分支」 | |
| # 4. 自动验证文件不丢失、内容完全一致 | |
| # 5. 无论成功/失败/中断,都自动清理 worktree,不留垃圾 |
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
| package com.pplive.archcomponent.jetpack.livedata; | |
| import androidx.lifecycle.Lifecycle; | |
| import androidx.lifecycle.LifecycleOwner; | |
| import androidx.lifecycle.Observer; | |
| import android.os.Handler; | |
| import android.os.Looper; | |
| import androidx.annotation.NonNull; | |
| import java.util.HashMap; |
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
| /* | |
| * Copyright (C) 2017 The Android Open Source Project | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
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
| /** | |
| * 当有很多用户同时登入和登出时, | |
| * onUserSignIn() 和 onUserSignOut() 就会有很多线程同时调用 | |
| */ | |
| class UserMgr private constructor() { | |
| private val userMap: ConcurrentHashMap<String, User> = ConcurrentHashMap<String, User>() | |
| companion object { | |
| private val instance by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { UserMgr() } |
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 PreDelegate<T>( | |
| private val name: String, | |
| private val default: T, | |
| private val isCommit: Boolean = false, | |
| private val prefs: SharedPreferences | |
| ) { | |
| operator fun getValue(thisRef: Any?, property: KProperty<*>): T { | |
| return getPref(name, default) ?: default | |
| } |
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 LiveDataBus { | |
| private static LiveDataBus liveDataBus; | |
| //应用中所有数据持有类的集合 | |
| private Map<String,MyMutableLiveData<Object>> map; | |
| private LiveDataBus(){ | |
| map=new HashMap<>(); |
NewerOlder