├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── config.yml │ └── enhancement.yml └── workflows │ ├── release-telegram.yml │ └── release.yml ├── .gitignore ├── AppIdMap.txt ├── LICENSE ├── README.md ├── app ├── build.gradle ├── libs │ ├── api-82-sources.jar │ └── api-82.jar ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── assets │ ├── web │ │ ├── css │ │ │ ├── index.css │ │ │ ├── scroll.css │ │ │ └── vant.css │ │ ├── demo.html │ │ ├── index.html │ │ ├── js │ │ │ ├── index.js │ │ │ ├── scroll.js │ │ │ ├── vant.js │ │ │ └── vue3.js │ │ ├── png │ │ │ ├── 0.png │ │ │ ├── 0_ed.png │ │ │ ├── 1.png │ │ │ ├── 10.png │ │ │ ├── 10_ed.png │ │ │ ├── 11.png │ │ │ ├── 11_ed.png │ │ │ ├── 12.png │ │ │ ├── 12_ed.png │ │ │ ├── 1_ed.png │ │ │ ├── 2.png │ │ │ ├── 2_ed.png │ │ │ ├── 3.png │ │ │ ├── 3_ed.png │ │ │ ├── 4.png │ │ │ ├── 4_ed.png │ │ │ ├── 5.png │ │ │ ├── 5_ed.png │ │ │ ├── 6.png │ │ │ ├── 6_ed.png │ │ │ ├── 7.png │ │ │ ├── 7_ed.png │ │ │ ├── 8.png │ │ │ ├── 8_ed.png │ │ │ ├── 9.png │ │ │ ├── 9_ed.png │ │ │ ├── AncientTree.png │ │ │ ├── AncientTree_ed.png │ │ │ ├── Cooperate.png │ │ │ └── Cooperate_ed.png │ │ └── svg │ │ │ ├── 14.svg │ │ │ └── 14_ed.svg │ └── xposed_init │ ├── java │ └── io │ │ └── github │ │ └── lazyimmortal │ │ └── sesame │ │ ├── data │ │ ├── AppConfig.java │ │ ├── ConfigV2.java │ │ ├── Model.java │ │ ├── ModelConfig.java │ │ ├── ModelField.java │ │ ├── ModelFields.java │ │ ├── ModelGroup.java │ │ ├── ModelType.java │ │ ├── RunType.java │ │ ├── RuntimeInfo.java │ │ ├── TokenConfig.java │ │ ├── ViewAppInfo.java │ │ ├── modelFieldExt │ │ │ ├── BooleanModelField.java │ │ │ ├── ChoiceModelField.java │ │ │ ├── EmptyModelField.java │ │ │ ├── IntegerModelField.java │ │ │ ├── ListModelField.java │ │ │ ├── SelectAndCountModelField.java │ │ │ ├── SelectAndCountOneModelField.java │ │ │ ├── SelectModelField.java │ │ │ ├── SelectOneModelField.java │ │ │ ├── StringModelField.java │ │ │ ├── TextModelField.java │ │ │ └── common │ │ │ │ └── SelectModelFieldFunc.java │ │ └── task │ │ │ ├── BaseTask.java │ │ │ ├── ChildTaskExecutor.java │ │ │ ├── ModelTask.java │ │ │ ├── ProgramChildTaskExecutor.java │ │ │ └── SystemChildTaskExecutor.java │ │ ├── entity │ │ ├── AlipayAnimal.java │ │ ├── AlipayBeach.java │ │ ├── AlipayMarathon.java │ │ ├── AlipayNewAncientTree.java │ │ ├── AlipayReserve.java │ │ ├── AlipayTree.java │ │ ├── AlipayUser.java │ │ ├── AlipayVersion.java │ │ ├── AreaCode.java │ │ ├── CollectEnergyEntity.java │ │ ├── CooperateUser.java │ │ ├── CustomOption.java │ │ ├── FarmOrnaments.java │ │ ├── FriendWatch.java │ │ ├── IdAndName.java │ │ ├── KVNode.java │ │ ├── MemberBenefit.java │ │ ├── PromiseSimpleTemplate.java │ │ ├── RpcEntity.java │ │ ├── UserEntity.java │ │ ├── VitalityBenefit.java │ │ └── WalkPath.java │ │ ├── hook │ │ ├── ApplicationHook.java │ │ └── Toast.java │ │ ├── model │ │ ├── base │ │ │ ├── ModelOrder.java │ │ │ └── TaskCommon.java │ │ ├── common │ │ │ └── rpcCall │ │ │ │ └── BaseTaskRpcCall.java │ │ ├── extensions │ │ │ ├── ExtensionsHandle.java │ │ │ ├── TestRpc.java │ │ │ └── TestRpcCall.java │ │ ├── normal │ │ │ ├── answerAI │ │ │ │ ├── AnswerAI.java │ │ │ │ ├── AnswerAIInterface.java │ │ │ │ ├── GeminiAI.java │ │ │ │ └── TongyiAI.java │ │ │ └── base │ │ │ │ └── BaseModel.java │ │ └── task │ │ │ ├── ancientTree │ │ │ ├── AncientTree.java │ │ │ └── AncientTreeRpcCall.java │ │ │ ├── antBookRead │ │ │ ├── AntBookRead.java │ │ │ └── AntBookReadRpcCall.java │ │ │ ├── antDodo │ │ │ ├── AntDodo.java │ │ │ └── AntDodoRpcCall.java │ │ │ ├── antFarm │ │ │ ├── AntFarm.java │ │ │ ├── AntFarmRpcCall.java │ │ │ └── DadaDailyRpcCall.java │ │ │ ├── antForest │ │ │ ├── AntForestRpcCall.java │ │ │ ├── AntForestV2.java │ │ │ ├── EcoLifeRpcCall.java │ │ │ └── GreenLifeRpcCall.java │ │ │ ├── antMember │ │ │ ├── AntInsurance.java │ │ │ ├── AntInsuranceRpcCall.java │ │ │ ├── AntMember.java │ │ │ ├── AntMemberRpcCall.java │ │ │ ├── MerchantService.java │ │ │ └── MerchantServiceRpcCall.java │ │ │ ├── antOcean │ │ │ ├── AntOcean.java │ │ │ └── AntOceanRpcCall.java │ │ │ ├── antOrchard │ │ │ ├── AntOrchard.java │ │ │ └── AntOrchardRpcCall.java │ │ │ ├── antSports │ │ │ ├── AntSports.java │ │ │ └── AntSportsRpcCall.java │ │ │ ├── antStall │ │ │ ├── AntStall.java │ │ │ └── AntStallRpcCall.java │ │ │ ├── consumeGold │ │ │ ├── ConsumeGold.java │ │ │ └── ConsumeGoldRpcCall.java │ │ │ ├── greenFinance │ │ │ ├── GreenFinance.java │ │ │ └── GreenFinanceRpcCall.java │ │ │ ├── omegakoiTown │ │ │ ├── OmegakoiTown.java │ │ │ └── OmegakoiTownRpcCall.java │ │ │ ├── protectEcology │ │ │ ├── CooperateRpcCall.java │ │ │ ├── ProtectEcology.java │ │ │ ├── ProtectOceanRpcCall.java │ │ │ └── ProtectTreeRpcCall.java │ │ │ └── readingDada │ │ │ ├── ReadingDada.java │ │ │ └── ReadingDadaRpcCall.java │ │ ├── rpc │ │ ├── bridge │ │ │ ├── NewRpcBridge.java │ │ │ ├── OldRpcBridge.java │ │ │ ├── RpcBridge.java │ │ │ └── RpcVersion.java │ │ └── intervallimit │ │ │ ├── DefaultIntervalLimit.java │ │ │ ├── FixedOrRangeIntervalLimit.java │ │ │ ├── IntervalLimit.java │ │ │ └── RpcIntervalLimit.java │ │ ├── ui │ │ ├── BaseActivity.java │ │ ├── ChoiceDialog.java │ │ ├── ExtensionsActivity.java │ │ ├── HtmlViewerActivity.java │ │ ├── ListAdapter.java │ │ ├── ListDialog.java │ │ ├── MainActivity.java │ │ ├── MyWebView.java │ │ ├── NewSettingsActivity.java │ │ ├── ObjReference.java │ │ ├── ObjSyncReference.java │ │ ├── OptionsAdapter.java │ │ ├── SettingsActivity.java │ │ ├── StringDialog.java │ │ └── dto │ │ │ ├── ModelDto.java │ │ │ ├── ModelFieldInfoDto.java │ │ │ ├── ModelFieldShowDto.java │ │ │ └── ModelGroupDto.java │ │ └── util │ │ ├── AESUtil.java │ │ ├── AverageMath.java │ │ ├── CircularFifoQueue.java │ │ ├── ClassUtil.java │ │ ├── FileUtil.java │ │ ├── HanziToPinyin.java │ │ ├── JsonUtil.java │ │ ├── LanguageUtil.java │ │ ├── LibraryUtil.java │ │ ├── ListUtil.java │ │ ├── Log.java │ │ ├── MessageUtil.java │ │ ├── NotificationUtil.java │ │ ├── PermissionUtil.java │ │ ├── RandomUtil.java │ │ ├── Statistics.java │ │ ├── Status.java │ │ ├── StringUtil.java │ │ ├── ThreadUtil.java │ │ ├── TimeUtil.java │ │ ├── ToastUtil.java │ │ ├── TypeUtil.java │ │ └── idMap │ │ ├── AnimalIdMap.java │ │ ├── BeachIdMap.java │ │ ├── CooperationIdMap.java │ │ ├── FarmOrnamentsIdMap.java │ │ ├── MarathonIdMap.java │ │ ├── MemberBenefitIdMap.java │ │ ├── NewAncientTreeIdMap.java │ │ ├── PromiseSimpleTemplateIdMap.java │ │ ├── ReserveIdMap.java │ │ ├── TreeIdMap.java │ │ ├── UserIdMap.java │ │ ├── VitalityBenefitIdMap.java │ │ └── WalkPathIdMap.java │ ├── jniLibs │ ├── arm64-v8a │ │ └── libsesame.so │ ├── armeabi-v7a │ │ └── libsesame.so │ ├── x86 │ │ └── libsesame.so │ └── x86_64 │ │ └── libsesame.so │ └── res │ ├── drawable-xxhdpi │ ├── logo.png │ ├── main.png │ └── unactivated.png │ ├── drawable │ ├── button.xml │ ├── button_extend.xml │ ├── button_main.xml │ ├── farm.xml │ ├── forest.xml │ ├── friend.xml │ ├── github.xml │ ├── other.xml │ ├── setting.xml │ └── title_logo.xml │ ├── layout │ ├── activity_extend.xml │ ├── activity_html_viewer.xml │ ├── activity_main.xml │ ├── activity_new_settings.xml │ ├── activity_settings.xml │ ├── base_title.xml │ ├── dialog_list.xml │ └── list_item.xml │ ├── values-zh-rCN │ ├── strings.xml │ ├── strings_common.xml │ ├── strings_extensions.xml │ ├── strings_ui.xml │ └── strings_view.xml │ └── values │ ├── arrays.xml │ ├── colors.xml │ ├── dimen.xml │ ├── strings.xml │ ├── strings_common.xml │ ├── strings_extensions.xml │ ├── strings_ui.xml │ ├── strings_view.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew └── settings.gradle /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: 问题与 BUG 反馈 2 | description: 问题反馈应当使用此模板进行提交 3 | labels: [ bug ] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | ### 请在下方填写问题发生的具体原因和复现步骤。 9 | 10 | 发生异常、崩溃、闪退或功能性问题,必须提交问题 Log (日志),没有 Log 的 issues 将直接被关闭。 11 | - type: input 12 | attributes: 13 | label: | 14 | 程序版本 / 框架版本 / 模块版本 15 | description: 请填写当前使用的 程序版本 (例如:10.5.8)、框架版本 (例如:LSPosed 1.8.4) 及 模块版本 (例如:1.1.1) 16 | validations: 17 | required: true 18 | - type: input 19 | attributes: 20 | label: | 21 | 系统版本 / Android版本 22 | description: 这里填写当前使用的 系统版本 (例如:MIUI、ColorOS、OxygenOS、PE/原生) 及 Android版本 (例如:Android 10、Android 11、Android 12) 23 | validations: 24 | required: true 25 | - type: textarea 26 | attributes: 27 | label: 详细描述问题发生的具体原因 28 | description: 请在下方详细描述问题发生的具体场景、复现步骤和经过,以便我们能够按照你所描述的步骤复现这个问题。 29 | validations: 30 | required: true 31 | - type: textarea 32 | attributes: 33 | label: 提供模块问题 Log 或必要 Log 34 | description: 闪退需提交闪退(crash)日志,无响应需提交无响应(ANR)日志,功能性问题需提交运行时(runtime)日志。 35 | value: | 36 |
展开查看

37 | 
38 |         (此处粘贴问题 Log)
39 | 
40 |         
41 | 42 | validations: 43 | required: true 44 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: 使用问题 4 | url: https://github.com/LazyImmortal/Sesame/discussions/ 5 | about: 请使用 GitHub Discussion 的“提问”分区讨论使用上的问题。 -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/enhancement.yml: -------------------------------------------------------------------------------- 1 | name: 功能建议 2 | description: 功能建议使用此模板进行提交 3 | labels: [ enhancement ] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | ### 请在下方填写功能需求或建议。 9 | - type: dropdown 10 | attributes: 11 | label: 增强类型 12 | options: 13 | - 功能型增强 14 | - 优化型增强 15 | - 强迫症增强 16 | validations: 17 | required: true 18 | - type: textarea 19 | attributes: 20 | label: 具体描述 21 | description: 请在下方详细描述功能需求或建议。 22 | validations: 23 | required: true -------------------------------------------------------------------------------- /.github/workflows/release-telegram.yml: -------------------------------------------------------------------------------- 1 | name: Notify Telegram on Release 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | jobs: 8 | notify: 9 | if: github.event.repository.fork == false 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Send Telegram Notification 14 | run: | 15 | curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \ 16 | -d "chat_id=${{ secrets.TELEGRAM_CHAT_ID }}" \ 17 | -d "text=🎉 芝麻粒 [${{ github.event.release.tag_name }}](${{ github.event.release.html_url }}) 已发布🚀%0A%0A${{ github.event.release.body }}" \ 18 | -d "parse_mode=Markdown" 19 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Android CI 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | jobs: 8 | build: 9 | 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v3 14 | with: 15 | fetch-depth: 0 16 | 17 | - name: set up JDK 21 18 | uses: actions/setup-java@v3 19 | with: 20 | java-version: '21' 21 | distribution: 'temurin' 22 | cache: gradle 23 | 24 | - name: Grant execute permission for gradlew 25 | run: chmod +x gradlew 26 | 27 | - name: Build with Gradle 28 | run: ./gradlew assembleRelease -P version=${{ github.ref_name }} 29 | 30 | - name: Sign Normal APK 31 | id: sign_normal_apk 32 | uses: ilharp/sign-android-release@v1 33 | with: 34 | releaseDir: app/build/outputs/apk/normal/release/ 35 | signingKey: ${{ secrets.ANDROID_SIGNING_KEY }} 36 | keyAlias: ${{ secrets.ANDROID_KEY_ALIAS }} 37 | keyStorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} 38 | keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }} 39 | buildToolsVersion: 34.0.0 40 | 41 | - name: Sign Compatible APK 42 | id: sign_compatible_apk 43 | uses: ilharp/sign-android-release@v1 44 | with: 45 | releaseDir: app/build/outputs/apk/compatible/release/ 46 | signingKey: ${{ secrets.ANDROID_SIGNING_KEY }} 47 | keyAlias: ${{ secrets.ANDROID_KEY_ALIAS }} 48 | keyStorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} 49 | keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }} 50 | buildToolsVersion: 34.0.0 51 | 52 | - name: Upload Normal to Release 53 | uses: termux/upload-release-action@v4.2.0 54 | with: 55 | asset_name: Sesame-Normal-${{ github.event.release.tag_name }}.apk 56 | file: ${{ steps.sign_normal_apk.outputs.signedFile }} 57 | repo_token: ${{ secrets.GITHUB_TOKEN }} 58 | tag: ${{ github.ref }} 59 | overwrite: true 60 | checksums: sha256 61 | checksums_file_name: CHECKSUMS-Sesame-Normal-${{ github.event.release.tag_name }}.%algo% 62 | 63 | - name: Upload Compatible to Release 64 | uses: termux/upload-release-action@v4.2.0 65 | with: 66 | asset_name: Sesame-Compatible-${{ github.event.release.tag_name }}.apk 67 | file: ${{ steps.sign_compatible_apk.outputs.signedFile }} 68 | repo_token: ${{ secrets.GITHUB_TOKEN }} 69 | tag: ${{ github.ref }} 70 | overwrite: true 71 | checksums: sha256 72 | checksums_file_name: CHECKSUMS-Sesame-Compatible-${{ github.event.release.tag_name }}.%algo% 73 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | release/ 20 | 21 | # Local configuration file (sdk path, etc) 22 | local.properties 23 | 24 | # Proguard folder generated by Eclipse 25 | proguard/ 26 | 27 | # Log Files 28 | *.log 29 | 30 | # Android Studio Navigation editor temp files 31 | .navigation/ 32 | 33 | # Android Studio captures folder 34 | captures/ 35 | 36 | # IntelliJ 37 | *.iml 38 | .idea/ 39 | 40 | # Keystore files 41 | # Uncomment the following line if you do not want to check your keystore files in. 42 | #*.jks 43 | 44 | # External native build folder generated in Android Studio 2.2 and later 45 | .externalNativeBuild 46 | 47 | # Google Services (e.g. APIs or Firebase) 48 | google-services.json 49 | 50 | # Freeline 51 | freeline.py 52 | freeline/ 53 | freeline_project_description.json 54 | 55 | # fastlane 56 | fastlane/report.xml 57 | fastlane/Preview.html 58 | fastlane/screenshots 59 | fastlane/test_output 60 | fastlane/readme.md 61 | 62 | Xposed-Modules-Repo/ 63 | plugin/ -------------------------------------------------------------------------------- /AppIdMap.txt: -------------------------------------------------------------------------------- 1 | 10000003:充值中心 2 | 10000009:爱心捐赠 3 | 20000001:null 4 | 20000003:账单 5 | 20000014:我的银行卡 6 | 20000019:余额 7 | 20000032:余额宝 8 | 20000033:余额提现 9 | 20000038:关联账户认证/身份认证 10 | 20000042:null 11 | 20000047:null 12 | 20000067:? 13 | 20000076:账单 14 | 20000111:? 15 | 20000120:饿了么外卖 16 | 20000123:个人收钱 17 | 20000134:股票 18 | 20000142:娱乐宝 19 | 20000160:支付宝会员 20 | 20000165:理财 21 | 20000180:借呗 22 | 20000193:生活缴费 23 | 20000199:花呗 24 | 20000218:黄金 25 | 20000241:车险服务 26 | 20000691:我的客服 27 | 20000725:设置 28 | 20000754:我的快递 29 | 20000793:基金 30 | 20000909:args error 31 | 20000936:蚂蚁保险 32 | 20001045:args error 33 | 60000002:蚂蚁森林 34 | 60000010:? 35 | 60000071:天天有料 36 | 60000081:商家服务 37 | 60000123:args error 38 | 60000127:args error 39 | 60000148:财富号 40 | 60000161:支付宝会员周周乐 41 | 63300018:? 42 | 66666673:风险测试/风险类型 43 | 66666674:蚂蚁庄园 44 | 66666698:标签系统/标签和随笔 45 | 66666708:余利宝 46 | 66666721:财富有料 47 | 66666735:基金组合 48 | 66666741:上证指数讨论区 49 | 66666755:好医保 50 | 66666783:爱攒油加油站 51 | 66666819:还贷管家 52 | 66666823:? 53 | 66666825:财富标签页/我的理财标签 54 | 66666828:知识课堂 55 | 66666866:收益曲线 56 | 66666883:网商贷 57 | 66666886:蚂蚁森林合种 58 | 66666897:工资理财 59 | 68686987:网贷 60 | 68687015:办理赔 61 | 68687031:智能理财助理 62 | 68687049:蚂蚁心愿 63 | 68687058:null 64 | 68687109:null 65 | 68687129:行走积分赛 66 | 68687131:养老金 67 | 68687158:支付宝积分猜涨跌 68 | 68687197:null 69 | 68687233:股票工具 70 | 68687242:尊享理财 71 | 68687249:大盘晴雨表 72 | 68687279:null 73 | 68687357:null 74 | 77700124:余额宝 75 | 77700126:互相宝 76 | 77700130:花呗账单 77 | 77700144:扫码点单 78 | 77700152:信用卡还款 79 | 77700173:标注高德地图(在高德地图上标注我的商铺) 80 | 77700174:财富王者 81 | 77700199:财富SHOW 82 | 77700223:笔笔攒 83 | 77700234:模拟炒股 84 | 77700252:市场投资情绪 85 | 77700253:资金管理 86 | 77700257:收钱有奖 87 | 77700279:校园生活 88 | 77700292:收入统计 89 | 77700296:? 90 | 98000012:? 91 | 2013062600000474:new 92 | 2016122804685366:new 93 | 2017081908285290:new 94 | 2018030502317554:new 95 | 2018040402504128:new 96 | 2018051160096372:new 97 | 2018052460226391:new 98 | 2018071160524903:new 99 | 2018091361395351:new 100 | 2018110662035452:new 101 | 2018110762040932:new 102 | 2018112962211021:new 103 | 2018122762703259:new 104 | 2019010462802084:new 105 | 2019012963182381:new 106 | 2019021363229455:new 107 | 2019030863479637:new 108 | 2019031563521845:new 109 | 2019032763709372:new 110 | 2019032863733398:new 111 | 2019040963856084:new 112 | 2019042364288308:new 113 | 2019060465478294:new 114 | 2019060565481471:new 115 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Sesame 2 | 3 | [![License](https://img.shields.io/github/license/LazyImmortal/Sesame.svg)](LICENSE) 4 | [![Latest Release](https://img.shields.io/github/release/LazyImmortal/Sesame.svg)](../../releases) 5 | [![All Releases Download](https://img.shields.io/github/downloads/LazyImmortal/Sesame/total.svg)](../../releases) 6 | [![Telegram](https://img.shields.io/static/v1?label=Telegram&message=Channel&color=0088cc)](https://t.me/Sesame_Channels) 7 | 8 | ## 为了大家的资金安全与个人信息安全,强烈建议 9 | 1. 不要使用任何未开放源代码的修改版! 10 | 2. 不要使用任何未开放源代码的修改版! 11 | 3. 不要使用任何未开放源代码的修改版! 12 | 13 | ## 主要功能 14 | 感谢蚂蚁森林对绿化事业的贡献。快速收取蚂蚁森林能量,也为祖国的绿化事业出一份微薄之力~ 15 | 16 | ### 版本特点 17 | 1. 重构 系统架构,**功能与配置全部模块化**,以后添加功能**无需再开发配置页面,大幅降低开发门槛,并极大节省开发成本**,欢迎有兴趣的朋友参与开发,开发指南见[维基](https://github.com/TKaxv-7S/Sesame-TK/wiki)或如下图所示,非常欢迎大家提[PR](https://github.com/LazyImmortal/Sesame/pulls) 18 | ![Sesame-TK开发指南](https://github.com/TKaxv-7S/Sesame-TK/assets/22593101/4d8451fe-2b7f-4f19-9439-b0afbf683510) 19 | 2. 重构 **森林收能量代码**,大幅提升能量多的账号收取效率 20 | 3. 重构 配置模块,**所有配置需要重新配置**,新配置文件名称为**config_v2.json**,旧配置文件未删除,可作参考 21 | 4. 修改 配置界面,模块列表改为左侧垂直布局 22 | 5. 添加 定时唤醒与定时执行逻辑,在基础设置中可配置多个定时执行或定时唤醒时间 23 | 6. 修复 一些逻辑问题 24 | 25 | ## 使用说明 26 | 1. 本APP是为了学习研究用,不得进行任何形式的转发,发布,传播。 27 | 2. 请于24小时内卸载本APP。若使用期间造成任何损失,作者不负任何责任。 28 | 3. 本APP不篡改,不修改,不获取任何个人信息及其支付宝信息。 29 | 4. 本APP使用者因为违反本声明的规定而触犯中华人民共和国法律的,一切后果自负,作者不承担任何责任。 30 | 5. 凡以任何方式直接、间接使用APP者,视为自愿接受本声明的约束。 31 | 6. 本APP如无意中侵犯了某个媒体或个人的知识产权,请来信或来电告之,作者将立即删除。 32 | 33 | ## 授权说明 34 | 本项目基于 [TKaxv-7S版Sesame](https://github.com/TKaxv-7S/Sesame-TK)、[constanline版XQuickEnergy](https://github.com/constanline/XQuickEnergy) 与 [pansong291版XQuickEnergy](https://github.com/pansong291/XQuickEnergy) 开发 35 | 36 | 遵循 GPLv3 协议,并**禁止**用于任何商业用途、禁止二次修改后**闭源**发布 37 | 38 | 所有图片由 ༒激༙྇流༙྇泉༙྇༒ 授权使用 39 | 40 | ## 特别说明 41 | - 本模块完全免费开源,没有任何收费,请勿二次贩卖 42 | - 由于下游闭源项目**违反**本项目开源协议,前端作者将闭源前端新UI源码,本仓库仅提交发布文件,后端暂不受影响 43 | - 如果您开发了新功能,觉得开发的功能还不错,同时愿意贡献PR,非常欢迎,也非常感谢大家为这个项目的付出! 44 | - 该项目**不支持**合并**任何**通过修改数据而**实际获利**的功能PR 45 | - 鉴于项目的特殊性,开发团队可能在任何时间**停止更新**或**删除项目** 46 | 47 | ## 特别感谢 48 | - 感谢 这个项目的上一位维护者 [@TKaxv-7S](https://github.com/TKaxv-7S) 重构项目代码 49 | - 感谢 [@wh-990624](https://github.com/wh-990624) 重构并开发新UI 50 | - 感谢 ༒激༙྇流༙྇泉༙྇༒ 重新设计新UI 51 | - 感谢 更早的项目维护者 [@constanline](https://github.com/constanline) 、 [@pansong291](https://github.com/pansong291) 与其他维护者们的无私奉献 52 | 53 | ## 贡献者们 54 | 55 | 56 | 57 | 58 | 59 | 贡献名单使用 [contrib.rocks](https://contrib.rocks) 生成 60 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | def version = project.getProperties().get("version") 5 | if (version == null || "unspecified".equalsIgnoreCase(version)) { 6 | version = "TEST" 7 | } 8 | def gitCommitHash = 'git rev-parse --short HEAD'.execute().text.trim() 9 | def gitBranchName = 'git rev-parse --abbrev-ref HEAD'.execute().text.trim() 10 | def gitCommitCount = "git rev-list --count HEAD".execute().text.trim().toInteger() 11 | def buildTime = new Date().format("yyyy-MM-dd HH:mm:ss", TimeZone.getTimeZone("Asia/Shanghai")) 12 | 13 | compileSdk 34 14 | namespace 'io.github.lazyimmortal.sesame' 15 | defaultConfig { 16 | applicationId "io.github.lazyimmortal.sesame" 17 | minSdk 21 18 | //noinspection ExpiredTargetSdkVersion 19 | targetSdk 34 20 | versionCode gitCommitCount 21 | versionName version 22 | 23 | buildConfigField "String", "GIT_COMMIT_HASH", "\"${gitCommitHash}\"" 24 | buildConfigField "String", "GIT_BRANCH_NAME", "\"${gitBranchName}\"" 25 | buildConfigField "String", "BUILD_TIME", "\"${buildTime}\"" 26 | } 27 | buildFeatures { 28 | buildConfig = true // 显式启用 BuildConfig 29 | } 30 | ext { 31 | applicationName = "Sesame" 32 | applicationType = "Normal" 33 | } 34 | flavorDimensions.add("default") 35 | productFlavors { 36 | normal { 37 | dimension "default" 38 | ext.applicationType = "Normal" 39 | } 40 | compatible { 41 | dimension "default" 42 | ext.applicationType = "Compatible" 43 | } 44 | } 45 | buildTypes { 46 | release { 47 | minifyEnabled false 48 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 49 | } 50 | } 51 | applicationVariants.configureEach { variant -> 52 | variant.outputs.configureEach { output -> 53 | def outputFile = output.outputFile 54 | if (outputFile != null && outputFile.name.endsWith('.apk')) { 55 | if (variant.buildType.name == 'release') { 56 | output.outputFileName = "${applicationName}-${variant.productFlavors[0].ext.applicationType}-${defaultConfig.versionName}.apk" 57 | } 58 | } 59 | } 60 | } 61 | sourceSets { 62 | main { 63 | jniLibs.srcDirs = ['src/main/jniLibs'] 64 | } 65 | } 66 | } 67 | 68 | dependencies { 69 | //noinspection GradleCompatible 70 | implementation 'com.android.support:appcompat-v7:28.0.0' 71 | compileOnly 'de.robv.android.xposed:api:82' 72 | compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.32' 73 | annotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.32' 74 | implementation 'com.elvishew:xlog:1.11.0' 75 | implementation 'com.squareup.okhttp3:okhttp:4.12.0' 76 | 77 | normalImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.18.2' 78 | normalImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.18.2' 79 | normalImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.18.2' 80 | 81 | compatibleImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.13.5' 82 | compatibleImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.13.5' 83 | compatibleImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.13.5' 84 | 85 | } 86 | -------------------------------------------------------------------------------- /app/libs/api-82-sources.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/libs/api-82-sources.jar -------------------------------------------------------------------------------- /app/libs/api-82.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/libs/api-82.jar -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\tools\adt-bundle-windows-x86_64-20131030\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 24 | 25 | 28 | 29 | 32 | 33 | 36 | 37 | 40 | 41 | 42 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 68 | 69 | 73 | 74 | 78 | 79 | 83 | 84 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /app/src/main/assets/web/css/scroll.css: -------------------------------------------------------------------------------- 1 | .vue-recycle-scroller{position:relative}.vue-recycle-scroller.direction-vertical:not(.page-mode){overflow-y:auto}.vue-recycle-scroller.direction-horizontal:not(.page-mode){overflow-x:auto}.vue-recycle-scroller.direction-horizontal{display:-webkit-box;display:-ms-flexbox;display:flex}.vue-recycle-scroller__slot{-webkit-box-flex:1;-ms-flex:auto 0 0px;flex:auto 0 0}.vue-recycle-scroller__item-wrapper{-webkit-box-flex:1;-ms-flex:1;flex:1;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;position:relative}.vue-recycle-scroller.ready .vue-recycle-scroller__item-view{position:absolute;top:0;left:0;will-change:transform}.vue-recycle-scroller.direction-vertical .vue-recycle-scroller__item-wrapper{width:100%}.vue-recycle-scroller.direction-horizontal .vue-recycle-scroller__item-wrapper{height:100%}.vue-recycle-scroller.ready.direction-vertical .vue-recycle-scroller__item-view{width:100%}.vue-recycle-scroller.ready.direction-horizontal .vue-recycle-scroller__item-view{height:100%}.resize-observer[data-v-b329ee4c]{position:absolute;top:0;left:0;z-index:-1;width:100%;height:100%;border:none;background-color:transparent;pointer-events:none;display:block;overflow:hidden;opacity:0}.resize-observer[data-v-b329ee4c] object{display:block;position:absolute;top:0;left:0;height:100%;width:100%;overflow:hidden;pointer-events:none;z-index:-1} -------------------------------------------------------------------------------- /app/src/main/assets/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/assets/web/png/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/0.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/0_ed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/0_ed.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/1.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/10.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/10_ed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/10_ed.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/11.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/11_ed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/11_ed.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/12.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/12_ed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/12_ed.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/1_ed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/1_ed.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/2.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/2_ed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/2_ed.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/3.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/3_ed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/3_ed.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/4.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/4_ed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/4_ed.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/5.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/5_ed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/5_ed.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/6.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/6_ed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/6_ed.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/7.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/7_ed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/7_ed.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/8.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/8_ed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/8_ed.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/9.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/9_ed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/9_ed.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/AncientTree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/AncientTree.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/AncientTree_ed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/AncientTree_ed.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/Cooperate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/Cooperate.png -------------------------------------------------------------------------------- /app/src/main/assets/web/png/Cooperate_ed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/assets/web/png/Cooperate_ed.png -------------------------------------------------------------------------------- /app/src/main/assets/web/svg/14.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/src/main/assets/web/svg/14_ed.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/src/main/assets/xposed_init: -------------------------------------------------------------------------------- 1 | io.github.lazyimmortal.sesame.hook.ApplicationHook 2 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/data/AppConfig.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.data; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.app.Application; 5 | 6 | import com.fasterxml.jackson.annotation.JsonIgnore; 7 | import com.fasterxml.jackson.databind.JsonMappingException; 8 | import lombok.Data; 9 | import io.github.lazyimmortal.sesame.util.FileUtil; 10 | import io.github.lazyimmortal.sesame.util.JsonUtil; 11 | import io.github.lazyimmortal.sesame.util.Log; 12 | 13 | import java.io.File; 14 | 15 | @Data 16 | public class AppConfig { 17 | 18 | private static final String TAG = AppConfig.class.getSimpleName(); 19 | 20 | private static final File APP_CONFIG_DIRECTORY_FILE = getExternalFilesDir(); 21 | 22 | public static final AppConfig INSTANCE = new AppConfig(); 23 | 24 | @JsonIgnore 25 | private boolean init; 26 | 27 | private Boolean newUI = true; 28 | private Boolean languageSimplifiedChinese = true; 29 | 30 | private static File getExternalFilesDir() { 31 | try { 32 | @SuppressLint("PrivateApi") 33 | Application application = (Application) Class.forName("android.app.ActivityThread").getMethod("currentApplication").invoke(null); 34 | if (application != null) { 35 | return application.getExternalFilesDir("Sesame"); 36 | } 37 | } catch (Exception e) { 38 | Log.printStackTrace(TAG, e); 39 | } 40 | return null; 41 | } 42 | 43 | public static Boolean save() { 44 | return FileUtil.write2File(toSaveStr(), new File(APP_CONFIG_DIRECTORY_FILE, "appConfig.json")); 45 | } 46 | 47 | public static synchronized AppConfig load() { 48 | File appConfigFile = new File(APP_CONFIG_DIRECTORY_FILE, "appConfig.json"); 49 | try { 50 | if (appConfigFile.exists()) { 51 | Log.i("加载APP配置"); 52 | String json = FileUtil.readFromFile(appConfigFile); 53 | JsonUtil.copyMapper().readerForUpdating(INSTANCE).readValue(json); 54 | String formatted = toSaveStr(); 55 | if (formatted != null && !formatted.equals(json)) { 56 | Log.i(TAG, "格式化APP配置"); 57 | Log.system(TAG, "格式化APP配置"); 58 | FileUtil.write2File(formatted, appConfigFile); 59 | } 60 | } else { 61 | unload(); 62 | Log.i(TAG, "初始APP配置"); 63 | Log.system(TAG, "初始APP配置"); 64 | FileUtil.write2File(toSaveStr(), appConfigFile); 65 | } 66 | } catch (Throwable t) { 67 | Log.printStackTrace(TAG, t); 68 | Log.i(TAG, "重置APP配置"); 69 | Log.system(TAG, "重置APP配置"); 70 | try { 71 | unload(); 72 | FileUtil.write2File(toSaveStr(), appConfigFile); 73 | } catch (Exception e) { 74 | Log.printStackTrace(TAG, t); 75 | } 76 | } 77 | INSTANCE.setInit(true); 78 | return INSTANCE; 79 | } 80 | 81 | public static synchronized void unload() { 82 | try { 83 | JsonUtil.copyMapper().updateValue(INSTANCE, new AppConfig()); 84 | } catch (JsonMappingException e) { 85 | Log.printStackTrace(TAG, e); 86 | } 87 | } 88 | 89 | public static String toSaveStr() { 90 | return JsonUtil.toFormatJsonString(INSTANCE); 91 | } 92 | 93 | } -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/data/ModelConfig.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.data; 2 | 3 | import lombok.Data; 4 | import io.github.lazyimmortal.sesame.data.modelFieldExt.BooleanModelField; 5 | 6 | import java.io.Serializable; 7 | import java.util.Map; 8 | 9 | @Data 10 | public final class ModelConfig implements Serializable { 11 | 12 | private static final long serialVersionUID = 1L; 13 | 14 | //private final Type dataType; 15 | 16 | private String code; 17 | 18 | private String name; 19 | 20 | private ModelGroup group; 21 | 22 | private String icon; 23 | 24 | private final ModelFields fields = new ModelFields(); 25 | 26 | public ModelConfig() { 27 | //dataType = TypeUtil.getTypeArgument(this.getClass().getGenericSuperclass(), 0); 28 | } 29 | 30 | public ModelConfig(Model model) { 31 | this(); 32 | this.code = model.getClass().getSimpleName(); 33 | this.name = model.getName(); 34 | this.group = model.getGroup(); 35 | BooleanModelField enableField = model.getEnableField(); 36 | fields.put(enableField.getCode(), enableField); 37 | ModelFields modelFields = model.getFields(); 38 | if (modelFields != null) { 39 | for (Map.Entry> entry : modelFields.entrySet()) { 40 | ModelField modelField = entry.getValue(); 41 | if (modelField != null) { 42 | fields.put(modelField.getCode(), modelField); 43 | } 44 | } 45 | } 46 | } 47 | 48 | public Boolean hasModelField(String fieldCode) { 49 | return fields.containsKey(fieldCode); 50 | } 51 | 52 | public ModelField getModelField(String fieldCode) { 53 | return fields.get(fieldCode); 54 | } 55 | 56 | /*public void removeModelField(String fieldCode) { 57 | fields.remove(fieldCode); 58 | }*/ 59 | 60 | /*public Boolean addModelField(ModelField modelField) { 61 | fields.put(modelField.getCode(), modelField); 62 | return true; 63 | }*/ 64 | 65 | @SuppressWarnings("unchecked") 66 | public > T getModelFieldExt(String fieldCode) { 67 | return (T) fields.get(fieldCode); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/data/ModelFields.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.data; 2 | 3 | import java.util.LinkedHashMap; 4 | 5 | //@Data 6 | public final class ModelFields extends LinkedHashMap> { 7 | 8 | //private BooleanModelField enable = new BooleanModelField("enable", "开启", true); 9 | 10 | public void addField(ModelField modelField) { 11 | put(modelField.getCode(), modelField); 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/data/ModelGroup.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.data; 2 | 3 | import lombok.Getter; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | @Getter 9 | public enum ModelGroup { 10 | 11 | BASE("BASE", "基础", "svg/group/base.svg") 12 | , FOREST("FOREST", "森林", "svg/group/forest.svg") 13 | , FARM("FARM", "庄园", "svg/group/farm.svg") 14 | , STALL("STALL", "新村", "svg/group/stall.svg") 15 | , ORCHARD("ORCHARD", "农场", "svg/group/orchard.svg") 16 | , SPORTS("SPORTS", "运动", "svg/group/sports.svg") 17 | , MEMBER("MEMBER", "会员", "svg/group/member.svg") 18 | , OTHER("OTHER", "其他", "svg/group/other.svg") 19 | 20 | ; 21 | 22 | final String code; 23 | 24 | final String name; 25 | 26 | final String icon; 27 | 28 | ModelGroup(String code, String name, String icon) { 29 | this.code = code; 30 | this.name = name; 31 | this.icon = icon; 32 | } 33 | 34 | private static final Map MAP; 35 | 36 | static { 37 | MAP = new HashMap<>(); 38 | ModelGroup[] values = ModelGroup.values(); 39 | for (ModelGroup value : values) { 40 | MAP.put(value.code, value); 41 | } 42 | } 43 | 44 | public static ModelGroup getByCode(String code) { 45 | return MAP.get(code); 46 | } 47 | 48 | public static String getName(String code) { 49 | ModelGroup modelGroup = getByCode(code); 50 | if (modelGroup == null) { 51 | return null; 52 | } 53 | return modelGroup.name; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/data/ModelType.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.data; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public enum ModelType { 7 | 8 | NORMAL(0, "普通模块"), 9 | 10 | TASK(1, "任务模块"), 11 | 12 | ; 13 | 14 | private final Integer code; 15 | 16 | private final String name; 17 | 18 | ModelType(Integer code, String name) { 19 | this.code = code; 20 | this.name = name; 21 | } 22 | 23 | private static final Map MAP; 24 | 25 | static { 26 | MAP = new HashMap<>(); 27 | ModelType[] values = ModelType.values(); 28 | for (ModelType value : values) { 29 | MAP.put(value.code, value); 30 | } 31 | } 32 | 33 | public static ModelType getByCode(Integer code) { 34 | return MAP.get(code); 35 | } 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/data/RunType.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.data; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | import lombok.Getter; 7 | 8 | @Getter 9 | public enum RunType { 10 | 11 | DISABLE(0, "已关闭"), 12 | 13 | MODEL(1, "已激活"), 14 | 15 | PACKAGE(2, "已加载"), 16 | 17 | ; 18 | 19 | private final Integer code; 20 | 21 | private final String name; 22 | 23 | RunType(Integer code, String name) { 24 | this.code = code; 25 | this.name = name; 26 | } 27 | 28 | private static final Map MAP; 29 | 30 | static { 31 | MAP = new HashMap<>(); 32 | RunType[] values = RunType.values(); 33 | for (RunType value : values) { 34 | MAP.put(value.code, value); 35 | } 36 | } 37 | 38 | public static RunType getByCode(Integer code) { 39 | return MAP.get(code); 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/data/RuntimeInfo.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.data; 2 | 3 | import org.json.JSONException; 4 | import org.json.JSONObject; 5 | 6 | import io.github.lazyimmortal.sesame.util.FileUtil; 7 | import io.github.lazyimmortal.sesame.util.Log; 8 | import io.github.lazyimmortal.sesame.util.idMap.UserIdMap; 9 | 10 | import java.util.Objects; 11 | 12 | /** 13 | * @author Constanline 14 | * @since 2023/08/18 15 | */ 16 | public class RuntimeInfo { 17 | private static final String TAG = RuntimeInfo.class.getSimpleName(); 18 | 19 | private static RuntimeInfo instance; 20 | 21 | private final String userId; 22 | 23 | private JSONObject joAll; 24 | 25 | private JSONObject joCurrent; 26 | 27 | public enum RuntimeInfoKey { 28 | ForestPauseTime 29 | } 30 | 31 | public static RuntimeInfo getInstance() { 32 | if (instance == null || !Objects.equals(instance.userId, UserIdMap.getCurrentUid())) { 33 | instance = new RuntimeInfo(); 34 | } 35 | return instance; 36 | } 37 | 38 | private RuntimeInfo() { 39 | userId = UserIdMap.getCurrentUid(); 40 | String content = FileUtil.readFromFile(FileUtil.runtimeInfoFile(userId)); 41 | try { 42 | joAll = new JSONObject(content); 43 | } catch (Exception ignored) { 44 | joAll = new JSONObject(); 45 | } 46 | try { 47 | if (!joAll.has(userId)) { 48 | joAll.put(userId, new JSONObject()); 49 | } 50 | } catch (Exception ignored) { 51 | } 52 | try { 53 | joCurrent = joAll.getJSONObject(userId); 54 | } catch (Exception ignored) { 55 | joCurrent = new JSONObject(); 56 | } 57 | } 58 | 59 | public void save() { 60 | FileUtil.write2File(joAll.toString(), FileUtil.runtimeInfoFile(userId)); 61 | } 62 | 63 | public Object get(RuntimeInfoKey key) throws JSONException { 64 | return joCurrent.opt(key.name()); 65 | } 66 | 67 | public String getString(String key) { 68 | return joCurrent.optString(key); 69 | } 70 | 71 | public Long getLong(String key, long def) { 72 | return joCurrent.optLong(key, def); 73 | } 74 | 75 | public boolean getBool(String key, boolean def) { 76 | return joCurrent.optBoolean(key, def); 77 | } 78 | 79 | public String getString(RuntimeInfoKey key) { 80 | return joCurrent.optString(key.name()); 81 | } 82 | 83 | public Long getLong(RuntimeInfoKey key) { 84 | return joCurrent.optLong(key.name(), 0L); 85 | } 86 | 87 | public void put(RuntimeInfoKey key, Object value) { 88 | put(key.name(), value); 89 | } 90 | 91 | public void put(String key, Object value) { 92 | try { 93 | joCurrent.put(key, value); 94 | joAll.put(userId, joCurrent); 95 | } catch (JSONException e) { 96 | Log.i(TAG, "put err:"); 97 | Log.printStackTrace(TAG, e); 98 | } 99 | save(); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/data/ViewAppInfo.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.data; 2 | 3 | import android.content.ContentResolver; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.content.pm.ApplicationInfo; 7 | import android.content.pm.PackageInfo; 8 | import android.net.Uri; 9 | import android.os.Bundle; 10 | import lombok.Getter; 11 | import lombok.Setter; 12 | import io.github.lazyimmortal.sesame.R; 13 | import io.github.lazyimmortal.sesame.util.Log; 14 | 15 | public final class ViewAppInfo { 16 | 17 | @Getter 18 | private static Context context = null; 19 | 20 | @Getter 21 | private static String appTitle = ""; 22 | 23 | @Getter 24 | private static String appVersion = ""; 25 | 26 | @Setter 27 | @Getter 28 | private static RunType runType = RunType.DISABLE; 29 | 30 | public static void init(Context context) { 31 | if (ViewAppInfo.context == null) { 32 | ViewAppInfo.context = context; 33 | appTitle = context.getString(R.string.app_name); 34 | try { 35 | PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); 36 | appVersion = packageInfo.versionName; 37 | appTitle = appTitle + " " + appVersion; 38 | } catch (Exception e) { 39 | Log.printStackTrace(e); 40 | } 41 | } 42 | } 43 | 44 | public static RunType checkRunType() { 45 | if (runType != null) { 46 | return runType; 47 | } 48 | try { 49 | if (context == null) { 50 | return runType = RunType.DISABLE; 51 | } 52 | ContentResolver contentResolver = context.getContentResolver(); 53 | Uri uri = Uri.parse("content://me.weishu.exposed.CP/"); 54 | Bundle result = null; 55 | try { 56 | result = contentResolver.call(uri, "active", null, null); 57 | } catch (RuntimeException e) { 58 | // TaiChi is killed, try invoke 59 | try { 60 | Intent intent = new Intent("me.weishu.exp.ACTION_ACTIVE"); 61 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 62 | context.startActivity(intent); 63 | } catch (Throwable e1) { 64 | return runType = RunType.DISABLE; 65 | } 66 | } 67 | if (result == null) { 68 | result = contentResolver.call(uri, "active", null, null); 69 | } 70 | 71 | if (result == null) { 72 | return runType = RunType.DISABLE; 73 | } 74 | if (result.getBoolean("active", false)) { 75 | return runType = RunType.MODEL; 76 | } 77 | return runType = RunType.DISABLE; 78 | } catch (Throwable ignored) { 79 | } 80 | return runType = RunType.DISABLE; 81 | } 82 | 83 | public static void setRunTypeByCode(Integer runTypeCode) { 84 | RunType newRunType = RunType.getByCode(runTypeCode); 85 | if (newRunType == null) { 86 | newRunType = RunType.DISABLE; 87 | } 88 | ViewAppInfo.runType = newRunType; 89 | } 90 | 91 | /** 92 | * 判断当前应用是否是debug状态 93 | */ 94 | public static boolean isApkInDebug() { 95 | try { 96 | ApplicationInfo info = context.getApplicationInfo(); 97 | return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; 98 | } catch (Exception e) { 99 | return false; 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/data/modelFieldExt/BooleanModelField.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.data.modelFieldExt; 2 | 3 | 4 | import android.content.Context; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.LinearLayout; 8 | import android.widget.Switch; 9 | import io.github.lazyimmortal.sesame.data.ModelField; 10 | 11 | public class BooleanModelField extends ModelField { 12 | 13 | public BooleanModelField(String code, String name, Boolean value) { 14 | super(code, name, value); 15 | } 16 | 17 | @Override 18 | public String getType() { 19 | return "BOOLEAN"; 20 | } 21 | 22 | @Override 23 | public View getView(Context context) { 24 | Switch sw = new Switch(context); 25 | sw.setText(getName()); 26 | sw.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); 27 | sw.setMinHeight(150); 28 | sw.setMaxHeight(180); 29 | sw.setPaddingRelative(40, 0, 40, 0); 30 | sw.setChecked(getValue()); 31 | sw.setOnClickListener(v -> setObjectValue(((Switch) v).isChecked())); 32 | return sw; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/data/modelFieldExt/ChoiceModelField.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.data.modelFieldExt; 2 | 3 | 4 | import android.content.Context; 5 | import android.view.Gravity; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.Button; 9 | import android.widget.LinearLayout; 10 | 11 | import androidx.core.content.ContextCompat; 12 | 13 | import io.github.lazyimmortal.sesame.R; 14 | import io.github.lazyimmortal.sesame.data.ModelField; 15 | import io.github.lazyimmortal.sesame.ui.ChoiceDialog; 16 | 17 | public class ChoiceModelField extends ModelField { 18 | 19 | private String[] choiceArray; 20 | 21 | public ChoiceModelField(String code, String name, Integer value) { 22 | super(code, name, value); 23 | } 24 | 25 | public ChoiceModelField(String code, String name, Integer value, String[] choiceArray) { 26 | super(code, name, value); 27 | this.choiceArray = choiceArray; 28 | } 29 | 30 | @Override 31 | public String getType() { 32 | return "CHOICE"; 33 | } 34 | 35 | public String[] getExpandKey() { 36 | return choiceArray; 37 | } 38 | 39 | @Override 40 | public View getView(Context context) { 41 | Button btn = new Button(context); 42 | btn.setText(getName()); 43 | btn.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); 44 | btn.setTextColor(ContextCompat.getColor(context, R.color.button)); 45 | btn.setBackground(ContextCompat.getDrawable(context, R.drawable.button)); 46 | btn.setGravity(Gravity.START | Gravity.CENTER_VERTICAL); 47 | btn.setMinHeight(150); 48 | btn.setMaxHeight(180); 49 | btn.setPaddingRelative(40, 0, 40, 0); 50 | btn.setAllCaps(false); 51 | btn.setOnClickListener(v -> ChoiceDialog.show(v.getContext(), ((Button) v).getText(), this)); 52 | return btn; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/data/modelFieldExt/EmptyModelField.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.data.modelFieldExt; 2 | 3 | import android.app.AlertDialog; 4 | import android.content.Context; 5 | import android.view.Gravity; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.Button; 9 | import android.widget.LinearLayout; 10 | 11 | import androidx.core.content.ContextCompat; 12 | 13 | import com.fasterxml.jackson.annotation.JsonIgnore; 14 | 15 | import io.github.lazyimmortal.sesame.R; 16 | import io.github.lazyimmortal.sesame.data.ModelField; 17 | import io.github.lazyimmortal.sesame.util.ToastUtil; 18 | 19 | public class EmptyModelField extends ModelField { 20 | 21 | private final Runnable clickRunner; 22 | 23 | public EmptyModelField(String code, String name) { 24 | super(code, name, null); 25 | this.clickRunner = null; 26 | } 27 | 28 | public EmptyModelField(String code, String name, Runnable clickRunner) { 29 | super(code, name, null); 30 | this.clickRunner = clickRunner; 31 | } 32 | 33 | @Override 34 | public String getType() { 35 | return "EMPTY"; 36 | } 37 | 38 | @Override 39 | public void setObjectValue(Object value) { 40 | } 41 | 42 | @JsonIgnore 43 | public View getView(Context context) { 44 | Button btn = new Button(context); 45 | btn.setText(getName()); 46 | btn.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); 47 | btn.setTextColor(ContextCompat.getColor(context, R.color.button)); 48 | btn.setBackground(ContextCompat.getDrawable(context, R.drawable.button)); 49 | btn.setGravity(Gravity.START | Gravity.CENTER_VERTICAL); 50 | btn.setMinHeight(150); 51 | btn.setMaxHeight(180); 52 | btn.setPaddingRelative(40, 0, 40, 0); 53 | btn.setAllCaps(false); 54 | if (clickRunner != null) { 55 | btn.setOnClickListener(v -> new AlertDialog.Builder(context) 56 | .setTitle("警告") 57 | .setMessage("确认执行该操作?") 58 | .setPositiveButton(R.string.ok, (dialog, id) -> clickRunner.run()) 59 | .setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss()) 60 | .create() 61 | .show()); 62 | } else { 63 | btn.setOnClickListener(v -> ToastUtil.show(context, "无配置项")); 64 | } 65 | return btn; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/data/modelFieldExt/ListModelField.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.data.modelFieldExt; 2 | 3 | import android.content.Context; 4 | import android.view.Gravity; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.Button; 8 | import android.widget.LinearLayout; 9 | 10 | import androidx.core.content.ContextCompat; 11 | 12 | import com.fasterxml.jackson.core.type.TypeReference; 13 | import io.github.lazyimmortal.sesame.R; 14 | import io.github.lazyimmortal.sesame.data.ModelField; 15 | import io.github.lazyimmortal.sesame.ui.StringDialog; 16 | 17 | import java.util.ArrayList; 18 | import java.util.List; 19 | 20 | public class ListModelField extends ModelField> { 21 | 22 | private static final TypeReference> typeReference = new TypeReference>() { 23 | }; 24 | 25 | public ListModelField(String code, String name, List value) { 26 | super(code, name, value); 27 | } 28 | 29 | @Override 30 | public String getType() { 31 | return "LIST"; 32 | } 33 | 34 | @Override 35 | public View getView(Context context) { 36 | Button btn = new Button(context); 37 | btn.setText(getName()); 38 | btn.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); 39 | btn.setTextColor(ContextCompat.getColor(context, R.color.button)); 40 | btn.setBackground(ContextCompat.getDrawable(context, R.drawable.button)); 41 | btn.setGravity(Gravity.START | Gravity.CENTER_VERTICAL); 42 | btn.setMinHeight(150); 43 | btn.setMaxHeight(180); 44 | btn.setPaddingRelative(40, 0, 40, 0); 45 | btn.setAllCaps(false); 46 | btn.setOnClickListener(v -> StringDialog.showEditDialog(v.getContext(), ((Button) v).getText(), this)); 47 | return btn; 48 | } 49 | 50 | public static class ListJoinCommaToStringModelField extends ListModelField { 51 | 52 | public ListJoinCommaToStringModelField(String code, String name, List value) { 53 | super(code, name, value); 54 | } 55 | 56 | @Override 57 | public void setConfigValue(String configValue) { 58 | if (configValue == null) { 59 | reset(); 60 | return; 61 | } 62 | List list = new ArrayList<>(); 63 | String[] split = configValue.split(","); 64 | if (split.length == 1) { 65 | String str = split[0]; 66 | if (!str.isEmpty()) { 67 | list.add(str); 68 | } 69 | } else { 70 | for (String str : split) { 71 | if (!str.isEmpty()) { 72 | list.add(str); 73 | } 74 | } 75 | } 76 | value = list; 77 | } 78 | 79 | @Override 80 | public String getConfigValue() { 81 | return String.join(",", value); 82 | } 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/data/modelFieldExt/SelectAndCountOneModelField.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.data.modelFieldExt; 2 | 3 | import android.content.Context; 4 | import android.view.Gravity; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.Button; 8 | import android.widget.LinearLayout; 9 | 10 | import androidx.core.content.ContextCompat; 11 | 12 | import io.github.lazyimmortal.sesame.R; 13 | import io.github.lazyimmortal.sesame.data.ModelField; 14 | import io.github.lazyimmortal.sesame.data.modelFieldExt.common.SelectModelFieldFunc; 15 | import io.github.lazyimmortal.sesame.entity.IdAndName; 16 | import io.github.lazyimmortal.sesame.entity.KVNode; 17 | import io.github.lazyimmortal.sesame.ui.ListDialog; 18 | 19 | import java.util.List; 20 | import java.util.Objects; 21 | 22 | public class SelectAndCountOneModelField extends ModelField> implements SelectModelFieldFunc { 23 | 24 | private SelectListFunc selectListFunc; 25 | 26 | private List expandValue; 27 | 28 | public SelectAndCountOneModelField(String code, String name, KVNode value, List expandValue) { 29 | super(code, name, value); 30 | this.expandValue = expandValue; 31 | } 32 | 33 | public SelectAndCountOneModelField(String code, String name, KVNode value, SelectListFunc selectListFunc) { 34 | super(code, name, value); 35 | this.selectListFunc = selectListFunc; 36 | } 37 | 38 | @Override 39 | public String getType() { 40 | return "SELECT_AND_COUNT_ONE"; 41 | } 42 | 43 | public List getExpandValue() { 44 | return selectListFunc == null ? expandValue : selectListFunc.getList(); 45 | } 46 | 47 | @Override 48 | public View getView(Context context) { 49 | Button btn = new Button(context); 50 | btn.setText(getName()); 51 | btn.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); 52 | btn.setTextColor(ContextCompat.getColor(context, R.color.button)); 53 | btn.setBackground(ContextCompat.getDrawable(context, R.drawable.button)); 54 | btn.setGravity(Gravity.START | Gravity.CENTER_VERTICAL); 55 | btn.setMinHeight(150); 56 | btn.setPaddingRelative(40, 0, 40, 0); 57 | btn.setAllCaps(false); 58 | btn.setOnClickListener(v -> ListDialog.show(v.getContext(), ((Button) v).getText(), this, ListDialog.ListType.RADIO)); 59 | return btn; 60 | } 61 | 62 | @Override 63 | public void clear() { 64 | value = defaultValue; 65 | } 66 | 67 | @Override 68 | public Integer get(String id) { 69 | KVNode kvNode = getValue(); 70 | if (kvNode != null && Objects.equals(kvNode.getKey(), id)) { 71 | return kvNode.getValue(); 72 | } 73 | return 0; 74 | } 75 | 76 | @Override 77 | public void add(String id, Integer count) { 78 | value = new KVNode<>(id, count); 79 | } 80 | 81 | @Override 82 | public void remove(String id) { 83 | KVNode kvNode = getValue(); 84 | if (kvNode != null && Objects.equals(kvNode.getKey(), id)) { 85 | value = defaultValue; 86 | } 87 | } 88 | 89 | @Override 90 | public Boolean contains(String id) { 91 | KVNode kvNode = getValue(); 92 | return kvNode != null && Objects.equals(kvNode.getKey(), id); 93 | } 94 | 95 | public interface SelectListFunc { 96 | List getList(); 97 | } 98 | } -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/data/modelFieldExt/SelectOneModelField.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.data.modelFieldExt; 2 | 3 | import android.content.Context; 4 | import android.view.Gravity; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.Button; 8 | import android.widget.LinearLayout; 9 | 10 | import androidx.core.content.ContextCompat; 11 | 12 | import io.github.lazyimmortal.sesame.R; 13 | import io.github.lazyimmortal.sesame.data.ModelField; 14 | import io.github.lazyimmortal.sesame.data.modelFieldExt.common.SelectModelFieldFunc; 15 | import io.github.lazyimmortal.sesame.entity.IdAndName; 16 | import io.github.lazyimmortal.sesame.ui.ListDialog; 17 | 18 | import java.util.List; 19 | import java.util.Objects; 20 | 21 | public class SelectOneModelField extends ModelField implements SelectModelFieldFunc { 22 | 23 | private SelectListFunc selectListFunc; 24 | 25 | private List expandValue; 26 | 27 | public SelectOneModelField(String code, String name, String value, List expandValue) { 28 | super(code, name, value); 29 | this.expandValue = expandValue; 30 | } 31 | 32 | public SelectOneModelField(String code, String name, String value, SelectListFunc selectListFunc) { 33 | super(code, name, value); 34 | this.selectListFunc = selectListFunc; 35 | } 36 | 37 | @Override 38 | public String getType() { 39 | return "SELECT_ONE"; 40 | } 41 | 42 | public List getExpandValue() { 43 | return selectListFunc == null ? expandValue : selectListFunc.getList(); 44 | } 45 | 46 | @Override 47 | public View getView(Context context) { 48 | Button btn = new Button(context); 49 | btn.setText(getName()); 50 | btn.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); 51 | btn.setTextColor(ContextCompat.getColor(context, R.color.button)); 52 | btn.setBackground(ContextCompat.getDrawable(context, R.drawable.button)); 53 | btn.setGravity(Gravity.START | Gravity.CENTER_VERTICAL); 54 | btn.setMinHeight(150); 55 | btn.setPaddingRelative(40, 0, 40, 0); 56 | btn.setAllCaps(false); 57 | btn.setOnClickListener(v -> ListDialog.show(v.getContext(), ((Button) v).getText(), this, ListDialog.ListType.RADIO)); 58 | return btn; 59 | } 60 | 61 | @Override 62 | public void clear() { 63 | value = defaultValue; 64 | } 65 | 66 | @Override 67 | public Integer get(String id) { 68 | return 0; 69 | } 70 | 71 | @Override 72 | public void add(String id, Integer count) { 73 | value = id; 74 | } 75 | 76 | @Override 77 | public void remove(String id) { 78 | if (Objects.equals(value, id)) { 79 | value = defaultValue; 80 | } 81 | } 82 | 83 | @Override 84 | public Boolean contains(String id) { 85 | return Objects.equals(value, id); 86 | } 87 | 88 | public interface SelectListFunc { 89 | List getList(); 90 | } 91 | } -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/data/modelFieldExt/StringModelField.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.data.modelFieldExt; 2 | 3 | 4 | import android.content.Context; 5 | import android.view.Gravity; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.Button; 9 | import android.widget.LinearLayout; 10 | 11 | import androidx.core.content.ContextCompat; 12 | 13 | import io.github.lazyimmortal.sesame.R; 14 | import io.github.lazyimmortal.sesame.data.ModelField; 15 | import io.github.lazyimmortal.sesame.ui.StringDialog; 16 | 17 | public class StringModelField extends ModelField { 18 | 19 | public StringModelField(String code, String name, String value) { 20 | super(code, name, value); 21 | } 22 | 23 | @Override 24 | public String getType() { 25 | return "STRING"; 26 | } 27 | 28 | @Override 29 | public String getConfigValue() { 30 | return value; 31 | } 32 | 33 | @Override 34 | public void setConfigValue(String configValue) { 35 | value = configValue; 36 | } 37 | 38 | @Override 39 | public View getView(Context context) { 40 | Button btn = new Button(context); 41 | btn.setText(getName()); 42 | btn.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); 43 | btn.setTextColor(ContextCompat.getColor(context, R.color.button)); 44 | btn.setBackground(ContextCompat.getDrawable(context, R.drawable.button)); 45 | btn.setGravity(Gravity.START | Gravity.CENTER_VERTICAL); 46 | btn.setMinHeight(150); 47 | btn.setMaxHeight(180); 48 | btn.setPaddingRelative(40, 0, 40, 0); 49 | btn.setAllCaps(false); 50 | btn.setOnClickListener(v -> StringDialog.showEditDialog(v.getContext(), ((Button) v).getText(), this)); 51 | return btn; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/data/modelFieldExt/common/SelectModelFieldFunc.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.data.modelFieldExt.common; 2 | 3 | import java.util.LinkedHashMap; 4 | import java.util.Map; 5 | 6 | public interface SelectModelFieldFunc { 7 | 8 | void clear(); 9 | 10 | Integer get(String id); 11 | 12 | void add(String id, Integer count); 13 | 14 | void remove(String id); 15 | 16 | Boolean contains(String id); 17 | 18 | 19 | static SelectModelFieldFunc newMapInstance() { 20 | return new SelectModelFieldFunc() { 21 | 22 | private final Map map = new LinkedHashMap<>(); 23 | 24 | @Override 25 | public void clear() { 26 | map.clear(); 27 | } 28 | 29 | @Override 30 | public Integer get(String id) { 31 | return map.get(id); 32 | } 33 | 34 | @Override 35 | public void add(String id, Integer count) { 36 | map.put(id, count); 37 | } 38 | 39 | @Override 40 | public void remove(String id) { 41 | map.remove(id); 42 | } 43 | 44 | @Override 45 | public Boolean contains(String id) { 46 | return map.containsKey(id); 47 | } 48 | }; 49 | } 50 | } -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/data/task/ChildTaskExecutor.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.data.task; 2 | 3 | public interface ChildTaskExecutor { 4 | 5 | Boolean addChildTask(ModelTask.ChildModelTask childTask); 6 | 7 | Boolean removeChildTask(ModelTask.ChildModelTask childTask); 8 | 9 | Boolean clearGroupChildTask(String group); 10 | 11 | Boolean clearAllChildTask(); 12 | 13 | } -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/entity/AlipayAnimal.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.entity; 2 | 3 | import io.github.lazyimmortal.sesame.util.idMap.AnimalIdMap; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | import java.util.Map; 8 | import java.util.Set; 9 | 10 | public class AlipayAnimal extends IdAndName { 11 | private static List list; 12 | 13 | public AlipayAnimal(String i, String n) { 14 | id = i; 15 | name = n; 16 | } 17 | 18 | public static List getList() { 19 | if (list == null) { 20 | list = new ArrayList<>(); 21 | Set> idSet = AnimalIdMap.getMap().entrySet(); 22 | for (Map.Entry entry : idSet) { 23 | list.add(new AlipayAnimal(entry.getKey(), entry.getValue())); 24 | } 25 | } 26 | return list; 27 | } 28 | 29 | public static void remove(String id) { 30 | getList(); 31 | for (int i = 0; i < list.size(); i++) { 32 | if (list.get(i).id.equals(id)) { 33 | list.remove(i); 34 | break; 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/entity/AlipayBeach.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.entity; 2 | 3 | import io.github.lazyimmortal.sesame.util.idMap.BeachIdMap; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public class AlipayBeach extends IdAndName { 10 | private static List list; 11 | 12 | public AlipayBeach(String i, String n) { 13 | id = i; 14 | name = n; 15 | } 16 | 17 | public static List getList() { 18 | if (list == null) { 19 | list = new ArrayList<>(); 20 | for (Map.Entry entry : BeachIdMap.getMap().entrySet()) { 21 | list.add(new AlipayBeach(entry.getKey(), entry.getValue())); 22 | } 23 | } 24 | return list; 25 | } 26 | 27 | public static void remove(String id) { 28 | getList(); 29 | for (int i = 0; i < list.size(); i++) { 30 | if (list.get(i).id.equals(id)) { 31 | list.remove(i); 32 | break; 33 | } 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/entity/AlipayMarathon.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.entity; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Map; 6 | import java.util.Set; 7 | 8 | import io.github.lazyimmortal.sesame.util.idMap.MarathonIdMap; 9 | 10 | public class AlipayMarathon extends IdAndName { 11 | private static List list; 12 | 13 | public AlipayMarathon(String i, String n) { 14 | id = i; 15 | name = n; 16 | } 17 | 18 | public static List getList() { 19 | if (list == null) { 20 | list = new ArrayList<>(); 21 | Set> idSet = MarathonIdMap.getMap().entrySet(); 22 | for (Map.Entry entry : idSet) { 23 | list.add(new AlipayMarathon(entry.getKey(), entry.getValue())); 24 | } 25 | } 26 | return list; 27 | } 28 | 29 | public static void remove(String id) { 30 | getList(); 31 | for (int i = 0; i < list.size(); i++) { 32 | if (list.get(i).id.equals(id)) { 33 | list.remove(i); 34 | break; 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/entity/AlipayNewAncientTree.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.entity; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Map; 6 | import java.util.Set; 7 | 8 | import io.github.lazyimmortal.sesame.util.idMap.NewAncientTreeIdMap; 9 | 10 | public class AlipayNewAncientTree extends IdAndName { 11 | private static List list; 12 | 13 | public AlipayNewAncientTree(String i, String n) { 14 | id = i; 15 | name = n; 16 | } 17 | 18 | public static List getList() { 19 | if (list == null) { 20 | list = new ArrayList<>(); 21 | Set> idSet = NewAncientTreeIdMap.getMap().entrySet(); 22 | for (Map.Entry entry : idSet) { 23 | list.add(new AlipayNewAncientTree(entry.getKey(), entry.getValue())); 24 | } 25 | } 26 | return list; 27 | } 28 | 29 | public static void remove(String id) { 30 | getList(); 31 | for (int i = 0; i < list.size(); i++) { 32 | if (list.get(i).id.equals(id)) { 33 | list.remove(i); 34 | break; 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/entity/AlipayReserve.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.entity; 2 | 3 | import io.github.lazyimmortal.sesame.util.idMap.ReserveIdMap; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | import java.util.Map; 8 | import java.util.Set; 9 | 10 | public class AlipayReserve extends IdAndName { 11 | private static List list; 12 | 13 | public AlipayReserve(String i, String n) { 14 | id = i; 15 | name = n; 16 | } 17 | 18 | public static List getList() { 19 | if (list == null) { 20 | list = new ArrayList<>(); 21 | Set> idSet = ReserveIdMap.getMap().entrySet(); 22 | for (Map.Entry entry : idSet) { 23 | list.add(new AlipayReserve(entry.getKey(), entry.getValue())); 24 | } 25 | } 26 | return list; 27 | } 28 | 29 | public static void remove(String id) { 30 | getList(); 31 | for (int i = 0; i < list.size(); i++) { 32 | if (list.get(i).id.equals(id)) { 33 | list.remove(i); 34 | break; 35 | } 36 | } 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/entity/AlipayTree.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.entity; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Map; 6 | import java.util.Set; 7 | 8 | import io.github.lazyimmortal.sesame.util.idMap.TreeIdMap; 9 | 10 | public class AlipayTree extends IdAndName { 11 | private static List list; 12 | 13 | public AlipayTree(String i, String n) { 14 | id = i; 15 | name = n; 16 | } 17 | 18 | public static List getList() { 19 | if (list == null) { 20 | list = new ArrayList<>(); 21 | Set> idSet = TreeIdMap.getMap().entrySet(); 22 | for (Map.Entry entry : idSet) { 23 | list.add(new AlipayTree(entry.getKey(), entry.getValue())); 24 | } 25 | } 26 | return list; 27 | } 28 | 29 | public static void remove(String id) { 30 | getList(); 31 | for (int i = 0; i < list.size(); i++) { 32 | if (list.get(i).id.equals(id)) { 33 | list.remove(i); 34 | break; 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/entity/AlipayUser.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.entity; 2 | 3 | import io.github.lazyimmortal.sesame.util.Log; 4 | import io.github.lazyimmortal.sesame.util.idMap.UserIdMap; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | public class AlipayUser extends IdAndName { 11 | 12 | public AlipayUser(String i, String n) { 13 | id = i; 14 | name = n; 15 | } 16 | 17 | public static List getList() { 18 | return getList(user -> true); 19 | } 20 | 21 | public static List getList(Filter filterFunc) { 22 | List list = new ArrayList<>(); 23 | Map userIdMap = UserIdMap.getUserMap(); 24 | for (Map.Entry entry : userIdMap.entrySet()) { 25 | UserEntity userEntity = entry.getValue(); 26 | try { 27 | if (filterFunc.apply(userEntity)) { 28 | list.add(new AlipayUser(entry.getKey(), userEntity.getFullName())); 29 | } 30 | } catch (Throwable t) { 31 | Log.printStackTrace(t); 32 | } 33 | } 34 | return list; 35 | } 36 | 37 | public interface Filter { 38 | 39 | Boolean apply(UserEntity user); 40 | 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/entity/AlipayVersion.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.entity; 2 | 3 | import lombok.Getter; 4 | 5 | @Getter 6 | public class AlipayVersion implements Comparable { 7 | 8 | private final String versionString; 9 | 10 | private final Integer[] versionArray; 11 | 12 | public AlipayVersion(String versionString) { 13 | this.versionString = versionString; 14 | String[] split = versionString.split("\\."); 15 | int length = split.length; 16 | versionArray = new Integer[length]; 17 | for (int i = 0; i < length; i++) { 18 | try { 19 | versionArray[i] = Integer.parseInt(split[i]); 20 | } catch (Exception e) { 21 | versionArray[i] = Integer.MAX_VALUE; 22 | } 23 | } 24 | } 25 | 26 | @Override 27 | public int compareTo(AlipayVersion alipayVersion) { 28 | int thisLength = versionArray.length; 29 | int thatLength = alipayVersion.versionArray.length; 30 | int compareResult; 31 | int length; 32 | if (thisLength > thatLength) { 33 | compareResult = 1; 34 | length = thatLength; 35 | } else if (thisLength < thatLength) { 36 | compareResult = -1; 37 | length = thisLength; 38 | } else { 39 | compareResult = 0; 40 | length = thisLength; 41 | } 42 | for (int i = 0; i < length; i++) { 43 | Integer thisVer = versionArray[i]; 44 | Integer thatVer = alipayVersion.versionArray[i]; 45 | if (thisVer < thatVer) { 46 | return -1; 47 | } else if (thisVer > thatVer) { 48 | return 1; 49 | } 50 | } 51 | return compareResult; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/entity/AreaCode.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.entity; 2 | 3 | import org.json.JSONArray; 4 | import org.json.JSONException; 5 | import org.json.JSONObject; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | import io.github.lazyimmortal.sesame.util.FileUtil; 11 | import io.github.lazyimmortal.sesame.util.Log; 12 | 13 | public class AreaCode extends IdAndName { 14 | private static final String TAG = AreaCode.class.getSimpleName(); 15 | private static List list; 16 | 17 | public AreaCode(String i, String n) { 18 | id = i; 19 | name = n; 20 | } 21 | 22 | public static List getList() { 23 | if (list == null) { 24 | String cityCode = FileUtil.readFromFile(FileUtil.getCityCodeFile()); 25 | JSONArray ja; 26 | try { 27 | ja = new JSONArray(cityCode); 28 | } catch (Throwable e) { 29 | cityCode = "[" + 30 | "{\"cityCode\":\"320100\",\"cityName\":\"南京市\"}," + 31 | "{\"cityCode\":\"330100\",\"cityName\":\"杭州市\"}," + 32 | "{\"cityCode\":\"350100\",\"cityName\":\"福州市\"}," + 33 | "{\"cityCode\":\"370100\",\"cityName\":\"济南市\"}," + 34 | "{\"cityCode\":\"430100\",\"cityName\":\"长沙市\"}," + 35 | "{\"cityCode\":\"440100\",\"cityName\":\"广州市\"}" + 36 | "]"; 37 | try { 38 | ja = new JSONArray(cityCode); 39 | } catch (JSONException ex) { 40 | ja = new JSONArray(); 41 | } 42 | } 43 | 44 | list = new ArrayList<>(); 45 | try { 46 | for (int i = 0; i < ja.length(); i++) { 47 | JSONObject jo = ja.getJSONObject(i); 48 | list.add(new AreaCode(jo.getString("cityCode"), jo.getString("cityName"))); 49 | } 50 | } catch (Throwable th) { 51 | Log.printStackTrace(TAG, th); 52 | } 53 | } 54 | return list; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/entity/CollectEnergyEntity.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.entity; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import org.json.JSONObject; 6 | 7 | @Getter 8 | public class CollectEnergyEntity { 9 | 10 | private final String userId; 11 | 12 | @Setter 13 | private JSONObject userHome; 14 | 15 | @Setter 16 | private RpcEntity rpcEntity; 17 | 18 | private Integer collectCount = 0; 19 | 20 | private Integer tryCount = 0; 21 | 22 | @Setter 23 | private Boolean needDouble = false; 24 | 25 | @Setter 26 | private Boolean needRetry = false; 27 | 28 | public CollectEnergyEntity(String userId) { 29 | this.userId = userId; 30 | } 31 | 32 | public CollectEnergyEntity(String userId, JSONObject userHome) { 33 | this.userId = userId; 34 | this.userHome = userHome; 35 | } 36 | 37 | public CollectEnergyEntity(String userId, JSONObject userHome, RpcEntity rpcEntity) { 38 | this.userId = userId; 39 | this.userHome = userHome; 40 | this.rpcEntity = rpcEntity; 41 | } 42 | 43 | public Integer addTryCount() { 44 | this.tryCount = tryCount + 1; 45 | return tryCount; 46 | } 47 | 48 | public void resetTryCount() { 49 | this.tryCount = 0; 50 | } 51 | 52 | public void setNeedDouble() { 53 | this.collectCount = collectCount + 1; 54 | this.needDouble = true; 55 | } 56 | 57 | public void unsetNeedDouble() { 58 | this.needDouble = false; 59 | } 60 | 61 | public void setNeedRetry() { 62 | this.needRetry = true; 63 | } 64 | 65 | public void unsetNeedRetry() { 66 | this.needRetry = false; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/entity/CooperateUser.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.entity; 2 | 3 | import io.github.lazyimmortal.sesame.util.idMap.CooperationIdMap; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | import java.util.Map; 8 | import java.util.Set; 9 | 10 | public class CooperateUser extends IdAndName { 11 | 12 | public CooperateUser(String i, String n) { 13 | id = i; 14 | name = n; 15 | } 16 | 17 | public static List getList() { 18 | List list = new ArrayList<>(); 19 | Set> idSet = CooperationIdMap.getMap().entrySet(); 20 | for (Map.Entry entry : idSet) { 21 | list.add(new CooperateUser(entry.getKey(), entry.getValue())); 22 | } 23 | return list; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/entity/CustomOption.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.entity; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class CustomOption extends IdAndName { 7 | 8 | public CustomOption(String i, String n) { 9 | id = i; 10 | name = n; 11 | } 12 | 13 | public static List getEcoLifeOptions() { 14 | List list = new ArrayList<>(); 15 | list.add(new CustomOption("tick", "绿色行动打卡")); 16 | list.add(new CustomOption("dish", "光盘行动打卡")); 17 | return list; 18 | } 19 | 20 | public static List getUseAccelerateToolOptions() { 21 | List list = new ArrayList<>(); 22 | list.add(new CustomOption("useAccelerateToolContinue", "连续使用")); 23 | list.add(new CustomOption("useAccelerateToolWhenMaxEmotion", "仅在满状态时使用")); 24 | return list; 25 | } 26 | 27 | public static List getAntFarmFamilyOptions() { 28 | List list = new ArrayList<>(); 29 | list.add(new CustomOption("familySign", "每日签到")); 30 | list.add(new CustomOption("familyFeed", "帮喂成员")); 31 | list.add(new CustomOption("familyEatTogether", "美食请客")); 32 | list.add(new CustomOption("familyAwardList", "领取奖励")); 33 | return list; 34 | } 35 | 36 | public static List getAntDodoPropList() { 37 | List list = new ArrayList<>(); 38 | list.add(new CustomOption("COLLECT_TIMES_7_DAYS", "抽卡道具")); 39 | list.add(new CustomOption("COLLECT_HISTORY_ANIMAL_7_DAYS", "历史图鉴随机卡道具")); 40 | list.add(new CustomOption("COLLECT_TO_FRIEND_TIMES_7_DAYS", "抽好友卡道具")); 41 | list.add(new CustomOption("UNIVERSAL_CARD_7_DAYS", "万能卡道具")); 42 | return list; 43 | } 44 | 45 | public static List getAntDodoBookMedalOptions() { 46 | List list = new ArrayList<>(); 47 | list.add(new CustomOption("generateBookMedal", "自动合成图鉴勋章")); 48 | list.add(new CustomOption("collectHistoryAnimal", "自动收集历史物种")); 49 | return list; 50 | } 51 | 52 | public static List getAntInsuranceOptions() { 53 | List list = new ArrayList<>(); 54 | list.add(new CustomOption("beanSignIn", "安心豆签到")); 55 | list.add(new CustomOption("beanExchangeGoldenTicket", "安心豆兑换黄金票")); 56 | list.add(new CustomOption("beanExchangeBubbleBoost", "安心豆兑换时光加速器")); 57 | list.add(new CustomOption("gainSumInsured", "保障金领取")); 58 | return list; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/entity/FarmOrnaments.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.entity; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Map; 6 | import java.util.Set; 7 | 8 | import io.github.lazyimmortal.sesame.util.idMap.FarmOrnamentsIdMap; 9 | 10 | public class FarmOrnaments extends IdAndName{ 11 | 12 | public FarmOrnaments(String i, String n) { 13 | id = i; 14 | name = n; 15 | } 16 | 17 | public static List getList() { 18 | List list = new ArrayList<>(); 19 | Set> idSet = FarmOrnamentsIdMap.getMap().entrySet(); 20 | for (Map.Entry entry: idSet) { 21 | list.add(new FarmOrnaments(entry.getKey(), entry.getValue())); 22 | } 23 | return list; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/entity/IdAndName.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | import lombok.Getter; 5 | import io.github.lazyimmortal.sesame.util.HanziToPinyin; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | public abstract class IdAndName implements Comparable { 11 | 12 | @Getter 13 | public String name; 14 | 15 | @Getter 16 | public String id; 17 | 18 | private ArrayList pinyin; 19 | 20 | @JsonIgnore 21 | public ArrayList getPinyin() { 22 | if (pinyin != null) { 23 | return pinyin; 24 | } 25 | ArrayList list = HanziToPinyin.getInstance().get(name); 26 | pinyin = new ArrayList<>(list.size()); 27 | for (HanziToPinyin.Token token : list) { 28 | pinyin.add(token.target); 29 | } 30 | return pinyin; 31 | } 32 | 33 | @Override 34 | public int compareTo(IdAndName o) { 35 | List list1 = this.getPinyin(); 36 | List list2 = o.getPinyin(); 37 | int i = 0; 38 | while (i < list1.size() && i < list2.size()) { 39 | if (list1.get(i).compareTo(list2.get(i)) != 0) { 40 | return list1.get(i).compareTo(list2.get(i)); 41 | } 42 | i++; 43 | } 44 | return list1.size() - list2.size(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/entity/KVNode.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | import lombok.Data; 6 | 7 | @Data 8 | public class KVNode implements Serializable { 9 | 10 | private K key; 11 | 12 | private V value; 13 | 14 | public KVNode() { 15 | } 16 | 17 | public KVNode(K key, V value) { 18 | this.key = key; 19 | this.value = value; 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/entity/MemberBenefit.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.entity; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Map; 6 | import java.util.Set; 7 | 8 | import io.github.lazyimmortal.sesame.util.idMap.MemberBenefitIdMap; 9 | 10 | public class MemberBenefit extends IdAndName { 11 | 12 | public MemberBenefit(String i, String n) { 13 | id = i; 14 | name = n; 15 | } 16 | 17 | public static List getList() { 18 | List list = new ArrayList<>(); 19 | Set> idSet = MemberBenefitIdMap.getMap().entrySet(); 20 | for (Map.Entry entry: idSet) { 21 | list.add(new MemberBenefit(entry.getKey(), entry.getValue())); 22 | } 23 | return list; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/entity/PromiseSimpleTemplate.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.entity; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Map; 6 | import java.util.Set; 7 | 8 | import io.github.lazyimmortal.sesame.util.idMap.PromiseSimpleTemplateIdMap; 9 | 10 | public class PromiseSimpleTemplate extends IdAndName { 11 | 12 | public PromiseSimpleTemplate(String i, String n) { 13 | id = i; 14 | name = n; 15 | } 16 | 17 | public static List getList() { 18 | List list = new ArrayList<>(); 19 | Set> idSet = PromiseSimpleTemplateIdMap.getMap().entrySet(); 20 | for (Map.Entry entry: idSet) { 21 | list.add(new PromiseSimpleTemplate(entry.getKey(), entry.getValue())); 22 | } 23 | return list; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/entity/RpcEntity.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.entity; 2 | 3 | import lombok.Getter; 4 | 5 | @Getter 6 | public class RpcEntity { 7 | 8 | private final Thread requestThread; 9 | 10 | private final String requestMethod; 11 | 12 | private final String requestData; 13 | 14 | private final String requestRelation; 15 | 16 | //private final Long requestTime; 17 | 18 | private volatile Boolean hasResult = false; 19 | 20 | private volatile Boolean hasError = false; 21 | 22 | private volatile Object responseObject; 23 | 24 | private volatile String responseString; 25 | 26 | public RpcEntity() { 27 | this(null, null); 28 | } 29 | 30 | public RpcEntity(String requestMethod, String requestData) { 31 | this(requestMethod, requestData, null); 32 | } 33 | 34 | /*public RpcEntity(String requestMethod, String requestData, String requestRelation) { 35 | this(requestMethod, requestData, requestRelation, null); 36 | }*/ 37 | 38 | public RpcEntity(String requestMethod, String requestData, String requestRelation) { 39 | this.requestThread = Thread.currentThread(); 40 | this.requestMethod = requestMethod; 41 | this.requestData = requestData; 42 | this.requestRelation = requestRelation; 43 | //this.requestTime = requestTime; 44 | } 45 | 46 | public void setResponseObject(Object result, String resultStr) { 47 | this.hasResult = true; 48 | this.responseObject = result; 49 | this.responseString = resultStr; 50 | } 51 | 52 | public void setError() { 53 | this.hasError = true; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/entity/UserEntity.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.entity; 2 | 3 | import lombok.Data; 4 | import lombok.Getter; 5 | import io.github.lazyimmortal.sesame.util.StringUtil; 6 | 7 | @Getter 8 | public class UserEntity { 9 | 10 | private final String userId; 11 | 12 | private final String account; 13 | 14 | private final Integer friendStatus; 15 | 16 | private final String realName; 17 | 18 | private final String nickName; 19 | 20 | private final String remarkName; 21 | 22 | private final String showName; 23 | 24 | private final String maskName; 25 | 26 | private final String fullName; 27 | 28 | public UserEntity(String userId, String account, Integer friendStatus, String realName, String nickName, String remarkName) { 29 | this.userId = userId; 30 | this.account = account; 31 | this.friendStatus = friendStatus; 32 | this.realName = realName; 33 | this.nickName = nickName; 34 | this.remarkName = remarkName; 35 | String showNameTmp; 36 | if (StringUtil.isEmpty(remarkName)) { 37 | showNameTmp = nickName; 38 | } else { 39 | showNameTmp = remarkName; 40 | } 41 | String maskNameTmp; 42 | if (realName != null && realName.length() > 1) { 43 | maskNameTmp = "*" + realName.substring(1); 44 | } else { 45 | maskNameTmp = realName; 46 | } 47 | /*if (isMaskAccount) { 48 | int length = account.length(); 49 | if (length > 5) { 50 | int prefixIndex = Math.min(3, Math.max(1, length - 3)); 51 | String prefix = account.substring(0, prefixIndex); 52 | int tmpIndex = prefixIndex + 3; 53 | int suffixIndex = length - 4; 54 | if (suffixIndex < tmpIndex) { 55 | suffixIndex = tmpIndex; 56 | } 57 | String suffix = account.substring(suffixIndex); 58 | account = prefix + "***" + suffix; 59 | } 60 | }*/ 61 | this.showName = showNameTmp; 62 | this.maskName = showNameTmp + "|" + maskNameTmp; 63 | this.fullName = showNameTmp + "|" + realName + "(" + account + ")"; 64 | } 65 | 66 | @Data 67 | public static class UserDto { 68 | 69 | private String userId; 70 | 71 | private String account; 72 | 73 | private Integer friendStatus; 74 | 75 | private String realName; 76 | 77 | private String nickName; 78 | 79 | private String remarkName; 80 | 81 | public UserEntity toEntity() { 82 | return new UserEntity(userId, account, friendStatus, realName, nickName, remarkName); 83 | } 84 | 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/entity/VitalityBenefit.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.entity; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Map; 6 | import java.util.Set; 7 | 8 | import io.github.lazyimmortal.sesame.util.idMap.VitalityBenefitIdMap; 9 | 10 | public class VitalityBenefit extends IdAndName { 11 | 12 | public VitalityBenefit(String i, String n) { 13 | id = i; 14 | name = n; 15 | } 16 | 17 | public static List getList() { 18 | List list = new ArrayList<>(); 19 | Set> idSet = VitalityBenefitIdMap.getMap().entrySet(); 20 | for (Map.Entry entry: idSet) { 21 | list.add(new VitalityBenefit(entry.getKey(), entry.getValue())); 22 | } 23 | return list; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/entity/WalkPath.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.entity; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Map; 6 | import java.util.Set; 7 | 8 | import io.github.lazyimmortal.sesame.util.idMap.WalkPathIdMap; 9 | 10 | public class WalkPath extends IdAndName { 11 | private static List list; 12 | 13 | public WalkPath(String i, String n) { 14 | id = i; 15 | name = n; 16 | } 17 | 18 | public static List getList() { 19 | list = new ArrayList<>(); 20 | Set> idSet = WalkPathIdMap.getMap().entrySet(); 21 | for (Map.Entry entry : idSet) { 22 | list.add(new WalkPath(entry.getKey(), entry.getValue())); 23 | } 24 | return list; 25 | } 26 | 27 | public static void remove(String id) { 28 | getList(); 29 | for (int i = 0; i < list.size(); i++) { 30 | if (list.get(i).id.equals(id)) { 31 | list.remove(i); 32 | break; 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/hook/Toast.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.hook; 2 | 3 | import android.content.Context; 4 | import android.os.Handler; 5 | 6 | import io.github.lazyimmortal.sesame.model.normal.base.BaseModel; 7 | import io.github.lazyimmortal.sesame.util.Log; 8 | 9 | public class Toast { 10 | private static final String TAG = Toast.class.getSimpleName(); 11 | 12 | public static void show(CharSequence cs) { 13 | show(cs, false); 14 | } 15 | 16 | public static void show(CharSequence cs, boolean force) { 17 | Context context = ApplicationHook.getContext(); 18 | if (context != null && (force || BaseModel.getShowToast().getValue())) { 19 | show(context, ApplicationHook.getMainHandler(), cs); 20 | } 21 | } 22 | 23 | public static void show(Context context, Handler handler, CharSequence cs) { 24 | try { 25 | handler.post(() -> { 26 | try { 27 | android.widget.Toast toast = android.widget.Toast.makeText(context, cs, android.widget.Toast.LENGTH_SHORT); 28 | toast.setGravity(toast.getGravity(), toast.getXOffset(), BaseModel.getToastOffsetY().getValue()); 29 | toast.show(); 30 | } catch (Throwable t) { 31 | Log.i(TAG, "show.run err:"); 32 | Log.printStackTrace(TAG, t); 33 | } 34 | }); 35 | } catch (Throwable t) { 36 | Log.i(TAG, "show err:"); 37 | Log.printStackTrace(TAG, t); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/model/base/ModelOrder.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.model.base; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import io.github.lazyimmortal.sesame.data.Model; 7 | import io.github.lazyimmortal.sesame.model.extensions.ExtensionsHandle; 8 | import io.github.lazyimmortal.sesame.model.normal.answerAI.AnswerAI; 9 | import io.github.lazyimmortal.sesame.model.normal.base.BaseModel; 10 | import io.github.lazyimmortal.sesame.model.task.antDodo.AntDodo; 11 | import io.github.lazyimmortal.sesame.model.task.antFarm.AntFarm; 12 | import io.github.lazyimmortal.sesame.model.task.antForest.AntForestV2; 13 | import io.github.lazyimmortal.sesame.model.task.antMember.AntMember; 14 | import io.github.lazyimmortal.sesame.model.task.antOcean.AntOcean; 15 | import io.github.lazyimmortal.sesame.model.task.antOrchard.AntOrchard; 16 | import io.github.lazyimmortal.sesame.model.task.antSports.AntSports; 17 | import io.github.lazyimmortal.sesame.model.task.antStall.AntStall; 18 | import io.github.lazyimmortal.sesame.model.task.greenFinance.GreenFinance; 19 | import io.github.lazyimmortal.sesame.model.task.protectEcology.ProtectEcology; 20 | import lombok.Getter; 21 | 22 | public class ModelOrder { 23 | 24 | @Getter 25 | private static final List> clazzList = new ArrayList<>(); 26 | 27 | static { 28 | clazzList.add(BaseModel.class); 29 | clazzList.add(AntForestV2.class); 30 | clazzList.add(AntFarm.class); 31 | clazzList.add(AntStall.class); 32 | clazzList.add(AntOrchard.class); 33 | clazzList.add(ProtectEcology.class); 34 | clazzList.add(AntDodo.class); 35 | clazzList.add(AntOcean.class); 36 | clazzList.add(AntSports.class); 37 | clazzList.add(AntMember.class); 38 | clazzList.add(GreenFinance.class); 39 | clazzList.add(AnswerAI.class); 40 | 41 | ExtensionsHandle.handleAlphaRequest("ModelOrder", "addExtensionsClass", clazzList); 42 | } 43 | } -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/model/base/TaskCommon.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.model.base; 2 | 3 | import io.github.lazyimmortal.sesame.model.normal.base.BaseModel; 4 | import io.github.lazyimmortal.sesame.util.TimeUtil; 5 | 6 | public class TaskCommon { 7 | 8 | public static volatile Boolean IS_ENERGY_TIME = false; 9 | 10 | public static volatile Boolean IS_AFTER_6AM = false; 11 | 12 | public static volatile Boolean IS_AFTER_8AM = false; 13 | 14 | public static void update() { 15 | long currentTimeMillis = System.currentTimeMillis(); 16 | IS_ENERGY_TIME = TimeUtil.checkInTimeRange(currentTimeMillis, BaseModel.getEnergyTime().getValue()); 17 | IS_AFTER_6AM = TimeUtil.isAfterOrCompareTimeStr(currentTimeMillis, "0600"); 18 | IS_AFTER_8AM = TimeUtil.isAfterOrCompareTimeStr(currentTimeMillis, "0800"); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/model/extensions/TestRpc.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.model.extensions; 2 | 3 | public class TestRpc { 4 | private static final String TAG = TestRpc.class.getSimpleName(); 5 | 6 | public static void start(String broadcastFun, String broadcastData, String testType) { 7 | new Thread() { 8 | String broadcastFun; 9 | String broadcastData; 10 | String testType; 11 | 12 | public Thread setData(String fun, String data, String type) { 13 | broadcastFun = fun; 14 | broadcastData = data; 15 | testType = type; 16 | return this; 17 | } 18 | 19 | @Override 20 | public void run() { 21 | ExtensionsHandle.handleRequest(testType, broadcastFun, broadcastData); 22 | } 23 | }.setData(broadcastFun, broadcastData, testType).start(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/model/extensions/TestRpcCall.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.model.extensions; 2 | 3 | import io.github.lazyimmortal.sesame.hook.ApplicationHook; 4 | 5 | public class TestRpcCall { 6 | private static final String VERSION = "20240704"; 7 | 8 | public static String queryEnvironmentCertDetailList(String alias, int pageNum, String targetUserID) { 9 | return ApplicationHook.requestString("alipay.antforest.forest.h5.queryEnvironmentCertDetailList", 10 | "[{\"alias\":\"" + alias + "\",\"certId\":\"\",\"pageNum\":" + pageNum 11 | + ",\"shareId\":\"\",\"source\":\"chInfo_ch_appcenter__chsub_9patch\",\"targetUserID\":\"" 12 | + targetUserID + "\",\"version\":\"20230701\"}]"); 13 | } 14 | 15 | public static String sendTree(String certificateId, String friendUserId) { 16 | return ApplicationHook.requestString("alipay.antforest.forest.h5.sendTree", 17 | "[{\"blessWords\":\"梭梭没有叶子,四季常青,从不掉发,祝你发量如梭。\",\"certificateId\":\"" + certificateId 18 | + "\",\"friendUserId\":\"" + friendUserId 19 | + "\",\"source\":\"chInfo_ch_appcenter__chsub_9patch\"}]"); 20 | } 21 | 22 | public static String queryTreeItemsForExchange(String applyActions) { 23 | return ApplicationHook.requestString("alipay.antforest.forest.h5.queryTreeItemsForExchange", 24 | "[{\"applyActions\":\"" + applyActions 25 | + "\",\"itemTypes\":\"\",\"source\":\"chInfo_ch_appcenter__chsub_9patch\",\"version\":\"" 26 | + VERSION + "\"}]"); 27 | } 28 | 29 | public static String queryTreeForExchange(String projectId) { 30 | return ApplicationHook.requestString("alipay.antforest.forest.h5.queryTreeForExchange", 31 | "[{\"projectId\":\"" + projectId + "\",\"version\":\"" + VERSION 32 | + "\",\"source\":\"chInfo_ch_appcenter__chsub_9patch\"}]"); 33 | } 34 | 35 | 36 | /* 查询地图树苗 */ 37 | public static String queryAreaTrees() { 38 | return ApplicationHook.requestString("alipay.antmember.forest.h5.queryAreaTrees", 39 | "[{\"source\":\"chInfo_ch_appcenter__chsub_9patch\",\"userId\":\"\",\"version\":\"20221215\"}]"); 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/model/normal/answerAI/AnswerAIInterface.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.model.normal.answerAI; 2 | 3 | import java.util.List; 4 | 5 | public interface AnswerAIInterface { 6 | 7 | /** 8 | * 获取AI回答结果 9 | * 10 | * @param text 问题内容 11 | * @return AI回答结果 12 | */ 13 | String getAnswerStr(String text); 14 | 15 | /** 16 | * 获取AI答案 17 | */ 18 | Integer getAnswer(String title, List answerList); 19 | 20 | static AnswerAIInterface getInstance() { 21 | return new AnswerAIInterface() { 22 | @Override 23 | public String getAnswerStr(String text) { 24 | return ""; 25 | } 26 | 27 | @Override 28 | public Integer getAnswer(String title, List answerList) { 29 | return -1; 30 | } 31 | }; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/model/task/ancientTree/AncientTreeRpcCall.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.model.task.ancientTree; 2 | 3 | import io.github.lazyimmortal.sesame.hook.ApplicationHook; 4 | 5 | public class AncientTreeRpcCall { 6 | private static final String VERSION = "20230522"; 7 | 8 | public static String homePage(String selectCityCode) { 9 | return ApplicationHook.requestString("alipay.greenmatrix.rpc.h5.ancienttree.homePage", 10 | "[{\"cityCode\":\"330100\",\"selectCityCode\":\"" + selectCityCode 11 | + "\",\"source\":\"antforesthome\"}]"); 12 | } 13 | 14 | public static String queryTreeItemsForExchange(String cityCode) { 15 | return ApplicationHook.requestString("alipay.antforest.forest.h5.queryTreeItemsForExchange", 16 | "[{\"cityCode\":\"" + cityCode 17 | + "\",\"itemTypes\":\"\",\"source\":\"chInfo_ch_appcenter__chsub_9patch\",\"version\":\"" 18 | + VERSION + "\"}]"); 19 | } 20 | 21 | public static String districtDetail(String districtCode) { 22 | return ApplicationHook.requestString("alipay.greenmatrix.rpc.h5.ancienttree.districtDetail", 23 | "[{\"districtCode\":\"" + districtCode + "\",\"source\":\"antforesthome\"}]"); 24 | } 25 | 26 | public static String projectDetail(String ancientTreeProjectId, String cityCode) { 27 | return ApplicationHook.requestString("alipay.greenmatrix.rpc.h5.ancienttree.projectDetail", 28 | "[{\"ancientTreeProjectId\":\"" + ancientTreeProjectId 29 | + "\",\"channel\":\"ONLINE\",\"cityCode\":\"" + cityCode 30 | + "\",\"source\":\"ancientreethome\"}]"); 31 | } 32 | 33 | public static String protect(String activityId, String ancientTreeProjectId, String cityCode) { 34 | return ApplicationHook.requestString("alipay.greenmatrix.rpc.h5.ancienttree.protect", 35 | "[{\"ancientTreeActivityId\":\"" + activityId + "\",\"ancientTreeProjectId\":\"" 36 | + ancientTreeProjectId + "\",\"cityCode\":\"" + cityCode 37 | + "\",\"source\":\"ancientreethome\"}]"); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/model/task/antFarm/DadaDailyRpcCall.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.model.task.antFarm; 2 | 3 | import io.github.lazyimmortal.sesame.hook.ApplicationHook; 4 | 5 | /** 6 | * @author Constanline 7 | * @since 2023/08/04 8 | */ 9 | public class DadaDailyRpcCall { 10 | 11 | public static String home(String activityId) { 12 | return ApplicationHook.requestString("com.alipay.reading.game.dadaDaily.home", 13 | "[{\"activityId\":" + activityId + ",\"dadaVersion\":\"1.3.0\",\"version\":1}]"); 14 | } 15 | 16 | public static String submit(String activityId, String answer, Long questionId) { 17 | return ApplicationHook.requestString("com.alipay.reading.game.dadaDaily.submit", 18 | "[{\"activityId\":" + activityId + ",\"answer\":\"" + answer + "\",\"dadaVersion\":\"1.3.0\",\"questionId\":" + 19 | questionId + ",\"version\":1}]"); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/model/task/antForest/GreenLifeRpcCall.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.model.task.antForest; 2 | 3 | import io.github.lazyimmortal.sesame.hook.ApplicationHook; 4 | import io.github.lazyimmortal.sesame.util.RandomUtil; 5 | 6 | public class GreenLifeRpcCall { 7 | 8 | /* 森林集市 */ 9 | public static String consultForSendEnergyByAction(String sourceType) { 10 | String args = "[{\"sourceType\":\"" + sourceType + "\"}]"; 11 | return ApplicationHook.requestString("alipay.bizfmcg.greenlife.consultForSendEnergyByAction", args); 12 | } 13 | 14 | public static String sendEnergyByAction(String sourceType) { 15 | String args = "[{\"actionType\":\"GOODS_BROWSE\",\"requestId\":\"" + RandomUtil.getRandomString(8) + "\",\"sourceType\":\"" + sourceType + "\"}]"; 16 | return ApplicationHook.requestString("alipay.bizfmcg.greenlife.sendEnergyByAction", args); 17 | } 18 | 19 | // 打卡兑好礼 20 | public static String retrieveCurrentActivity() { 21 | String args = "[{}]"; 22 | return ApplicationHook.requestString("alipay.bizfmcg.greenlife.retrieveCurrentActivity", args); 23 | } 24 | 25 | public static String retrieveHotActivityPrize(String activityId) { 26 | String args = "[{\"activityId\":\"" + activityId + "\"}]"; 27 | return ApplicationHook.requestString("alipay.bizfmcg.greenlife.retrieveHotActivityPrize", args); 28 | } 29 | 30 | public static String finishCurrentTask(String taskTemplateId) { 31 | String args = "[{\"taskTemplateId\":\"" + taskTemplateId + "\"}]"; 32 | return ApplicationHook.requestString("alipay.bizfmcg.greenlife.finishCurrentTask", args); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/model/task/protectEcology/CooperateRpcCall.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.model.task.protectEcology; 2 | 3 | import io.github.lazyimmortal.sesame.hook.ApplicationHook; 4 | 5 | public class CooperateRpcCall { 6 | private static final String VERSION = "20230501"; 7 | 8 | public static String queryUserCooperatePlantList() { 9 | return ApplicationHook.requestString("alipay.antmember.forest.h5.queryUserCooperatePlantList", "[{}]"); 10 | } 11 | 12 | public static String queryCooperatePlant(String cooperationId) { 13 | String args = "[{\"cooperationId\":\"" + cooperationId + "\"}]"; 14 | return ApplicationHook.requestString("alipay.antmember.forest.h5.queryCooperatePlant", args); 15 | } 16 | 17 | public static String cooperateWater(String userId, String cooperationId, int energyCount) { 18 | String bizNo = userId + "_" + cooperationId + "_" + System.currentTimeMillis(); 19 | String args = "[{\"bizNo\":\"" + bizNo + "\",\"cooperationId\":\"" + cooperationId + "\",\"energyCount\":" + energyCount + "}]"; 20 | return ApplicationHook.requestString("alipay.antmember.forest.h5.cooperateWater", args); 21 | } 22 | 23 | /** 24 | * 获取合种浇水量排行 25 | * @param bizType 参数:D/A,“D”为查询当天,“A”为查询所有 26 | * @param cooperationId 合种ID 27 | * @return requestString 28 | */ 29 | public static String queryCooperateRank(String bizType, String cooperationId) { 30 | return ApplicationHook.requestString("alipay.antmember.forest.h5.queryCooperateRank", 31 | "[{\"bizType\":\""+ bizType + "\",\"cooperationId\":\"" + cooperationId + "\",\"source\":\"chInfo_ch_url-https://render.alipay.com/p/yuyan/180020010001247580/home.html\"}]"); 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/model/task/protectEcology/ProtectOceanRpcCall.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.model.task.protectEcology; 2 | 3 | import io.github.lazyimmortal.sesame.hook.ApplicationHook; 4 | import io.github.lazyimmortal.sesame.util.RandomUtil; 5 | 6 | public class ProtectOceanRpcCall { 7 | 8 | private static String getUniqueId() { 9 | return String.valueOf(System.currentTimeMillis()) + RandomUtil.nextLong(); 10 | } 11 | 12 | /* 保护海洋净滩行动 */ 13 | public static String queryCultivationList() { 14 | String args = "[{\"source\":\"ANT_FOREST\"}]"; 15 | return ApplicationHook.requestString("alipay.antocean.ocean.h5.queryCultivationList", args); 16 | } 17 | 18 | public static String queryCultivationDetail(String cultivationCode, String projectCode) { 19 | // source: ANT_FOREST ANT_FOREST_listExchange 20 | String args = "[{\"cultivationCode\":\"" + cultivationCode + "\",\"projectCode\":\"" + projectCode + "\",\"source\":\"ANT_FOREST\",\"uniqueId\":\"" + getUniqueId() + "\"}]"; 21 | return ApplicationHook.requestString("alipay.antocean.ocean.h5.queryCultivationDetail", args); 22 | } 23 | 24 | public static String oceanExchangeTree(String cultivationCode, String projectCode) { 25 | String args = "[{\"cultivationCode\":\"" + cultivationCode + "\",\"projectCode\":\"" + projectCode + "\",\"source\":\"ANT_FOREST\",\"uniqueId\":\"" + getUniqueId() + "\"}]"; 26 | return ApplicationHook.requestString("alipay.antocean.ocean.h5.exchangeTree", args); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/model/task/protectEcology/ProtectTreeRpcCall.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.model.task.protectEcology; 2 | 3 | import org.json.JSONObject; 4 | 5 | import io.github.lazyimmortal.sesame.hook.ApplicationHook; 6 | 7 | public class ProtectTreeRpcCall { 8 | private static final String VERSION = "20230501"; 9 | private static final String VERSION2 = "20230522"; 10 | 11 | /* 查询地图树苗 */ 12 | public static String queryAreaTrees() { 13 | return ApplicationHook.requestString("alipay.antmember.forest.h5.queryAreaTrees", "[{}]"); 14 | } 15 | 16 | public static String queryTreeItemsForExchange() { 17 | return ApplicationHook.requestString("alipay.antforest.forest.h5.queryTreeItemsForExchange", "[{}]"); 18 | } 19 | 20 | public static String queryTreeItemsForExchange(String applyActions, String itemTypes) { 21 | // "applyActions": "LIMITED,NO_STOCK,AVAILABLE,ENERGY_LACK,COMING" 22 | // "itemTypes": "project,special" 23 | String args = "[{\"applyActions\":\"" + applyActions + "\",\"itemTypes\":\"" + itemTypes + "\"}]"; 24 | return ApplicationHook.requestString("alipay.antforest.forest.h5.queryTreeItemsForExchange", args); 25 | } 26 | 27 | public static String queryTreeForExchange(Object projectId) { 28 | String args = "[{\"projectId\":\"" + projectId + "\"}]"; 29 | return ApplicationHook.requestString("alipay.antforest.forest.h5.queryTreeForExchange", args); 30 | } 31 | 32 | public static String exchangeTree(int projectId) { 33 | String args = "[{\"projectId\":" + projectId + ",\"sToken\":\"" + System.currentTimeMillis() + "\"}]"; 34 | return ApplicationHook.requestString("alipay.antmember.forest.h5.exchangeTree", args); 35 | } 36 | 37 | public static String applyGoldAnimalCert(int projectId) { 38 | String args = "[{\"projectId\":\"" + projectId + "\"}]"; 39 | return ApplicationHook.requestString("alipay.antforest.forest.h5.applyGoldAnimalCert", args); 40 | } 41 | 42 | // 碳中和 43 | /** 44 | * 45 | * @param actionCode actionCode 46 | * marathonHome marathonWater 47 | * carbonHome carbonWater 48 | * @param activityId activityId 49 | * @param paramMap 查询时: {"donateQueryActionParam":"marathonWater"} 50 | * 捐赠时: {"donateNum":1000,"incrNum":1000} 51 | * @return String 52 | */ 53 | public static String doRubickActivity(String actionCode, String activityId, JSONObject paramMap) { 54 | String args = "[{\"actionCode\":\"" + actionCode + "\",\"activityId\":\"" + activityId + "\",\"paramMap\":" + paramMap + ",\"source\":\"forest\"}]"; 55 | return ApplicationHook.requestString("com.alipay.charityactivity.rubick.rpc.h5.doRubickActivity", args); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/model/task/readingDada/ReadingDada.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.model.task.readingDada; 2 | 3 | import org.json.JSONArray; 4 | import org.json.JSONObject; 5 | import io.github.lazyimmortal.sesame.data.ModelGroup; 6 | import io.github.lazyimmortal.sesame.model.normal.answerAI.AnswerAI; 7 | import io.github.lazyimmortal.sesame.util.JsonUtil; 8 | import io.github.lazyimmortal.sesame.util.Log; 9 | import io.github.lazyimmortal.sesame.util.StringUtil; 10 | 11 | /** 12 | * @author Constanline 13 | * @since 2023/08/22 14 | */ 15 | public class ReadingDada { 16 | private static final String TAG = ReadingDada.class.getSimpleName(); 17 | 18 | public ModelGroup getGroup() { 19 | return ModelGroup.STALL; 20 | } 21 | 22 | public static boolean answerQuestion(JSONObject bizInfo) { 23 | try { 24 | String taskJumpUrl = bizInfo.optString("taskJumpUrl"); 25 | if (StringUtil.isEmpty(taskJumpUrl)) { 26 | taskJumpUrl = bizInfo.getString("targetUrl"); 27 | } 28 | String activityId = taskJumpUrl.split("activityId%3D")[1].split("%26")[0]; 29 | String outBizId; 30 | if (taskJumpUrl.contains("outBizId%3D")) { 31 | outBizId = taskJumpUrl.split("outBizId%3D")[1].split("%26")[0]; 32 | } else { 33 | outBizId = ""; 34 | } 35 | String s = ReadingDadaRpcCall.getQuestion(activityId); 36 | JSONObject jo = new JSONObject(s); 37 | if ("200".equals(jo.getString("resultCode"))) { 38 | JSONArray jsonArray = jo.getJSONArray("options"); 39 | String answer = AnswerAI.getAnswer(jo.getString("title"), JsonUtil.jsonArrayToList(jsonArray)); 40 | if (answer == null || answer.isEmpty()) { 41 | answer = jsonArray.getString(0); 42 | } 43 | s = ReadingDadaRpcCall.submitAnswer(activityId, outBizId, jo.getString("questionId"), answer); 44 | jo = new JSONObject(s); 45 | if ("200".equals(jo.getString("resultCode"))) { 46 | Log.record("答题完成"); 47 | return true; 48 | } else { 49 | Log.record("答题失败"); 50 | } 51 | } else { 52 | Log.record("获取问题失败"); 53 | } 54 | } catch (Throwable e) { 55 | Log.i(TAG, "answerQuestion err:"); 56 | Log.printStackTrace(TAG, e); 57 | } 58 | return false; 59 | } 60 | } -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/model/task/readingDada/ReadingDadaRpcCall.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.model.task.readingDada; 2 | 3 | import io.github.lazyimmortal.sesame.hook.ApplicationHook; 4 | import io.github.lazyimmortal.sesame.util.StringUtil; 5 | 6 | /** 7 | * @author Constanline 8 | * @since 2023/08/22 9 | */ 10 | public class ReadingDadaRpcCall { 11 | private static final String VERSION = "1"; 12 | 13 | public static String submitAnswer(String activityId, String outBizId, String questionId, String answer) { 14 | return ApplicationHook.requestString("com.alipay.reading.game.dada.openDailyAnswer.submitAnswer", 15 | "[{\"activityId\":\"" + activityId + "\",\"answer\":\"" + answer + "\",\"dadaVersion\":\"1.3.0\"," + 16 | (StringUtil.isEmpty(outBizId) ? "" : "\"outBizId\":\"" + outBizId + "\",") + 17 | "\"questionId\":\"" + questionId + "\",\"version\":" + VERSION + "}]"); 18 | } 19 | 20 | public static String getQuestion(String activityId) { 21 | return ApplicationHook.requestString("com.alipay.reading.game.dada.openDailyAnswer.getQuestion", 22 | "[{\"activityId\":\"" + activityId + "\",\"dadaVersion\":\"1.3.0\",\"version\":" + VERSION + "}]"); 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/rpc/bridge/RpcBridge.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.rpc.bridge; 2 | 3 | import io.github.lazyimmortal.sesame.entity.RpcEntity; 4 | 5 | public interface RpcBridge { 6 | 7 | RpcVersion getVersion(); 8 | 9 | void load() throws Exception; 10 | 11 | void unload(); 12 | 13 | String requestString(RpcEntity rpcEntity, int tryCount, int retryInterval); 14 | 15 | default String requestString(RpcEntity rpcEntity) { 16 | return requestString(rpcEntity, 3, -1); 17 | } 18 | 19 | default String requestString(String method, String data) { 20 | return requestString(method, data, 3, -1); 21 | } 22 | 23 | default String requestString(String method, String data, String relation) { 24 | return requestString(method, data, relation, 3, -1); 25 | } 26 | 27 | /*default String requestString(String method, String data, String relation, Long time) { 28 | return requestString(method, data, relation, time, 3, -1); 29 | }*/ 30 | 31 | default String requestString(String method, String data, int tryCount, int retryInterval) { 32 | return requestString(new RpcEntity(method, data), tryCount, retryInterval); 33 | } 34 | 35 | default String requestString(String method, String data, String relation, int tryCount, int retryInterval) { 36 | return requestString(new RpcEntity(method, data, relation), tryCount, retryInterval); 37 | } 38 | 39 | /*default String requestString(String method, String data, String relation, Long time, int tryCount, int retryInterval) { 40 | return requestString(new RpcEntity(method, data, relation, time), tryCount, retryInterval); 41 | }*/ 42 | 43 | RpcEntity requestObject(RpcEntity rpcEntity, int tryCount, int retryInterval); 44 | 45 | default RpcEntity requestObject(RpcEntity rpcEntity) { 46 | return requestObject(rpcEntity, 3, -1); 47 | } 48 | 49 | default RpcEntity requestObject(String method, String data) { 50 | return requestObject(method, data, 3, -1); 51 | } 52 | 53 | default RpcEntity requestObject(String method, String data, String relation) { 54 | return requestObject(method, data, relation, 3, -1); 55 | } 56 | 57 | /*default RpcEntity requestObject(String method, String data, String relation, Long time) { 58 | return requestObject(method, data, relation, time, 3, -1); 59 | }*/ 60 | 61 | default RpcEntity requestObject(String method, String data, int tryCount, int retryInterval) { 62 | return requestObject(new RpcEntity(method, data), tryCount, retryInterval); 63 | } 64 | 65 | default RpcEntity requestObject(String method, String data, String relation, int tryCount, int retryInterval) { 66 | return requestObject(new RpcEntity(method, data, relation), tryCount, retryInterval); 67 | } 68 | 69 | /*default RpcEntity requestObject(String method, String data, String relation, Long time, int tryCount, int retryInterval) { 70 | return requestObject(new RpcEntity(method, data, relation, time), tryCount, retryInterval); 71 | }*/ 72 | 73 | } 74 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/rpc/bridge/RpcVersion.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.rpc.bridge; 2 | 3 | import lombok.Getter; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | @Getter 9 | public enum RpcVersion { 10 | 11 | OLD("OLD"), 12 | NEW("NEW"), 13 | 14 | ; 15 | 16 | final String code; 17 | 18 | RpcVersion(String code) { 19 | this.code = code; 20 | } 21 | 22 | private static final Map MAP; 23 | 24 | static { 25 | MAP = new HashMap<>(); 26 | RpcVersion[] values = RpcVersion.values(); 27 | for (RpcVersion value : values) { 28 | MAP.put(value.code, value); 29 | } 30 | } 31 | 32 | public static RpcVersion getByCode(String code) { 33 | return MAP.get(code); 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/rpc/intervallimit/DefaultIntervalLimit.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.rpc.intervallimit; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class DefaultIntervalLimit implements IntervalLimit { 7 | 8 | private final Integer interval; 9 | 10 | private Long time = 0L; 11 | 12 | public DefaultIntervalLimit(Integer interval) { 13 | this.interval = interval; 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/rpc/intervallimit/FixedOrRangeIntervalLimit.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.rpc.intervallimit; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | import java.util.concurrent.ThreadLocalRandom; 7 | 8 | public class FixedOrRangeIntervalLimit implements IntervalLimit { 9 | 10 | private final Boolean fixedOrRange; 11 | 12 | private final Integer fixedInt; 13 | 14 | private final Integer rangeMin; 15 | 16 | private final Integer rangeMax; 17 | 18 | @Getter 19 | @Setter 20 | private Long time = 0L; 21 | 22 | public FixedOrRangeIntervalLimit(String fixedOrRangeStr, int min, int max) { 23 | if (min > max) { 24 | max = min; 25 | } 26 | if (fixedOrRangeStr != null && !fixedOrRangeStr.isEmpty()) { 27 | String[] split = fixedOrRangeStr.split("-"); 28 | if (split.length == 2) { 29 | int rangeMinTmp, rangeMaxTmp; 30 | try { 31 | rangeMinTmp = Math.max(Integer.parseInt(split[0]), min); 32 | } catch (Exception ignored) { 33 | rangeMinTmp = min; 34 | } 35 | try { 36 | rangeMaxTmp = Math.min(Integer.parseInt(split[1]), max); 37 | } catch (Exception ignored) { 38 | rangeMaxTmp = max; 39 | } 40 | if (rangeMinTmp > rangeMaxTmp) { 41 | rangeMaxTmp = rangeMinTmp; 42 | } 43 | fixedInt = null; 44 | rangeMin = rangeMinTmp; 45 | rangeMax = rangeMaxTmp + 1; 46 | fixedOrRange = false; 47 | } else { 48 | int fixedIntTmp; 49 | try { 50 | fixedIntTmp = Integer.parseInt(fixedOrRangeStr); 51 | } catch (Exception ignored) { 52 | fixedIntTmp = max; 53 | } 54 | fixedIntTmp = Math.max(fixedIntTmp, min); 55 | fixedIntTmp = Math.min(fixedIntTmp, max); 56 | fixedInt = fixedIntTmp; 57 | rangeMin = null; 58 | rangeMax = null; 59 | fixedOrRange = true; 60 | } 61 | } else { 62 | fixedInt = max; 63 | rangeMin = null; 64 | rangeMax = null; 65 | fixedOrRange = true; 66 | } 67 | } 68 | 69 | public Integer getInterval() { 70 | if (fixedOrRange) { 71 | return fixedInt; 72 | } 73 | return ThreadLocalRandom.current().nextInt(rangeMin, rangeMax); 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/rpc/intervallimit/IntervalLimit.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.rpc.intervallimit; 2 | 3 | public interface IntervalLimit { 4 | 5 | Integer getInterval(); 6 | 7 | Long getTime(); 8 | 9 | void setTime(Long time); 10 | 11 | } -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/rpc/intervallimit/RpcIntervalLimit.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.rpc.intervallimit; 2 | 3 | import io.github.lazyimmortal.sesame.util.Log; 4 | import io.github.lazyimmortal.sesame.util.TimeUtil; 5 | 6 | import java.util.Map; 7 | import java.util.concurrent.ConcurrentHashMap; 8 | 9 | public class RpcIntervalLimit { 10 | 11 | private static final IntervalLimit defaultIntervalLimit = new DefaultIntervalLimit(50); 12 | 13 | private static final Map intervalLimitMap = new ConcurrentHashMap<>(); 14 | 15 | public static synchronized void addIntervalLimit(String method, Integer interval) { 16 | addIntervalLimit(method, new DefaultIntervalLimit(interval)); 17 | } 18 | 19 | public static synchronized void addIntervalLimit(String method, IntervalLimit intervalLimit) { 20 | if (intervalLimitMap.containsKey(method)) { 21 | Log.i("方法:" + method + " 间隔限制已存在"); 22 | throw new IllegalArgumentException("方法:" + method + " 间隔限制已存在"); 23 | } 24 | intervalLimitMap.put(method, intervalLimit); 25 | } 26 | 27 | public static synchronized void updateIntervalLimit(String method, Integer interval) { 28 | updateIntervalLimit(method, new DefaultIntervalLimit(interval)); 29 | } 30 | 31 | public static synchronized void updateIntervalLimit(String method, IntervalLimit intervalLimit) { 32 | intervalLimitMap.put(method, intervalLimit); 33 | } 34 | 35 | public static void enterIntervalLimit(String method) { 36 | IntervalLimit intervalLimit = intervalLimitMap.get(method); 37 | if (intervalLimit == null) { 38 | intervalLimit = defaultIntervalLimit; 39 | } 40 | synchronized (intervalLimit) { 41 | long sleep = intervalLimit.getInterval() - System.currentTimeMillis() + intervalLimit.getTime(); 42 | if (sleep > 0) { 43 | TimeUtil.sleep(sleep); 44 | } 45 | intervalLimit.setTime(System.currentTimeMillis()); 46 | } 47 | } 48 | 49 | public static synchronized void clearIntervalLimit() { 50 | intervalLimitMap.clear(); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/ui/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.ui; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | 6 | import androidx.appcompat.app.AppCompatActivity; 7 | import androidx.appcompat.widget.Toolbar; 8 | 9 | import io.github.lazyimmortal.sesame.R; 10 | import io.github.lazyimmortal.sesame.data.ViewAppInfo; 11 | import io.github.lazyimmortal.sesame.util.LanguageUtil; 12 | 13 | public class BaseActivity extends AppCompatActivity { 14 | 15 | private Toolbar toolbar; 16 | 17 | @Override 18 | protected void onCreate(Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | ViewAppInfo.init(getApplicationContext()); 21 | } 22 | 23 | @Override 24 | public void onContentChanged() { 25 | super.onContentChanged(); 26 | toolbar = findViewById(R.id.x_toolbar); 27 | toolbar.setTitle(getBaseTitle()); 28 | toolbar.setSubtitle(getBaseSubtitle()); 29 | setSupportActionBar(toolbar); 30 | } 31 | 32 | @Override 33 | protected void attachBaseContext(Context newBase) { 34 | super.attachBaseContext(LanguageUtil.setLocal(newBase)); 35 | } 36 | 37 | public String getBaseTitle() { 38 | return ViewAppInfo.getAppTitle(); 39 | } 40 | 41 | public String getBaseSubtitle() { 42 | return null; 43 | } 44 | 45 | public void setBaseTitle(String title) { 46 | toolbar.setTitle(title); 47 | } 48 | 49 | public void setBaseSubtitle(String subTitle) { 50 | toolbar.setSubtitle(subTitle); 51 | } 52 | 53 | public void setBaseTitleTextColor(int color) { 54 | toolbar.setTitleTextColor(color); 55 | } 56 | 57 | public void setBaseSubtitleTextColor(int color) { 58 | toolbar.setSubtitleTextColor(color); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/ui/ChoiceDialog.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.ui; 2 | 3 | import android.content.Context; 4 | import androidx.appcompat.app.AlertDialog; 5 | import io.github.lazyimmortal.sesame.R; 6 | import io.github.lazyimmortal.sesame.data.modelFieldExt.ChoiceModelField; 7 | 8 | public class ChoiceDialog { 9 | 10 | public static void show(Context c, CharSequence title, ChoiceModelField choiceModelField) { 11 | new AlertDialog.Builder(c) 12 | .setTitle(title) 13 | .setSingleChoiceItems(choiceModelField.getExpandKey(), choiceModelField.getValue(), 14 | (p1, p2) -> choiceModelField.setObjectValue(p2)) 15 | .setPositiveButton(c.getString(R.string.ok), null) 16 | .create().show(); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/ui/MyWebView.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.ui; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.webkit.WebSettings; 6 | import android.webkit.WebView; 7 | import android.webkit.WebViewClient; 8 | 9 | public class MyWebView extends WebView { 10 | public MyWebView(Context c) { 11 | super(c); 12 | defInit(); 13 | } 14 | 15 | public MyWebView(Context context, AttributeSet attrs) { 16 | super(context, attrs); 17 | defInit(); 18 | } 19 | 20 | public MyWebView(Context context, AttributeSet attrs, int defStyleAttr) { 21 | super(context, attrs, defStyleAttr); 22 | defInit(); 23 | } 24 | 25 | public MyWebView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { 26 | super(context, attrs, defStyleAttr, defStyleRes); 27 | defInit(); 28 | } 29 | 30 | private void defInit() { 31 | getSettings().setSupportZoom(true); 32 | getSettings().setBuiltInZoomControls(true); 33 | getSettings().setDisplayZoomControls(false); 34 | getSettings().setUseWideViewPort(false); 35 | getSettings().setUseWideViewPort(true); 36 | getSettings().setLoadWithOverviewMode(true); 37 | getSettings().setAllowFileAccess(true); 38 | setWebViewClient( 39 | new WebViewClient() { 40 | public void onPageFinished(WebView view, String url) { 41 | if (url.endsWith(".log")) 42 | postDelayed( 43 | new Runnable() { 44 | @Override 45 | public void run() { 46 | if (Thread.interrupted()) return; 47 | if (getContentHeight() == 0) 48 | postDelayed(this, 100); 49 | else 50 | scrollToBottom(); 51 | } 52 | }, 500); 53 | } 54 | }); 55 | } 56 | 57 | public void scrollToBottom() { 58 | scrollTo(0, computeVerticalScrollRange()); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/ui/ObjReference.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.ui; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class ObjReference { 7 | 8 | private T obj; 9 | 10 | public ObjReference() { 11 | } 12 | 13 | public ObjReference(T obj) { 14 | this.obj = obj; 15 | } 16 | 17 | public Boolean has() { 18 | return this.obj != null; 19 | } 20 | 21 | public T get() { 22 | return obj; 23 | } 24 | 25 | public Boolean set(T obj) { 26 | if (this.obj == obj) { 27 | return true; 28 | } 29 | if (this.obj != null) { 30 | return false; 31 | } 32 | this.obj = obj; 33 | return true; 34 | } 35 | 36 | public void setForce(T obj) { 37 | this.obj = obj; 38 | } 39 | 40 | public void del() { 41 | this.obj = null; 42 | } 43 | 44 | public void delIfEquals(T obj) { 45 | if (this.obj == obj) { 46 | this.obj = null; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/ui/ObjSyncReference.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.ui; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class ObjSyncReference { 7 | 8 | private T obj; 9 | 10 | public ObjSyncReference() { 11 | } 12 | 13 | public ObjSyncReference(T obj) { 14 | this.obj = obj; 15 | } 16 | 17 | public Boolean has() { 18 | synchronized (this) { 19 | return this.obj != null; 20 | } 21 | } 22 | 23 | public T get() { 24 | synchronized (this) { 25 | return obj; 26 | } 27 | } 28 | 29 | public Boolean set(T obj) { 30 | synchronized (this) { 31 | if (this.obj == obj) { 32 | return true; 33 | } 34 | if (this.obj != null) { 35 | return false; 36 | } 37 | this.obj = obj; 38 | return true; 39 | } 40 | } 41 | 42 | public void setForce(T obj) { 43 | synchronized (this) { 44 | this.obj = obj; 45 | } 46 | } 47 | 48 | public void del() { 49 | synchronized (this) { 50 | this.obj = null; 51 | } 52 | } 53 | 54 | public void delIfEquals(T obj) { 55 | synchronized (this) { 56 | if (this.obj == obj) { 57 | this.obj = null; 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/ui/OptionsAdapter.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.ui; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.content.Context; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.BaseAdapter; 9 | import android.widget.TextView; 10 | 11 | import java.util.ArrayList; 12 | 13 | public class OptionsAdapter extends BaseAdapter { 14 | @SuppressLint("StaticFieldLeak") 15 | private static OptionsAdapter adapter; 16 | 17 | public static OptionsAdapter get(Context c) { 18 | if (adapter == null) 19 | adapter = new OptionsAdapter(c); 20 | return adapter; 21 | } 22 | 23 | Context context; 24 | ArrayList list; 25 | 26 | private OptionsAdapter(Context c) { 27 | context = c; 28 | list = new ArrayList<>(); 29 | list.add("查看森林"); 30 | list.add("查看庄园"); 31 | list.add("查看资料"); 32 | list.add("删除"); 33 | } 34 | 35 | @Override 36 | public int getCount() { 37 | return list == null ? 0 : list.size(); 38 | } 39 | 40 | @Override 41 | public Object getItem(int p1) { 42 | return list.get(p1); 43 | } 44 | 45 | @Override 46 | public long getItemId(int p1) { 47 | return p1; 48 | } 49 | 50 | @SuppressLint("InflateParams") 51 | @Override 52 | public View getView(int p1, View p2, ViewGroup p3) { 53 | if (p2 == null) { 54 | p2 = LayoutInflater.from(context).inflate(android.R.layout.simple_list_item_1, null); 55 | } 56 | TextView txt = (TextView) p2; 57 | txt.setText(getItem(p1).toString()); 58 | return p2; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/ui/dto/ModelDto.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.ui.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | import java.util.List; 7 | 8 | @Data 9 | public class ModelDto implements Serializable { 10 | 11 | private String modelCode; 12 | 13 | private String modelName; 14 | 15 | private String groupCode; 16 | 17 | private List modelFields; 18 | 19 | public ModelDto() { 20 | } 21 | 22 | public ModelDto(String modelCode, String modelName, String groupCode, List modelFields) { 23 | this.modelCode = modelCode; 24 | this.modelName = modelName; 25 | this.groupCode = groupCode; 26 | this.modelFields = modelFields; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/ui/dto/ModelFieldInfoDto.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.ui.dto; 2 | 3 | import lombok.Data; 4 | import io.github.lazyimmortal.sesame.data.ModelField; 5 | 6 | import java.io.Serializable; 7 | 8 | @Data 9 | public class ModelFieldInfoDto implements Serializable { 10 | 11 | private String code; 12 | 13 | private String name; 14 | 15 | private String type; 16 | 17 | private Object expandKey; 18 | 19 | private Object expandValue; 20 | 21 | private String configValue; 22 | 23 | private String description; 24 | 25 | public ModelFieldInfoDto() { 26 | } 27 | 28 | public static ModelFieldInfoDto toInfoDto(ModelField modelField) { 29 | ModelFieldInfoDto dto = new ModelFieldInfoDto(); 30 | dto.setCode(modelField.getCode()); 31 | dto.setName(modelField.getName()); 32 | dto.setType(modelField.getType()); 33 | dto.setExpandKey(modelField.getExpandKey()); 34 | dto.setExpandValue(modelField.getExpandValue()); 35 | dto.setConfigValue(modelField.getConfigValue()); 36 | dto.setDescription(modelField.getDescription()); 37 | return dto; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/ui/dto/ModelFieldShowDto.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.ui.dto; 2 | 3 | import lombok.Data; 4 | import io.github.lazyimmortal.sesame.data.ModelField; 5 | 6 | import java.io.Serializable; 7 | 8 | @Data 9 | public class ModelFieldShowDto implements Serializable { 10 | 11 | private String code; 12 | 13 | private String name; 14 | 15 | private String type; 16 | 17 | private Object expandKey; 18 | 19 | private String configValue; 20 | 21 | private String description; 22 | 23 | public ModelFieldShowDto() { 24 | } 25 | 26 | public static ModelFieldShowDto toShowDto(ModelField modelField) { 27 | ModelFieldShowDto dto = new ModelFieldShowDto(); 28 | dto.setCode(modelField.getCode()); 29 | dto.setName(modelField.getName()); 30 | dto.setType(modelField.getType()); 31 | dto.setExpandKey(modelField.getExpandKey()); 32 | dto.setConfigValue(modelField.getConfigValue()); 33 | dto.setDescription(modelField.getDescription()); 34 | return dto; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/ui/dto/ModelGroupDto.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.ui.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | @Data 8 | public class ModelGroupDto implements Serializable { 9 | 10 | private String code; 11 | 12 | private String name; 13 | 14 | private String icon; 15 | 16 | public ModelGroupDto() { 17 | } 18 | 19 | public ModelGroupDto(String code, String name, String icon) { 20 | this.code = code; 21 | this.name = name; 22 | this.icon = icon; 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/util/AverageMath.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.util; 2 | 3 | public class AverageMath { 4 | 5 | private final CircularFifoQueue queue; 6 | 7 | private double sum; 8 | 9 | private double average; 10 | 11 | public AverageMath(int size) { 12 | this.queue = new CircularFifoQueue<>(size); 13 | this.sum = 0.0; 14 | this.average = 0.0; 15 | } 16 | 17 | public double nextDouble(int value) { 18 | Integer last = queue.push(value); 19 | if (last != null) { 20 | sum -= last; 21 | } 22 | sum += value; 23 | return average = sum / queue.size(); 24 | } 25 | 26 | public int nextInteger(int value) { 27 | return (int) nextDouble(value); 28 | } 29 | 30 | public double averageDouble() { 31 | return average; 32 | } 33 | 34 | public int getAverageInteger() { 35 | return (int) average; 36 | } 37 | 38 | public void clear() { 39 | queue.clear(); 40 | sum = 0.0; 41 | average = 0.0; 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/util/ClassUtil.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.util; 2 | 3 | public class ClassUtil { 4 | 5 | public static final String PACKAGE_NAME = "com.eg.android.AlipayGphone"; 6 | 7 | public static final String CURRENT_USING_SERVICE = "com.alipay.dexaop.power.RuntimePowerService"; 8 | 9 | public static final String CURRENT_USING_ACTIVITY = "com.eg.android.AlipayGphone.AlipayLogin"; 10 | 11 | public static final String JSON_OBJECT_NAME = "com.alibaba.fastjson.JSONObject"; 12 | 13 | public static final String H5PAGE_NAME = "com.alipay.mobile.h5container.api.H5Page"; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/util/LanguageUtil.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.util; 2 | 3 | import android.content.Context; 4 | import android.content.res.Configuration; 5 | 6 | import java.util.Locale; 7 | 8 | import io.github.lazyimmortal.sesame.data.AppConfig; 9 | 10 | 11 | public class LanguageUtil { 12 | public static Context setLocal(Context context) { 13 | AppConfig.load(); 14 | if (AppConfig.INSTANCE.getLanguageSimplifiedChinese()) { 15 | // 忽略系统语言,强制使用简体中文 16 | Locale locale = new Locale("zh", "CN"); // 简体中文的区域代码 17 | return setLocal(context, locale); 18 | } else { 19 | return setLocal(context, Locale.getDefault()); 20 | } 21 | } 22 | 23 | public static Context setLocal(Context context, Locale locale) { 24 | Configuration configuration = new Configuration(); 25 | configuration.setLocale(locale); 26 | return context.createConfigurationContext(configuration); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/util/LibraryUtil.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.util; 2 | 3 | import android.content.Context; 4 | import android.content.pm.PackageManager; 5 | 6 | import org.json.JSONObject; 7 | 8 | import io.github.lazyimmortal.sesame.BuildConfig; 9 | 10 | public class LibraryUtil { 11 | private static final String TAG = LibraryUtil.class.getSimpleName(); 12 | 13 | public static String getLibSesamePath(Context context) { 14 | String libSesamePath = null; 15 | try { 16 | libSesamePath = context.getPackageManager() 17 | .getApplicationInfo(BuildConfig.APPLICATION_ID, 0) 18 | .nativeLibraryDir + "/" + System.mapLibraryName("sesame"); 19 | } catch (PackageManager.NameNotFoundException e) { 20 | ToastUtil.show(context, "请授予支付宝读取芝麻粒的权限"); 21 | Log.record("请授予支付宝读取芝麻粒的权限"); 22 | } 23 | return libSesamePath; 24 | } 25 | 26 | public static Boolean loadLibrary(String libraryName) { 27 | try { 28 | System.loadLibrary(libraryName); 29 | return true; 30 | } catch (UnsatisfiedLinkError e) { 31 | return false; 32 | } 33 | } 34 | 35 | 36 | // native code 37 | private static native boolean libraryCheckFarmTaskStatus(JSONObject task); 38 | public static Boolean checkFarmTaskStatus(JSONObject task) { 39 | return libraryCheckFarmTaskStatus(task); // 注释此行,重写实现 40 | } 41 | 42 | private static native boolean libraryDoFarmTask(JSONObject task); 43 | public static Boolean doFarmTask(JSONObject task) { 44 | return libraryDoFarmTask(task); 45 | } 46 | 47 | private static native boolean libraryDoFarmDrawTimesTask(JSONObject task); 48 | public static Boolean doFarmDrawTimesTask(JSONObject task) { 49 | return libraryDoFarmDrawTimesTask(task); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/util/ListUtil.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.util; 2 | 3 | 4 | import java.util.ArrayList; 5 | import java.util.Collections; 6 | import java.util.List; 7 | 8 | public class ListUtil { 9 | private static final String TAG = ListUtil.class.getSimpleName(); 10 | 11 | @SafeVarargs 12 | public static List newArrayList(T... objects) { 13 | List list = new ArrayList<>(); 14 | if (objects != null) { 15 | Collections.addAll(list, objects); 16 | } 17 | return list; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/util/RandomUtil.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.util; 2 | 3 | import java.util.Random; 4 | import java.util.UUID; 5 | 6 | public class RandomUtil { 7 | private static final Random rnd = new Random(); 8 | 9 | public static int delay() { 10 | return nextInt(100, 300); 11 | } 12 | 13 | public static int nextInt(int min, int max) { 14 | if (min >= max) return min; 15 | return rnd.nextInt(max - min) + min; 16 | } 17 | 18 | public static long nextLong() { 19 | return rnd.nextLong(); 20 | } 21 | 22 | public static long nextLong(long min, long max) { 23 | if (min >= max) return min; 24 | long o = max - min; 25 | return rnd.nextLong() % o + min; 26 | } 27 | 28 | public static double nextDouble() { 29 | return rnd.nextDouble(); 30 | } 31 | 32 | public static String getRandom(int len) { 33 | StringBuilder rs = new StringBuilder(); 34 | for (int i = 0; i < len; i++) { 35 | rs.append(rnd.nextInt(10)); 36 | } 37 | return rs.toString(); 38 | } 39 | 40 | public static String getRandomString(int length) { 41 | String str = "abcdefghijklmnopqrstuvwxyz0123456789"; 42 | StringBuilder sb = new StringBuilder(); 43 | for (int i = 0; i < length; i++) { 44 | int number = rnd.nextInt(36); 45 | sb.append(str.charAt(number)); 46 | } 47 | return sb.toString(); 48 | } 49 | 50 | public static String getRandomUUID() { 51 | return UUID.randomUUID().toString(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/util/StringUtil.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.util; 2 | 3 | import java.util.Collection; 4 | import java.util.Iterator; 5 | import java.util.Objects; 6 | 7 | public class StringUtil { 8 | public static boolean isEmpty(String str) { 9 | return str == null || str.isEmpty(); 10 | } 11 | 12 | public static String collectionJoinString(CharSequence conjunction, Collection collection) { 13 | if (!collection.isEmpty()) { 14 | StringBuilder b = new StringBuilder(); 15 | Iterator iterator = collection.iterator(); 16 | b.append(toStringOrEmpty(iterator.next())); 17 | while (iterator.hasNext()) { 18 | b.append(conjunction).append(toStringOrEmpty(iterator.next())); 19 | } 20 | return b.toString(); 21 | } 22 | return ""; 23 | } 24 | 25 | public static String arrayJoinString(CharSequence conjunction, Object... array) { 26 | int length = array.length; 27 | if (length > 0) { 28 | StringBuilder b = new StringBuilder(); 29 | b.append(toStringOrEmpty(array[0])); 30 | for (int i = 1; i < length; i++) { 31 | b.append(conjunction).append(toStringOrEmpty(array[i])); 32 | } 33 | return b.toString(); 34 | } 35 | return ""; 36 | } 37 | 38 | public static String arrayToString(Object... array) { 39 | return arrayJoinString(",", array); 40 | } 41 | 42 | private static String toStringOrEmpty(Object obj) { 43 | return Objects.toString(obj, ""); 44 | } 45 | 46 | public static String padLeft(int str, int totalWidth, char padChar) { 47 | return padLeft(String.valueOf(str), totalWidth, padChar); 48 | } 49 | 50 | public static String padRight(int str, int totalWidth, char padChar) { 51 | return padRight(String.valueOf(str), totalWidth, padChar); 52 | } 53 | 54 | public static String padLeft(String str, int totalWidth, char padChar) { 55 | StringBuilder sb = new StringBuilder(str); 56 | while (sb.length() < totalWidth) { 57 | sb.insert(0, padChar); 58 | } 59 | return sb.toString(); 60 | } 61 | 62 | public static String padRight(String str, int totalWidth, char padChar) { 63 | StringBuilder sb = new StringBuilder(str); 64 | while (sb.length() < totalWidth) { 65 | sb.append(padChar); 66 | } 67 | return sb.toString(); 68 | } 69 | 70 | public static String getSubString(String text, String left, String right) { 71 | int leftIndex = isEmpty(left) ? 0 : text.indexOf(left); 72 | if (leftIndex == -1) { 73 | return ""; 74 | } else if (!isEmpty(left)) { 75 | leftIndex += left.length(); 76 | } 77 | int rightIndex = isEmpty(right) ? text.length() : text.indexOf(right, leftIndex); 78 | if (rightIndex == -1) { 79 | return ""; 80 | } 81 | return text.substring(leftIndex, rightIndex); 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/util/ThreadUtil.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.util; 2 | 3 | import java.util.concurrent.ExecutorService; 4 | import java.util.concurrent.TimeUnit; 5 | 6 | public class ThreadUtil { 7 | 8 | private static final String TAG = ThreadUtil.class.getSimpleName(); 9 | 10 | public static void shutdownAndWait(Thread thread, long timeout, TimeUnit unit) { 11 | if (thread != null) { 12 | thread.interrupt(); 13 | if (timeout > -1L) { 14 | try { 15 | thread.join(unit.toMillis(timeout)); 16 | } catch (InterruptedException e) { 17 | Log.i(TAG, "thread shutdownAndWait err:"); 18 | Log.printStackTrace(TAG, e); 19 | } 20 | } 21 | } 22 | } 23 | 24 | public static void shutdownNow(ExecutorService pool) { 25 | if (pool != null && !pool.isShutdown()) { 26 | pool.shutdownNow(); 27 | } 28 | } 29 | 30 | public boolean shutdownAndAwaitTermination(ExecutorService pool) { 31 | try { 32 | shutdownAndAwaitTermination(pool, 30, TimeUnit.SECONDS); 33 | } catch (Exception e) { 34 | Log.i(TAG, "thread shutdownAndWait err:"); 35 | Log.printStackTrace(TAG, e); 36 | return false; 37 | } 38 | return true; 39 | } 40 | 41 | public static void shutdownAndAwaitTermination(ExecutorService pool, long timeout, TimeUnit unit) { 42 | if (pool != null && !pool.isShutdown()) { 43 | pool.shutdown(); 44 | try { 45 | if (!pool.awaitTermination(1, TimeUnit.SECONDS)) { 46 | pool.shutdownNow(); 47 | if (!pool.awaitTermination(timeout, unit)) { 48 | Log.i(TAG, "thread pool can't close"); 49 | } 50 | } 51 | } catch (InterruptedException ie) { 52 | pool.shutdownNow(); 53 | Thread.currentThread().interrupt(); 54 | } 55 | } 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/util/ToastUtil.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.util; 2 | 3 | import android.content.Context; 4 | import android.widget.Toast; 5 | 6 | import io.github.lazyimmortal.sesame.model.normal.base.BaseModel; 7 | 8 | public class ToastUtil { 9 | 10 | public static void show(Context context, int resId) { 11 | show(context, context.getText(resId)); 12 | } 13 | 14 | public static void show(Context context, CharSequence text) { 15 | Toast toast = Toast.makeText(context, text, Toast.LENGTH_SHORT); 16 | show(toast); 17 | } 18 | 19 | private static void show(Toast toast) { 20 | toast.setGravity(toast.getGravity(), toast.getXOffset(), BaseModel.getToastOffsetY().getValue()); 21 | toast.show(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/util/idMap/AnimalIdMap.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.util.idMap; 2 | 3 | import com.fasterxml.jackson.core.type.TypeReference; 4 | 5 | import java.util.Collections; 6 | import java.util.Map; 7 | import java.util.concurrent.ConcurrentHashMap; 8 | 9 | import io.github.lazyimmortal.sesame.util.FileUtil; 10 | import io.github.lazyimmortal.sesame.util.JsonUtil; 11 | import io.github.lazyimmortal.sesame.util.Log; 12 | 13 | public class AnimalIdMap { 14 | 15 | private static final Map idMap = new ConcurrentHashMap<>(); 16 | 17 | private static final Map readOnlyIdMap = Collections.unmodifiableMap(idMap); 18 | 19 | public static Map getMap() { 20 | return readOnlyIdMap; 21 | } 22 | 23 | public static String get(String key) { 24 | return idMap.get(key); 25 | } 26 | 27 | public synchronized static void add(String key, String value) { 28 | idMap.put(key, value); 29 | } 30 | 31 | public synchronized static void remove(String key) { 32 | idMap.remove(key); 33 | } 34 | 35 | public synchronized static void load() { 36 | idMap.clear(); 37 | try { 38 | String body = FileUtil.readFromFile(FileUtil.getAnimalIdMapFile()); 39 | if (!body.isEmpty()) { 40 | Map newMap = JsonUtil.parseObject(body, new TypeReference>() { 41 | }); 42 | idMap.putAll(newMap); 43 | } 44 | } catch (Exception e) { 45 | Log.printStackTrace(e); 46 | } 47 | } 48 | 49 | public synchronized static boolean save() { 50 | return FileUtil.write2File(JsonUtil.toJsonString(idMap), FileUtil.getAnimalIdMapFile()); 51 | } 52 | 53 | public synchronized static void clear() { 54 | idMap.clear(); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/util/idMap/BeachIdMap.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.util.idMap; 2 | 3 | import com.fasterxml.jackson.core.type.TypeReference; 4 | 5 | import java.util.Collections; 6 | import java.util.Map; 7 | import java.util.concurrent.ConcurrentHashMap; 8 | 9 | import io.github.lazyimmortal.sesame.util.FileUtil; 10 | import io.github.lazyimmortal.sesame.util.JsonUtil; 11 | import io.github.lazyimmortal.sesame.util.Log; 12 | 13 | public class BeachIdMap { 14 | 15 | private static final Map idMap = new ConcurrentHashMap<>(); 16 | 17 | private static final Map readOnlyIdMap = Collections.unmodifiableMap(idMap); 18 | 19 | public static Map getMap() { 20 | return readOnlyIdMap; 21 | } 22 | 23 | public static String get(String key) { 24 | return idMap.get(key); 25 | } 26 | 27 | public synchronized static void add(String key, String value) { 28 | idMap.put(key, value); 29 | } 30 | 31 | public synchronized static void remove(String key) { 32 | idMap.remove(key); 33 | } 34 | 35 | public synchronized static void load() { 36 | idMap.clear(); 37 | try { 38 | String body = FileUtil.readFromFile(FileUtil.getBeachIdMapFile()); 39 | if (!body.isEmpty()) { 40 | Map newMap = JsonUtil.parseObject(body, new TypeReference>() { 41 | }); 42 | idMap.putAll(newMap); 43 | } 44 | } catch (Exception e) { 45 | Log.printStackTrace(e); 46 | } 47 | } 48 | 49 | public synchronized static boolean save() { 50 | return FileUtil.write2File(JsonUtil.toJsonString(idMap), FileUtil.getBeachIdMapFile()); 51 | } 52 | 53 | public synchronized static void clear() { 54 | idMap.clear(); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/util/idMap/CooperationIdMap.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.util.idMap; 2 | 3 | import com.fasterxml.jackson.core.type.TypeReference; 4 | 5 | import java.util.Collections; 6 | import java.util.Map; 7 | import java.util.concurrent.ConcurrentHashMap; 8 | 9 | import io.github.lazyimmortal.sesame.util.FileUtil; 10 | import io.github.lazyimmortal.sesame.util.JsonUtil; 11 | import io.github.lazyimmortal.sesame.util.Log; 12 | 13 | public class CooperationIdMap { 14 | 15 | private static final Map idMap = new ConcurrentHashMap<>(); 16 | 17 | private static final Map readOnlyIdMap = Collections.unmodifiableMap(idMap); 18 | 19 | public static Map getMap() { 20 | return readOnlyIdMap; 21 | } 22 | 23 | public static synchronized void add(String key, String value) { 24 | idMap.put(key, value); 25 | } 26 | 27 | public static synchronized void remove(String key) { 28 | idMap.remove(key); 29 | } 30 | 31 | public static synchronized void load(String userId) { 32 | idMap.clear(); 33 | try { 34 | String body = FileUtil.readFromFile(FileUtil.getCooperationIdMapFile(userId)); 35 | if (!body.isEmpty()) { 36 | Map newMap = JsonUtil.parseObject(body, new TypeReference>() { 37 | }); 38 | idMap.putAll(newMap); 39 | } 40 | } catch (Exception e) { 41 | Log.printStackTrace(e); 42 | } 43 | } 44 | 45 | public static synchronized boolean save(String userId) { 46 | return FileUtil.write2File(JsonUtil.toJsonString(idMap), FileUtil.getCooperationIdMapFile(userId)); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/util/idMap/FarmOrnamentsIdMap.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.util.idMap; 2 | 3 | import com.fasterxml.jackson.core.type.TypeReference; 4 | 5 | import java.util.Collections; 6 | import java.util.Map; 7 | import java.util.concurrent.ConcurrentHashMap; 8 | 9 | import io.github.lazyimmortal.sesame.util.FileUtil; 10 | import io.github.lazyimmortal.sesame.util.JsonUtil; 11 | import io.github.lazyimmortal.sesame.util.Log; 12 | 13 | public class FarmOrnamentsIdMap { 14 | private static final Map idMap = new ConcurrentHashMap<>(); 15 | 16 | private static final Map readOnlyIdMap = Collections.unmodifiableMap(idMap); 17 | 18 | public static Map getMap() { 19 | return readOnlyIdMap; 20 | } 21 | 22 | public static synchronized void add(String key, String value) { 23 | idMap.put(key, value); 24 | } 25 | 26 | public static synchronized void remove(String key) { 27 | idMap.remove(key); 28 | } 29 | 30 | public static synchronized void load(String userId) { 31 | idMap.clear(); 32 | try { 33 | String body = FileUtil.readFromFile(FileUtil.getFarmOrnamentsIdMapFile(userId)); 34 | if (!body.isEmpty()) { 35 | Map newMap = JsonUtil.parseObject(body, new TypeReference>() { 36 | }); 37 | idMap.putAll(newMap); 38 | } 39 | } catch (Exception e) { 40 | Log.printStackTrace(e); 41 | } 42 | } 43 | 44 | public static synchronized boolean save(String userId) { 45 | return FileUtil.write2File(JsonUtil.toJsonString(idMap), FileUtil.getFarmOrnamentsIdMapFile(userId)); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/util/idMap/MarathonIdMap.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.util.idMap; 2 | 3 | import com.fasterxml.jackson.core.type.TypeReference; 4 | 5 | import java.util.Collections; 6 | import java.util.Map; 7 | import java.util.concurrent.ConcurrentHashMap; 8 | 9 | import io.github.lazyimmortal.sesame.util.FileUtil; 10 | import io.github.lazyimmortal.sesame.util.JsonUtil; 11 | import io.github.lazyimmortal.sesame.util.Log; 12 | 13 | public class MarathonIdMap { 14 | 15 | private static final Map idMap = new ConcurrentHashMap<>(); 16 | 17 | private static final Map readOnlyIdMap = Collections.unmodifiableMap(idMap); 18 | 19 | public static Map getMap() { 20 | return readOnlyIdMap; 21 | } 22 | 23 | public static String get(String key) { 24 | return idMap.get(key); 25 | } 26 | 27 | public synchronized static void add(String key, String value) { 28 | idMap.put(key, value); 29 | } 30 | 31 | public synchronized static void remove(String key) { 32 | idMap.remove(key); 33 | } 34 | 35 | public synchronized static void load() { 36 | idMap.clear(); 37 | try { 38 | String body = FileUtil.readFromFile(FileUtil.getMarathonIdMapFile()); 39 | if (!body.isEmpty()) { 40 | Map newMap = JsonUtil.parseObject(body, new TypeReference>() { 41 | }); 42 | idMap.putAll(newMap); 43 | } 44 | } catch (Exception e) { 45 | Log.printStackTrace(e); 46 | } 47 | } 48 | 49 | public synchronized static boolean save() { 50 | return FileUtil.write2File(JsonUtil.toJsonString(idMap), FileUtil.getMarathonIdMapFile()); 51 | } 52 | 53 | public synchronized static void clear() { 54 | idMap.clear(); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/util/idMap/MemberBenefitIdMap.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.util.idMap; 2 | 3 | import com.fasterxml.jackson.core.type.TypeReference; 4 | 5 | import java.util.Collections; 6 | import java.util.Map; 7 | import java.util.concurrent.ConcurrentHashMap; 8 | 9 | import io.github.lazyimmortal.sesame.util.FileUtil; 10 | import io.github.lazyimmortal.sesame.util.JsonUtil; 11 | import io.github.lazyimmortal.sesame.util.Log; 12 | 13 | public class MemberBenefitIdMap { 14 | private static final Map idMap = new ConcurrentHashMap<>(); 15 | 16 | private static final Map readOnlyIdMap = Collections.unmodifiableMap(idMap); 17 | 18 | public static Map getMap() { 19 | return readOnlyIdMap; 20 | } 21 | 22 | public static synchronized void add(String key, String value) { 23 | idMap.put(key, value); 24 | } 25 | 26 | public static synchronized void remove(String key) { 27 | idMap.remove(key); 28 | } 29 | 30 | public static synchronized void load(String userId) { 31 | idMap.clear(); 32 | try { 33 | String body = FileUtil.readFromFile(FileUtil.getMemberBenefitIdMapFile(userId)); 34 | if (!body.isEmpty()) { 35 | Map newMap = JsonUtil.parseObject(body, new TypeReference>() { 36 | }); 37 | idMap.putAll(newMap); 38 | } 39 | } catch (Exception e) { 40 | Log.printStackTrace(e); 41 | } 42 | } 43 | 44 | public static synchronized boolean save(String userId) { 45 | return FileUtil.write2File(JsonUtil.toJsonString(idMap), FileUtil.getMemberBenefitIdMapFile(userId)); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/util/idMap/NewAncientTreeIdMap.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.util.idMap; 2 | 3 | import com.fasterxml.jackson.core.type.TypeReference; 4 | 5 | import java.util.Collections; 6 | import java.util.Map; 7 | import java.util.concurrent.ConcurrentHashMap; 8 | 9 | import io.github.lazyimmortal.sesame.util.FileUtil; 10 | import io.github.lazyimmortal.sesame.util.JsonUtil; 11 | import io.github.lazyimmortal.sesame.util.Log; 12 | 13 | public class NewAncientTreeIdMap { 14 | 15 | private static final Map idMap = new ConcurrentHashMap<>(); 16 | 17 | private static final Map readOnlyIdMap = Collections.unmodifiableMap(idMap); 18 | 19 | public static Map getMap() { 20 | return readOnlyIdMap; 21 | } 22 | 23 | public static String get(String key) { 24 | return idMap.get(key); 25 | } 26 | 27 | public synchronized static void add(String key, String value) { 28 | idMap.put(key, value); 29 | } 30 | 31 | public synchronized static void remove(String key) { 32 | idMap.remove(key); 33 | } 34 | 35 | public synchronized static void load() { 36 | idMap.clear(); 37 | try { 38 | String body = FileUtil.readFromFile(FileUtil.getNewAncientTreeIdMapFile()); 39 | if (!body.isEmpty()) { 40 | Map newMap = JsonUtil.parseObject(body, new TypeReference>() { 41 | }); 42 | idMap.putAll(newMap); 43 | } 44 | } catch (Exception e) { 45 | Log.printStackTrace(e); 46 | } 47 | } 48 | 49 | public synchronized static boolean save() { 50 | return FileUtil.write2File(JsonUtil.toJsonString(idMap), FileUtil.getNewAncientTreeIdMapFile()); 51 | } 52 | 53 | public synchronized static void clear() { 54 | idMap.clear(); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/util/idMap/PromiseSimpleTemplateIdMap.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.util.idMap; 2 | 3 | import com.fasterxml.jackson.core.type.TypeReference; 4 | 5 | import java.util.Collections; 6 | import java.util.Map; 7 | import java.util.concurrent.ConcurrentHashMap; 8 | 9 | import io.github.lazyimmortal.sesame.util.FileUtil; 10 | import io.github.lazyimmortal.sesame.util.JsonUtil; 11 | import io.github.lazyimmortal.sesame.util.Log; 12 | 13 | public class PromiseSimpleTemplateIdMap { 14 | private static final Map idMap = new ConcurrentHashMap<>(); 15 | 16 | private static final Map readOnlyIdMap = Collections.unmodifiableMap(idMap); 17 | 18 | public static Map getMap() { 19 | return readOnlyIdMap; 20 | } 21 | 22 | public static synchronized void add(String key, String value) { 23 | idMap.put(key, value); 24 | } 25 | 26 | public static synchronized void remove(String key) { 27 | idMap.remove(key); 28 | } 29 | 30 | public static synchronized void load(String userId) { 31 | idMap.clear(); 32 | try { 33 | String body = FileUtil.readFromFile(FileUtil.getPromiseSimpleTemplateIdMapFile(userId)); 34 | if (!body.isEmpty()) { 35 | Map newMap = JsonUtil.parseObject(body, new TypeReference>() { 36 | }); 37 | idMap.putAll(newMap); 38 | } 39 | } catch (Exception e) { 40 | Log.printStackTrace(e); 41 | } 42 | } 43 | 44 | public static synchronized boolean save(String userId) { 45 | return FileUtil.write2File(JsonUtil.toJsonString(idMap), FileUtil.getPromiseSimpleTemplateIdMapFile(userId)); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/util/idMap/ReserveIdMap.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.util.idMap; 2 | 3 | import com.fasterxml.jackson.core.type.TypeReference; 4 | 5 | import java.util.Collections; 6 | import java.util.Map; 7 | import java.util.concurrent.ConcurrentHashMap; 8 | 9 | import io.github.lazyimmortal.sesame.util.FileUtil; 10 | import io.github.lazyimmortal.sesame.util.JsonUtil; 11 | import io.github.lazyimmortal.sesame.util.Log; 12 | 13 | public class ReserveIdMap { 14 | 15 | private static final Map idMap = new ConcurrentHashMap<>(); 16 | 17 | private static final Map readOnlyIdMap = Collections.unmodifiableMap(idMap); 18 | 19 | public static Map getMap() { 20 | return readOnlyIdMap; 21 | } 22 | 23 | public static String get(String key) { 24 | return idMap.get(key); 25 | } 26 | 27 | public synchronized static void add(String key, String value) { 28 | idMap.put(key, value); 29 | } 30 | 31 | public synchronized static void remove(String key) { 32 | idMap.remove(key); 33 | } 34 | 35 | public synchronized static void load() { 36 | idMap.clear(); 37 | try { 38 | String body = FileUtil.readFromFile(FileUtil.getReserveIdMapFile()); 39 | if (!body.isEmpty()) { 40 | Map newMap = JsonUtil.parseObject(body, new TypeReference>() { 41 | }); 42 | idMap.putAll(newMap); 43 | } 44 | } catch (Exception e) { 45 | Log.printStackTrace(e); 46 | } 47 | } 48 | 49 | public synchronized static boolean save() { 50 | return FileUtil.write2File(JsonUtil.toJsonString(idMap), FileUtil.getReserveIdMapFile()); 51 | } 52 | 53 | public synchronized static void clear() { 54 | idMap.clear(); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/util/idMap/TreeIdMap.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.util.idMap; 2 | 3 | import com.fasterxml.jackson.core.type.TypeReference; 4 | 5 | import java.util.Collections; 6 | import java.util.Map; 7 | import java.util.concurrent.ConcurrentHashMap; 8 | 9 | import io.github.lazyimmortal.sesame.util.FileUtil; 10 | import io.github.lazyimmortal.sesame.util.JsonUtil; 11 | import io.github.lazyimmortal.sesame.util.Log; 12 | 13 | public class TreeIdMap { 14 | 15 | private static final Map idMap = new ConcurrentHashMap<>(); 16 | 17 | private static final Map readOnlyIdMap = Collections.unmodifiableMap(idMap); 18 | 19 | public static Map getMap() { 20 | return readOnlyIdMap; 21 | } 22 | 23 | public static String get(String key) { 24 | return idMap.get(key); 25 | } 26 | 27 | public synchronized static void add(String key, String value) { 28 | idMap.put(key, value); 29 | } 30 | 31 | public synchronized static void remove(String key) { 32 | idMap.remove(key); 33 | } 34 | 35 | public synchronized static void load() { 36 | idMap.clear(); 37 | try { 38 | String body = FileUtil.readFromFile(FileUtil.getTreeIdMapFile()); 39 | if (!body.isEmpty()) { 40 | Map newMap = JsonUtil.parseObject(body, new TypeReference>() { 41 | }); 42 | idMap.putAll(newMap); 43 | } 44 | } catch (Exception e) { 45 | Log.printStackTrace(e); 46 | } 47 | } 48 | 49 | public synchronized static boolean save() { 50 | return FileUtil.write2File(JsonUtil.toJsonString(idMap), FileUtil.getTreeIdMapFile()); 51 | } 52 | 53 | public synchronized static void clear() { 54 | idMap.clear(); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/util/idMap/VitalityBenefitIdMap.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.util.idMap; 2 | 3 | import com.fasterxml.jackson.core.type.TypeReference; 4 | 5 | import java.util.Collections; 6 | import java.util.Map; 7 | import java.util.concurrent.ConcurrentHashMap; 8 | 9 | import io.github.lazyimmortal.sesame.util.FileUtil; 10 | import io.github.lazyimmortal.sesame.util.JsonUtil; 11 | import io.github.lazyimmortal.sesame.util.Log; 12 | 13 | public class VitalityBenefitIdMap { 14 | private static final Map idMap = new ConcurrentHashMap<>(); 15 | 16 | private static final Map readOnlyIdMap = Collections.unmodifiableMap(idMap); 17 | 18 | public static Map getMap() { 19 | return readOnlyIdMap; 20 | } 21 | 22 | public static synchronized void add(String key, String value) { 23 | idMap.put(key, value); 24 | } 25 | 26 | public static synchronized void remove(String key) { 27 | idMap.remove(key); 28 | } 29 | 30 | public static synchronized void load(String userId) { 31 | idMap.clear(); 32 | try { 33 | String body = FileUtil.readFromFile(FileUtil.getVitalityBenefitIdMap(userId)); 34 | if (!body.isEmpty()) { 35 | Map newMap = JsonUtil.parseObject(body, new TypeReference>() { 36 | }); 37 | idMap.putAll(newMap); 38 | } 39 | } catch (Exception e) { 40 | Log.printStackTrace(e); 41 | } 42 | } 43 | 44 | public static synchronized boolean save(String userId) { 45 | return FileUtil.write2File(JsonUtil.toJsonString(idMap), FileUtil.getVitalityBenefitIdMap(userId)); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lazyimmortal/sesame/util/idMap/WalkPathIdMap.java: -------------------------------------------------------------------------------- 1 | package io.github.lazyimmortal.sesame.util.idMap; 2 | 3 | import com.fasterxml.jackson.core.type.TypeReference; 4 | 5 | import java.util.Collections; 6 | import java.util.Map; 7 | import java.util.concurrent.ConcurrentHashMap; 8 | 9 | import io.github.lazyimmortal.sesame.util.FileUtil; 10 | import io.github.lazyimmortal.sesame.util.JsonUtil; 11 | import io.github.lazyimmortal.sesame.util.Log; 12 | 13 | public class WalkPathIdMap { 14 | 15 | private static final Map idMap = new ConcurrentHashMap<>(); 16 | 17 | private static final Map readOnlyIdMap = Collections.unmodifiableMap(idMap); 18 | 19 | public static Map getMap() { 20 | return readOnlyIdMap; 21 | } 22 | 23 | public static String get(String key) { 24 | return idMap.get(key); 25 | } 26 | 27 | public synchronized static void add(String key, String value) { 28 | idMap.put(key, value); 29 | } 30 | 31 | public synchronized static void remove(String key) { 32 | idMap.remove(key); 33 | } 34 | 35 | public synchronized static void load() { 36 | idMap.clear(); 37 | try { 38 | String body = FileUtil.readFromFile(FileUtil.getWalkPathIdMapFile()); 39 | if (!body.isEmpty()) { 40 | Map newMap = JsonUtil.parseObject(body, new TypeReference>() { 41 | }); 42 | idMap.putAll(newMap); 43 | } 44 | } catch (Exception e) { 45 | Log.printStackTrace(e); 46 | } 47 | } 48 | 49 | public synchronized static boolean save() { 50 | return FileUtil.write2File(JsonUtil.toJsonString(idMap), FileUtil.getWalkPathIdMapFile()); 51 | } 52 | 53 | public synchronized static void clear() { 54 | idMap.clear(); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/arm64-v8a/libsesame.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/jniLibs/arm64-v8a/libsesame.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi-v7a/libsesame.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/jniLibs/armeabi-v7a/libsesame.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/x86/libsesame.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/jniLibs/x86/libsesame.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/x86_64/libsesame.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/jniLibs/x86_64/libsesame.so -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/res/drawable-xxhdpi/logo.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/res/drawable-xxhdpi/main.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/unactivated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/app/src/main/res/drawable-xxhdpi/unactivated.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/button.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/button_extend.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/button_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/farm.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 10 | 13 | 16 | 19 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/forest.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/friend.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 15 | 18 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/github.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | 12 | 18 | 21 | 24 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/other.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/setting.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/title_logo.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_html_viewer.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 12 | 13 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_new_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/base_title.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 16 | 17 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/values-zh-rCN/strings_common.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 芝麻粒 4 | 本APP是为了学习研究而开发,免费且开源,禁止用于任何商业用途,并禁止二次修改后闭源发布。请于24小时内卸载本APP。如果您是通过购买获得,请联系卖家退款或在平台举报卖家。 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 | 导入统计 33 | 导出统计 34 | 抓包记录 35 | 全部记录 36 | 扩展功能 37 | 设 置 38 | -------------------------------------------------------------------------------- /app/src/main/res/values-zh-rCN/strings_extensions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 查询树苗余量🌱 4 | 查询树苗上新🌱 5 | 查询未解锁地区🗺️ 6 | 查询未解锁项目🐘 7 | 清空光盘行动图片💿 8 | 自定义路线列表🚶🏻‍♂️ 9 | 待行走路线队列🚶🏻‍♂️ 10 | 开发者模式💻 11 | 12 | 添加 13 | 清除 14 | 请输入要添加的路线代码 15 | -------------------------------------------------------------------------------- /app/src/main/res/values-zh-rCN/strings_ui.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 搜索 4 | 上一个 5 | 下一个 6 | 全选 7 | 反选 8 | 确认 9 | 取消 10 | 关闭 11 | -------------------------------------------------------------------------------- /app/src/main/res/values-zh-rCN/strings_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 用浏览器打开 4 | 选择浏览器 5 | 导出文件 6 | 清空文件 7 | 跳到顶部 8 | 跳到底部 9 | 复制链接 10 | 复制成功 11 | -------------------------------------------------------------------------------- /app/src/main/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.eg.android.AlipayGphone 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #F4F4F4 4 | #9CA1B5 5 | #FFFFFF 6 | #FFEBCD 7 | #290C4C 8 | #216EEE 9 | #219FFF 10 | #FFFFFF 11 | #216EEE 12 | #5351FC 13 | #E64000 14 | #F6B900 15 | 16 | #216EEE 17 | #FFFFFF 18 | #333333 19 | #AA000000 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings_common.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Sesame 4 | 本APP是为了学习研究而开发,免费且开源,禁止用于任何商业用途,并禁止二次修改后闭源发布。请于24小时内卸载本APP。如果您是通过购买获得,请联系卖家退款或在平台举报卖家。 5 | 6 | Disable 7 | Loading 8 | Activated 9 | 10 | Year 11 | Month 12 | Day 13 | Collected 14 | Helped 15 | Watered 16 | 17 | MORE 18 | Hello User! 19 | Forest log 20 | Farm log 21 | Other log 22 | Runtime log 23 | UNACTIVATED 24 | Tips 25 | I see 26 | Hide the application icon 27 | Always Chinese Language 28 | View error log file 29 | Export error log file 30 | Export all log file 31 | View runtime log file 32 | Export the statistic file 33 | Import the statistic file 34 | View debug file 35 | View record file 36 | Extensions 37 | Settings 38 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings_extensions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Get tree items🌱 4 | Get newTree items🌱 5 | Query unlock area🗺️ 6 | Query unlock item🐘 7 | Clear dish image💿 8 | Set custom walk pathId list🚶🏻‍♂️ 9 | Set custom walk pathId queue🚶🏻‍♂️ 10 | Developer mode💻 11 | 12 | Add 13 | Clear 14 | Please input walk pathId 15 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings_ui.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Search 4 | Last 5 | Next 6 | Select All 7 | Select Invert 8 | OK 9 | Cancel 10 | Close 11 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Open with other browser 4 | Choose a browser 5 | Export file 6 | Clear file 7 | Scroll to top 8 | Scroll to bottom 9 | Copy the url 10 | Copy success 11 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | 18 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | 2 | buildscript { 3 | repositories { 4 | maven { url 'https://maven.aliyun.com/repository/public/' } 5 | maven { url 'https://maven.aliyun.com/repository/google/'} 6 | maven { url 'https://maven.aliyun.com/repository/jcenter/'} 7 | google() 8 | mavenCentral() 9 | } 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:8.5.2' 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | maven { url 'https://maven.aliyun.com/repository/public/' } 18 | maven { url 'https://maven.aliyun.com/repository/google/'} 19 | maven { url 'https://maven.aliyun.com/repository/jcenter/'} 20 | google() 21 | mavenCentral() 22 | } 23 | } 24 | 25 | tasks.register('clean', Delete) { 26 | delete rootProject.buildDir 27 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | android.enableJetifier=true 2 | android.useAndroidX=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LazyImmortal/Sesame/a123122739ddca3fd7094f8b42f450acdb8a2f3d/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------