├── .gitignore ├── APPTest ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── bihe0832 │ │ └── android │ │ └── test │ │ ├── DebugMainActivity.kt │ │ ├── DebugMainFragment.java │ │ ├── DebugSplashActivity.kt │ │ ├── module │ │ ├── DebugCommonFragment.kt │ │ ├── DebugGamesFragment.kt │ │ ├── DebugLogActivity.kt │ │ ├── DebugRouterFragment.kt │ │ └── DebugTempFragment.kt │ │ └── widget │ │ └── DebugWidget.kt │ └── res │ ├── mipmap-xxhdpi │ └── icon.png │ └── values │ └── strings.xml ├── AndResGuard-cli-1.2.0.jar ├── Application ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── assets │ ├── app.ini │ ├── config.default │ └── web │ │ ├── author.html │ │ └── zixie_shi.jpg │ ├── java │ └── com │ │ └── bihe0832 │ │ └── android │ │ └── app │ │ ├── AppFactoryInit.kt │ │ ├── Application.java │ │ ├── about │ │ ├── AboutActivity.kt │ │ └── AboutFragment.kt │ │ ├── api │ │ └── NetWorkApi.kt │ │ ├── constants │ │ └── ConfigConstants.java │ │ ├── dialog │ │ └── AAFUniqueDialogManager.kt │ │ ├── encrypt │ │ ├── AAFEncrypt.java │ │ ├── AAFEncryptConstants.java │ │ └── AAFEncryptResult.java │ │ ├── log │ │ └── AAFLoggerFile.kt │ │ ├── message │ │ ├── AAFMessageActivity.java │ │ ├── AAFMessageListFragment.kt │ │ ├── AAFMessageManager.kt │ │ └── BaseActivityWrapperForMessage.kt │ │ ├── permission │ │ └── PermissionManagerWrapper.kt │ │ ├── router │ │ ├── RouterConstants.java │ │ ├── RouterHelper.kt │ │ └── RouterHelperWrapper.kt │ │ ├── tools │ │ └── AAFTools.kt │ │ ├── ui │ │ ├── AAFCommonMainActivity.kt │ │ └── navigation │ │ │ ├── AAFNavigationActivityWrapperForNavigation.kt │ │ │ ├── AAFNavigationContentFragment.kt │ │ │ └── AAFNavigationDrawerFragment.kt │ │ └── update │ │ └── UpdateManager.kt │ └── res │ ├── drawable-xxhdpi │ └── empty.9.png │ ├── drawable │ ├── icon_camera.xml │ ├── icon_cloud.xml │ ├── icon_cycle.xml │ └── icon_qr_code_scanner.xml │ ├── values-v19 │ └── fade_integer.xml │ └── values │ ├── common_res.xml │ └── file_path.xml ├── BaseAdbInput ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── bihe0832 │ │ └── android │ │ └── base │ │ └── adb │ │ └── input │ │ ├── ZixieIME.java │ │ ├── config │ │ └── InputSwitchConfig.kt │ │ ├── keyboard │ │ ├── InputManager.kt │ │ └── InputToolBarActionListener.kt │ │ ├── service │ │ └── AdbReceiver.java │ │ ├── settings │ │ ├── InputSettingsActivity.kt │ │ └── InputSettingsFragment.kt │ │ ├── switcher │ │ └── InputSwitchTools.kt │ │ ├── tools │ │ └── InputWrapper.kt │ │ └── ui │ │ └── InputToolsBar.kt │ └── res │ ├── drawable │ ├── keyboard_bg.xml │ ├── keyboard_enter_bg.xml │ ├── keyboard_enter_bg_default.xml │ ├── keyboard_enter_bg_pressed.xml │ ├── keyboard_setting_item_bg.xml │ ├── keyboard_setting_item_bg_default.xml │ └── keyboard_setting_item_bg_pressed.xml │ ├── layout │ ├── fragment_input_settings.xml │ ├── layout_input_keyboard_global.xml │ └── layout_input_toolbar.xml │ ├── mipmap │ ├── help.png │ ├── key_back.png │ ├── key_change.png │ ├── key_clear.png │ ├── key_enter.png │ ├── key_hide.png │ ├── key_locat.png │ ├── key_setting.png │ └── key_switch.png │ ├── values │ ├── colors.xml │ └── dimens.xml │ └── xml │ └── method.xml ├── BaseCard ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── bihe0832 │ │ └── android │ │ └── base │ │ └── card │ │ ├── apk │ │ ├── APPItemData.kt │ │ └── APPItemHolder.kt │ │ ├── m3u8 │ │ ├── M3U8ViewData.java │ │ └── M3U8ViewHolder.java │ │ ├── photo │ │ ├── IconTextData.java │ │ └── IconTextHolder.java │ │ └── tips │ │ ├── TipsData.java │ │ └── TipsHolder.java │ └── res │ ├── drawable │ └── card_apk_corner.xml │ └── layout │ ├── card_apk_info.xml │ ├── card_m3u8_list_item.xml │ ├── card_puzzle_item.xml │ └── card_tips.xml ├── BaseDebug ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── bihe0832 │ └── android │ └── base │ └── debug │ └── webview │ ├── DebugM3U8Fragment.kt │ └── DebugWebviewFragment.kt ├── BaseGame ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── bihe0832 │ └── android │ └── base │ └── game │ ├── GameWrapper.java │ └── ui │ └── BaseShakeGameFragment.java ├── BaseGameDice ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── bihe0832 │ │ └── android │ │ └── base │ │ └── dice │ │ ├── DiceConfig.kt │ │ └── DiceFragment.java │ └── res │ ├── layout │ └── com_bihe0832_base_dice.xml │ ├── mipmap-xxhdpi │ ├── dice_1.png │ ├── dice_2.png │ ├── dice_3.png │ ├── dice_4.png │ ├── dice_5.png │ ├── dice_6.png │ └── dice_barrel.png │ └── values │ └── com_bihe0832_base_dice_res.xml ├── BaseGamePuzzle ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── bihe0832 │ │ └── android │ │ └── base │ │ └── puzzle │ │ ├── PuzzleGameManager.kt │ │ ├── PuzzleGameMode.java │ │ ├── ui │ │ ├── GameActivity.kt │ │ ├── PuzzleGameMainFragment.kt │ │ └── PuzzlePhotosFragment.kt │ │ └── view │ │ ├── ImagePiece.java │ │ └── PuzzleLayout.java │ └── res │ ├── drawable │ └── game_button_bg.xml │ ├── layout │ └── fragment_puzzle_game_main.xml │ └── values │ ├── colors.xml │ └── strings.xml ├── BaseM3U8 ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── bihe0832 │ │ └── android │ │ └── base │ │ └── m3u8 │ │ ├── M3U8Listener.kt │ │ ├── M3U8ModuleManager.kt │ │ ├── M3u8DownloadActivity.kt │ │ ├── bean │ │ ├── M3U8Info.kt │ │ └── M3U8TSInfo.java │ │ ├── db │ │ ├── M3U8DBManager.kt │ │ ├── M3U8InfoDBHelper.java │ │ └── M3U8InfoTableModel.java │ │ ├── history │ │ ├── M3U8ListFragment.kt │ │ └── M3U8ListLiveData.kt │ │ └── tools │ │ ├── M3U8DownloadImpl.kt │ │ └── M3U8Tools.kt │ └── res │ └── layout │ ├── fragment_m3u8_list.xml │ └── m3u8_activity_download.xml ├── BasePhotos ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── bihe0832 │ │ └── android │ │ └── base │ │ └── photos │ │ └── PhotosSelectFragment.kt │ └── res │ └── values │ ├── colors.xml │ └── strings.xml ├── LICENSE ├── PubAdbInput ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── bihe0832 │ │ └── android │ │ └── app │ │ └── browser │ │ └── SplashActivity.kt │ └── res │ ├── mipmap-xxhdpi │ └── icon.png │ └── values │ └── strings.xml ├── PubBrowser ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── bihe0832 │ │ └── android │ │ └── app │ │ └── browser │ │ ├── BrowserFragment.kt │ │ ├── BrowserListActivity.kt │ │ ├── MainActivity.kt │ │ └── SplashActivity.kt │ └── res │ ├── layout │ ├── activity_browser_list.xml │ └── activity_browser_main.xml │ ├── mipmap-xxhdpi │ └── icon.png │ └── values │ └── strings.xml ├── PubGamePuzzle ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── bihe0832 │ │ └── android │ │ └── app │ │ └── puzzle │ │ ├── MainActivity.kt │ │ ├── MainFragment.kt │ │ ├── SplashActivity.kt │ │ └── navigation │ │ ├── PuzzleNavigationContentFragment.kt │ │ ├── PuzzleNavigationDrawerFragment.kt │ │ └── PuzzlePermissionFragment.kt │ └── res │ ├── layout │ └── fragment_puzzle_main.xml │ ├── mipmap-xxhdpi │ └── icon.jpg │ └── values │ └── strings.xml ├── PubGameShakeba ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── bihe0832 │ │ └── android │ │ └── app │ │ └── shakeba │ │ ├── MainActivity.kt │ │ └── SplashActivity.kt │ └── res │ ├── mipmap-xxhdpi │ └── icon.png │ └── values │ └── strings.xml ├── PubGetAPKInfo ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── bihe0832 │ │ └── android │ │ └── app │ │ └── apk │ │ ├── MainActivity.kt │ │ ├── MainFragment.kt │ │ ├── SplashActivity.kt │ │ └── navigation │ │ ├── APKNavigationContentFragment.kt │ │ ├── APKNavigationDrawerFragment.kt │ │ └── APKPermissionFragment.kt │ └── res │ ├── mipmap-xxhdpi │ └── icon.png │ └── values │ └── strings.xml ├── PubM3U8 ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── bihe0832 │ │ └── android │ │ └── app │ │ └── m3u8 │ │ ├── MainActivity.kt │ │ └── SplashActivity.kt │ └── res │ ├── mipmap-xxhdpi │ └── icon.jpg │ └── values │ ├── colors_teal_indigo.xml │ └── strings.xml ├── README.md ├── build.gradle ├── build_apk.sh ├── build_module.gradle ├── build_new.sh ├── config.gradle ├── debug.keystore ├── dependencies.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── mapping.txt ├── mapping_resource.txt ├── proguard-rules-common.pro ├── proguard-rules-resource.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | ###################### 2 | # 解决java产生文件 3 | ###################### 4 | *.class 5 | 6 | ###################### 7 | # 解决maven产生的文件 8 | ###################### 9 | target/ 10 | **/target/ 11 | pom.xml.tag 12 | pom.xml.releaseBackup 13 | pom.xml.versionsBackup 14 | pom.xml.next 15 | release.properties 16 | dependency-reduced-pom.xml 17 | buildNumber.properties 18 | .mvn/timing.properties 19 | 20 | ###################### 21 | # 解决各类编辑器自动产生的文件 22 | ###################### 23 | *.iml 24 | .idea/ 25 | /out/ 26 | /target/ 27 | .idea_modules/ 28 | local.properties 29 | 30 | ###################### 31 | # gradle 32 | ###################### 33 | .gradle 34 | 35 | ###################### 36 | # android 37 | ###################### 38 | build 39 | captures 40 | gradle.properties 41 | .externalNativeBuild 42 | 43 | ###################### 44 | # mac 45 | ###################### 46 | .DS_Store 47 | bin -------------------------------------------------------------------------------- /APPTest/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | apply plugin: 'kotlin-kapt' 5 | // 不同类型的包,仅仅修改下面两项即可,其余内容保持一致 6 | project.ext.applicationID = "com.bihe0832.android.app.test" 7 | project.ext.applicationPrefix = "ZSample" 8 | project.ext.routerSchema = "ztest" 9 | project.ext.applicationName = project.ext.applicationPrefix + "内测" 10 | project.ext.test_activity_name = project.ext.applicationPrefix + "调试" 11 | 12 | android { 13 | compileSdkVersion project.compileSdkVersion 14 | buildToolsVersion project.buildToolsVersion 15 | 16 | defaultConfig { 17 | applicationId applicationID 18 | minSdkVersion project.appMinSdkVersion 19 | targetSdkVersion project.targetSdkVersion 20 | versionName project.versionName 21 | versionCode project.versionCode 22 | vectorDrawables.useSupportLibrary = true 23 | multiDexEnabled true 24 | 25 | } 26 | 27 | packagingOptions { 28 | project.ndk_abiFilters_project.split(",").each { abiItem -> 29 | def finalDoNotStripFileName = "*/" + abiItem + "/*.so" 30 | doNotStrip finalDoNotStripFileName 31 | } 32 | 33 | project.ndk_abiFilters_all.split(",").each { abiItem -> 34 | project.pickFirstList.each { item -> 35 | def finalPickFirstFileName = "lib/" + abiItem + "/" + item 36 | pickFirst finalPickFirstFileName 37 | } 38 | } 39 | 40 | project.excludeList.each { item -> 41 | exclude item 42 | } 43 | } 44 | 45 | lintOptions { 46 | abortOnError false 47 | } 48 | 49 | signingConfigs { 50 | debug { 51 | keyAlias project.signingConfigs.keyAlias 52 | keyPassword project.signingConfigs.keyPassword 53 | storeFile file(project.signingConfigs.storeFile) 54 | storePassword project.signingConfigs.storePassword 55 | v1SigningEnabled project.signingConfigs.v1SigningEnabled as boolean 56 | v2SigningEnabled project.signingConfigs.v2SigningEnabled as boolean 57 | } 58 | 59 | release { 60 | keyAlias project.signingConfigs.keyAlias 61 | keyPassword project.signingConfigs.keyPassword 62 | storeFile file(project.signingConfigs.storeFile) 63 | storePassword project.signingConfigs.storePassword 64 | v1SigningEnabled project.signingConfigs.v1SigningEnabled as boolean 65 | v2SigningEnabled project.signingConfigs.v2SigningEnabled as boolean 66 | } 67 | } 68 | 69 | archivesBaseName = applicationPrefix + "_V${defaultConfig.versionName}_${defaultConfig.versionCode}" 70 | 71 | buildTypes { 72 | debug { 73 | resValue "string", "app_name", applicationName 74 | resValue "string", "router_schema", routerSchema 75 | resValue "string", "test_activity_name", test_activity_name 76 | 77 | signingConfig signingConfigs.debug 78 | minifyEnabled false 79 | shrinkResources false 80 | } 81 | 82 | release { 83 | resValue "string", "app_name", applicationName 84 | resValue "string", "router_schema", routerSchema 85 | resValue "string", "test_activity_name", test_activity_name 86 | 87 | signingConfig signingConfigs.release 88 | minifyEnabled project.minifyEnabled as boolean 89 | proguardFiles "./../proguard-rules-common.pro" 90 | shrinkResources false 91 | } 92 | } 93 | } 94 | 95 | -------------------------------------------------------------------------------- /APPTest/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 17 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 35 | 36 | 37 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /APPTest/src/main/java/com/bihe0832/android/test/DebugMainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.test 2 | 3 | import android.Manifest 4 | import android.os.Build 5 | import android.os.Bundle 6 | import android.os.StrictMode 7 | import com.bihe0832.android.app.router.RouterConstants 8 | import com.bihe0832.android.app.ui.AAFCommonMainActivity 9 | import com.bihe0832.android.lib.adapter.CardInfoHelper 10 | import com.bihe0832.android.lib.immersion.hideBottomUIMenu 11 | import com.bihe0832.android.lib.permission.PermissionManager 12 | import com.bihe0832.android.lib.router.annotation.APPMain 13 | import com.bihe0832.android.lib.router.annotation.Module 14 | import com.bihe0832.android.lib.sqlite.impl.CommonDBManager 15 | import com.bihe0832.android.lib.utils.os.BuildUtils 16 | import com.bihe0832.android.test.widget.DebugWidget 17 | 18 | @APPMain 19 | @Module(RouterConstants.MODULE_NAME_DEBUG) 20 | class DebugMainActivity : AAFCommonMainActivity() { 21 | override fun onCreate(savedInstanceState: Bundle?) { 22 | super.onCreate(savedInstanceState) 23 | initToolbar(R.id.common_toolbar, "DebugMainActivity", false, needBack = true, iconRes = R.drawable.ic_left_arrow) 24 | if (BuildUtils.SDK_INT > Build.VERSION_CODES.GINGERBREAD) { 25 | StrictMode.setThreadPolicy(StrictMode.ThreadPolicy.Builder().permitAll().build()) 26 | } 27 | 28 | CardInfoHelper.getInstance().setAutoAddItem(true) 29 | 30 | PermissionManager.addPermissionGroupDesc(HashMap().apply { 31 | put(Manifest.permission.WRITE_EXTERNAL_STORAGE, "访问存储卡") 32 | }) 33 | 34 | PermissionManager.addPermissionGroupScene(HashMap().apply { 35 | put(Manifest.permission.WRITE_EXTERNAL_STORAGE, "存储权限测试") 36 | }) 37 | hideBottomUIMenu() 38 | CommonDBManager.init(this) 39 | DebugWidget.showAddDebugWidgetTips(this) 40 | } 41 | 42 | 43 | override fun getRootFragmentClassName(): String { 44 | return DebugMainFragment::class.java.name 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /APPTest/src/main/java/com/bihe0832/android/test/DebugMainFragment.java: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.test; 2 | 3 | import androidx.fragment.app.Fragment; 4 | 5 | import com.bihe0832.android.test.module.DebugCommonFragment; 6 | import com.bihe0832.android.test.module.DebugRouterFragment; 7 | import com.bihe0832.android.test.module.DebugTempFragment; 8 | 9 | 10 | /** 11 | * Created by zixie on 16/6/30. 12 | */ 13 | public class DebugMainFragment extends com.bihe0832.android.common.debug.DebugMainFragment { 14 | 15 | private static final String TAB_FOR_DEV_COMMON = "通用调试"; 16 | private static final String TAB_FOR_DEV_TEMP = "临时调试"; 17 | private static final String TAB_FOR_ROUTER = "路由测试"; 18 | private static final String TAB_FOR_DEV = "开发测试"; 19 | 20 | public DebugMainFragment() { 21 | super(new String[]{ 22 | TAB_FOR_DEV_COMMON, TAB_FOR_DEV_TEMP, TAB_FOR_ROUTER, TAB_FOR_DEV 23 | }); 24 | } 25 | 26 | private final boolean isDev = true; 27 | 28 | protected Fragment getFragmentByIndex(String title) { 29 | if (title.equals(TAB_FOR_DEV)) { 30 | return new DebugTempFragment(); 31 | } else if (title.equals(TAB_FOR_DEV_TEMP)) { 32 | return new DebugTempFragment(); 33 | } else if (title.equals(TAB_FOR_DEV_COMMON)) { 34 | return new DebugCommonFragment(); 35 | } else if (title.equals(TAB_FOR_ROUTER)) { 36 | return new DebugRouterFragment(); 37 | } else { 38 | return new DebugCommonFragment(); 39 | } 40 | } 41 | 42 | @Override 43 | protected int getDefaultTabIndex() { 44 | if (isDev) { 45 | return mTabString.length - 1; 46 | } else { 47 | return 0; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /APPTest/src/main/java/com/bihe0832/android/test/DebugSplashActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.test 2 | 3 | import android.os.Bundle 4 | import com.bihe0832.android.app.AppFactoryInit 5 | import com.bihe0832.android.app.router.RouterConstants 6 | import com.bihe0832.android.common.splash.SplashActivity 7 | import com.bihe0832.android.lib.router.annotation.APPMain 8 | import com.bihe0832.android.lib.router.annotation.Module 9 | 10 | @APPMain 11 | @Module(RouterConstants.MODULE_NAME_SPLASH) 12 | class DebugSplashActivity : SplashActivity() { 13 | 14 | override fun onCreate(savedInstanceState: Bundle?) { 15 | super.onCreate(savedInstanceState) 16 | } 17 | 18 | override fun doNext() { 19 | AppFactoryInit.initAll(application) 20 | super.doNext() 21 | } 22 | 23 | override fun getMainRouter(): String { 24 | return RouterConstants.MODULE_NAME_DEBUG 25 | } 26 | } -------------------------------------------------------------------------------- /APPTest/src/main/java/com/bihe0832/android/test/module/DebugCommonFragment.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.test.module 2 | 3 | import android.view.View 4 | import com.bihe0832.android.common.debug.device.DebugDeviceFragment 5 | import com.bihe0832.android.common.debug.device.getMobileInfo 6 | import com.bihe0832.android.common.debug.item.getDebugItem 7 | import com.bihe0832.android.common.debug.item.getTipsItem 8 | import com.bihe0832.android.common.debug.log.DebugLogActivity 9 | import com.bihe0832.android.common.debug.module.DebugCommonFragment 10 | import com.bihe0832.android.framework.ZixieContext 11 | import com.bihe0832.android.lib.adapter.CardBaseModule 12 | 13 | open class DebugCommonFragment : DebugCommonFragment() { 14 | 15 | override fun getDataList(): ArrayList { 16 | return ArrayList().apply { 17 | add(getTipsItem("APPFactory的通用组件和工具")) 18 | add(getDebugItem("查看应用版本及环境", View.OnClickListener { showAPPInfo() })) 19 | add(getDebugItem("查看使用情况", View.OnClickListener { showUsedInfo() })) 20 | add(getDebugItem("查看设备概要信息", View.OnClickListener { showInfoWithHTML("设备概要信息", getMobileInfo(context)) })) 21 | add(getDebugFragmentItemData("查看设备详细信息", DebugDeviceFragment::class.java)) 22 | add(getDebugItem("日志管理", View.OnClickListener { startActivityWithException(DebugLogActivity::class.java) })) 23 | add(getTipsItem("AAF 支持的应用")) 24 | add(getDebugFragmentItemData("AAF 支持的小游戏", DebugGamesFragment::class.java)) 25 | 26 | add(getDebugItem("应用信息获取") { 27 | openNew("com.bihe0832.android.app.apk.MainActivity") 28 | }) 29 | 30 | add(getDebugItem("ADB 输入") { 31 | openNew("com.bihe0832.android.app.apk.MainActivity") 32 | }) 33 | 34 | add(getDebugItem("来拼图") { 35 | openNew("com.bihe0832.android.app.puzzle.MainActivity") 36 | }) 37 | 38 | add(getDebugItem("M3U8下载器") { 39 | openNew("com.bihe0832.android.app.m3u8.MainActivity") 40 | }) 41 | 42 | } 43 | } 44 | 45 | fun openNew(activityName: String) { 46 | try { 47 | startActivityWithException(activityName) 48 | } catch (e: Exception) { 49 | e.printStackTrace() 50 | ZixieContext.showDebug("APP模块未集成") 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /APPTest/src/main/java/com/bihe0832/android/test/module/DebugGamesFragment.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.test.module 2 | 3 | import com.bihe0832.android.base.dice.DiceFragment 4 | import com.bihe0832.android.base.game.GameWrapper 5 | import com.bihe0832.android.base.puzzle.ui.PuzzleGameMainFragment 6 | import com.bihe0832.android.common.debug.item.DebugItemData 7 | import com.bihe0832.android.common.debug.item.getDebugItem 8 | import com.bihe0832.android.common.debug.item.getTipsItem 9 | import com.bihe0832.android.framework.ZixieContext 10 | import com.bihe0832.android.lib.adapter.CardBaseModule 11 | 12 | open class DebugGamesFragment : DebugCommonFragment() { 13 | 14 | override fun getDataList(): ArrayList { 15 | return ArrayList().apply { 16 | add(getTipsItem("APPFactory支持的一些小游戏应用")) 17 | add(getGameFragmentItemData("摇骰子", DiceFragment::class.java)) 18 | add(getGameFragmentItemData("来拼图", PuzzleGameMainFragment::class.java)) 19 | } 20 | } 21 | 22 | fun getGameFragmentItemData(content: String, clazz: Class<*>): DebugItemData { 23 | return getDebugItem(content) { GameWrapper.startGame(ZixieContext.applicationContext, clazz, content) } 24 | } 25 | } -------------------------------------------------------------------------------- /APPTest/src/main/java/com/bihe0832/android/test/module/DebugLogActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.test.module 2 | 3 | import androidx.recyclerview.widget.RecyclerView 4 | import com.bihe0832.android.app.log.AAFLoggerFile 5 | import com.bihe0832.android.common.debug.item.DebugItemData 6 | import com.bihe0832.android.common.debug.log.DebugLogActivity 7 | import com.bihe0832.android.common.debug.log.SectionDataContent 8 | import com.bihe0832.android.common.debug.log.SectionDataHeader 9 | import com.bihe0832.android.common.webview.core.WebViewLoggerFile 10 | import com.bihe0832.android.framework.ZixieContext 11 | import com.bihe0832.android.framework.router.RouterInterrupt 12 | import com.bihe0832.android.lib.adapter.CardBaseModule 13 | import com.bihe0832.android.lib.file.select.FileSelectTools 14 | import com.bihe0832.android.lib.ui.recycleview.ext.SafeGridLayoutManager 15 | 16 | 17 | class DebugLogActivity : DebugLogActivity() { 18 | override fun getLayoutManagerForList(): RecyclerView.LayoutManager { 19 | return SafeGridLayoutManager(this, 3) 20 | } 21 | 22 | override fun getTempData(): List { 23 | return mutableListOf().apply { 24 | add(SectionDataHeader("通用日志工具")) 25 | add(getOpenLogItem()) 26 | // add(DebugItemData("上传日志") { }) 27 | add(SectionDataHeader("基础通用日志")) 28 | add(SectionDataContent("路由跳转", RouterInterrupt.getRouterLogPath())) 29 | add(SectionDataContent("Webview", WebViewLoggerFile.getWebviewLogPath())) 30 | add(SectionDataContent("应用更新", AAFLoggerFile.getLogPathByModuleName(AAFLoggerFile.MODULE_UPDATE))) 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /APPTest/src/main/java/com/bihe0832/android/test/module/DebugRouterFragment.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.test.module 2 | 3 | import com.bihe0832.android.app.router.RouterConstants 4 | import com.bihe0832.android.app.router.RouterHelper 5 | import com.bihe0832.android.common.debug.item.DebugItemData 6 | import com.bihe0832.android.common.debug.item.getRouterItem 7 | 8 | 9 | class DebugRouterFragment : com.bihe0832.android.common.debug.module.DebugRouterFragment() { 10 | 11 | override fun getRouterList(): ArrayList { 12 | return ArrayList().apply { 13 | add(getRouterItem("zixie://zweb?url=https%3A%2F%2Fblog.bihe0832.com")) 14 | add(getRouterItem("zixie://zfeedback?url=https%3A%2F%2Fsupport.qq.com%2Fproduct%2F290858")) 15 | add(getRouterItem((RouterHelper.getFinalURL(RouterConstants.MODULE_NAME_BASE_ABOUT)))) 16 | add(getRouterItem("zm3u8://m3u8")) 17 | add(getRouterItem("zm3u8://m3u8list")) 18 | add(getRouterItem(RouterHelper.getFinalURL(RouterConstants.MODULE_NAME_INPUT_GUIDE))) 19 | add(getRouterItem(RouterHelper.getFinalURL(RouterConstants.MODULE_NAME_MESSAGE))) 20 | } 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /APPTest/src/main/java/com/bihe0832/android/test/module/DebugTempFragment.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.test.module 2 | 3 | import com.bihe0832.android.app.router.RouterConstants 4 | import com.bihe0832.android.app.router.RouterHelper 5 | import com.bihe0832.android.base.debug.webview.DebugM3U8Fragment 6 | import com.bihe0832.android.base.debug.webview.DebugWebviewFragment 7 | import com.bihe0832.android.common.debug.base.BaseDebugListFragment 8 | import com.bihe0832.android.common.debug.item.getDebugItem 9 | import com.bihe0832.android.lib.adapter.CardBaseModule 10 | import com.bihe0832.android.lib.sqlite.impl.CommonDBManager 11 | import com.bihe0832.android.lib.utils.intent.IntentUtils 12 | 13 | class DebugTempFragment : BaseDebugListFragment() { 14 | val LOG_TAG = "DebugTempFragment" 15 | 16 | override fun getDataList(): ArrayList { 17 | return ArrayList().apply { 18 | add(getDebugItem("简单测试函数") { testFunc() }) 19 | add(getDebugItem("通用测试预处理") { preTest() }) 20 | add(getDebugItem("测试自定义请求") { testOneRequest() }) 21 | add(getDebugItem("默认关于页") { RouterHelper.openPageByRouter(RouterConstants.MODULE_NAME_BASE_ABOUT) }) 22 | add(getDebugItem("APP设置") { IntentUtils.startAppDetailSettings(context) }) 23 | add(getDebugFragmentItemData("WebView 调试", DebugWebviewFragment::class.java)) 24 | add(getDebugFragmentItemData("M3U8 调试", DebugM3U8Fragment::class.java)) 25 | } 26 | } 27 | 28 | private fun testOneRequest() { 29 | } 30 | 31 | private fun preTest() { 32 | CommonDBManager.getData("sss") 33 | 34 | 35 | } 36 | 37 | private fun testFunc() { 38 | // CommonDBManager.saveData("sss", "Fsdfsd") 39 | } 40 | 41 | 42 | } -------------------------------------------------------------------------------- /APPTest/src/main/java/com/bihe0832/android/test/widget/DebugWidget.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.test.widget 2 | 3 | import android.content.Context 4 | import com.bihe0832.android.app.dialog.AAFUniqueDialogManager 5 | import com.bihe0832.android.common.debug.R 6 | import com.bihe0832.android.common.debug.widget.app.AAFDebugWidgetProviderDetail 7 | import com.bihe0832.android.common.debug.widget.app.AAFDebugWidgetProviderSimple 8 | import com.bihe0832.android.common.debug.widget.device.AAFDebugWidgetProviderDevice 9 | import com.bihe0832.android.framework.ZixieContext 10 | import com.bihe0832.android.lib.config.Config 11 | import com.bihe0832.android.lib.ui.dialog.callback.OnDialogListener 12 | import com.bihe0832.android.lib.widget.tools.WidgetTools 13 | 14 | /** 15 | * 16 | * @author zixie code@bihe0832.com 17 | * Created on 2023/6/15. 18 | * Description: Description 19 | * 20 | */ 21 | 22 | object DebugWidget { 23 | 24 | private var hasShow = false 25 | private val CONFIG_KEY_HAS_REFUSE = "DebugWidget" 26 | fun showAddDebugWidgetTips(context: Context) { 27 | if (!hasShow && !ZixieContext.isOfficial() && 28 | !Config.isSwitchEnabled(CONFIG_KEY_HAS_REFUSE, false) && 29 | !WidgetTools.hasAddWidget(context, AAFDebugWidgetProviderDetail::class.java) && 30 | !WidgetTools.hasAddWidget(context, AAFDebugWidgetProviderSimple::class.java) && 31 | !WidgetTools.hasAddWidget(context, AAFDebugWidgetProviderDevice::class.java) 32 | ) { 33 | hasShow = true 34 | AAFUniqueDialogManager.tipsUniqueDialogManager.showUniqueDialog( 35 | context, 36 | CONFIG_KEY_HAS_REFUSE, 37 | "调试优化", 38 | "为提高开发调试效率," + context.resources.getString(R.string.app_name) + "已支持在主界面添加调试组件快速查看基本信息,是否立即添加?", 39 | "立即添加", 40 | "稍后添加", 41 | true, 42 | object : OnDialogListener { 43 | override fun onPositiveClick() { 44 | WidgetTools.addWidgetToHome(context, AAFDebugWidgetProviderDetail::class.java) 45 | } 46 | 47 | override fun onNegativeClick() { 48 | Config.writeConfig(CONFIG_KEY_HAS_REFUSE, Config.VALUE_SWITCH_ON) 49 | } 50 | 51 | override fun onCancel() { 52 | } 53 | }, 54 | ) 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /APPTest/src/main/res/mipmap-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/APPTest/src/main/res/mipmap-xxhdpi/icon.png -------------------------------------------------------------------------------- /APPTest/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | https://cdn.bihe0832.com/app/update/get_apk.json 3 | https://cdn.bihe0832.com/app/help/zapk.html 4 | https://cdn.bihe0832.com/app/msg/aaf_msg_debug.json 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /AndResGuard-cli-1.2.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/AndResGuard-cli-1.2.0.jar -------------------------------------------------------------------------------- /Application/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-kapt' 4 | 5 | android { 6 | compileSdkVersion project.compileSdkVersion 7 | buildToolsVersion project.buildToolsVersion 8 | 9 | 10 | defaultConfig { 11 | minSdkVersion project.libMinSdkVersion 12 | targetSdkVersion project.targetSdkVersion 13 | versionName project.zixieVersionName 14 | versionCode project.zixieVersionCode 15 | } 16 | 17 | lintOptions { 18 | abortOnError false 19 | } 20 | 21 | buildTypes { 22 | debug { 23 | minifyEnabled false 24 | shrinkResources false 25 | } 26 | 27 | release { 28 | proguardFiles "./../proguard-rules-common.pro" 29 | shrinkResources false 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Application/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | 21 | 22 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /Application/src/main/assets/app.ini: -------------------------------------------------------------------------------- 1 | 1.3.3 info: 2 | ----------------------------- 3 | 4 | VERSION_NAME=1.3.3 5 | VERSION_CODE=148 6 | TAG=Tag_ZSHAKE_1.3.3_148 7 | DATETIME=0411 8 | COMMIT=526f6015a5e9a419e8ca2cc0e6c2bc817ba05131 9 | isOfficial=true 10 | 11 | ----------------------------- 12 | -------------------------------------------------------------------------------- /Application/src/main/assets/config.default: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/Application/src/main/assets/config.default -------------------------------------------------------------------------------- /Application/src/main/assets/web/author.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 子勰 16 | 17 | 18 | 63 | 64 | 65 | 66 | 67 | 68 | 扫一扫,关注开发者微信公众号! 69 | 70 | 71 | 72 | 73 | 74 | 开发者博客: 75 | http://blog.bihe0832.com 76 | 77 | 78 | 开发者github: 79 | https://github.com/bihe0832 80 | 81 | 82 | 开发者邮箱: 83 | code@bihe0832.com 84 | 85 | 86 | 87 | 88 | 89 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /Application/src/main/assets/web/zixie_shi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/Application/src/main/assets/web/zixie_shi.jpg -------------------------------------------------------------------------------- /Application/src/main/java/com/bihe0832/android/app/Application.java: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app; 2 | 3 | import com.bihe0832.android.framework.privacy.AgreementPrivacy; 4 | import com.bihe0832.android.framework.ui.BaseApplication; 5 | import com.bihe0832.android.lib.log.ZLog; 6 | 7 | public class Application extends BaseApplication { 8 | 9 | /** 10 | * 是否为调试版本,请勿手动修改,自动构建会自动修改。如有问题,请联系zixie 11 | * 当IS_TEST_VERSION为true时,表示当前是开发版本 12 | */ 13 | private static final boolean IS_TEST_VERSION = true; 14 | 15 | /** 16 | * 是否为正式发布版本,请勿手动修改,自动构建会自动修改。如有问题,请联系zixie 17 | * 当 IS_OFFICIAL_VERSION == true && IS_TEST_VERSION == false 时 不提示 [ showOfficial ] 其余都提示 18 | */ 19 | private static final boolean IS_OFFICIAL_VERSION = false; 20 | 21 | //版本对应TAG,请勿手动修改,自动构建会自动修改。如有问题,请联系zixie 22 | private static final String VERSION_TAG = "Tag_ZIXIE_1.0.0_1"; 23 | 24 | static { 25 | try { 26 | // Load so 27 | } catch (UnsatisfiedLinkError e) { 28 | e.printStackTrace(); 29 | } 30 | } 31 | 32 | 33 | @Override 34 | protected boolean isDebug() { 35 | return IS_TEST_VERSION; 36 | } 37 | 38 | @Override 39 | protected boolean isOfficial() { 40 | return IS_OFFICIAL_VERSION; 41 | } 42 | 43 | @Override 44 | protected String versionTag() { 45 | return VERSION_TAG; 46 | } 47 | 48 | @Override 49 | protected boolean skipPrivacy() { 50 | return !isOfficial(); 51 | } 52 | 53 | @Override 54 | public void onCreate() { 55 | super.onCreate(); 56 | ZLog.d("Application", "Application onCreate start"); 57 | AppFactoryInit.INSTANCE.initAll(this); 58 | ZLog.d("Application", "Application onCreate end"); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Application/src/main/java/com/bihe0832/android/app/about/AboutActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.about 2 | 3 | import android.os.Bundle 4 | import com.bihe0832.android.app.router.RouterConstants 5 | import com.bihe0832.android.app.update.UpdateManager 6 | import com.bihe0832.android.lib.router.annotation.Module 7 | 8 | @Module(RouterConstants.MODULE_NAME_BASE_ABOUT) 9 | open class AboutActivity : com.bihe0832.android.common.about.AboutActivity() { 10 | 11 | override fun getAboutItemClass(): Class { 12 | return AboutFragment::class.java 13 | } 14 | 15 | override fun getItemFragment(): AboutFragment { 16 | return AboutFragment() 17 | } 18 | 19 | override fun onCreate(savedInstanceState: Bundle?) { 20 | super.onCreate(savedInstanceState) 21 | UpdateManager.checkUpdateAndShowDialog(this, checkUpdateByUser = false, showIfNeedUpdate = true) 22 | } 23 | } -------------------------------------------------------------------------------- /Application/src/main/java/com/bihe0832/android/app/about/AboutFragment.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.about 2 | 3 | import android.app.Activity 4 | import android.view.View 5 | import com.bihe0832.android.app.update.UpdateManager 6 | import com.bihe0832.android.common.settings.SettingsItem 7 | import com.bihe0832.android.common.settings.card.SettingsDataGo 8 | import com.bihe0832.android.framework.update.UpdateInfoLiveData 9 | import com.bihe0832.android.lib.adapter.CardBaseModule 10 | 11 | open class AboutFragment : com.bihe0832.android.common.about.AboutFragment() { 12 | 13 | override fun getDataList(processLast: Boolean): ArrayList { 14 | return ArrayList().apply { 15 | add(SettingsItem.getUpdate(UpdateInfoLiveData.value, View.OnClickListener { 16 | activity?.let { 17 | UpdateManager.checkUpdateAndShowDialog(it, checkUpdateByUser = true, showIfNeedUpdate = true) 18 | } 19 | })) 20 | add(SettingsItem.getVersionList()) 21 | add(getFeedbackItem(activity)) 22 | }.apply { 23 | processLastItemDriver(processLast) 24 | } 25 | } 26 | } 27 | 28 | fun getFeedbackItem(activity: Activity?): SettingsDataGo { 29 | return SettingsItem.getFeedbackURL() 30 | } -------------------------------------------------------------------------------- /Application/src/main/java/com/bihe0832/android/app/api/NetWorkApi.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.api 2 | 3 | import android.text.TextUtils 4 | import com.bihe0832.android.framework.ZixieContext 5 | import com.bihe0832.android.framework.constant.Constants 6 | import com.bihe0832.android.lib.okhttp.wrapper.OkHttpWrapper 7 | import com.bihe0832.android.lib.okhttp.wrapper.convert.GsonConverterFactory 8 | import com.bihe0832.android.lib.okhttp.wrapper.getRequestBodyByJsonString 9 | import com.bihe0832.android.lib.request.URLUtils 10 | import okhttp3.OkHttpClient 11 | import okhttp3.RequestBody 12 | import org.json.JSONObject 13 | import retrofit2.Retrofit 14 | 15 | /** 16 | * Created by zixie on 2018/2/5. 17 | */ 18 | 19 | object AAFNetWorkApi { 20 | 21 | private val mHttpClient: OkHttpClient by lazy { 22 | OkHttpWrapper.getBasicOkHttpClientBuilderWithInterceptor(!ZixieContext.isOfficial()).build() 23 | } 24 | 25 | const val LOG_TAG = "RetrofitLog" 26 | 27 | // 获取个人信息等对应的后台接口地址 28 | const val REQUEST_PARAM_APP_VERSION = "version" 29 | const val REQUEST_PARAM_OS = "os" 30 | const val REQUEST_PARAM_DEVKEY = "devid" 31 | const val REQUEST_PARAM_PACKAGE_NAME = "package" 32 | 33 | fun getCommonURL(url: String?, param: String): String { 34 | if (TextUtils.isEmpty(url)) { 35 | return "" 36 | } 37 | val publicPara = StringBuffer() 38 | publicPara.append(REQUEST_PARAM_DEVKEY).append(URLUtils.HTTP_REQ_ENTITY_MERGE).append(ZixieContext.deviceId) 39 | publicPara.append(URLUtils.HTTP_REQ_ENTITY_JOIN).append(REQUEST_PARAM_OS).append(URLUtils.HTTP_REQ_ENTITY_MERGE) 40 | .append(Constants.SYSTEM_CONSTANT) 41 | publicPara.append(URLUtils.HTTP_REQ_ENTITY_JOIN).append(REQUEST_PARAM_APP_VERSION) 42 | .append(URLUtils.HTTP_REQ_ENTITY_MERGE).append(ZixieContext.getVersionCode()) 43 | publicPara.append(URLUtils.HTTP_REQ_ENTITY_JOIN).append(REQUEST_PARAM_PACKAGE_NAME) 44 | .append(URLUtils.HTTP_REQ_ENTITY_MERGE).append(ZixieContext.applicationContext?.packageName) 45 | return URLUtils.marge(URLUtils.marge("$url", publicPara.toString()), param) 46 | } 47 | 48 | fun getRetrofit(url: String): Retrofit { 49 | return Retrofit.Builder() 50 | .client(mHttpClient) 51 | .addConverterFactory(GsonConverterFactory()) 52 | .baseUrl(url) 53 | .build() 54 | } 55 | 56 | fun getRetrofitWithoutJsonParse(url: String): Retrofit { 57 | return Retrofit.Builder() 58 | .client(mHttpClient) 59 | .baseUrl(url) 60 | .build() 61 | } 62 | 63 | fun getRequestPara(): JSONObject { 64 | val result = JSONObject() 65 | try { 66 | result.put(REQUEST_PARAM_DEVKEY, ZixieContext.deviceId) 67 | result.put(REQUEST_PARAM_APP_VERSION, ZixieContext.getVersionCode().toString()) 68 | result.put(REQUEST_PARAM_OS, Constants.SYSTEM_CONSTANT) 69 | result.put(REQUEST_PARAM_PACKAGE_NAME, ZixieContext.applicationContext?.packageName) 70 | } catch (e: Exception) { 71 | e.printStackTrace() 72 | } 73 | 74 | return result 75 | } 76 | 77 | fun getRequestBody(): RequestBody { 78 | return getRequestBodyByJsonString(getRequestPara().toString()) 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Application/src/main/java/com/bihe0832/android/app/constants/ConfigConstants.java: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.constants; 2 | 3 | import com.bihe0832.android.lib.utils.encrypt.messagedigest.MD5; 4 | 5 | /** 6 | * @author zixie code@bihe0832.com 7 | * Created on 2023/6/16. 8 | * Description: Description 9 | */ 10 | public interface ConfigConstants { 11 | 12 | public interface APK { 13 | String KEY_SIGNATURE_TYPE = "signatureType"; 14 | String VALUE_DEFAULT_SIGNATURE_TYPE = MD5.MESSAGE_DIGEST_TYPE_MD5; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Application/src/main/java/com/bihe0832/android/app/dialog/AAFUniqueDialogManager.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.dialog 2 | 3 | import android.content.Context 4 | import com.bihe0832.android.lib.ui.dialog.callback.OnDialogListener 5 | import com.bihe0832.android.lib.ui.dialog.tools.DialogUtils 6 | import com.bihe0832.android.lib.ui.dialog.tools.UniqueDialogManager 7 | 8 | /** 9 | * 10 | * @author zixie code@bihe0832.com 11 | * Created on 2022/8/9. 12 | * Description: Description 13 | * 14 | */ 15 | object AAFUniqueDialogManager { 16 | 17 | val tipsUniqueDialogManager by lazy { 18 | UniqueDialogManager().apply { 19 | setShowDialogInterface(object : UniqueDialogManager.ShowDialogInterface { 20 | override fun showDialog(context: Context, title: String, content: String, positiveText: String, negativeText: String, canCancel: Boolean, listener: OnDialogListener): Boolean { 21 | DialogUtils.showConfirmDialog( 22 | context, 23 | title, 24 | content, 25 | positiveText, 26 | negativeText, 27 | canCancel, 28 | listener, 29 | 30 | ) 31 | return true 32 | } 33 | }) 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Application/src/main/java/com/bihe0832/android/app/encrypt/AAFEncrypt.java: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.encrypt; 2 | 3 | import android.content.Context; 4 | import com.bihe0832.android.lib.file.FileUtils; 5 | import com.bihe0832.android.lib.utils.encrypt.aes.AESEncryptResult; 6 | import com.bihe0832.android.lib.utils.encrypt.aes.AESUtils; 7 | import com.bihe0832.android.lib.utils.encrypt.rsa.RSAUtils; 8 | import com.bihe0832.android.lib.utils.keystore.AESKeyStoreUtils; 9 | import java.security.PrivateKey; 10 | import java.security.PublicKey; 11 | import javax.crypto.Cipher; 12 | import javax.crypto.SecretKey; 13 | import javax.crypto.spec.SecretKeySpec; 14 | 15 | /** 16 | * Summary 17 | * 18 | * @author zixie code@bihe0832.com 19 | * Created on 2023/8/28. 20 | * 推荐使用场景: 21 | * 1. 登录数据等本地加密,本地解密的数据,可以使用:aesEncrypt && aesDecrypt 22 | * 2. 前后台数据交互的数据加密,推荐使用:encryptDataWithKeyStore 23 | * 3. 若是本地提前硬编码的加密数据,建议本地落地AES加密后的数据,然后 AES 加密的秘钥后台下发或者使用其他方式保存 24 | */ 25 | public class AAFEncrypt { 26 | 27 | /** 28 | * 读取Assets的RSA 公钥 29 | */ 30 | public static PublicKey getRSAPublicKeyFormAssets(Context context, String fileName) { 31 | String content = FileUtils.INSTANCE.getAssetFileContent(context, fileName); 32 | return RSAUtils.pemStringToRSAPublicKey(content); 33 | } 34 | 35 | /** 36 | * 读取Assets的RSA 私钥 37 | */ 38 | public static PrivateKey getRSAPrivateKeyFormAssets(Context context, String fileName) { 39 | String content = FileUtils.INSTANCE.getAssetFileContent(context, fileName); 40 | return RSAUtils.pemStringToRSAPrivateKey(content); 41 | } 42 | 43 | /** 44 | * 利用Keystore自动生成的AES秘钥加密数据 45 | */ 46 | public static AESEncryptResult aesEncrypt(Context context, String aesKeyAlias, String data) { 47 | SecretKey key = AESKeyStoreUtils.getAESKeyByKeystore(context, aesKeyAlias); 48 | return AESUtils.doAESEncrypt(AAFEncryptConstants.AES_MOD, key, null, Cipher.ENCRYPT_MODE, data.getBytes()); 49 | } 50 | 51 | /** 52 | * 利用Keystore自动生成的AES秘钥解密数据 53 | */ 54 | public static String aesDecrypt(Context context, String aesKeyAlias, byte[] ivParaBytes, byte[] data) { 55 | SecretKey key = AESKeyStoreUtils.getAESKeyByKeystore(context, aesKeyAlias); 56 | AESEncryptResult result = AESUtils.doAESEncrypt(AAFEncryptConstants.AES_MOD, key, ivParaBytes, 57 | Cipher.DECRYPT_MODE, 58 | data); 59 | if (result != null) { 60 | return new String(result.result); 61 | } 62 | return null; 63 | } 64 | 65 | /** 66 | * 利用系统自动生成秘钥AES加密数据,并用公钥加密AES秘钥 67 | */ 68 | public static AAFEncryptResult encryptDataWithKeyStore(Context context, String rsaKeyName, String data) { 69 | SecretKey secretKey = AESKeyStoreUtils.getAESKeyByKeystore(); 70 | return encryptDataWithKeyStore(context, secretKey, rsaKeyName, data); 71 | } 72 | 73 | /** 74 | * 利用秘钥AES加密数据,并用公钥加密AES秘钥 75 | */ 76 | public static AAFEncryptResult encryptDataWithKeyStore(Context context, String aesKey, String rsaKeyName, 77 | String data) { 78 | SecretKeySpec secretKey = new SecretKeySpec(aesKey.getBytes(), "AES"); 79 | return encryptDataWithKeyStore(context, secretKey, rsaKeyName, data); 80 | } 81 | 82 | public static AAFEncryptResult encryptDataWithKeyStore(Context context, SecretKey secretKey, String rsaKeyName, 83 | String data) { 84 | AESEncryptResult result = AESUtils.doAESEncrypt(AAFEncryptConstants.AES_MOD, secretKey, null, 85 | Cipher.ENCRYPT_MODE, 86 | data.getBytes()); 87 | PublicKey rsaKey = getRSAPublicKeyFormAssets(context, rsaKeyName); 88 | byte[] key = RSAUtils.encryptSecretKeyWithRSAPublicKey(AAFEncryptConstants.RSA_MOD, rsaKey, secretKey); 89 | return new AAFEncryptResult(key, result.iv, result.result); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /Application/src/main/java/com/bihe0832/android/app/encrypt/AAFEncryptConstants.java: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.encrypt; 2 | 3 | import com.bihe0832.android.lib.utils.encrypt.aes.AESUtils; 4 | import com.bihe0832.android.lib.utils.encrypt.rsa.RSAUtils; 5 | 6 | /** 7 | * Summary 8 | * 9 | * @author zixie code@bihe0832.com 10 | * Created on 2023/8/28. 11 | * Description: 12 | */ 13 | public class AAFEncryptConstants { 14 | 15 | public static final String RSA_MOD = RSAUtils.MOD_PKCS_1; 16 | public static final String AES_MOD = AESUtils.MODE_CBC_PKCS7; 17 | public static final byte[] IV_BYTES = new byte[]{0x4D, 0x4E, 0x41, 0x40, 0x32, 0x30, 0x31, 0x37, 0x47, 0x4F, 0x48, 18 | 0x45, 0x41, 0x44, 0x21, 0x21}; 19 | } 20 | -------------------------------------------------------------------------------- /Application/src/main/java/com/bihe0832/android/app/encrypt/AAFEncryptResult.java: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.encrypt; 2 | 3 | import com.bihe0832.android.lib.utils.encrypt.aes.AESEncryptResult; 4 | 5 | /** 6 | * Summary 7 | * 8 | * @author zixie code@bihe0832.com 9 | * Created on 2023/8/28. 10 | * Description: 11 | */ 12 | public class AAFEncryptResult extends AESEncryptResult { 13 | 14 | public byte[] keyEncryptData; 15 | 16 | public AAFEncryptResult(byte[] keyEncryptData, byte[] iv, byte[] result) { 17 | super(iv, result); 18 | this.keyEncryptData = keyEncryptData; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Application/src/main/java/com/bihe0832/android/app/log/AAFLoggerFile.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.log 2 | 3 | import com.bihe0832.android.framework.ZixieContext 4 | import com.bihe0832.android.framework.file.AAFFileTools 5 | import com.bihe0832.android.framework.log.LoggerFile 6 | 7 | 8 | /** 9 | * 10 | * @author zixie code@bihe0832.com 11 | * Created on 2020-03-05. 12 | * Description: 用户处理特殊日志 13 | * 14 | */ 15 | object AAFLoggerFile { 16 | 17 | const val MODULE_UPDATE = "udpate" 18 | const val MODULE_INPUT = "input" 19 | 20 | fun logUpdate(msg: String) { 21 | logFile(MODULE_UPDATE, msg) 22 | } 23 | 24 | 25 | 26 | fun log(module: String, msg: String) { 27 | LoggerFile.log(LoggerFile.getZixieFileLogPathByModule(module), msg) 28 | } 29 | 30 | fun logFile(module: String, msg: String) { 31 | LoggerFile.logFile(LoggerFile.getZixieFileLogPathByModule(module), msg) 32 | } 33 | 34 | fun openLog(module: String) { 35 | AAFFileTools.openFileWithTips(ZixieContext.getCurrentActivity()!!,LoggerFile.getZixieFileLogPathByModule(module)) 36 | } 37 | 38 | fun sendLog(module: String) { 39 | AAFFileTools.sendFile(LoggerFile.getZixieFileLogPathByModule(module)) 40 | } 41 | 42 | 43 | fun getLogPathByModuleName(module: String): String { 44 | return LoggerFile.getZixieFileLogPathByModule(module) 45 | } 46 | } -------------------------------------------------------------------------------- /Application/src/main/java/com/bihe0832/android/app/message/AAFMessageActivity.java: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.message; 2 | 3 | import android.os.Bundle; 4 | 5 | import androidx.annotation.Nullable; 6 | 7 | import com.bihe0832.android.app.R; 8 | import com.bihe0832.android.app.router.RouterConstants; 9 | import com.bihe0832.android.framework.ui.main.CommonActivity; 10 | import com.bihe0832.android.lib.router.annotation.Module; 11 | import com.bihe0832.android.lib.theme.ThemeResourcesManager; 12 | 13 | 14 | @Module(RouterConstants.MODULE_NAME_MESSAGE) 15 | public final class AAFMessageActivity extends CommonActivity { 16 | @Override 17 | protected void onCreate(@Nullable Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | initToolbar(ThemeResourcesManager.INSTANCE.getString(R.string.settings_message_title), true); 20 | if (findFragment(AAFMessageListFragment.class) == null) { 21 | loadRootFragment(new AAFMessageListFragment()); 22 | } 23 | } 24 | 25 | protected void onResume() { 26 | super.onResume(); 27 | try { 28 | if (this.findFragment(AAFMessageListFragment.class) != null) { 29 | this.findFragment(AAFMessageListFragment.class).setUserVisibleHint(true); 30 | } 31 | } catch (Exception var2) { 32 | var2.printStackTrace(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Application/src/main/java/com/bihe0832/android/app/message/AAFMessageListFragment.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.message 2 | 3 | import android.app.Activity 4 | import com.bihe0832.android.common.message.base.MessageManager 5 | import com.bihe0832.android.common.message.data.MessageInfoItem 6 | import com.bihe0832.android.common.message.list.BaseMessageFragment 7 | 8 | 9 | class AAFMessageListFragment : BaseMessageFragment() { 10 | 11 | override fun getMessageManager(): MessageManager { 12 | return AAFMessageManager 13 | } 14 | 15 | override fun showMessage(activity: Activity, messageInfoItem: MessageInfoItem, showFace: Boolean) { 16 | AAFMessageManager.showMessage(activity, messageInfoItem, showFace) 17 | } 18 | } -------------------------------------------------------------------------------- /Application/src/main/java/com/bihe0832/android/app/message/AAFMessageManager.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.message 2 | 3 | import android.app.Activity 4 | import com.bihe0832.android.app.R 5 | import com.bihe0832.android.app.api.AAFNetWorkApi 6 | import com.bihe0832.android.common.message.base.MessageManager 7 | import com.bihe0832.android.common.message.data.MessageInfoItem 8 | import com.bihe0832.android.lib.theme.ThemeResourcesManager 9 | import com.bihe0832.android.lib.thread.ThreadManager 10 | import com.bihe0832.android.lib.ui.dialog.blockdialog.DependenceBlockDialogManager 11 | import com.bihe0832.android.lib.ui.dialog.callback.OnDialogListener 12 | 13 | /** 14 | * 15 | * @author zixie code@bihe0832.com 16 | * Created on 2019-10-21. 17 | * Description: Description 18 | * 19 | */ 20 | object AAFMessageManager : MessageManager() { 21 | 22 | /** 23 | * 所有已经通过拍脸展示的公告 24 | */ 25 | val mAutoShowMessageList = mutableListOf() 26 | 27 | private val mDependenceBlockDialogManager by lazy { 28 | DependenceBlockDialogManager(true) 29 | } 30 | 31 | override fun fetchNewMsg() { 32 | fetchMessageByURLList( 33 | AAFNetWorkApi.getCommonURL( 34 | ThemeResourcesManager.getString(R.string.message_url) 35 | ?: "", 36 | "", 37 | ), 38 | ) 39 | } 40 | 41 | fun showMessage(activity: Activity, messageInfoItem: MessageInfoItem, showFace: Boolean) { 42 | mDependenceBlockDialogManager.getDependentTaskManager().addTask(messageInfoItem.messageID, { 43 | ThreadManager.getInstance().runOnUIThread { 44 | showMessage( 45 | activity, 46 | messageInfoItem, 47 | showFace, 48 | object : OnDialogListener { 49 | override fun onPositiveClick() { 50 | mDependenceBlockDialogManager.getDependentTaskManager().finishTask(messageInfoItem.messageID) 51 | } 52 | 53 | override fun onNegativeClick() { 54 | onPositiveClick() 55 | } 56 | 57 | override fun onCancel() { 58 | onPositiveClick() 59 | } 60 | }, 61 | ) 62 | } 63 | }, mutableListOf()) 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Application/src/main/java/com/bihe0832/android/app/permission/PermissionManagerWrapper.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.permission 2 | 3 | import android.Manifest 4 | import com.bihe0832.android.common.permission.AAFPermissionManager 5 | import com.bihe0832.android.framework.ZixieContext 6 | import com.bihe0832.android.lib.permission.PermissionManager 7 | 8 | /** 9 | * 10 | * @author zixie code@bihe0832.com 11 | * Created on 2023/4/26. 12 | * Description: Description 13 | * 14 | */ 15 | 16 | 17 | val SCENE_TAKE_PHOTO = "takePhoto" 18 | val SCENE_SELECT_PHOTO = "PhotoSelect" 19 | val SCENE_GAME_ACCESSIBILITY = "Accessibility" 20 | 21 | fun initPermission() { 22 | 23 | PermissionManager.addPermissionGroup("", Manifest.permission.CAMERA, AAFPermissionManager.takePhotoPermission) 24 | PermissionManager.addPermissionGroupDesc("", Manifest.permission.CAMERA, "相机") 25 | PermissionManager.addPermissionGroupScene("", Manifest.permission.CAMERA, "扫描、识别二维码") 26 | 27 | PermissionManager.addPermissionGroup(SCENE_TAKE_PHOTO, Manifest.permission.CAMERA, AAFPermissionManager.takePhotoPermission) 28 | PermissionManager.addPermissionGroupDesc(SCENE_TAKE_PHOTO, Manifest.permission.CAMERA, "相机") 29 | PermissionManager.addPermissionGroupScene(SCENE_TAKE_PHOTO, Manifest.permission.CAMERA, "扫描二维码、拍照") 30 | 31 | PermissionManager.addPermissionGroup("", Manifest.permission.READ_PHONE_STATE, mutableListOf().apply { 32 | add(Manifest.permission.READ_PHONE_STATE) 33 | }) 34 | PermissionManager.addPermissionGroupDesc("", Manifest.permission.READ_PHONE_STATE, "读取手机状态") 35 | PermissionManager.addPermissionGroupScene("", Manifest.permission.READ_PHONE_STATE, "获取应用安装时间等") 36 | 37 | PermissionManager.addPermissionGroupDesc(SCENE_GAME_ACCESSIBILITY, Manifest.permission.SYSTEM_ALERT_WINDOW, "悬浮窗") 38 | PermissionManager.addPermissionGroupScene(SCENE_GAME_ACCESSIBILITY, Manifest.permission.SYSTEM_ALERT_WINDOW, "按键精灵需要通过悬浮窗实时展示") 39 | PermissionManager.addPermissionGroupContent( 40 | SCENE_GAME_ACCESSIBILITY, 41 | Manifest.permission.SYSTEM_ALERT_WINDOW, 42 | "按键精灵需要通过悬浮窗实时展示。当前手机尚未授权,请点击「" + PermissionManager.getPositiveText(ZixieContext.applicationContext!!) + "」前往设置!" 43 | ) 44 | } 45 | -------------------------------------------------------------------------------- /Application/src/main/java/com/bihe0832/android/app/router/RouterConstants.java: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.router; 2 | 3 | 4 | import com.bihe0832.android.common.webview.nativeimpl.NativeWebViewFragment; 5 | 6 | /** 7 | * Created by zixie on 2017/10/25. 8 | */ 9 | 10 | public class RouterConstants extends com.bihe0832.android.framework.router.RouterConstants { 11 | 12 | public static final String INTENT_EXTRA_KEY_WEB_URL = NativeWebViewFragment.INTENT_KEY_URL; 13 | public static final String MODULE_NAME_BASE_ABOUT = "about"; 14 | public static final String MODULE_NAME_APK_LIST = "apklist"; 15 | public static final String MODULE_NAME_PUZZLE_GAME = "puzzlegame"; 16 | public static final String MODULE_NAME_PUZZLE = "puzzle"; 17 | public static final String MODULE_NAME_M3U8 = "m3u8"; 18 | public static final String INTENT_EXTRA_KEY_M3U8_BASE_URL = "baseurl"; 19 | 20 | public static final String MODULE_NAME_MAIN = "main"; 21 | public static final String MODULE_NAME_MESSAGE = "message"; 22 | 23 | public static final String MODULE_NAME_BROWSER_LIST = "weblist"; 24 | 25 | public static final String MODULE_NAME_INPUT_GUIDE = "guide"; 26 | public static final String INTENT_EXTRA_KEY_INPUT_GUIDE_TYPE = "type"; 27 | public static final String INTENT_EXTRA_VALUE_INPUT_SWITCH = "1"; 28 | 29 | public static final String MODULE_NAME_GAME_ROOT = "game"; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /Application/src/main/java/com/bihe0832/android/app/router/RouterHelperWrapper.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.router 2 | 3 | import com.bihe0832.android.lib.request.URLUtils 4 | 5 | 6 | /** 7 | * Created by zixie on 2017/6/27. 8 | * 9 | */ 10 | //需要拥有权限才能进入的特权,前提是已经登录了 11 | fun getNeedCheckInterceptHostList(): List { 12 | return listOf( 13 | 14 | ) 15 | } 16 | 17 | //只需要登录就能进入的特权 18 | fun getNeedLoginInterceptHostList(): List { 19 | return listOf( 20 | 21 | ) 22 | } 23 | 24 | //不需要检查,直接跳过的路由 25 | fun getSkipListHostList(): List { 26 | return listOf( 27 | RouterConstants.MODULE_NAME_SPLASH 28 | ) 29 | } 30 | 31 | fun openWebPage(url: String) { 32 | val map = HashMap() 33 | map[RouterConstants.INTENT_EXTRA_KEY_WEB_URL] = URLUtils.encode(url) 34 | RouterHelper.openPageByRouter(RouterConstants.MODULE_NAME_WEB_PAGE_TBS, map) 35 | } 36 | 37 | -------------------------------------------------------------------------------- /Application/src/main/java/com/bihe0832/android/app/tools/AAFTools.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.tools 2 | 3 | import android.content.ClipboardManager 4 | import android.content.Context 5 | import android.text.TextUtils 6 | 7 | /** 8 | * @author zixie code@bihe0832.com 9 | * Created on 2023/7/10. 10 | * Description: Description 11 | */ 12 | object AAFTools { 13 | /** 14 | * 获取剪切板内容 15 | * 16 | * @return 17 | */ 18 | fun pasteFromClipboard(context: Context?): String { 19 | val manager = context?.getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager 20 | if (manager != null) { 21 | if (manager.hasPrimaryClip() && manager.primaryClip!!.itemCount > 0) { 22 | val addedText = manager.primaryClip!!.getItemAt(0).text 23 | val addedTextString = addedText.toString() 24 | if (!TextUtils.isEmpty(addedTextString)) { 25 | return addedTextString 26 | } 27 | } 28 | } 29 | return "" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Application/src/main/java/com/bihe0832/android/app/ui/AAFCommonMainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.ui 2 | 3 | import android.os.Bundle 4 | import com.bihe0832.android.app.R 5 | import com.bihe0832.android.app.message.checkMsgAndShowFace 6 | import com.bihe0832.android.app.ui.navigation.AAFNavigationDrawerFragment 7 | import com.bihe0832.android.app.ui.navigation.addRedDotAction 8 | import com.bihe0832.android.app.update.UpdateManager 9 | import com.bihe0832.android.common.main.CommonActivityWithNavigationDrawer 10 | import com.bihe0832.android.common.navigation.drawer.NavigationDrawerFragment 11 | import com.bihe0832.android.framework.ZixieContext 12 | 13 | 14 | open class AAFCommonMainActivity : CommonActivityWithNavigationDrawer() { 15 | 16 | private val mAAFNavigationDrawerFragment = createAAFNavigationDrawerFragment() 17 | open fun createAAFNavigationDrawerFragment(): AAFNavigationDrawerFragment { 18 | return AAFNavigationDrawerFragment() 19 | } 20 | 21 | override fun getNavigationDrawerFragment(): NavigationDrawerFragment? { 22 | return mAAFNavigationDrawerFragment 23 | } 24 | 25 | override fun onCreate(savedInstanceState: Bundle?) { 26 | super.onCreate(savedInstanceState) 27 | addRedDotAction(findViewById(R.id.title_icon_unread)) 28 | checkMsgAndShowFace() 29 | UpdateManager.checkUpdateAndShowDialog(this, false, ZixieContext.isOfficial()) 30 | updateTitle(titleName) 31 | showQrcodeScan(needSound = true, needVibrate = true, onlyQRCode = true) 32 | } 33 | 34 | fun disableDrawerGesture() { 35 | mAAFNavigationDrawerFragment.disableDrawerGesture() 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Application/src/main/java/com/bihe0832/android/app/ui/navigation/AAFNavigationActivityWrapperForNavigation.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.ui.navigation 2 | 3 | import com.bihe0832.android.app.message.AAFMessageManager 4 | import com.bihe0832.android.common.main.CommonActivityWithNavigationDrawer 5 | import com.bihe0832.android.framework.ui.BaseActivity 6 | import com.bihe0832.android.framework.update.UpdateInfoLiveData 7 | import com.bihe0832.android.lib.ui.custom.view.background.TextViewWithBackground 8 | import com.bihe0832.android.lib.ui.custom.view.background.changeStatusWithUnreadMsg 9 | import com.bihe0832.android.lib.utils.os.DisplayUtil 10 | 11 | /** 12 | * 13 | * @author zixie code@bihe0832.com 14 | * Created on 2023/3/9. 15 | * Description: 根据更新和消息未读数目汇总红点数目 16 | * 17 | */ 18 | 19 | fun CommonActivityWithNavigationDrawer.addRedDotAction(unreadView: TextViewWithBackground) { 20 | updateRedDot(unreadView) 21 | AAFMessageManager.getMessageLiveData().observe(this) { t -> 22 | updateRedDot(unreadView) 23 | } 24 | UpdateInfoLiveData.observe(this) { t -> 25 | updateRedDot(unreadView) 26 | } 27 | } 28 | 29 | private fun updateRedDot(unreadView: TextViewWithBackground) { 30 | val hasNewUpdate = UpdateInfoLiveData.value?.canShowNew() ?: false 31 | val msgNum = AAFMessageManager.getUnreadNum() 32 | if (msgNum > 0) { 33 | if (hasNewUpdate) { 34 | msgNum + 1 35 | } else { 36 | msgNum 37 | } 38 | } else { 39 | if (hasNewUpdate) { 40 | 0 41 | } else { 42 | -1 43 | } 44 | }.let { 45 | unreadView.changeStatusWithUnreadMsg(it, DisplayUtil.dip2px(unreadView.context, 8f)) 46 | } 47 | } 48 | 49 | 50 | -------------------------------------------------------------------------------- /Application/src/main/java/com/bihe0832/android/app/ui/navigation/AAFNavigationContentFragment.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.ui.navigation 2 | 3 | import android.view.View 4 | import com.bihe0832.android.app.R 5 | import com.bihe0832.android.app.message.AAFMessageManager 6 | import com.bihe0832.android.app.router.RouterConstants 7 | import com.bihe0832.android.common.main.CommonNavigationContentFragment 8 | import com.bihe0832.android.common.settings.SettingsItem 9 | import com.bihe0832.android.framework.ZixieContext 10 | import com.bihe0832.android.framework.router.RouterAction 11 | import com.bihe0832.android.framework.update.UpdateInfoLiveData 12 | import com.bihe0832.android.lib.adapter.CardBaseModule 13 | import com.bihe0832.android.lib.theme.ThemeResourcesManager 14 | 15 | /** 16 | * 17 | * @author zixie code@bihe0832.com 18 | * Created on 2023/4/10. 19 | * Description: Description 20 | * 21 | */ 22 | open class AAFNavigationContentFragment : CommonNavigationContentFragment() { 23 | 24 | override fun initView(view: View) { 25 | super.initView(view) 26 | AAFMessageManager.getMessageLiveData().observe(this) { t -> 27 | changeMessageRedDot( 28 | ThemeResourcesManager.getString(R.string.settings_message_title), 29 | AAFMessageManager.getUnreadNum(), 30 | ) 31 | } 32 | UpdateInfoLiveData.observe(this) { t -> 33 | changeUpdateRedDot(SettingsItem.getAboutTitle(), t, false) 34 | } 35 | } 36 | 37 | override fun getDataList(processLast: Boolean): ArrayList { 38 | return ArrayList().apply { 39 | add( 40 | SettingsItem.getAboutAPP(UpdateInfoLiveData.value) { 41 | RouterAction.openPageByRouter(RouterConstants.MODULE_NAME_BASE_ABOUT) 42 | }, 43 | ) 44 | if (AAFMessageManager.getUnreadNum() > 0) { 45 | add( 46 | SettingsItem.getMessage(AAFMessageManager.getUnreadNum()) { 47 | RouterAction.openPageByRouter(RouterConstants.MODULE_NAME_MESSAGE) 48 | }, 49 | ) 50 | } else { 51 | add( 52 | SettingsItem.getMessage(-1) { 53 | RouterAction.openPageByRouter(RouterConstants.MODULE_NAME_MESSAGE) 54 | }, 55 | ) 56 | } 57 | addAll(getBaseDataList(processLast)) 58 | }.apply { 59 | processLastItemDriver(processLast) 60 | } 61 | } 62 | 63 | fun getBaseDataList(processLast: Boolean): ArrayList { 64 | return ArrayList().apply { 65 | add(SettingsItem.getFeedbackURL()) 66 | add(SettingsItem.getShareAPP(true)) 67 | add(SettingsItem.getVersionList()) 68 | add(SettingsItem.getClearCache(activity!!)) 69 | add(SettingsItem.getZixie()) 70 | if (!ZixieContext.isOfficial()) { 71 | add(SettingsItem.getDebug()) 72 | } 73 | }.apply { 74 | processLastItemDriver(processLast) 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Application/src/main/java/com/bihe0832/android/app/ui/navigation/AAFNavigationDrawerFragment.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.ui.navigation 2 | 3 | import com.bihe0832.android.common.main.CommonNavigationDrawerFragment 4 | 5 | /** 6 | * 7 | * @author zixie code@bihe0832.com 8 | * Created on 2023/4/10. 9 | * Description: Description 10 | * 11 | */ 12 | class AAFNavigationDrawerFragment : CommonNavigationDrawerFragment() { 13 | 14 | override fun loadFragment(containerId: Int) { 15 | loadRootFragment(containerId, AAFNavigationContentFragment()) 16 | } 17 | } -------------------------------------------------------------------------------- /Application/src/main/res/drawable-xxhdpi/empty.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/Application/src/main/res/drawable-xxhdpi/empty.9.png -------------------------------------------------------------------------------- /Application/src/main/res/drawable/icon_camera.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /Application/src/main/res/drawable/icon_cloud.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /Application/src/main/res/drawable/icon_cycle.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /Application/src/main/res/drawable/icon_qr_code_scanner.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /Application/src/main/res/values-v19/fade_integer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1000 5 | 500 6 | -------------------------------------------------------------------------------- /Application/src/main/res/values/common_res.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 温馨提示 11 | 12 | 切换主题 13 | 你可上下滑动主题列表查看更多主题 14 | 暗夜模式 15 | 改变主题不会自动保存当前文档, 确认放弃文档改变而改变主题? 16 | 17 | -------------------------------------------------------------------------------- /Application/src/main/res/values/file_path.xml: -------------------------------------------------------------------------------- 1 | 2 | zixie/ 3 | 4 | -------------------------------------------------------------------------------- /BaseAdbInput/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | apply plugin: 'kotlin-kapt' 5 | 6 | android { 7 | compileSdkVersion project.compileSdkVersion 8 | buildToolsVersion project.buildToolsVersion 9 | 10 | 11 | defaultConfig { 12 | minSdkVersion project.libMinSdkVersion 13 | targetSdkVersion project.targetSdkVersion 14 | versionName project.zixieVersionName 15 | versionCode project.zixieVersionCode 16 | } 17 | 18 | lintOptions { 19 | abortOnError false 20 | } 21 | 22 | buildTypes { 23 | debug { 24 | minifyEnabled false 25 | shrinkResources false 26 | } 27 | 28 | release { 29 | proguardFiles "./../proguard-rules-common.pro" 30 | shrinkResources false 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BaseAdbInput/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 33 | 34 | 35 | 36 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /BaseAdbInput/src/main/java/com/bihe0832/android/base/adb/input/config/InputSwitchConfig.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.adb.input.config 2 | 3 | import com.bihe0832.android.lib.config.Config 4 | 5 | /** 6 | * @author zixie code@bihe0832.com Created on 4/9/21. 7 | */ 8 | object InputSwitchConfig { 9 | 10 | private val KEY_NOTIFY = "com.bihe0832.input.config.notify" 11 | private val KEY_RECORD = "com.bihe0832.input.config.record" 12 | 13 | fun canNotify(): Boolean { 14 | return Config.isSwitchEnabled(KEY_NOTIFY, true) 15 | } 16 | 17 | fun setNotify(notify: Boolean) { 18 | Config.writeConfig(KEY_NOTIFY, notify) 19 | } 20 | 21 | fun canRecord(): Boolean { 22 | return Config.isSwitchEnabled(KEY_RECORD, true) 23 | } 24 | 25 | fun setRecord(record: Boolean) { 26 | Config.writeConfig(KEY_RECORD, record) 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /BaseAdbInput/src/main/java/com/bihe0832/android/base/adb/input/keyboard/InputToolBarActionListener.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.adb.input.keyboard 2 | 3 | import android.view.KeyEvent 4 | 5 | /** 6 | * @author zixie code@bihe0832.com Created on 5/31/21. 7 | */ 8 | interface InputToolBarActionListener { 9 | fun onBack():Boolean 10 | fun onClearText():Boolean 11 | fun enterAction():Boolean 12 | fun onSendKeyEvent(keyEvent: KeyEvent?):Boolean 13 | fun closeKeyboard():Boolean 14 | } -------------------------------------------------------------------------------- /BaseAdbInput/src/main/java/com/bihe0832/android/base/adb/input/service/AdbReceiver.java: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.adb.input.service; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.util.Base64; 7 | 8 | import com.bihe0832.android.base.adb.input.ZixieIME; 9 | import com.bihe0832.android.base.adb.input.keyboard.InputManager; 10 | 11 | /** 12 | * @author zixie code@bihe0832.com 13 | * Created on 2023/3/14. 14 | * Description: Description 15 | */ 16 | public class AdbReceiver extends BroadcastReceiver { 17 | 18 | public static final String IME_ADB_INPUT_ACTION_TEXT = "ZIXIE_ADB_INPUT_TEXT"; 19 | public static final String IME_ADB_INPUT_ACTION_BASE64 = "ZIXIE_ADB_INPUT_BASE64"; 20 | 21 | @Override 22 | public void onReceive(Context context, Intent intent) { 23 | String action = intent.getAction(); 24 | if (action.startsWith(IME_ADB_INPUT_ACTION_TEXT)) { 25 | String msg = intent.getStringExtra("msg"); 26 | if (msg != null) { 27 | InputManager.INSTANCE.commitResultText(msg); 28 | } 29 | 30 | } else if (action.startsWith(IME_ADB_INPUT_ACTION_BASE64)) { 31 | String msg = intent.getStringExtra("msg"); 32 | if (msg != null) { 33 | String result = new String(Base64.decode(msg, Base64.DEFAULT)); 34 | if (result.endsWith(ZixieIME.SPECIAL_CHAR_ENTER)) { 35 | InputManager.INSTANCE.commitResultText(result.substring(0, result.lastIndexOf(ZixieIME.SPECIAL_CHAR_ENTER))); 36 | } else { 37 | InputManager.INSTANCE.commitResultText(result); 38 | } 39 | 40 | } 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /BaseAdbInput/src/main/java/com/bihe0832/android/base/adb/input/settings/InputSettingsActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.adb.input.settings 2 | 3 | import android.content.Intent 4 | import android.os.Bundle 5 | import android.view.inputmethod.InputMethodManager 6 | import com.bihe0832.android.app.router.RouterConstants 7 | import com.bihe0832.android.app.ui.AAFCommonMainActivity 8 | import com.bihe0832.android.base.adb.input.ZixieIME 9 | import com.bihe0832.android.base.adb.input.switcher.InputSwitchTools 10 | import com.bihe0832.android.lib.log.ZLog 11 | import com.bihe0832.android.lib.router.annotation.Module 12 | 13 | 14 | @Module(RouterConstants.MODULE_NAME_INPUT_GUIDE) 15 | class InputSettingsActivity : AAFCommonMainActivity() { 16 | 17 | override fun onCreate(savedInstanceState: Bundle?) { 18 | super.onCreate(savedInstanceState) 19 | showInputMethodPicker(intent) 20 | } 21 | 22 | override fun getTitleName(): String { 23 | return "输入法设置引导" 24 | } 25 | 26 | override fun getRootFragmentClassName(): String { 27 | return InputSettingsFragment::class.java.name 28 | } 29 | 30 | override fun onNewIntent(intent: Intent?) { 31 | super.onNewIntent(intent) 32 | showInputMethodPicker(intent) 33 | } 34 | 35 | private fun showInputMethodPicker(intent: Intent?) { 36 | if (InputSwitchTools.hasInstall(this)) { 37 | var type = intent?.extras?.getString(RouterConstants.INTENT_EXTRA_KEY_INPUT_GUIDE_TYPE, "") 38 | ?: "" 39 | if (type == RouterConstants.INTENT_EXTRA_VALUE_INPUT_SWITCH) { 40 | (getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager).showInputMethodPicker() 41 | } 42 | } 43 | } 44 | 45 | override fun onResume() { 46 | super.onResume() 47 | ZLog.d(ZixieIME.TAG, "$this:onResume") 48 | for (fragment in supportFragmentManager.fragments) { 49 | if (fragment.isAdded) { 50 | fragment.userVisibleHint = true 51 | } 52 | } 53 | } 54 | 55 | override fun onBackPressedSupport() { 56 | finish() 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /BaseAdbInput/src/main/java/com/bihe0832/android/base/adb/input/tools/InputWrapper.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.adb.input.tools 2 | 3 | import com.bihe0832.android.app.log.AAFLoggerFile 4 | 5 | /** 6 | * 7 | * @author zixie code@bihe0832.com 8 | * Created on 2023/2/25. 9 | * Description: Description 10 | * 11 | */ 12 | fun logInput(msg: String) { 13 | AAFLoggerFile.log(AAFLoggerFile.MODULE_INPUT, msg) 14 | } -------------------------------------------------------------------------------- /BaseAdbInput/src/main/res/drawable/keyboard_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /BaseAdbInput/src/main/res/drawable/keyboard_enter_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /BaseAdbInput/src/main/res/drawable/keyboard_enter_bg_default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /BaseAdbInput/src/main/res/drawable/keyboard_enter_bg_pressed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /BaseAdbInput/src/main/res/drawable/keyboard_setting_item_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /BaseAdbInput/src/main/res/drawable/keyboard_setting_item_bg_default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /BaseAdbInput/src/main/res/drawable/keyboard_setting_item_bg_pressed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /BaseAdbInput/src/main/res/layout/layout_input_keyboard_global.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 23 | 24 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /BaseAdbInput/src/main/res/layout/layout_input_toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 19 | 20 | 29 | 30 | 39 | 40 | 49 | 50 | 59 | 60 | 61 | 70 | 71 | 72 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /BaseAdbInput/src/main/res/mipmap/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/BaseAdbInput/src/main/res/mipmap/help.png -------------------------------------------------------------------------------- /BaseAdbInput/src/main/res/mipmap/key_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/BaseAdbInput/src/main/res/mipmap/key_back.png -------------------------------------------------------------------------------- /BaseAdbInput/src/main/res/mipmap/key_change.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/BaseAdbInput/src/main/res/mipmap/key_change.png -------------------------------------------------------------------------------- /BaseAdbInput/src/main/res/mipmap/key_clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/BaseAdbInput/src/main/res/mipmap/key_clear.png -------------------------------------------------------------------------------- /BaseAdbInput/src/main/res/mipmap/key_enter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/BaseAdbInput/src/main/res/mipmap/key_enter.png -------------------------------------------------------------------------------- /BaseAdbInput/src/main/res/mipmap/key_hide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/BaseAdbInput/src/main/res/mipmap/key_hide.png -------------------------------------------------------------------------------- /BaseAdbInput/src/main/res/mipmap/key_locat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/BaseAdbInput/src/main/res/mipmap/key_locat.png -------------------------------------------------------------------------------- /BaseAdbInput/src/main/res/mipmap/key_setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/BaseAdbInput/src/main/res/mipmap/key_setting.png -------------------------------------------------------------------------------- /BaseAdbInput/src/main/res/mipmap/key_switch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/BaseAdbInput/src/main/res/mipmap/key_switch.png -------------------------------------------------------------------------------- /BaseAdbInput/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #80000000 4 | #00000000 5 | #ACACAC 6 | #3F51B5 7 | #536DFE 8 | #E0FFFFFF 9 | #FFFFFF 10 | #000000 11 | 12 | 13 | -------------------------------------------------------------------------------- /BaseAdbInput/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8dp 4 | 1dp 5 | 6 | 30dp 7 | 25dp 8 | 300dp 9 | 120dp 10 | -------------------------------------------------------------------------------- /BaseAdbInput/src/main/res/xml/method.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /BaseCard/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | apply plugin: 'kotlin-kapt' 5 | 6 | android { 7 | compileSdkVersion project.compileSdkVersion 8 | buildToolsVersion project.buildToolsVersion 9 | 10 | 11 | defaultConfig { 12 | minSdkVersion project.libMinSdkVersion 13 | targetSdkVersion project.targetSdkVersion 14 | versionName project.zixieVersionName 15 | versionCode project.zixieVersionCode 16 | } 17 | 18 | lintOptions { 19 | abortOnError false 20 | } 21 | 22 | buildTypes { 23 | debug { 24 | minifyEnabled false 25 | shrinkResources false 26 | } 27 | 28 | release { 29 | proguardFiles "./../proguard-rules-common.pro" 30 | shrinkResources false 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BaseCard/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /BaseCard/src/main/java/com/bihe0832/android/base/card/apk/APPItemData.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.card.apk 2 | 3 | import android.graphics.drawable.Drawable 4 | import com.bihe0832.android.base.card.R 5 | import com.bihe0832.android.lib.adapter.CardBaseHolder 6 | import com.bihe0832.android.lib.adapter.CardBaseModule 7 | import com.bihe0832.android.lib.utils.time.DateUtil 8 | 9 | /** 10 | * @author zixie code@bihe0832.com 11 | * Created on 2019-11-21. 12 | * Description: Description 13 | */ 14 | class APPItemData : CardBaseModule() { 15 | 16 | override fun getResID(): Int { 17 | return R.layout.card_apk_info 18 | } 19 | 20 | override fun getViewHolderClass(): Class { 21 | return APPItemHolder::class.java 22 | } 23 | 24 | var app_icon: Drawable? = null 25 | var app_name = "" 26 | var app_version = "" 27 | var app_package = "" 28 | var app_install_time = 0L 29 | var app_update_time = 0L 30 | var app_md5 = "" 31 | var signature_type = "" 32 | var signature_value = "" 33 | var androidPublicKey = "" 34 | var windowsPublicKey = "" 35 | 36 | override fun toString(): String { 37 | return "应用:$app_name\n" + 38 | "版本号:$app_version\n" + 39 | "包名:$app_package\n" + 40 | "安装于:${DateUtil.getDateEN(app_install_time)}\n" + 41 | "更新于:${DateUtil.getDateEN(app_update_time)} \n" + 42 | "APK MD5:$app_md5\n" + 43 | "签名 算法:$signature_type\n" + 44 | "签名 值:\n$signature_value\n" + 45 | "签名 公钥:\n$androidPublicKey\n" + 46 | "签名 公钥(二进制 Windows 格式):\n$windowsPublicKey\n" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /BaseCard/src/main/java/com/bihe0832/android/base/card/apk/APPItemHolder.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.card.apk 2 | 3 | import android.content.Context 4 | import android.view.View 5 | import android.widget.ImageView 6 | import android.widget.TextView 7 | import com.bihe0832.android.base.card.R 8 | import com.bihe0832.android.lib.adapter.CardBaseHolder 9 | import com.bihe0832.android.lib.adapter.CardBaseModule 10 | import com.bihe0832.android.lib.text.TextFactoryUtils 11 | import com.bihe0832.android.lib.utils.apk.APKUtils 12 | import com.bihe0832.android.lib.utils.encrypt.rsa.RSAUtils 13 | import com.bihe0832.android.lib.utils.time.DateUtil 14 | import java.util.Locale 15 | 16 | /** 17 | * @author zixie code@bihe0832.com 18 | * Created on 2019-11-21. 19 | * Description: Description 20 | */ 21 | class APPItemHolder(itemView: View?, context: Context?) : CardBaseHolder(itemView, context) { 22 | 23 | private var app_icon: ImageView? = null 24 | private var app_name: TextView? = null 25 | private var app_version: TextView? = null 26 | private var app_package: TextView? = null 27 | private var app_install: TextView? = null 28 | private var app_update: TextView? = null 29 | private var app_md5: TextView? = null 30 | private var signature_value: TextView? = null 31 | 32 | override fun initView() { 33 | app_icon = getView(R.id.app_icon) 34 | app_name = getView(R.id.title_info) 35 | app_version = getView(R.id.app_version) 36 | app_package = getView(R.id.download_url) 37 | app_install = getView(R.id.app_install) 38 | app_update = getView(R.id.app_update) 39 | app_md5 = getView(R.id.app_md5) 40 | signature_value = getView(R.id.signature_value) 41 | } 42 | 43 | override fun initData(item: CardBaseModule) { 44 | val data = item as APPItemData 45 | addOnClickListener(R.id.app_layout) 46 | addOnClickListener(R.id.settings) 47 | addOnClickListener(R.id.app_icon) 48 | addOnLongClickListener(R.id.app_icon) 49 | app_icon?.setImageDrawable(data.app_icon) 50 | app_name?.text = data.app_name 51 | app_version?.text = "当前版本:${data.app_version}" 52 | app_package?.text = "应用包名:${data.app_package}" 53 | app_install?.text = "安装时间:${DateUtil.getDateEN(data.app_install_time)}" 54 | app_update?.text = "最后更新:${DateUtil.getDateEN(data.app_update_time)}" 55 | app_md5?.text = TextFactoryUtils.getSpannedTextByHtml(" APK MD5:${data.app_md5}") 56 | if (data.signature_value.isNullOrBlank()) { 57 | data.signature_value = 58 | APKUtils.getSigMessageDigestByPkgName(context, data.signature_type, data.app_package, true) 59 | .uppercase(Locale.getDefault()) 60 | } 61 | 62 | if (data.androidPublicKey.isNullOrBlank()) { 63 | APKUtils.getSigPublicKey(context, data.app_package)?.let { key -> 64 | data.androidPublicKey = RSAUtils.getPublicKeyPemString(key) 65 | data.windowsPublicKey = RSAUtils.transPublicKeyByteStringToWindows(RSAUtils.getPublicKeyByteString(key)) 66 | .uppercase(Locale.getDefault()) 67 | } 68 | } 69 | 70 | signature_value?.text = 71 | TextFactoryUtils.getSpannedTextByHtml(" 签名 ${data.signature_type}:${data.signature_value}") 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /BaseCard/src/main/java/com/bihe0832/android/base/card/m3u8/M3U8ViewData.java: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.card.m3u8; 2 | 3 | import com.bihe0832.android.base.card.R; 4 | import com.bihe0832.android.base.card.m3u8.M3U8ViewHolder.OnClickListener; 5 | import com.bihe0832.android.lib.adapter.CardBaseHolder; 6 | import com.bihe0832.android.lib.adapter.CardBaseModule; 7 | 8 | /** 9 | * @author zixie code@bihe0832.com 10 | * Created on 2019-11-21. 11 | * Description: Description 12 | */ 13 | public class M3U8ViewData extends CardBaseModule { 14 | 15 | public String m3u8URL = ""; 16 | public String baseURl = ""; 17 | public long downloadTime = 0; 18 | 19 | public String localpath = ""; 20 | 21 | public OnClickListener mListener = null; 22 | 23 | public int getResID() { 24 | return R.layout.card_m3u8_list_item; 25 | } 26 | 27 | public Class extends CardBaseHolder> getViewHolderClass() { 28 | return M3U8ViewHolder.class; 29 | } 30 | 31 | public M3U8ViewData() { 32 | 33 | } 34 | } -------------------------------------------------------------------------------- /BaseCard/src/main/java/com/bihe0832/android/base/card/m3u8/M3U8ViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.card.m3u8; 2 | 3 | 4 | import android.content.Context; 5 | import android.text.Html; 6 | import android.view.View; 7 | import android.widget.TextView; 8 | import com.bihe0832.android.base.card.R; 9 | import com.bihe0832.android.lib.adapter.CardBaseHolder; 10 | import com.bihe0832.android.lib.adapter.CardBaseModule; 11 | import com.bihe0832.android.lib.utils.encrypt.messagedigest.MD5; 12 | import com.bihe0832.android.lib.utils.time.DateUtil; 13 | 14 | /** 15 | * @author zixie code@bihe0832.com 16 | * Created on 2019-11-21. 17 | * Description: Description 18 | */ 19 | 20 | public class M3U8ViewHolder extends CardBaseHolder { 21 | 22 | public TextView title_info; 23 | public TextView download_url; 24 | public TextView local_path; 25 | public TextView download_delete; 26 | public TextView video_name; 27 | 28 | 29 | public interface OnClickListener { 30 | 31 | void onClick(); 32 | 33 | void onDelete(); 34 | 35 | } 36 | 37 | public M3U8ViewHolder(View view, Context context) { 38 | super(view, context); 39 | } 40 | 41 | @Override 42 | public void initView() { 43 | title_info = getView(R.id.title_info); 44 | download_url = getView(R.id.download_url); 45 | local_path = getView(R.id.local_path); 46 | video_name = getView(R.id.video_name); 47 | download_delete = getView(R.id.download_delete); 48 | } 49 | 50 | @Override 51 | public void initData(CardBaseModule item) { 52 | final M3U8ViewData data = (M3U8ViewData) item; 53 | title_info.setText(DateUtil.getDateEN(data.downloadTime, "yyyy-MM-dd") + " 下载视频"); 54 | download_url.setText("下载地址:" + Html.fromHtml(data.m3u8URL)); 55 | local_path.setText("本地路径:" + data.localpath); 56 | video_name.setText("视频名称:" + MD5.getMd5(data.m3u8URL) + ".mp4"); 57 | if (null != data.mListener) { 58 | itemView.setOnClickListener(new View.OnClickListener() { 59 | @Override 60 | public void onClick(View v) { 61 | data.mListener.onClick(); 62 | } 63 | }); 64 | 65 | download_delete.setOnClickListener(new View.OnClickListener() { 66 | @Override 67 | public void onClick(View v) { 68 | data.mListener.onDelete(); 69 | } 70 | }); 71 | }else { 72 | itemView.setOnClickListener(null); 73 | download_delete.setOnClickListener(null); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /BaseCard/src/main/java/com/bihe0832/android/base/card/photo/IconTextData.java: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.card.photo; 2 | 3 | import com.bihe0832.android.base.card.R; 4 | import com.bihe0832.android.lib.adapter.CardBaseHolder; 5 | import com.bihe0832.android.lib.adapter.CardBaseModule; 6 | 7 | /** 8 | * @author zixie code@bihe0832.com 9 | * Created on 2019-11-21. 10 | * Description: Description 11 | */ 12 | public class IconTextData extends CardBaseModule { 13 | 14 | public int mIconID = 0; 15 | public String mContentText = ""; 16 | public String mContentResURL = ""; 17 | public int mContentResID = -1; 18 | public int mHorizontalNum = 2; 19 | public int mVerticalNum = 2; 20 | public int mHorizontalFix = 0; 21 | public int mVerticalFix = 600; 22 | 23 | public int getResID() { 24 | return R.layout.card_puzzle_item; 25 | } 26 | 27 | public Class extends CardBaseHolder> getViewHolderClass() { 28 | return IconTextHolder.class; 29 | } 30 | 31 | public IconTextData() { 32 | 33 | } 34 | 35 | public IconTextData(String tips) { 36 | mContentText = tips; 37 | } 38 | 39 | public IconTextData(String netType, int resID) { 40 | mContentText = netType; 41 | mContentResID = resID; 42 | } 43 | 44 | public IconTextData(String netType, String url) { 45 | mContentText = netType; 46 | mContentResURL = url; 47 | } 48 | } -------------------------------------------------------------------------------- /BaseCard/src/main/java/com/bihe0832/android/base/card/photo/IconTextHolder.java: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.card.photo; 2 | 3 | 4 | import android.content.Context; 5 | import android.text.Html; 6 | import android.text.TextUtils; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.ImageView; 10 | import android.widget.TextView; 11 | 12 | import com.bihe0832.android.base.card.R; 13 | import com.bihe0832.android.framework.ZixieContext; 14 | import com.bihe0832.android.lib.adapter.CardBaseHolder; 15 | import com.bihe0832.android.lib.adapter.CardBaseModule; 16 | import com.bihe0832.android.lib.media.image.GlideExtKt; 17 | import com.bihe0832.android.lib.utils.os.DisplayUtil; 18 | 19 | /** 20 | * @author zixie code@bihe0832.com 21 | * Created on 2019-11-21. 22 | * Description: Description 23 | */ 24 | 25 | public class IconTextHolder extends CardBaseHolder { 26 | 27 | public TextView mTipsText; 28 | public ImageView mTipsIcon; 29 | 30 | public IconTextHolder(View view, Context context) { 31 | super(view, context); 32 | } 33 | 34 | @Override 35 | public void initView() { 36 | mTipsIcon = getView(R.id.scene_icon); 37 | mTipsText = getView(R.id.scene_desc); 38 | } 39 | 40 | @Override 41 | public void initData(CardBaseModule item) { 42 | IconTextData data = (IconTextData) item; 43 | mTipsText.setText(Html.fromHtml(data.mContentText)); 44 | if (TextUtils.isEmpty(data.mContentResURL)) { 45 | GlideExtKt.loadCenterInsideImage(mTipsIcon, data.mContentResID); 46 | } else { 47 | GlideExtKt.loadFitCenterImage(mTipsIcon, data.mContentResURL, R.color.gray, R.color.gray); 48 | } 49 | 50 | ViewGroup.LayoutParams newParams = itemView.getLayoutParams(); 51 | int itemHeight = 52 | ((ZixieContext.INSTANCE.getScreenHeight() - data.mVerticalFix) - 53 | DisplayUtil.dip2px(ZixieContext.INSTANCE.getApplicationContext(), 32 * data.mVerticalNum)) 54 | / data.mVerticalNum; 55 | newParams.height = itemHeight; 56 | itemView.setLayoutParams(newParams); 57 | 58 | ViewGroup.LayoutParams imageParams = mTipsIcon.getLayoutParams(); 59 | int itemWidth = 60 | ((ZixieContext.INSTANCE.getScreenWidth() - data.mHorizontalFix - DisplayUtil 61 | .dip2px(ZixieContext.INSTANCE.getApplicationContext(), 32 * data.mHorizontalNum)) 62 | / data.mHorizontalNum) 63 | - DisplayUtil.dip2px(ZixieContext.INSTANCE.getApplicationContext(), 64); 64 | imageParams.width = itemWidth; 65 | imageParams.height = itemWidth; 66 | mTipsIcon.setLayoutParams(imageParams); 67 | 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /BaseCard/src/main/java/com/bihe0832/android/base/card/tips/TipsData.java: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.card.tips; 2 | 3 | import android.view.View; 4 | 5 | import com.bihe0832.android.base.card.R; 6 | import com.bihe0832.android.lib.adapter.CardBaseHolder; 7 | import com.bihe0832.android.lib.adapter.CardBaseModule; 8 | 9 | /** 10 | * @author zixie code@bihe0832.com 11 | * Created on 2019-11-21. 12 | * Description: Description 13 | */ 14 | public class TipsData extends CardBaseModule { 15 | public String mContentText = ""; 16 | public View.OnClickListener mListener = null; 17 | 18 | public int getResID() { 19 | return R.layout.card_tips; 20 | } 21 | 22 | public Class extends CardBaseHolder> getViewHolderClass() { 23 | return TipsHolder.class; 24 | } 25 | 26 | public TipsData(){ 27 | 28 | } 29 | public TipsData(String tips) { 30 | mContentText = tips; 31 | } 32 | 33 | public TipsData(String netType, View.OnClickListener listener) { 34 | mContentText = netType; 35 | mListener = listener; 36 | } 37 | } -------------------------------------------------------------------------------- /BaseCard/src/main/java/com/bihe0832/android/base/card/tips/TipsHolder.java: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.card.tips; 2 | 3 | 4 | import android.content.Context; 5 | import android.text.Html; 6 | import android.view.View; 7 | import android.widget.TextView; 8 | 9 | import com.bihe0832.android.base.card.R; 10 | import com.bihe0832.android.lib.adapter.CardBaseHolder; 11 | import com.bihe0832.android.lib.adapter.CardBaseModule; 12 | 13 | /** 14 | * @author zixie code@bihe0832.com 15 | * Created on 2019-11-21. 16 | * Description: Description 17 | */ 18 | 19 | public class TipsHolder extends CardBaseHolder { 20 | 21 | public TextView mTipsText; 22 | 23 | 24 | public TipsHolder(View view, Context context) { 25 | super(view, context); 26 | } 27 | 28 | @Override 29 | public void initView() { 30 | mTipsText = getView(R.id.test_title); 31 | } 32 | 33 | @Override 34 | public void initData(CardBaseModule item) { 35 | TipsData data = (TipsData) item; 36 | mTipsText.setText(Html.fromHtml(data.mContentText)); 37 | if (null != data.mListener) { 38 | itemView.setOnClickListener(data.mListener); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /BaseCard/src/main/res/drawable/card_apk_corner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 11 | -------------------------------------------------------------------------------- /BaseCard/src/main/res/layout/card_m3u8_list_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 30 | 31 | 44 | 45 | 59 | 60 | 72 | 73 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /BaseCard/src/main/res/layout/card_puzzle_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 24 | 25 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /BaseCard/src/main/res/layout/card_tips.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 21 | 22 | -------------------------------------------------------------------------------- /BaseDebug/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | apply plugin: 'kotlin-kapt' 5 | 6 | android { 7 | compileSdkVersion project.compileSdkVersion 8 | buildToolsVersion project.buildToolsVersion 9 | 10 | 11 | defaultConfig { 12 | minSdkVersion project.libMinSdkVersion 13 | targetSdkVersion project.targetSdkVersion 14 | versionName project.zixieVersionName 15 | versionCode project.zixieVersionCode 16 | } 17 | 18 | lintOptions { 19 | abortOnError false 20 | } 21 | 22 | buildTypes { 23 | debug { 24 | minifyEnabled false 25 | shrinkResources false 26 | } 27 | 28 | release { 29 | proguardFiles "./../proguard-rules-common.pro" 30 | shrinkResources false 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BaseDebug/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /BaseDebug/src/main/java/com/bihe0832/android/base/debug/webview/DebugM3U8Fragment.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.debug.webview 2 | 3 | import android.view.View 4 | import com.bihe0832.android.base.m3u8.bean.M3U8Info 5 | import com.bihe0832.android.base.m3u8.db.M3U8DBManager 6 | import com.bihe0832.android.common.debug.base.BaseDebugListFragment 7 | import com.bihe0832.android.common.debug.item.DebugItemData 8 | import com.bihe0832.android.common.debug.item.getDebugItem 9 | import com.bihe0832.android.lib.adapter.CardBaseModule 10 | import com.bihe0832.android.lib.gson.JsonHelper 11 | import com.bihe0832.android.lib.log.ZLog 12 | import com.bihe0832.android.lib.ui.dialog.callback.DialogCompletedStringCallback 13 | import com.bihe0832.android.lib.ui.dialog.tools.DialogUtils 14 | 15 | class DebugM3U8Fragment : BaseDebugListFragment() { 16 | val LOG_TAG = "DebugTTSFragment" 17 | 18 | override fun initView(view: View) { 19 | super.initView(view) 20 | M3U8DBManager.init(view.context) 21 | } 22 | 23 | override fun getDataList(): ArrayList { 24 | return ArrayList().apply { 25 | add(getDebugItem("批量导出下载记录") { export() }) 26 | add(getDebugItem("批量新增下载地址") { add() }) 27 | 28 | } 29 | } 30 | 31 | private fun add() { 32 | DialogUtils.showInputDialog( 33 | activity!!, 34 | "批量导入下载地址", 35 | "请导入下载地址列表的Json 结构", 36 | "", 37 | DialogCompletedStringCallback { 38 | JsonHelper.fromJsonList(it, M3U8Info::class.java)?.forEach { 39 | M3U8DBManager.saveData(it) 40 | } 41 | }, 42 | ) 43 | } 44 | 45 | private fun export() { 46 | JsonHelper.toJson(M3U8DBManager.getAll().toList()).let { 47 | ZLog.e("\n\n\n !!! all m3u8 urls :\n $it \n !!! \n\n\n ") 48 | } 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /BaseDebug/src/main/java/com/bihe0832/android/base/debug/webview/DebugWebviewFragment.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.debug.webview 2 | 3 | import android.text.TextUtils 4 | import android.view.View 5 | import com.bihe0832.android.app.router.openWebPage 6 | import com.bihe0832.android.common.debug.base.BaseDebugListFragment 7 | import com.bihe0832.android.common.debug.item.getDebugItem 8 | import com.bihe0832.android.framework.ZixieContext 9 | import com.bihe0832.android.lib.adapter.CardBaseModule 10 | import com.bihe0832.android.lib.ui.dialog.callback.DialogCompletedStringCallback 11 | 12 | class DebugWebviewFragment : BaseDebugListFragment() { 13 | 14 | private var lastUrl = "https://blog.bihe0832.com" 15 | 16 | override fun getDataList(): ArrayList { 17 | return ArrayList().apply { 18 | add( 19 | getDebugItem( 20 | "打开指定Web页面", 21 | View.OnClickListener { 22 | showInputDialog( 23 | "打开指定Web页面", 24 | "请在输入框输入网页地址后点击“确定”", 25 | lastUrl, 26 | DialogCompletedStringCallback { result: String -> 27 | try { 28 | if (!TextUtils.isEmpty(result)) { 29 | lastUrl = result 30 | openWebPage(result) 31 | } else { 32 | ZixieContext.showDebug("请输入正确的网页地址") 33 | } 34 | } catch (e: Exception) { 35 | } 36 | }, 37 | ) 38 | }, 39 | ), 40 | ) 41 | add( 42 | getDebugItem( 43 | "打开JSbridge调试页面", 44 | View.OnClickListener { openWebPage("https://microdemo.bihe0832.com/jsbridge/index.html") }, 45 | ), 46 | ) 47 | add(getDebugItem("打开TBS调试页面", View.OnClickListener { openWebPage("http://debugtbs.qq.com/") })) 48 | add(getDebugItem("打开本地调试页", View.OnClickListener { openWebPage("file:///android_asset/index.html") })) 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /BaseGame/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | apply plugin: 'kotlin-kapt' 5 | 6 | android { 7 | compileSdkVersion project.compileSdkVersion 8 | buildToolsVersion project.buildToolsVersion 9 | 10 | 11 | defaultConfig { 12 | minSdkVersion project.libMinSdkVersion 13 | targetSdkVersion project.targetSdkVersion 14 | versionName project.zixieVersionName 15 | versionCode project.zixieVersionCode 16 | } 17 | 18 | lintOptions { 19 | abortOnError false 20 | } 21 | 22 | buildTypes { 23 | debug { 24 | minifyEnabled false 25 | shrinkResources false 26 | } 27 | 28 | release { 29 | proguardFiles "./../proguard-rules-common.pro" 30 | shrinkResources false 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BaseGame/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /BaseGame/src/main/java/com/bihe0832/android/base/game/GameWrapper.java: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.game; 2 | 3 | import android.content.Context; 4 | 5 | import com.bihe0832.android.framework.ui.main.CommonRootActivity; 6 | 7 | /** 8 | * @author zixie code@bihe0832.com 9 | * Created on 2023/4/7. 10 | * Description: Description 11 | */ 12 | public class GameWrapper { 13 | public static void startGame(Context context, Class cls, String titleName) { 14 | CommonRootActivity.startCommonRootActivity(context, cls, titleName); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /BaseGame/src/main/java/com/bihe0832/android/base/game/ui/BaseShakeGameFragment.java: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.game.ui; 2 | 3 | import android.view.View; 4 | 5 | import androidx.annotation.NonNull; 6 | 7 | import com.bihe0832.android.framework.ui.BaseFragment; 8 | import com.bihe0832.android.lib.device.shake.ShakeManager; 9 | 10 | public abstract class BaseShakeGameFragment extends BaseFragment { 11 | 12 | private boolean mIsLocked = false; 13 | 14 | 15 | @Override 16 | protected void initView(@NonNull View view) { 17 | super.initView(view); 18 | ShakeManager.INSTANCE.setOnShakeListener(new ShakeManager.OnShakeListener() { 19 | @Override 20 | public void onShake() { 21 | if (!mIsLocked) { 22 | restartGame(); 23 | } 24 | } 25 | }); 26 | initGameUI(); 27 | } 28 | 29 | @Override 30 | public void setUserVisibleHint(boolean isVisibleToUser, boolean hasCreateView) { 31 | super.setUserVisibleHint(isVisibleToUser, hasCreateView); 32 | if (isVisibleToUser && hasCreateView) { 33 | ShakeManager.INSTANCE.start(); 34 | } else { 35 | ShakeManager.INSTANCE.stop(); 36 | } 37 | } 38 | 39 | public void restartGame() { 40 | resetGameUI(); 41 | startGame(); 42 | } 43 | 44 | public boolean isLocked() { 45 | return mIsLocked; 46 | } 47 | 48 | public void setLocked(boolean mIsLocked) { 49 | this.mIsLocked = mIsLocked; 50 | } 51 | 52 | public abstract void initGameUI(); 53 | 54 | public abstract void startGame(); 55 | 56 | public abstract void resetGameUI(); 57 | 58 | } 59 | -------------------------------------------------------------------------------- /BaseGameDice/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | apply plugin: 'kotlin-kapt' 5 | 6 | android { 7 | compileSdkVersion project.compileSdkVersion 8 | buildToolsVersion project.buildToolsVersion 9 | 10 | 11 | defaultConfig { 12 | minSdkVersion project.libMinSdkVersion 13 | targetSdkVersion project.targetSdkVersion 14 | versionName project.zixieVersionName 15 | versionCode project.zixieVersionCode 16 | } 17 | 18 | lintOptions { 19 | abortOnError false 20 | } 21 | 22 | buildTypes { 23 | debug { 24 | minifyEnabled false 25 | shrinkResources false 26 | } 27 | 28 | release { 29 | proguardFiles "./../proguard-rules-common.pro" 30 | shrinkResources false 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BaseGameDice/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /BaseGameDice/src/main/java/com/bihe0832/android/base/dice/DiceConfig.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.dice 2 | 3 | import com.bihe0832.android.lib.config.Config 4 | 5 | 6 | /** 7 | * 8 | * @author zixie code@bihe0832.com 9 | * Created on 2023/4/7. 10 | * Description: Description 11 | * 12 | */ 13 | object DiceConfig { 14 | 15 | const val GAME_DICE_NUM = "diceNum" 16 | const val GAME_RESULT_IS_LOCKED = "mIsLocked" 17 | const val GAME_RESULT_IS_SORTED = "mIsSort" 18 | 19 | fun getDiceNum(): Int { 20 | return Config.readConfig(GAME_DICE_NUM, 6) 21 | } 22 | 23 | fun setDiceNum(diceNum: Int): Boolean { 24 | return Config.writeConfig(GAME_DICE_NUM, diceNum) 25 | } 26 | 27 | fun isAutoLocked(): Boolean { 28 | return Config.isSwitchEnabled(GAME_RESULT_IS_LOCKED, false) 29 | } 30 | 31 | fun setAutoLocked(isLocked: Boolean): Boolean { 32 | return Config.writeConfig(GAME_RESULT_IS_LOCKED, isLocked) 33 | } 34 | 35 | fun isAutoSorted(): Boolean { 36 | return Config.isSwitchEnabled(GAME_RESULT_IS_SORTED, true) 37 | } 38 | 39 | fun setAutoSorted(mIsSort: Boolean): Boolean { 40 | return Config.writeConfig(GAME_RESULT_IS_SORTED, mIsSort) 41 | } 42 | 43 | fun getDiceResIDByNum(num: Int): Int { 44 | return when (num) { 45 | 1 -> R.mipmap.dice_1 46 | 2 -> R.mipmap.dice_2 47 | 3 -> R.mipmap.dice_3 48 | 4 -> R.mipmap.dice_4 49 | 5 -> R.mipmap.dice_5 50 | 6 -> R.mipmap.dice_6 51 | else -> -1 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /BaseGameDice/src/main/res/mipmap-xxhdpi/dice_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/BaseGameDice/src/main/res/mipmap-xxhdpi/dice_1.png -------------------------------------------------------------------------------- /BaseGameDice/src/main/res/mipmap-xxhdpi/dice_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/BaseGameDice/src/main/res/mipmap-xxhdpi/dice_2.png -------------------------------------------------------------------------------- /BaseGameDice/src/main/res/mipmap-xxhdpi/dice_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/BaseGameDice/src/main/res/mipmap-xxhdpi/dice_3.png -------------------------------------------------------------------------------- /BaseGameDice/src/main/res/mipmap-xxhdpi/dice_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/BaseGameDice/src/main/res/mipmap-xxhdpi/dice_4.png -------------------------------------------------------------------------------- /BaseGameDice/src/main/res/mipmap-xxhdpi/dice_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/BaseGameDice/src/main/res/mipmap-xxhdpi/dice_5.png -------------------------------------------------------------------------------- /BaseGameDice/src/main/res/mipmap-xxhdpi/dice_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/BaseGameDice/src/main/res/mipmap-xxhdpi/dice_6.png -------------------------------------------------------------------------------- /BaseGameDice/src/main/res/mipmap-xxhdpi/dice_barrel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/BaseGameDice/src/main/res/mipmap-xxhdpi/dice_barrel.png -------------------------------------------------------------------------------- /BaseGameDice/src/main/res/values/com_bihe0832_base_dice_res.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 骰子战争 4 | 5 | 自动锁定结果 6 | 自动排序结果 7 | 8 | 点击锁定 9 | 点击解锁 10 | 点击还原 11 | 点击整理 12 | 再来一次 13 | 14 | 您本次摇一摇的点数之和为: 15 | 您选择同时摇动 5 个骰子 16 | 您选择同时摇动 %1$s 个骰子 17 | 您要选择同时摇动 %1$s 个骰子 18 | 您当前选择同时摇动 %1$s 个骰子 19 | 20 | -------------------------------------------------------------------------------- /BaseGamePuzzle/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | apply plugin: 'kotlin-kapt' 5 | 6 | android { 7 | compileSdkVersion project.compileSdkVersion 8 | buildToolsVersion project.buildToolsVersion 9 | 10 | 11 | defaultConfig { 12 | minSdkVersion project.libMinSdkVersion 13 | targetSdkVersion project.targetSdkVersion 14 | versionName project.zixieVersionName 15 | versionCode project.zixieVersionCode 16 | } 17 | 18 | lintOptions { 19 | abortOnError false 20 | } 21 | 22 | buildTypes { 23 | debug { 24 | minifyEnabled false 25 | shrinkResources false 26 | } 27 | 28 | release { 29 | proguardFiles "./../proguard-rules-common.pro" 30 | shrinkResources false 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BaseGamePuzzle/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /BaseGamePuzzle/src/main/java/com/bihe0832/android/base/puzzle/PuzzleGameMode.java: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.puzzle; 2 | 3 | /** 4 | * @author zixie code@bihe0832.com Created on 1/6/21. 5 | */ 6 | 7 | public enum PuzzleGameMode { 8 | 9 | BAD(0), NORMAL(1), EXCHANGE(2); 10 | 11 | private int val = 0; 12 | 13 | PuzzleGameMode(int i) { 14 | val = i; 15 | } 16 | 17 | public static PuzzleGameMode getGameMode(int i) { 18 | PuzzleGameMode platform = PuzzleGameMode.BAD; 19 | switch (i) { 20 | case 0: 21 | platform = PuzzleGameMode.BAD; 22 | break; 23 | case 1: 24 | platform = PuzzleGameMode.NORMAL; 25 | break; 26 | case 2: 27 | platform = PuzzleGameMode.EXCHANGE; 28 | break; 29 | } 30 | return platform; 31 | } 32 | 33 | public String getDesc() { 34 | switch (val) { 35 | case 1: 36 | return "普通模式"; 37 | case 2: 38 | return "交换模式"; 39 | default: 40 | return "未知模式"; 41 | } 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /BaseGamePuzzle/src/main/java/com/bihe0832/android/base/puzzle/ui/GameActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.puzzle.ui 2 | 3 | /** 4 | * @author zixie code@bihe0832.com 5 | * Created on 2023/4/11. 6 | * Description: Description 7 | */ 8 | 9 | import android.os.Bundle 10 | import com.bihe0832.android.app.router.RouterConstants 11 | import com.bihe0832.android.base.puzzle.R 12 | import com.bihe0832.android.framework.ui.main.CommonActivity 13 | import com.bihe0832.android.lib.router.annotation.Module 14 | 15 | @Module(RouterConstants.MODULE_NAME_PUZZLE_GAME) 16 | class GameActivity : CommonActivity() { 17 | override fun onCreate(savedInstanceState: Bundle?) { 18 | super.onCreate(savedInstanceState) 19 | initToolbar("拼图游戏中", true) 20 | } 21 | 22 | override fun onResume() { 23 | super.onResume() 24 | if (findFragment(PuzzleGameMainFragment::class.java) == null) { 25 | loadRootFragment(R.id.common_fragment_content, PuzzleGameMainFragment()) 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /BaseGamePuzzle/src/main/java/com/bihe0832/android/base/puzzle/view/ImagePiece.java: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.puzzle.view; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.BitmapFactory; 6 | import android.widget.ImageView; 7 | import com.bihe0832.android.base.puzzle.PuzzleGameMode; 8 | import com.bihe0832.android.base.puzzle.R; 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | /** 13 | * Created by Administrator on 2016/9/8 0008. 14 | */ 15 | public class ImagePiece { 16 | 17 | public static final int TYPE_NORMAL = 0; 18 | public static final int TYPE_EMPTY = 1; 19 | 20 | private int type = TYPE_NORMAL; 21 | private int index; 22 | private Bitmap bitmap; 23 | private ImageView imageView; 24 | 25 | public ImageView getImageView() { 26 | return imageView; 27 | } 28 | 29 | public void setImageView(ImageView imageView) { 30 | this.imageView = imageView; 31 | } 32 | 33 | public int getType() { 34 | return type; 35 | } 36 | 37 | public void setType(int type) { 38 | this.type = type; 39 | } 40 | 41 | public int getIndex() { 42 | return index; 43 | } 44 | 45 | public void setIndex(int index) { 46 | this.index = index; 47 | } 48 | 49 | public Bitmap getBitmap() { 50 | return bitmap; 51 | } 52 | 53 | public void setBitmap(Bitmap bitmap) { 54 | this.bitmap = bitmap; 55 | } 56 | 57 | @Override 58 | public String toString() { 59 | return super.toString(); 60 | } 61 | 62 | /** 63 | * 传入一个bitmap 返回 一个picec集合 64 | * 65 | * @param bitmap 66 | * @param count 67 | * @return 68 | */ 69 | public static List splitImage(Context context, Bitmap bitmap, int count, PuzzleGameMode gameMode) { 70 | 71 | List imagePieces = new ArrayList<>(); 72 | int width = bitmap.getWidth(); 73 | int height = bitmap.getHeight(); 74 | 75 | int picWidth = Math.min(width, height) / count; 76 | 77 | for (int i = 0; i < count; i++) { 78 | for (int j = 0; j < count; j++) { 79 | ImagePiece imagePiece = new ImagePiece(); 80 | imagePiece.setIndex(j + i * count); 81 | //为createBitmap 切割图片获取xy 82 | int x = j * picWidth; 83 | int y = i * picWidth; 84 | if (PuzzleGameMode.NORMAL == gameMode) { 85 | if (i == count - 1 && j == count - 1) { 86 | imagePiece.setType(ImagePiece.TYPE_EMPTY); 87 | Bitmap emptyBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.empty); 88 | imagePiece.setBitmap(emptyBitmap); 89 | } else { 90 | imagePiece.setBitmap(Bitmap.createBitmap(bitmap, x, y, picWidth, picWidth)); 91 | } 92 | } else { 93 | imagePiece.setBitmap(Bitmap.createBitmap(bitmap, x, y, picWidth, picWidth)); 94 | } 95 | imagePieces.add(imagePiece); 96 | } 97 | } 98 | return imagePieces; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /BaseGamePuzzle/src/main/res/drawable/game_button_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 9 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /BaseGamePuzzle/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | #E2E2E4 3 | #0099CC 4 | 5 | -------------------------------------------------------------------------------- /BaseGamePuzzle/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 游戏模式:%1$s 3 | 难度等级: %1$s 级 4 | 当前已经是最高难度 5 | 当前已经是最低难度 6 | 挑战成功 7 | 继续当前 8 | 换张图 9 | 10 | -------------------------------------------------------------------------------- /BaseM3U8/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | apply plugin: 'kotlin-kapt' 5 | 6 | android { 7 | compileSdkVersion project.compileSdkVersion 8 | buildToolsVersion project.buildToolsVersion 9 | 10 | 11 | defaultConfig { 12 | minSdkVersion project.libMinSdkVersion 13 | targetSdkVersion project.targetSdkVersion 14 | versionName project.zixieVersionName 15 | versionCode project.zixieVersionCode 16 | } 17 | 18 | lintOptions { 19 | abortOnError false 20 | } 21 | 22 | buildTypes { 23 | debug { 24 | minifyEnabled false 25 | shrinkResources false 26 | } 27 | 28 | release { 29 | proguardFiles "./../proguard-rules-common.pro" 30 | shrinkResources false 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BaseM3U8/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /BaseM3U8/src/main/java/com/bihe0832/android/base/m3u8/M3U8Listener.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.m3u8 2 | 3 | /** 4 | * 5 | * @author zixie code@bihe0832.com Created on 2/22/21. 6 | * 7 | */ 8 | interface M3U8Listener { 9 | 10 | /** 11 | * 任务下载失败通知,在任务下载失败后回调 12 | * 根据需要更新任务的UI状态显示,如:任务状态显示为”已失败“ 13 | */ 14 | fun onFail(errorCode: Int, msg: String) 15 | 16 | fun onComplete() 17 | 18 | fun onProcess(finished: Int, total: Int) 19 | } -------------------------------------------------------------------------------- /BaseM3U8/src/main/java/com/bihe0832/android/base/m3u8/M3U8ModuleManager.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.m3u8 2 | 3 | import android.content.Context 4 | import com.bihe0832.android.base.m3u8.db.M3U8DBManager 5 | import com.bihe0832.android.framework.ZixieContext 6 | import com.bihe0832.android.lib.download.wrapper.DownloadFileUtils 7 | import com.bihe0832.android.lib.file.FileUtils 8 | import com.bihe0832.android.lib.utils.encrypt.messagedigest.MD5 9 | import java.io.File 10 | 11 | /** 12 | * 13 | * @author zixie code@bihe0832.com 14 | * Created on 2021/3/27. 15 | * Description: Description 16 | * 17 | */ 18 | object M3U8ModuleManager { 19 | 20 | private var mApplicationContext: Context? = null 21 | private var hasInit = false 22 | 23 | fun init(context: Context) { 24 | mApplicationContext = context 25 | if (hasInit) { 26 | return 27 | } 28 | hasInit = true 29 | DownloadFileUtils.init(context, 30, ZixieContext.isDebug()) 30 | M3U8DBManager.init(context) 31 | } 32 | 33 | fun getBasePath(): String { 34 | return FileUtils.getFolderPathWithSeparator(ZixieContext.getZixieFolder()) 35 | } 36 | 37 | fun getDownloadPath(m3u8Url: String): String { 38 | return FileUtils.getFolderPathWithSeparator(getBasePath() + MD5.getMd5(m3u8Url) + File.separator) 39 | } 40 | 41 | fun getFinalVideoPath(m3u8Url: String): String { 42 | val finalOutPutFile = 43 | getBasePath() + "pictures" + File.separator + "m3u8" + File.separator + getFinalVideoName(m3u8Url) 44 | FileUtils.checkAndCreateFolder(File(finalOutPutFile).parentFile.absolutePath) 45 | return finalOutPutFile 46 | } 47 | 48 | fun getFinalVideoName(m3u8Url: String): String { 49 | return MD5.getMd5(m3u8Url) + ".mp4" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /BaseM3U8/src/main/java/com/bihe0832/android/base/m3u8/bean/M3U8Info.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.m3u8.bean 2 | 3 | import com.bihe0832.android.base.m3u8.M3U8ModuleManager 4 | import com.bihe0832.android.lib.file.FileUtils.getFileLength 5 | import java.util.concurrent.CopyOnWriteArrayList 6 | 7 | /** 8 | * @author zixie code@bihe0832.com 9 | * Created on 2021/2/20. 10 | * Description: Description 11 | */ 12 | class M3U8Info { 13 | 14 | //Header 15 | var header = "" 16 | 17 | //下载ts的基础URL 18 | private var baseURL = "" 19 | 20 | //m3u8文件URL 21 | private var m3u8URL = "" 22 | 23 | //更新时间 24 | private var downloadTime: Long = 0 25 | 26 | //文件总大小 27 | private var fileSize: Long = 0 28 | 29 | //总时间,单位毫秒 30 | private var totalTime: Long = 0 31 | 32 | //视频切片 33 | private val tsList: CopyOnWriteArrayList = CopyOnWriteArrayList() 34 | 35 | // 实际去重以后得切片数量 36 | private var mTsSize = 0 37 | 38 | fun getBaseURL(): String { 39 | return baseURL 40 | } 41 | 42 | fun setBaseURL(baseURL: String) { 43 | this.baseURL = baseURL!! 44 | } 45 | 46 | fun getM3u8URL(): String { 47 | return m3u8URL 48 | } 49 | 50 | fun setM3u8URL(m3u8URL: String) { 51 | this.m3u8URL = m3u8URL 52 | } 53 | 54 | fun getDownloadTime(): Long { 55 | return downloadTime 56 | } 57 | 58 | fun setDownloadTime(downloadTime: Long) { 59 | this.downloadTime = downloadTime 60 | } 61 | 62 | fun getFileSize(): Long { 63 | fileSize = 0 64 | for (m3U8Ts in tsList) { 65 | fileSize += m3U8Ts.fileSize 66 | } 67 | return fileSize 68 | } 69 | 70 | fun getFormatFileSize(): String? { 71 | return getFileLength(getFileSize()) 72 | } 73 | 74 | fun getTsList(): List { 75 | return tsList 76 | } 77 | 78 | fun getTsSize(): Int { 79 | if (mTsSize == 0) { 80 | mTsSize = this.tsList.distinctBy { it.m3u8TSURL }.size 81 | } 82 | return mTsSize 83 | } 84 | 85 | fun addTs(ts: M3U8TSInfo) { 86 | this.tsList.add(ts) 87 | this.mTsSize = this.tsList.distinctBy { it.m3u8TSURL }.size 88 | } 89 | 90 | fun getTotalTime(): Long { 91 | totalTime = 0 92 | for (m3U8Ts in tsList) { 93 | totalTime += (m3U8Ts.seconds * 1000).toInt() 94 | } 95 | return totalTime 96 | } 97 | 98 | fun isOK(): Boolean { 99 | return tsList.isNotEmpty() 100 | } 101 | 102 | override fun toString(): String { 103 | val sb = StringBuilder() 104 | sb.append("视频信息: \n\n") 105 | sb.append("m3u8URL: ").append(m3u8URL).append("\n\n") 106 | sb.append("baseURL: ").append(baseURL).append("\n\n") 107 | sb.append("保存地址: ").append(M3U8ModuleManager.getDownloadPath(m3u8URL)).append("\n\n") 108 | sb.append("视频地址: ").append(M3U8ModuleManager.getFinalVideoPath(m3u8URL)).append("\n\n") 109 | sb.append("分片数量: ").append(tsList.size).append(",").append("实际分片数量: ").append(getTsSize()).append("\n\n") 110 | if (tsList.isNotEmpty()) { 111 | sb.append("第一分片信息: ").append(tsList.get(0).toString()) 112 | } 113 | return sb.toString() 114 | } 115 | 116 | fun getFinalVideoPath(): String { 117 | return M3U8ModuleManager.getFinalVideoPath(m3u8URL) 118 | } 119 | 120 | fun getFinalVideoName(): String { 121 | return M3U8ModuleManager.getFinalVideoName(m3u8URL) 122 | } 123 | 124 | override fun equals(other: Any?): Boolean { 125 | if (other is M3U8Info) { 126 | return m3u8URL != null && m3u8URL == other.m3u8URL 127 | } 128 | return false 129 | } 130 | } -------------------------------------------------------------------------------- /BaseM3U8/src/main/java/com/bihe0832/android/base/m3u8/bean/M3U8TSInfo.java: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.m3u8.bean; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.bihe0832.android.lib.utils.encrypt.messagedigest.MD5; 6 | 7 | 8 | /** 9 | * @author zixie code@bihe0832.com 10 | * Created on 2021/2/20. 11 | * Description: Description 12 | */ 13 | public class M3U8TSInfo implements Comparable { 14 | public static final String FILE_EXTENTION = ".ts"; 15 | private String m3u8TSURL; 16 | private String m3u8TSKeyURL; 17 | private long fileSize; 18 | private float seconds; 19 | public boolean finished = false; 20 | 21 | public M3U8TSInfo(String m3u8TSURL, String key, float seconds) { 22 | this.m3u8TSURL = m3u8TSURL; 23 | this.m3u8TSKeyURL = key; 24 | this.seconds = seconds; 25 | } 26 | 27 | public String getM3u8TSURL() { 28 | return m3u8TSURL; 29 | } 30 | 31 | public String getM3u8TSFullURL(String baseURL) { 32 | return getFullUrl(baseURL, m3u8TSURL); 33 | } 34 | 35 | public String getM3u8TSKeyURL() { 36 | return m3u8TSKeyURL; 37 | } 38 | 39 | public String getM3u8TSKKeyFullURL(String baseURL) { 40 | return getFullUrl(baseURL, m3u8TSKeyURL); 41 | } 42 | 43 | public static final String getFullUrl(String baseURL, String path) { 44 | if (TextUtils.isEmpty(path)) { 45 | return ""; 46 | } else if (path.startsWith("http")) { 47 | return path; 48 | } else if (path.startsWith("//")) { 49 | return "http:" + path; 50 | } else { 51 | return mergeURL(baseURL, path); 52 | } 53 | 54 | } 55 | 56 | public static String mergeURL(String baseUrl, String tempUrl) { 57 | String newBaseURL = baseUrl; 58 | if (!baseUrl.endsWith("/")) { 59 | newBaseURL = baseUrl + "/"; 60 | } 61 | 62 | String newTempURL = tempUrl; 63 | if (tempUrl.startsWith("/")) { 64 | newTempURL = tempUrl.substring(1); 65 | } 66 | 67 | String[] tempList = newTempURL.split("/"); 68 | if (newBaseURL.contains(tempList[0])) { 69 | String sameString = newBaseURL.substring(newBaseURL.lastIndexOf(tempList[0])); 70 | if (newTempURL.contains(sameString)) { 71 | return newBaseURL + newTempURL.substring(sameString.length()); 72 | } 73 | } 74 | 75 | return newBaseURL + newTempURL; 76 | } 77 | 78 | public float getSeconds() { 79 | return seconds; 80 | } 81 | 82 | 83 | public String getLocalFileName() { 84 | if (TextUtils.isEmpty(m3u8TSURL)) { 85 | return "error" + FILE_EXTENTION; 86 | } else { 87 | return MD5.getMd5(m3u8TSURL).concat(FILE_EXTENTION); 88 | } 89 | } 90 | 91 | public String getLocalKeyName() { 92 | if (TextUtils.isEmpty(m3u8TSKeyURL)) { 93 | return ""; 94 | } else { 95 | return MD5.getMd5(m3u8TSKeyURL); 96 | } 97 | } 98 | 99 | 100 | @Override 101 | public int compareTo(M3U8TSInfo o) { 102 | return m3u8TSURL.compareTo(o.m3u8TSURL); 103 | } 104 | 105 | public long getFileSize() { 106 | return fileSize; 107 | } 108 | 109 | public void setFileSize(long fileSize) { 110 | this.fileSize = fileSize; 111 | } 112 | 113 | @Override 114 | public String toString() { 115 | return "M3U8TSInfo{" + "m3u8TSURL='" + m3u8TSURL + '\'' + ", m3u8TSKeyURL='" + m3u8TSKeyURL + '\'' + ", seconds=" + seconds + '}'; 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /BaseM3U8/src/main/java/com/bihe0832/android/base/m3u8/db/M3U8DBManager.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.m3u8.db 2 | 3 | import android.content.Context 4 | import com.bihe0832.android.base.m3u8.bean.M3U8Info 5 | 6 | /** 7 | * 8 | * @author zixie code@bihe0832.com 9 | * Created on 2020/6/11. 10 | * Description: Description 11 | * 12 | */ 13 | object M3U8DBManager { 14 | 15 | private var commonDBHelperInstance: M3U8InfoDBHelper? = null 16 | 17 | fun init(context: Context) { 18 | if (null == commonDBHelperInstance) { 19 | commonDBHelperInstance = M3U8InfoDBHelper(context) 20 | } 21 | } 22 | 23 | fun getAll(): List { 24 | try { 25 | commonDBHelperInstance?.let { 26 | return M3U8InfoTableModel.getAllData(it) 27 | } 28 | } catch (e: Exception) { 29 | e.printStackTrace() 30 | } 31 | 32 | return mutableListOf() 33 | } 34 | 35 | fun getData(url: String): M3U8Info? { 36 | try { 37 | commonDBHelperInstance?.let { 38 | return M3U8InfoTableModel.getData(it, url) 39 | } 40 | } catch (e: Exception) { 41 | e.printStackTrace() 42 | } 43 | 44 | return null 45 | } 46 | 47 | fun saveData(info: M3U8Info): Boolean { 48 | try { 49 | commonDBHelperInstance?.let { 50 | return M3U8InfoTableModel.saveData(it, info) 51 | } 52 | } catch (e: Exception) { 53 | e.printStackTrace() 54 | } 55 | return false 56 | } 57 | 58 | fun deleteData(url: String): Boolean { 59 | try { 60 | commonDBHelperInstance?.let { 61 | return M3U8InfoTableModel.clearData(it, url) 62 | } 63 | } catch (e: Exception) { 64 | e.printStackTrace() 65 | } 66 | return false 67 | } 68 | 69 | fun deleteAll(): Int { 70 | try { 71 | commonDBHelperInstance?.let { 72 | return M3U8InfoTableModel.deleteAll(it) 73 | } 74 | } catch (e: Exception) { 75 | e.printStackTrace() 76 | } 77 | return 0 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /BaseM3U8/src/main/java/com/bihe0832/android/base/m3u8/db/M3U8InfoDBHelper.java: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.m3u8.db; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.content.Context; 5 | import android.database.sqlite.SQLiteDatabase; 6 | 7 | import com.bihe0832.android.lib.sqlite.BaseDBHelper; 8 | 9 | 10 | class M3U8InfoDBHelper extends BaseDBHelper { 11 | private static final String DB_NAME = "zixie_m3u8"; 12 | 13 | private static final int DB_VERSION = 2; 14 | 15 | M3U8InfoDBHelper(Context ctx) { 16 | super(ctx, DB_NAME, DB_VERSION); 17 | } 18 | 19 | @Override 20 | public void onCreate(SQLiteDatabase db) { 21 | try { 22 | db.execSQL(M3U8InfoTableModel.TABLE_CREATE_SQL); 23 | } catch (Exception e) { 24 | e.printStackTrace(); 25 | } 26 | } 27 | 28 | @Override 29 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { 30 | try { 31 | db.execSQL(M3U8InfoTableModel.TABLE_DROP_SQL); 32 | onCreate(db); 33 | } catch (Exception e) { 34 | e.printStackTrace(); 35 | } 36 | } 37 | 38 | @SuppressLint("Override") 39 | public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) { 40 | try { 41 | db.execSQL(M3U8InfoTableModel.TABLE_DROP_SQL); 42 | onCreate(db); 43 | } catch (Exception e) { 44 | e.printStackTrace(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /BaseM3U8/src/main/java/com/bihe0832/android/base/m3u8/history/M3U8ListLiveData.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.base.m3u8.history 2 | 3 | import com.bihe0832.android.common.list.CommonListLiveData 4 | 5 | 6 | /** 7 | * 8 | * @author zixie code@bihe0832.com Created on 2020/12/1. 9 | * 10 | */ 11 | abstract class M3U8ListLiveData : CommonListLiveData() { 12 | 13 | override fun loadMore() { 14 | 15 | } 16 | 17 | override fun hasMore(): Boolean { 18 | return false 19 | } 20 | 21 | override fun canRefresh(): Boolean { 22 | return false 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /BaseM3U8/src/main/res/layout/fragment_m3u8_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 19 | 20 | 24 | 25 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /BasePhotos/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | apply plugin: 'kotlin-kapt' 5 | 6 | android { 7 | compileSdkVersion project.compileSdkVersion 8 | buildToolsVersion project.buildToolsVersion 9 | 10 | 11 | defaultConfig { 12 | minSdkVersion project.libMinSdkVersion 13 | targetSdkVersion project.targetSdkVersion 14 | versionName project.zixieVersionName 15 | versionCode project.zixieVersionCode 16 | } 17 | 18 | lintOptions { 19 | abortOnError false 20 | } 21 | 22 | buildTypes { 23 | debug { 24 | minifyEnabled false 25 | shrinkResources false 26 | } 27 | 28 | release { 29 | proguardFiles "./../proguard-rules-common.pro" 30 | shrinkResources false 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BasePhotos/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /BasePhotos/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | #E2E2E4 3 | #0099CC 4 | 5 | -------------------------------------------------------------------------------- /BasePhotos/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | PuzzleGame 3 | 普通模式 4 | 交换模式 5 | 已经是最高等级 6 | 已经是最低等级 7 | 成功! 8 | 你已经完成拼图,是否挑战下一个等级? 9 | 下一等级 10 | 取消 11 | 12 | 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 AndroidAppFactory 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PubAdbInput/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /PubAdbInput/src/main/java/com/bihe0832/android/app/browser/SplashActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.browser 2 | 3 | import com.bihe0832.android.app.router.RouterConstants 4 | import com.bihe0832.android.common.splash.SplashActivity 5 | import com.bihe0832.android.lib.router.annotation.Module 6 | 7 | @Module(RouterConstants.MODULE_NAME_SPLASH) 8 | class SplashActivity : SplashActivity() { 9 | 10 | override fun getMainRouter(): String { 11 | return RouterConstants.MODULE_NAME_INPUT_GUIDE 12 | } 13 | } -------------------------------------------------------------------------------- /PubAdbInput/src/main/res/mipmap-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/PubAdbInput/src/main/res/mipmap-xxhdpi/icon.png -------------------------------------------------------------------------------- /PubAdbInput/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | https://cdn.bihe0832.com/app/update/get_input.json 3 | https://cdn.bihe0832.com/app/help/zinput.html 4 | https://cdn.bihe0832.com/app/msg/zinput.json 5 | 6 | 为了向你提供快速输入等服务以及优化我们的应用体验,我们需要收集你的设备信息、操作日志等个人信息。你可以在「设置」中管理你的授权。<BR>如你同意,请点击「同意」授权后开始使用我们的服务 7 | 8 | -------------------------------------------------------------------------------- /PubBrowser/build.gradle: -------------------------------------------------------------------------------- 1 | if (rootProject.ext.pubModuleIsApplication as boolean) { 2 | apply plugin: 'com.android.application' 3 | } else { 4 | apply plugin: 'com.android.library' 5 | } 6 | apply plugin: 'kotlin-android' 7 | apply plugin: 'kotlin-android-extensions' 8 | apply plugin: 'kotlin-kapt' 9 | 10 | // 不同类型的包,仅仅修改下面两项即可,其余内容保持一致 11 | project.ext.applicationID = "com.bihe0832.browser" 12 | project.ext.applicationName = "子勰浏览" 13 | project.ext.applicationPrefix = "ZBROWSER" 14 | project.ext.routerSchema = "zbrowser" 15 | 16 | android { 17 | 18 | compileSdkVersion project.compileSdkVersion 19 | buildToolsVersion project.buildToolsVersion 20 | 21 | defaultConfig { 22 | if (rootProject.ext.pubModuleIsApplication as boolean) { 23 | applicationId applicationID 24 | } 25 | multiDexEnabled true 26 | minSdkVersion project.appMinSdkVersion 27 | targetSdkVersion project.targetSdkVersion 28 | versionName project.versionName 29 | versionCode project.versionCode 30 | vectorDrawables.useSupportLibrary = true 31 | ndk { 32 | abiFilters project.ndk_abiFilters_project.split(",") 33 | stl "stlport_static" 34 | } 35 | } 36 | 37 | packagingOptions { 38 | project.ndk_abiFilters_project.split(",").each { abiItem -> 39 | def finalDoNotStripFileName = "*/" + abiItem + "/*.so" 40 | doNotStrip finalDoNotStripFileName 41 | } 42 | 43 | project.ndk_abiFilters_all.split(",").each { abiItem -> 44 | project.pickFirstList.each { item -> 45 | def finalPickFirstFileName = "lib/" + abiItem + "/" + item 46 | pickFirst finalPickFirstFileName 47 | } 48 | } 49 | 50 | project.excludeList.each { item -> 51 | exclude item 52 | } 53 | } 54 | 55 | compileOptions { 56 | sourceCompatibility JavaVersion.VERSION_1_8 57 | targetCompatibility JavaVersion.VERSION_1_8 58 | } 59 | 60 | lintOptions { 61 | abortOnError false 62 | } 63 | 64 | signingConfigs { 65 | debug { 66 | keyAlias project.signingConfigs.keyAlias 67 | keyPassword project.signingConfigs.keyPassword 68 | storeFile file(project.signingConfigs.storeFile) 69 | storePassword project.signingConfigs.storePassword 70 | v1SigningEnabled project.signingConfigs.v1SigningEnabled as boolean 71 | v2SigningEnabled project.signingConfigs.v2SigningEnabled as boolean 72 | } 73 | 74 | release { 75 | keyAlias project.signingConfigs.keyAlias 76 | keyPassword project.signingConfigs.keyPassword 77 | storeFile file(project.signingConfigs.storeFile) 78 | storePassword project.signingConfigs.storePassword 79 | v1SigningEnabled project.signingConfigs.v1SigningEnabled as boolean 80 | v2SigningEnabled project.signingConfigs.v2SigningEnabled as boolean 81 | } 82 | } 83 | 84 | archivesBaseName = applicationPrefix + "_V${defaultConfig.versionName}_${defaultConfig.versionCode}" 85 | 86 | buildTypes { 87 | debug { 88 | resValue "string", "app_name", applicationName 89 | resValue "string", "router_schema", routerSchema 90 | signingConfig signingConfigs.debug 91 | minifyEnabled false 92 | shrinkResources false 93 | } 94 | 95 | release { 96 | resValue "string", "app_name", applicationName 97 | resValue "string", "router_schema", routerSchema 98 | 99 | signingConfig signingConfigs.release 100 | minifyEnabled project.minifyEnabled as boolean 101 | proguardFiles "./../proguard-rules-common.pro" 102 | shrinkResources false 103 | } 104 | } 105 | } -------------------------------------------------------------------------------- /PubBrowser/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /PubBrowser/src/main/java/com/bihe0832/android/app/browser/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.browser 2 | 3 | import android.os.Bundle 4 | import com.bihe0832.android.app.router.RouterConstants 5 | import com.bihe0832.android.app.router.RouterHelper 6 | import com.bihe0832.android.app.update.UpdateManager 7 | import com.bihe0832.android.common.webview.WebPageActivity 8 | import com.bihe0832.android.common.webview.tbsimpl.TBSWebViewFragment 9 | import com.bihe0832.android.framework.ZixieContext 10 | import com.bihe0832.android.lib.router.annotation.Module 11 | import java.util.* 12 | 13 | @Module(RouterConstants.MODULE_NAME_MAIN) 14 | class MainActivity : WebPageActivity() { 15 | 16 | override fun onCreate(savedInstanceState: Bundle?) { 17 | super.onCreate(savedInstanceState) 18 | UpdateManager.checkUpdateAndShowDialog(this, false, ZixieContext.isOfficial()) 19 | } 20 | 21 | override fun getWebViewFragment(): TBSWebViewFragment? { 22 | return BrowserFragment.newInstance(url) 23 | } 24 | 25 | override fun getWebViewFragmentClass(): Class<*>? { 26 | return BrowserFragment::class.java 27 | } 28 | } 29 | 30 | fun openMain(url: String) { 31 | val map = HashMap() 32 | map[RouterConstants.INTENT_EXTRA_KEY_WEB_URL] = url 33 | RouterHelper.openPageByRouter(RouterConstants.MODULE_NAME_MAIN, map) 34 | } -------------------------------------------------------------------------------- /PubBrowser/src/main/java/com/bihe0832/android/app/browser/SplashActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.browser 2 | 3 | import android.text.TextUtils 4 | import com.bihe0832.android.app.router.RouterConstants 5 | import com.bihe0832.android.app.router.RouterHelper 6 | import com.bihe0832.android.app.tools.AAFTools 7 | import com.bihe0832.android.common.splash.SplashActivity 8 | import com.bihe0832.android.lib.router.annotation.Module 9 | import com.bihe0832.android.lib.sqlite.impl.CommonDBManager 10 | 11 | @Module(RouterConstants.MODULE_NAME_SPLASH) 12 | class SplashActivity : SplashActivity() { 13 | 14 | override fun getMainRouter(): String { 15 | return RouterConstants.MODULE_NAME_MAIN 16 | } 17 | 18 | override fun doNext() { 19 | CommonDBManager.init(this) 20 | var url = AAFTools.pasteFromClipboard(this) 21 | if (TextUtils.isEmpty(url)) { 22 | RouterHelper.openPageByRouter(RouterConstants.MODULE_NAME_BROWSER_LIST) 23 | } else { 24 | openMain(url) 25 | } 26 | finish() 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /PubBrowser/src/main/res/layout/activity_browser_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 18 | 19 | 20 | 21 | 26 | -------------------------------------------------------------------------------- /PubBrowser/src/main/res/mipmap-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/PubBrowser/src/main/res/mipmap-xxhdpi/icon.png -------------------------------------------------------------------------------- /PubBrowser/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | https://cdn.bihe0832.com/app/update/get_browser.json 4 | https://cdn.bihe0832.com/app/help/zbrowser.html 5 | https://cdn.bihe0832.com/app/msg/zbrowser.json 6 | 7 | 为了向你提供网页浏览、下载等服务以及优化我们的应用体验,我们需要收集你的设备信息、操作日志等个人信息。你可以在「设置」中管理你的授权。<BR>如你同意,请点击「同意」授权后开始使用我们的服务 8 | 9 | -------------------------------------------------------------------------------- /PubGamePuzzle/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 13 | 14 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /PubGamePuzzle/src/main/java/com/bihe0832/android/app/puzzle/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.puzzle 2 | 3 | import android.content.Intent 4 | import com.bihe0832.android.app.puzzle.navigation.PuzzleNavigationDrawerFragment 5 | import com.bihe0832.android.app.router.RouterConstants 6 | import com.bihe0832.android.app.ui.AAFCommonMainActivity 7 | import com.bihe0832.android.common.navigation.drawer.NavigationDrawerFragment 8 | import com.bihe0832.android.lib.router.annotation.APPMain 9 | import com.bihe0832.android.lib.router.annotation.Module 10 | 11 | @APPMain 12 | @Module(RouterConstants.MODULE_NAME_PUZZLE) 13 | class MainActivity : AAFCommonMainActivity() { 14 | private val mAAFNavigationDrawerFragment = PuzzleNavigationDrawerFragment() 15 | 16 | override fun getNavigationDrawerFragment(): NavigationDrawerFragment? { 17 | return mAAFNavigationDrawerFragment 18 | } 19 | 20 | override fun getRootFragmentClassName(): String { 21 | return MainFragment::class.java.name 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /PubGamePuzzle/src/main/java/com/bihe0832/android/app/puzzle/MainFragment.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.puzzle 2 | 3 | import android.content.Intent 4 | import android.view.View 5 | import android.widget.TextView 6 | import com.bihe0832.android.base.puzzle.ui.PuzzlePhotosFragment 7 | import com.bihe0832.android.framework.ui.BaseFragment 8 | import com.bihe0832.android.lib.text.TextFactoryUtils 9 | 10 | class MainFragment : BaseFragment() { 11 | 12 | override fun getLayoutID(): Int { 13 | return R.layout.fragment_puzzle_main 14 | } 15 | 16 | override fun initView(view: View) { 17 | super.initView(view) 18 | view.findViewById(R.id.puzzle_desc).text = TextFactoryUtils.getSpannedTextByHtml( 19 | "使用教程" + 20 | " 1. 点击下方图标,选择拼图的素材" + 21 | " 2. 选择图片后,进入拼图游戏页面,可自由切换模式和难度" 22 | ) 23 | loadRootFragment(R.id.puzzle_content, PuzzlePhotosFragment()) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /PubGamePuzzle/src/main/java/com/bihe0832/android/app/puzzle/SplashActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.puzzle 2 | 3 | import com.bihe0832.android.app.router.RouterConstants 4 | import com.bihe0832.android.common.splash.SplashActivity 5 | import com.bihe0832.android.lib.router.annotation.APPMain 6 | import com.bihe0832.android.lib.router.annotation.Module 7 | 8 | @APPMain 9 | @Module(RouterConstants.MODULE_NAME_SPLASH) 10 | class SplashActivity : SplashActivity() { 11 | 12 | 13 | override fun getMainRouter(): String { 14 | return RouterConstants.MODULE_NAME_PUZZLE 15 | } 16 | } -------------------------------------------------------------------------------- /PubGamePuzzle/src/main/java/com/bihe0832/android/app/puzzle/navigation/PuzzleNavigationContentFragment.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.puzzle.navigation 2 | 3 | import com.bihe0832.android.app.message.AAFMessageManager 4 | import com.bihe0832.android.app.router.RouterConstants 5 | import com.bihe0832.android.app.ui.navigation.AAFNavigationContentFragment 6 | import com.bihe0832.android.common.settings.SettingsItem 7 | import com.bihe0832.android.framework.router.RouterAction 8 | import com.bihe0832.android.framework.update.UpdateInfoLiveData 9 | import com.bihe0832.android.lib.adapter.CardBaseModule 10 | 11 | /** 12 | * 13 | * @author zixie code@bihe0832.com 14 | * Created on 2023/4/10. 15 | * Description: Description 16 | * 17 | */ 18 | open class PuzzleNavigationContentFragment : AAFNavigationContentFragment() { 19 | 20 | 21 | override fun getDataList(): ArrayList { 22 | return ArrayList().apply { 23 | add(getAboutAPP(UpdateInfoLiveData.value) { 24 | RouterAction.openPageByRouter(RouterConstants.MODULE_NAME_BASE_ABOUT) 25 | }) 26 | add(SettingsItem.getMessage(AAFMessageManager.getUnreadNum()) { 27 | RouterAction.openPageByRouter(RouterConstants.MODULE_NAME_MESSAGE) 28 | }) 29 | 30 | add(SettingsItem.getPermission(PuzzlePermissionFragment::class.java)) 31 | addAll(getBaseDataList()) 32 | }.apply { 33 | processLastItemDriver() 34 | } 35 | } 36 | 37 | 38 | } -------------------------------------------------------------------------------- /PubGamePuzzle/src/main/java/com/bihe0832/android/app/puzzle/navigation/PuzzleNavigationDrawerFragment.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.puzzle.navigation 2 | 3 | import com.bihe0832.android.common.main.CommonNavigationDrawerFragment 4 | 5 | /** 6 | * 7 | * @author zixie code@bihe0832.com 8 | * Created on 2023/4/10. 9 | * Description: Description 10 | * 11 | */ 12 | class PuzzleNavigationDrawerFragment : CommonNavigationDrawerFragment() { 13 | 14 | override fun loadFragment(containerId: Int) { 15 | loadRootFragment(containerId, PuzzleNavigationContentFragment()) 16 | } 17 | } -------------------------------------------------------------------------------- /PubGamePuzzle/src/main/java/com/bihe0832/android/app/puzzle/navigation/PuzzlePermissionFragment.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.puzzle.navigation 2 | 3 | import android.Manifest 4 | import com.bihe0832.android.app.permission.AAFPermissionFragment 5 | import com.bihe0832.android.app.permission.AAFPermissionManager.SCENE_TAKE_PHOTO 6 | import com.bihe0832.android.common.permission.PermissionItem 7 | import com.bihe0832.android.lib.adapter.CardBaseModule 8 | 9 | 10 | open class PuzzlePermissionFragment : AAFPermissionFragment() { 11 | 12 | override fun getDataList(): ArrayList { 13 | return ArrayList().apply { 14 | add(PermissionItem.getPermissionSetting(activity!!, SCENE_TAKE_PHOTO, Manifest.permission.CAMERA).apply { 15 | mShowDriver = true 16 | }) 17 | }.apply { 18 | processLastItemDriver() 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /PubGamePuzzle/src/main/res/layout/fragment_puzzle_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 19 | 20 | 25 | -------------------------------------------------------------------------------- /PubGamePuzzle/src/main/res/mipmap-xxhdpi/icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/PubGamePuzzle/src/main/res/mipmap-xxhdpi/icon.jpg -------------------------------------------------------------------------------- /PubGamePuzzle/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | https://cdn.bihe0832.com/app/update/get_puzzle.json 3 | https://cdn.bihe0832.com/app/help/zpuzzle.html 4 | https://cdn.bihe0832.com/app/msg/zpuzzle.json 5 | 6 | 7 | -------------------------------------------------------------------------------- /PubGameShakeba/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /PubGameShakeba/src/main/java/com/bihe0832/android/app/shakeba/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.shakeba 2 | 3 | import android.os.Bundle 4 | import com.bihe0832.android.app.router.RouterConstants 5 | import com.bihe0832.android.app.ui.AAFCommonMainActivity 6 | import com.bihe0832.android.base.dice.DiceFragment 7 | import com.bihe0832.android.lib.router.annotation.APPMain 8 | import com.bihe0832.android.lib.router.annotation.Module 9 | 10 | @APPMain 11 | @Module(RouterConstants.MODULE_NAME_GAME_ROOT) 12 | open class MainActivity : AAFCommonMainActivity() { 13 | 14 | override fun onCreate(savedInstanceState: Bundle?) { 15 | super.onCreate(savedInstanceState) 16 | disableDrawerGesture() 17 | } 18 | 19 | override fun getRootFragmentClassName(): String { 20 | return DiceFragment::class.java.name 21 | } 22 | 23 | override fun getTitleName(): String { 24 | return "骰子战争" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /PubGameShakeba/src/main/java/com/bihe0832/android/app/shakeba/SplashActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.shakeba 2 | 3 | import com.bihe0832.android.app.router.RouterConstants 4 | import com.bihe0832.android.common.splash.SplashActivity 5 | import com.bihe0832.android.lib.router.annotation.Module 6 | 7 | @Module(RouterConstants.MODULE_NAME_SPLASH) 8 | class SplashActivity : SplashActivity() { 9 | 10 | override fun getMainRouter(): String { 11 | return RouterConstants.MODULE_NAME_GAME_ROOT 12 | } 13 | } -------------------------------------------------------------------------------- /PubGameShakeba/src/main/res/mipmap-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/PubGameShakeba/src/main/res/mipmap-xxhdpi/icon.png -------------------------------------------------------------------------------- /PubGameShakeba/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 来到摇吧 你就摇吧 3 | 4 | https://cdn.bihe0832.com/app/update/get_shakeba.json 5 | https://cdn.bihe0832.com/app/help/shakeba.html 6 | https://cdn.bihe0832.com/app/msg/shakeba.json 7 | 8 | 为了向你提供摇骰子等服务以及优化我们的应用体验,我们需要收集你的设备信息、操作日志等个人信息。<BR>如你同意,请点击「同意」授权后开始使用我们的服务 9 | 10 | -------------------------------------------------------------------------------- /PubGetAPKInfo/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /PubGetAPKInfo/src/main/java/com/bihe0832/android/app/apk/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.apk 2 | 3 | import com.bihe0832.android.app.apk.navigation.APKNavigationDrawerFragment 4 | import com.bihe0832.android.app.getapk.R 5 | import com.bihe0832.android.app.router.RouterConstants 6 | import com.bihe0832.android.app.ui.AAFCommonMainActivity 7 | import com.bihe0832.android.common.navigation.drawer.NavigationDrawerFragment 8 | import com.bihe0832.android.lib.router.annotation.APPMain 9 | import com.bihe0832.android.lib.router.annotation.Module 10 | import com.bihe0832.android.lib.theme.ThemeResourcesManager 11 | import java.util.* 12 | 13 | @APPMain 14 | @Module(RouterConstants.MODULE_NAME_APK_LIST) 15 | class MainActivity : AAFCommonMainActivity() { 16 | private val mAAFNavigationDrawerFragment = APKNavigationDrawerFragment() 17 | 18 | override fun getNavigationDrawerFragment(): NavigationDrawerFragment? { 19 | return mAAFNavigationDrawerFragment 20 | } 21 | 22 | override fun getTitleName(): String? { 23 | return ThemeResourcesManager.getString(R.string.app_name) 24 | } 25 | 26 | override fun getRootFragmentClassName(): String { 27 | return MainFragment::class.java.name 28 | } 29 | } -------------------------------------------------------------------------------- /PubGetAPKInfo/src/main/java/com/bihe0832/android/app/apk/SplashActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.apk 2 | 3 | import com.bihe0832.android.app.router.RouterConstants 4 | import com.bihe0832.android.common.splash.SplashActivity 5 | import com.bihe0832.android.lib.router.annotation.APPMain 6 | import com.bihe0832.android.lib.router.annotation.Module 7 | 8 | @Module(RouterConstants.MODULE_NAME_SPLASH) 9 | class SplashActivity : SplashActivity() { 10 | 11 | override fun getMainRouter(): String { 12 | return RouterConstants.MODULE_NAME_APK_LIST 13 | } 14 | } -------------------------------------------------------------------------------- /PubGetAPKInfo/src/main/java/com/bihe0832/android/app/apk/navigation/APKNavigationContentFragment.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.apk.navigation 2 | 3 | import android.text.TextUtils 4 | import android.view.View 5 | import com.bihe0832.android.app.constants.ConfigConstants 6 | import com.bihe0832.android.app.message.AAFMessageManager 7 | import com.bihe0832.android.app.router.RouterConstants 8 | import com.bihe0832.android.app.ui.navigation.AAFNavigationContentFragment 9 | import com.bihe0832.android.common.about.R 10 | import com.bihe0832.android.common.permission.settings.PermissionItem 11 | import com.bihe0832.android.common.settings.SettingsItem 12 | import com.bihe0832.android.common.settings.card.SettingsDataGo 13 | import com.bihe0832.android.framework.router.RouterAction 14 | import com.bihe0832.android.framework.update.UpdateInfoLiveData 15 | import com.bihe0832.android.lib.adapter.CardBaseModule 16 | import com.bihe0832.android.lib.config.Config 17 | import com.bihe0832.android.lib.ui.dialog.tools.DialogUtils 18 | 19 | /** 20 | * 21 | * @author zixie code@bihe0832.com 22 | * Created on 2023/4/10. 23 | * Description: Description 24 | * 25 | */ 26 | open class APKNavigationContentFragment : AAFNavigationContentFragment() { 27 | 28 | override fun getDataList(processLast: Boolean): ArrayList { 29 | return ArrayList().apply { 30 | add( 31 | SettingsItem.getAboutAPP(UpdateInfoLiveData.value) { 32 | RouterAction.openPageByRouter(RouterConstants.MODULE_NAME_BASE_ABOUT) 33 | }, 34 | ) 35 | if (AAFMessageManager.getUnreadNum() > 0) { 36 | add( 37 | SettingsItem.getMessage(AAFMessageManager.getUnreadNum()) { 38 | RouterAction.openPageByRouter(RouterConstants.MODULE_NAME_MESSAGE) 39 | }, 40 | ) 41 | } else { 42 | add( 43 | SettingsItem.getMessage(-1) { 44 | RouterAction.openPageByRouter(RouterConstants.MODULE_NAME_MESSAGE) 45 | }, 46 | ) 47 | } 48 | add(getChangeSignatureType()) 49 | addAll(getBaseDataList(processLast)) 50 | }.apply { 51 | processLastItemDriver(processLast) 52 | } 53 | } 54 | 55 | fun getChangeSignatureType(): SettingsDataGo { 56 | val title = "设置默认签名算法" 57 | return SettingsDataGo(title).apply { 58 | mItemIconRes = R.drawable.icon_android 59 | mHeaderTextBold = true 60 | mShowDriver = true 61 | mShowGo = true 62 | mHeaderListener = View.OnClickListener { 63 | DialogUtils.showInputDialog(context!!, title, "在下方输入对应签名计算算法的Key值并点击确定即可切换默认签名算法", Config.readConfig(ConfigConstants.APK.KEY_SIGNATURE_TYPE, ConfigConstants.APK.VALUE_DEFAULT_SIGNATURE_TYPE)) { p0 -> 64 | if (!TextUtils.isEmpty(p0)) { 65 | Config.writeConfig(ConfigConstants.APK.KEY_SIGNATURE_TYPE, p0) 66 | } 67 | } 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /PubGetAPKInfo/src/main/java/com/bihe0832/android/app/apk/navigation/APKNavigationDrawerFragment.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.apk.navigation 2 | 3 | import com.bihe0832.android.common.main.CommonNavigationDrawerFragment 4 | 5 | /** 6 | * 7 | * @author zixie code@bihe0832.com 8 | * Created on 2023/4/10. 9 | * Description: Description 10 | * 11 | */ 12 | class APKNavigationDrawerFragment : CommonNavigationDrawerFragment() { 13 | 14 | override fun loadFragment(containerId: Int) { 15 | loadRootFragment(containerId, APKNavigationContentFragment()) 16 | } 17 | } -------------------------------------------------------------------------------- /PubGetAPKInfo/src/main/java/com/bihe0832/android/app/apk/navigation/APKPermissionFragment.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.apk.navigation 2 | 3 | import android.Manifest 4 | import com.bihe0832.android.common.permission.settings.PermissionFragment 5 | import com.bihe0832.android.common.permission.settings.PermissionItem 6 | import com.bihe0832.android.lib.adapter.CardBaseModule 7 | 8 | open class APKPermissionFragment : PermissionFragment() { 9 | 10 | override fun getDataList(processLast: Boolean): ArrayList { 11 | return ArrayList().apply { 12 | add( 13 | PermissionItem.getPermissionSetting(activity!!, Manifest.permission.CAMERA).apply { 14 | mShowDriver = true 15 | }, 16 | ) 17 | add(PermissionItem.getPermissionSetting(activity!!, Manifest.permission.READ_PHONE_STATE)) 18 | }.apply { 19 | processLastItemDriver(processLast) 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /PubGetAPKInfo/src/main/res/mipmap-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/PubGetAPKInfo/src/main/res/mipmap-xxhdpi/icon.png -------------------------------------------------------------------------------- /PubGetAPKInfo/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | https://cdn.bihe0832.com/app/update/get_apk.json 3 | https://cdn.bihe0832.com/app/help/zapk.html 4 | https://cdn.bihe0832.com/app/msg/zapk.json 5 | 6 | 应用 7 | 为了向你提供应用信息获取等服务以及优化我们的应用体验,我们需要收集你的设备信息、操作日志等个人信息。你可以在「设置」中管理你的授权。<BR>如你同意,请点击「同意」授权后开始使用我们的服务 8 | -------------------------------------------------------------------------------- /PubM3U8/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /PubM3U8/src/main/java/com/bihe0832/android/app/m3u8/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.m3u8 2 | 3 | import android.os.Bundle 4 | import com.bihe0832.android.app.router.RouterConstants 5 | import com.bihe0832.android.app.ui.AAFCommonMainActivity 6 | import com.bihe0832.android.base.m3u8.M3U8ModuleManager 7 | import com.bihe0832.android.base.m3u8.db.M3U8DBManager 8 | import com.bihe0832.android.base.m3u8.history.M3U8ListFragment 9 | import com.bihe0832.android.framework.ZixieContext 10 | import com.bihe0832.android.lib.download.wrapper.DownloadUtils 11 | import com.bihe0832.android.lib.router.annotation.APPMain 12 | import com.bihe0832.android.lib.router.annotation.Module 13 | 14 | @APPMain 15 | @Module(RouterConstants.MODULE_NAME_MAIN) 16 | class MainActivity : AAFCommonMainActivity() { 17 | 18 | override fun onCreate(savedInstanceState: Bundle?) { 19 | super.onCreate(savedInstanceState) 20 | M3U8ModuleManager.init(this) 21 | } 22 | 23 | override fun getRootFragmentClassName(): String { 24 | return M3U8ListFragment::class.java.name 25 | } 26 | } -------------------------------------------------------------------------------- /PubM3U8/src/main/java/com/bihe0832/android/app/m3u8/SplashActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bihe0832.android.app.m3u8 2 | 3 | import android.os.Bundle 4 | import com.bihe0832.android.app.router.RouterConstants 5 | import com.bihe0832.android.base.m3u8.M3U8ModuleManager 6 | import com.bihe0832.android.base.m3u8.db.M3U8DBManager 7 | import com.bihe0832.android.common.splash.SplashActivity 8 | import com.bihe0832.android.lib.router.annotation.Module 9 | 10 | @Module(RouterConstants.MODULE_NAME_SPLASH) 11 | class SplashActivity : SplashActivity() { 12 | 13 | override fun onCreate(savedInstanceState: Bundle?) { 14 | super.onCreate(savedInstanceState) 15 | M3U8ModuleManager.init(this) 16 | } 17 | 18 | override fun getMainRouter(): String { 19 | if (M3U8DBManager.getAll().isNotEmpty()) { 20 | return RouterConstants.MODULE_NAME_MAIN 21 | } else { 22 | return RouterConstants.MODULE_NAME_M3U8 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /PubM3U8/src/main/res/mipmap-xxhdpi/icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/PubM3U8/src/main/res/mipmap-xxhdpi/icon.jpg -------------------------------------------------------------------------------- /PubM3U8/src/main/res/values/colors_teal_indigo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #009688 4 | #009688 5 | #B2DFDB 6 | #757575 7 | 8 | -------------------------------------------------------------------------------- /PubM3U8/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | https://cdn.bihe0832.com/app/update/get_m3u8.json 4 | https://cdn.bihe0832.com/app/help/zm3u8.html 5 | https://cdn.bihe0832.com/app/msg/zm3u8.json 6 | 7 | 为了向你提供基于M3U8格式的视频下载等服务以及优化我们的应用体验,我们需要收集你的设备信息、操作日志等个人信息。你可以在「设置」中管理你的授权。<BR>如你同意,请点击「同意」授权后开始使用我们的服务 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## AAF(AndroidAppFactory)介绍 2 | 3 | AAF 是基于组件化方案,逐渐积累的一套 Android 终端开发方案。方案力求做到**技术方案可以轻松的从一个项目复用到另一个项目,或者可以快速在框架基础上开发出一个独立全新的应用**,开发过程中基本聚焦在新业务的逻辑,而不是基础功能。 4 | 5 | - AAF 概述:[https://blog.bihe0832.com/android-dev-summary.html](https://blog.bihe0832.com/android-dev-summary.html) 6 | 7 | - AAF 主页:[https://android.bihe0832.com](https://android.bihe0832.com) 8 | 9 | - AAF 文档:[https://android.bihe0832.com/doc/](https://android.bihe0832.com/doc/) 10 | 11 | - AAF 源码:[https://github.com/bihe0832/AndroidAppFactory](https://github.com/bihe0832/AndroidAppFactory) 12 | 13 | ## AAF Sample 介绍 14 | 15 | AAF Sample 是所有基于AAF开发的应用的集合。用于日常功能开发,以及AAF相关方案在具体实践中的验证。当前支持的独立应用有: 16 | 17 | - APPTest:所有Sample共享的调试模块 18 | 19 | - PubGetAPKInfo:获取设备已安装应用基本信息 20 | 21 | - PubAdbInput:基于ADB的快捷输入法 22 | 23 | - PubGamePuzzle:拼图 24 | 25 | - PubM3U8:M3U8文件下载工具 26 | 27 | - PubGameShakeba:摇骰子的小游戏 28 | 29 | **如果想下载体验对应的应用可前往**: 30 | 31 | - AAF 应用事例介绍:[https://android.bihe0832.com/doc/summary/samples.html](https://android.bihe0832.com/doc/summary/samples.html) 32 | 33 | - AAF 应用事例下载:[https://cdn.bihe0832.com/app/download.html](https://cdn.bihe0832.com/app/download.html) 34 | 35 | ## 运行工程 36 | 37 | - 环境配置 38 | 39 | 根据开发者的Android Studio 版本以及网络环境修改maven依赖等配置。具体设置方法可以参考:[终端基于gradle的开源项目运行环境配置指引](https://blog.bihe0832.com/android-as-gradle-config.html) 40 | 41 | - 项目配置及运行 42 | 43 | 对于基于AAF的项目,目前已经整理了对应的文档,可以点击下面的链接查看运行Demo的指引: 44 | 45 | [https://android.bihe0832.com/doc/sample/start.html](https://android.bihe0832.com/doc/sample/start.html) 46 | 47 | - **基于项目基本框架搭建Demo** 48 | 49 | **由于AAF 对于Android的构建方式做了一定范围的重构与定制。为了更贴近实际开发的场景,这里提供两种开发模式的使用事例。可以参考下面的指引独立运行**: 50 | 51 | [**https://android.bihe0832.com/doc/sample/customize.html**](https://android.bihe0832.com/doc/sample/customize.html) -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | apply from: rootDir.toString() + '/config.gradle' 3 | apply from: rootDir.toString() + '/build_module.gradle' 4 | 5 | buildscript { 6 | repositories { 7 | maven { url "https://mirrors.tencent.com/nexus/repository/maven-public/" } 8 | maven { url "https://mirrors.tencent.com/repository/maven/thirdparty-snapshots/" } 9 | // maven { url "https://repo1.maven.org/maven2" } 10 | maven { url "https://s01.oss.sonatype.org/content/groups/public" } 11 | } 12 | 13 | dependencies { 14 | classpath 'com.android.tools.build:gradle:7.0.4' 15 | classpath "com.bihe0832.android:GradleDependenciesCheck:4.1.0" 16 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10" 17 | } 18 | } 19 | 20 | task clean(type: Delete) { 21 | println("clean " + rootProject.buildDir) 22 | delete rootProject.buildDir 23 | } 24 | 25 | allprojects { 26 | repositories { 27 | maven { url "https://mirrors.tencent.com/nexus/repository/maven-public/" } 28 | maven { url "https://mirrors.tencent.com/repository/maven/thirdparty-snapshots/" } 29 | // maven { url "https://repo1.maven.org/maven2" } 30 | maven { url "https://s01.oss.sonatype.org/content/groups/public" } 31 | flatDir { 32 | dirs './../libs/' 33 | } 34 | } 35 | 36 | afterEvaluate { Project subproject -> 37 | if (subproject.name == rootProject.name) { 38 | rootProject.getTasks().create("showInfo") { 39 | group = "zixieDev" 40 | doLast { 41 | System.err.println("\n\n >>>>>>>>>>>>>>>>>>>>>>>>>>>> AndroidAPPFactory <<<<<<<<<<<<<<<<<<<<<<<<<<<<<") 42 | System.err.println("|\n| AAF 相关信息可以参考文档:") 43 | System.err.println("|\n| AAF文档:https://android.bihe0832.com/doc/") 44 | System.err.println("|\n| AAF事例:https://android.bihe0832.com/samples/") 45 | System.err.println("|\n >>>>>>>>>>>>>>>>>>>>>>>>>>> AndroidAPPFactory <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<") 46 | } 47 | } 48 | } 49 | } 50 | } 51 | 52 | 53 | subprojects { 54 | // apply plugin: 'com.bihe0832.gradleDependenciesCheck' 55 | // 56 | // GradleDependenciesCheckConfig { 57 | // showResultType = 1 58 | // excludePackage = "com.android.support;org.jetbrains.kotlin;android.arch.lifecycle" 59 | // } 60 | 61 | afterEvaluate { Project subproject -> 62 | if (zixieIsDebug) println("subprojects afterEvaluate : " + subproject.name) 63 | 64 | zixieAutoDependencies(subproject.name) 65 | zixieLocalDependencies(subproject.name, subproject.getProjectDir().absolutePath + "/libs") 66 | 67 | subproject.getTasks().getByName('clean').doFirst { 68 | delete "build" 69 | } 70 | 71 | if (!subproject.name.startsWith("Pub") || subproject.name != "APPTest") { 72 | // subproject.getTasks().create("copyAAR", Copy.class) { 73 | // group = "zixieDev" 74 | // from 'build/outputs/aar/' + module.name + '-release.aar' 75 | // into "./../libs/" 76 | // } 77 | // 78 | // subproject.getTasks().getByName('copyAAR').dependsOn("assembleRelease") 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /build_new.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # author zixie 3 | 4 | #函数定义,检测执行结果 5 | function checkResult() { 6 | result=$? 7 | echo "result : $result" 8 | if [ $result -eq 0 ];then 9 | echo "checkResult: execCommand succ" 10 | else 11 | echo "checkResult: execCommand failed" 12 | exit $result 13 | fi 14 | } 15 | 16 | echo "********APK build init set env *******" 17 | localPath=`pwd` 18 | echo "localPath:"$localPath 19 | chmod +x ./build_apk.sh 20 | echo "appNo:${appNo}" 21 | echo "param:${1}" 22 | 23 | moduleKey=${1} 24 | if [ "$moduleKey"x = ""x ];then 25 | moduleKey=$appNo 26 | fi 27 | #获取应用基本信息的APP 28 | if [ "$moduleKey"x = "ZAPK"x ];then 29 | /bin/bash ./build_apk.sh ZAPK PubGetAPKInfo com.bihe0832.getsignature com.bihe0832.android.app.Application 30 | checkResult 31 | fi 32 | 33 | #拼图APP 34 | if [ "$moduleKey"x = "ZPUZZLE"x ];then 35 | /bin/bash ./build_apk.sh ZPUZZLE PubGamePuzzle com.bihe0832.puzzle com.bihe0832.android.app.Application 36 | checkResult 37 | fi 38 | 39 | #M3u8 APP 40 | if [ "$moduleKey"x = "ZM3U8"x ];then 41 | /bin/bash ./build_apk.sh ZM3U8 PubM3U8 com.bihe0832.m3u8 com.bihe0832.android.app.Application 42 | checkResult 43 | fi 44 | 45 | #ADB Input APP 46 | if [ "$moduleKey"x = "ZINPUT"x ];then 47 | /bin/bash ./build_apk.sh ZINPUT PubAdbInput com.bihe0832.adb.input com.bihe0832.android.app.Application 48 | checkResult 49 | fi 50 | 51 | #ADB Input APP 52 | if [ "$moduleKey"x = "ZSHAKE"x ];then 53 | /bin/bash ./build_apk.sh ZSHAKE PubGameShakeba com.bihe0832.shakeba com.bihe0832.android.app.Application 54 | checkResult 55 | fi -------------------------------------------------------------------------------- /config.gradle: -------------------------------------------------------------------------------- 1 | ext { 2 | //Android编译SDK版本 3 | compileSdkVersion = 32 4 | //Android编译工具版本 5 | buildToolsVersion = "32.0.0" 6 | //Lib 最低适配Android 版本 7 | libMinSdkVersion = 16 8 | //APK 最低适配Android 版本 9 | appMinSdkVersion = 23 10 | //Android 最佳适配Android 版本 11 | targetSdkVersion = 31 12 | //版本号,正式版本会由自动构建替换 13 | versionCode = 181 14 | //版本名,正式版本会由自动构建替换 15 | versionName = "1.3.7" 16 | //Android 构建包时是否混淆代码 17 | minifyEnabled = true 18 | 19 | // 所有的CPU 类型 20 | ndk_abiFilters_all = "armeabi,x86,x86_64,armeabi-v7a,arm64-v8a" 21 | // 当前项目支持的CPU类型 22 | ndk_abiFilters_project = "armeabi-v7a,arm64-v8a" 23 | // 项目使用到的so 24 | pickFirstList = ['libc++_shared.so'] 25 | 26 | excludeList = [ 27 | 'META-INF/*.kotlin_module', 28 | 'META-INF/proguard/androidx-annotations.pro', 29 | 'META-INF/proguard/coroutines.pro' 30 | ] 31 | 32 | //签名信息 33 | signingConfigs = [ 34 | keyAlias : 'androiddebugkey', 35 | keyPassword : 'android', 36 | storeFile : "./../debug.keystore", 37 | storePassword : 'android', 38 | v1SigningEnabled: true, 39 | v2SigningEnabled: true, 40 | ] 41 | 42 | //签名信息 43 | releaseSigningConfigs = [ 44 | keyAlias : ZixieSigKeyAlias, 45 | keyPassword : ZixieSigKeyPassword, 46 | storeFile : ZixieSigPath, 47 | storePassword : ZixieSigStorePassword, 48 | v1SigningEnabled: true, 49 | v2SigningEnabled: true, 50 | ] 51 | 52 | //使用kotlin版本 53 | kotlin_version = '1.7.10' 54 | 55 | aaf_version = '6.21.9' 56 | aaf_test_version = '6.21.12' 57 | aaf_screen_version = '6.21.9' 58 | aaf_tbs_version = '6.21.9' 59 | } 60 | -------------------------------------------------------------------------------- /debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/debug.keystore -------------------------------------------------------------------------------- /dependencies.gradle: -------------------------------------------------------------------------------- 1 | apply from: rootDir.toString() + '/config.gradle' 2 | def project = ext 3 | 4 | /************************************ 组件化开发常用配置 ************************************/ 5 | /** 6 | * 当前开发中,最终运行的主工程,多个用 "," 分隔 7 | * 当前如果全量填"APPTest" 8 | */ 9 | ext.mainProject = "PubGetAPKInfo" 10 | /** 11 | * 当前开发中,涉及到修改的工程(仅填写直接修改的即可,依赖他的会自动添加),多个用 "," 分隔。 12 | * 当前如果全量填"Application" 13 | */ 14 | ext.developModule = "Application" 15 | /** 16 | * 应用组件 (Pub 开头,各个外发APP的发布模块)是否以application模式运行,当需要独立运行应用组件时修改,默认为false 17 | * true 表示以 application 模式运行 18 | * false 表示以 Android Library 模式运行 19 | */ 20 | ext.pubModuleIsApplication = true 21 | /** 22 | * 是否将所有依赖了 developModule 的模块都加载进来。 23 | * true 全都加载, 24 | * false 仅加载与 mainProject 相关的模块 25 | */ 26 | ext.includeALLDependOnDevelopModule = true 27 | /** 28 | * 组件所有模块的最新版本 29 | */ 30 | ext.moduleVersionName = "3.6.5" 31 | /************************************ 组件化开发常用配置 ************************************/ 32 | 33 | ext.moduleInfo = [ 34 | 35 | "APPTest" : [ 36 | "apidependenciesList" : [ "", 37 | "Application", "BaseDebug" 38 | ] 39 | ], 40 | "Application" : [ 41 | "apidependenciesList" : [ 42 | "com.bihe0832.android:common-wrapper-min:${project.aaf_version}", 43 | "com.bihe0832.android:common-wrapper-tbs:${project.aaf_tbs_version}", 44 | "com.bihe0832.android:lib-wrapper-screen:${project.aaf_screen_version}", 45 | "androidx.work:work-runtime:2.7.1" 46 | ], 47 | "specialdependenciesList": [ 48 | "debugImplementation": ["com.squareup.leakcanary:leakcanary-android:2.11"], 49 | "kapt" : ["com.bihe0832.android:lib-router-compiler:5.1.7"] 50 | ] 51 | ], 52 | "BaseDebug" : [ 53 | "apidependenciesList" : [ 54 | "com.bihe0832.android:common-debug:${project.aaf_test_version}", 55 | "Application", "BaseCard", "BaseGamePuzzle", "BaseGameDice", "BaseAdbInput","BaseM3U8" 56 | ], 57 | specialdependenciesList: [ 58 | 59 | ] 60 | ], 61 | "BaseCard" : [ 62 | "apidependenciesList": [ 63 | "Application" 64 | ] 65 | ], 66 | "BaseM3U8" : [ 67 | "apidependenciesList": [ 68 | "Application", "BaseCard" 69 | ] 70 | ], 71 | "BasePhotos" : [ 72 | "apidependenciesList": [ 73 | "BaseCard" 74 | ] 75 | ], 76 | "BaseAdbInput" : [ 77 | "apidependenciesList": [ 78 | "BaseCard" 79 | ] 80 | ], 81 | "BaseGame" : [ 82 | "apidependenciesList": [ 83 | "Application" 84 | ] 85 | ], 86 | "BaseGamePuzzle" : [ 87 | "apidependenciesList": [ 88 | "BasePhotos" 89 | ] 90 | ], 91 | "BaseGameDice" : [ 92 | "apidependenciesList": [ 93 | "BaseGame" 94 | ] 95 | ], 96 | "PubGetAPKInfo" : [ 97 | "apidependenciesList": [ 98 | "BaseCard" 99 | ] 100 | ], 101 | "PubGamePuzzle" : [ 102 | "apidependenciesList": [ 103 | "BaseGamePuzzle", "BaseCard" 104 | ] 105 | ], 106 | "PubGameShakeba" : [ 107 | "apidependenciesList": [ 108 | "BaseGameDice" 109 | ] 110 | ], 111 | "PubM3U8" : [ 112 | "apidependenciesList": [ 113 | "BaseM3U8" 114 | ] 115 | ], 116 | "PubBrowser" : [ 117 | "apidependenciesList": [ 118 | "BaseCard" 119 | ] 120 | ], 121 | "PubAdbInput" : [ 122 | "apidependenciesList": [ 123 | "BaseAdbInput" 124 | ] 125 | ] 126 | ] 127 | 128 | 129 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAppFactory/AndroidAppFactory-Sample/3555dd9f06411e184f380373febe2108910ee7d8/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Aug 24 12:59:18 CST 2022 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | 7 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /proguard-rules-resource.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | apply from: rootDir.toString() + '/build_module.gradle' 2 | System.err.println("MainProjectList: " + zixieMainProject) 3 | System.err.println("DevProjectList: " + zixieDevelopModule) 4 | 5 | zixieMainProject.split(",").each { projectName -> 6 | addInclude(projectName) 7 | } 8 | 9 | zixieDevelopModule.replaceAll("\\s*", "").split(",").each { projectName -> 10 | addInclude(projectName) 11 | } 12 | 13 | 14 | if (zixieIncludeALL) { 15 | zixieDepenciesList.each { projectName, subModuleList -> 16 | autoAddInclude(projectName) 17 | } 18 | } else { 19 | zixieMainProject.split(",").each { projectName -> 20 | zixieDepenciesList[projectName].each { dependenciesModule -> 21 | autoAddInclude(dependenciesModule) 22 | } 23 | } 24 | } 25 | 26 | System.err.println("\n\n========================================\n\n") 27 | System.err.println("当前工程导入组件如下:\n\n\t" + zixieIncludeList) 28 | System.err.println("\n\n========================================\n\n") 29 | 30 | def addInclude(projectName) { 31 | if (null == projectName || projectName.trim().length() == 0) { 32 | if (zixieIsDebug) System.out.println("Add Include: " + projectName + " is bad !") 33 | } else if (zixieIncludeList.contains(projectName)) { 34 | if (zixieIsDebug) System.out.println("Add Include: " + projectName + " has bad !") 35 | } else{ 36 | String finalProjectName = ':' + projectName 37 | System.out.println("include " + finalProjectName) 38 | zixieIncludeList.add(projectName) 39 | include finalProjectName 40 | } 41 | } 42 | 43 | def autoAddInclude(dependenciesModule) { 44 | if (zixieIsDebug) println("autoAddInclude Depenciese of dependenciesModule " + dependenciesModule + " " + zixieCheckModuleIsDev(dependenciesModule)) 45 | if(zixieCheckModuleIsDev(dependenciesModule)){ 46 | addInclude(dependenciesModule) 47 | } 48 | } 49 | 50 | 51 | --------------------------------------------------------------------------------
http://blog.bihe0832.com
https://github.com/bihe0832
code@bihe0832.com