├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── deploymentTargetDropDown.xml ├── gradle.xml ├── kotlinc.xml ├── migrations.xml ├── misc.xml └── vcs.xml ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── ic_launcher-playstore.png │ ├── java │ └── com │ │ └── mBZo │ │ └── jar │ │ ├── ArchiveFragment.kt │ │ ├── DownloadActivity.kt │ │ ├── HomeFragment.kt │ │ ├── MainActivity.kt │ │ ├── SettingRootFragment.kt │ │ ├── SettingsFragment.kt │ │ ├── StoreActivity.kt │ │ ├── adapter │ │ ├── ArchiveRecyclerAdapter.kt │ │ ├── DownloadRecyclerAdapter.kt │ │ └── ImgShowRecyclerAdapter.kt │ │ ├── store │ │ ├── apidecode │ │ │ ├── 52emu.kt │ │ │ ├── bzyun.kt │ │ │ ├── iniche.kt │ │ │ └── lanzou.kt │ │ ├── storeManage.kt │ │ └── webViewTools.kt │ │ └── tool │ │ ├── FileLazy.kt │ │ ├── GetArchive.kt │ │ ├── util.kt │ │ └── value.kt │ └── res │ ├── drawable │ ├── baseline_palette_24.xml │ ├── ic_app_center.xml │ ├── ic_baseline_archive_24.xml │ ├── ic_baseline_block_24.xml │ ├── ic_baseline_check_24.xml │ ├── ic_baseline_exit_to_app_24.xml │ ├── ic_baseline_get_app_24.xml │ ├── ic_baseline_home_24.xml │ ├── ic_baseline_login_24.xml │ ├── ic_baseline_query_builder_24.xml │ ├── ic_baseline_sd_storage_24.xml │ ├── ic_baseline_search_24.xml │ ├── ic_baseline_settings_24.xml │ ├── ic_baseline_update_24.xml │ ├── ic_launcher_foreground.xml │ ├── ic_load_error_image.png │ ├── ic_load_waiting_image.png │ ├── ic_outline_archive_24.xml │ ├── ic_outline_home_24.xml │ ├── ic_outline_settings_24.xml │ ├── ic_select_archive.xml │ ├── ic_select_home.xml │ └── ic_select_settings.xml │ ├── layout │ ├── activity_download.xml │ ├── activity_main.xml │ ├── activity_store.xml │ ├── dialog_about.xml │ ├── dialog_webview.xml │ ├── fragment_archive.xml │ ├── fragment_home.xml │ ├── fragment_settingroot.xml │ ├── item_archive.xml │ ├── item_download.xml │ └── item_image.xml │ ├── menu │ ├── archive_toolbar_menu.xml │ ├── home_toolbar_menu.xml │ └── main_nav_menu.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-anydpi-v33 │ └── ic_launcher.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── values-night-v23 │ └── themes.xml │ ├── values-night-v27 │ └── themes.xml │ ├── values-night-v29 │ └── themes.xml │ ├── values-night-v31 │ └── themes.xml │ ├── values-night │ ├── colors.xml │ └── themes.xml │ ├── values-v19 │ └── themes.xml │ ├── values-v23 │ └── themes.xml │ ├── values-v27 │ └── themes.xml │ ├── values-v29 │ └── themes.xml │ ├── values-v31 │ └── themes.xml │ ├── values │ ├── arrays.xml │ ├── colors.xml │ ├── ic_launcher_background.xml │ ├── strings.xml │ └── themes.xml │ └── xml │ ├── backup_rules.xml │ ├── data_extraction_rules.xml │ ├── file_paths.xml │ └── root_preferences.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | local.properties 16 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | J2ME下载 -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/deploymentTargetDropDown.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/kotlinc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/migrations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2023 zf1234d 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 没有精力维护,索性还是结束吧。 2 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /release 3 | /debug 4 | /src/main/java/com/mBZo/jar/notpublic/ 5 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | import java.text.SimpleDateFormat 2 | 3 | plugins { 4 | id 'com.android.application' 5 | id 'org.jetbrains.kotlin.android' 6 | } 7 | 8 | android { 9 | compileSdk 34 10 | 11 | defaultConfig { 12 | applicationId "com.mBZo.jar" 13 | minSdk 21 14 | targetSdk 34 15 | versionCode 92 16 | versionName '3.7.6' 17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 18 | def df = new SimpleDateFormat("MMdd") 19 | setProperty("archivesBaseName", "J2meStore_${df.format(new Date())}_v${versionName}") 20 | } 21 | 22 | buildTypes { 23 | debug { 24 | applicationIdSuffix ".test" 25 | } 26 | release { 27 | minifyEnabled = true 28 | shrinkResources = true 29 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 30 | } 31 | } 32 | 33 | 34 | compileOptions { 35 | sourceCompatibility JavaVersion.VERSION_1_8 36 | targetCompatibility JavaVersion.VERSION_1_8 37 | } 38 | 39 | viewBinding{ 40 | enabled = true 41 | } 42 | 43 | 44 | kotlinOptions { 45 | jvmTarget = '1.8' 46 | } 47 | 48 | namespace 'com.mBZo.jar' 49 | } 50 | 51 | dependencies { 52 | implementation 'androidx.core:core-ktx:1.10.1' 53 | 54 | def appCenterSdkVersion = '5.0.2' 55 | implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}" 56 | implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}" 57 | 58 | 59 | implementation "dev.rikka.rikkax.insets:insets:1.3.0" 60 | implementation "dev.rikka.rikkax.layoutinflater:layoutinflater:1.3.0" 61 | implementation 'com.github.stfalcon-studio:StfalconImageViewer:v1.0.1' 62 | implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.11' 63 | implementation 'io.coil-kt:coil-gif:2.4.0' 64 | implementation 'io.coil-kt:coil:2.4.0' 65 | implementation 'net.lingala.zip4j:zip4j:2.11.5' 66 | implementation 'com.github.john990:WaveView:v0.9' 67 | 68 | 69 | implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1' 70 | implementation 'androidx.appcompat:appcompat:1.6.1' 71 | implementation 'com.google.android.material:material:1.9.0' 72 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4' 73 | implementation 'androidx.preference:preference-ktx:1.2.1' 74 | testImplementation 'junit:junit:4.13.2' 75 | androidTestImplementation 'androidx.test.ext:junit:1.1.5' 76 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' 77 | } 78 | 79 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 18 | 23 | 26 | 27 | 30 | 33 | 34 | 37 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /app/src/main/ic_launcher-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zf1234d/J2me-res-store/32ea482573f5a6f86ba6f0f4aac92af4b87a8167/app/src/main/ic_launcher-playstore.png -------------------------------------------------------------------------------- /app/src/main/java/com/mBZo/jar/ArchiveFragment.kt: -------------------------------------------------------------------------------- 1 | package com.mBZo.jar 2 | 3 | import android.annotation.SuppressLint 4 | import android.app.Activity 5 | import android.os.Bundle 6 | import android.view.* 7 | import androidx.appcompat.widget.SearchView 8 | import androidx.fragment.app.Fragment 9 | import androidx.recyclerview.widget.LinearLayoutManager 10 | import com.mBZo.jar.adapter.ArchiveRecyclerAdapter 11 | import com.mBZo.jar.databinding.FragmentArchiveBinding 12 | import com.mBZo.jar.tool.ArchiveItem 13 | import com.mBZo.jar.tool.FileLazy 14 | import com.mBZo.jar.tool.askReloadArchive 15 | import java.io.File 16 | 17 | // TODO: Rename parameter arguments, choose names that match 18 | // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER 19 | private const val ARG_PARAM1 = "param1" 20 | private const val ARG_PARAM2 = "param2" 21 | 22 | /** 23 | * A simple [Fragment] subclass. 24 | * Use the [ArchiveFragment.newInstance] factory method to 25 | * create an instance of this fragment. 26 | */ 27 | class ArchiveFragment : Fragment() { 28 | // TODO: Rename and change types of parameters 29 | private var param1: String? = null 30 | private var param2: String? = null 31 | 32 | override fun onCreate(savedInstanceState: Bundle?) { 33 | super.onCreate(savedInstanceState) 34 | arguments?.let { 35 | param1 = it.getString(ARG_PARAM1) 36 | param2 = it.getString(ARG_PARAM2) 37 | } 38 | } 39 | 40 | 41 | private var _binding: FragmentArchiveBinding? = null 42 | private val binding: FragmentArchiveBinding get() = _binding!! 43 | private val activity: Activity get() = requireActivity() 44 | override fun onCreateView( 45 | inflater: LayoutInflater, container: ViewGroup?, 46 | savedInstanceState: Bundle? 47 | ): View { 48 | // Inflate the layout for this fragment 49 | _binding = FragmentArchiveBinding.inflate(inflater, container, false) 50 | return binding.root 51 | } 52 | override fun onDestroyView() { 53 | super.onDestroyView() 54 | _binding = null 55 | } 56 | 57 | 58 | private val gameList = arrayListOf() 59 | override fun onResume() { 60 | super.onResume() 61 | if (askReloadArchive){ 62 | val searchView: SearchView = binding.archiveToolbar.menu.findItem(R.id.toolbar_search).actionView as SearchView 63 | askReloadArchive = false 64 | loadArchive() 65 | searchView.setQuery("",false) 66 | } 67 | } 68 | 69 | override fun onPause() { 70 | super.onPause() 71 | val searchView: SearchView = binding.archiveToolbar.menu.findItem(R.id.toolbar_search).actionView as SearchView 72 | searchView.clearFocus() 73 | } 74 | 75 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 76 | super.onViewCreated(view, savedInstanceState) 77 | binding.archiveToolbar.inflateMenu(R.menu.archive_toolbar_menu) 78 | val searchView: SearchView = binding.archiveToolbar.menu.findItem(R.id.toolbar_search).actionView as SearchView 79 | //搜索功能 80 | val filterList = arrayListOf() 81 | searchView.setOnQueryTextListener(object :SearchView.OnQueryTextListener{ 82 | override fun onQueryTextSubmit(query: String?): Boolean { 83 | return true 84 | } 85 | @SuppressLint("NotifyDataSetChanged") 86 | override fun onQueryTextChange(newText: String?): Boolean { 87 | filterList.clear() 88 | for (i in gameList) { 89 | if (newText!=null && i.name.contains(newText)){ 90 | filterList.add(i) 91 | } 92 | } 93 | val adapter = ArchiveRecyclerAdapter(activity,filterList) 94 | binding.recyclerArchive.adapter = adapter 95 | binding.recyclerArchive.adapter?.notifyDataSetChanged() 96 | return true 97 | } 98 | }) 99 | searchView.addOnAttachStateChangeListener(object :View.OnAttachStateChangeListener{ 100 | override fun onViewAttachedToWindow(v: View) { 101 | binding.archiveAppbar.setExpanded(false) 102 | binding.recyclerArchive.isNestedScrollingEnabled = false 103 | } 104 | 105 | override fun onViewDetachedFromWindow(v: View) { 106 | searchView.onActionViewCollapsed() 107 | binding.recyclerArchive.isNestedScrollingEnabled = true 108 | } 109 | }) 110 | } 111 | 112 | private fun loadArchive(){ 113 | try { 114 | val list = arrayListOf() 115 | if (File("${activity.filesDir.absolutePath}/mBZo/java/list/1.list").exists().not()){ 116 | FileLazy("${activity.filesDir.absolutePath}/mBZo/java/list/1.list").writeNew() 117 | } 118 | val lines = FileLazy("${activity.filesDir.absolutePath}/mBZo/java/list/1.list").readLines() 119 | var name = "";var nameFC = "";var from = "" 120 | for (str in lines){ 121 | if (str.contains("\"name\"")){ 122 | name=str.substringAfter("\"name\":\"").substringBefore("\"") 123 | } 124 | else if (str.contains("\"nameFc\"")){ 125 | nameFC=str.substringAfter("\"nameFc\":\"").substringBefore("\"") 126 | } 127 | else if (str.contains("\"from\"")){ 128 | from=str.substringAfter("\"from\":\"").substringBefore("\"") 129 | } 130 | else if (str.contains("\"url\"")){ 131 | list.add(ArchiveItem(name,nameFC,from,str.substringAfter("\"url\":\"").substringBefore("\""))) 132 | } 133 | } 134 | gameList.clear() 135 | gameList.addAll(list) 136 | binding.recyclerArchive.layoutManager = LinearLayoutManager(activity) 137 | binding.recyclerArchive.adapter = ArchiveRecyclerAdapter(activity, list) 138 | val searchView = binding.archiveToolbar.menu.findItem(R.id.toolbar_search).actionView as SearchView 139 | searchView.queryHint = "在${list.size}个项目中搜索" 140 | }catch (_:Exception){} 141 | } 142 | 143 | 144 | companion object { 145 | /** 146 | * Use this factory method to create a new instance of 147 | * this fragment using the provided parameters. 148 | * 149 | * @param param1 Parameter 1. 150 | * @param param2 Parameter 2. 151 | * @return A new instance of fragment ArchiveFragment. 152 | */ 153 | // TODO: Rename and change types and number of parameters 154 | @JvmStatic 155 | fun newInstance(param1: String, param2: String) = 156 | ArchiveFragment().apply { 157 | arguments = Bundle().apply { 158 | putString(ARG_PARAM1, param1) 159 | putString(ARG_PARAM2, param2) 160 | } 161 | } 162 | } 163 | } 164 | 165 | -------------------------------------------------------------------------------- /app/src/main/java/com/mBZo/jar/DownloadActivity.kt: -------------------------------------------------------------------------------- 1 | package com.mBZo.jar 2 | 3 | import android.os.Bundle 4 | import androidx.appcompat.app.AppCompatActivity 5 | import androidx.recyclerview.widget.LinearLayoutManager 6 | import androidx.recyclerview.widget.RecyclerView 7 | import com.google.android.material.dialog.MaterialAlertDialogBuilder 8 | import com.mBZo.jar.adapter.DownloadRecyclerAdapter 9 | import com.mBZo.jar.tool.FileLazy 10 | import com.mBZo.jar.tool.attachDynamicColor 11 | import java.io.File 12 | 13 | class DownloadActivity : AppCompatActivity() { 14 | 15 | override fun onCreate(savedInstanceState: Bundle?) { 16 | super.onCreate(savedInstanceState) 17 | attachDynamicColor() 18 | setContentView(R.layout.activity_download) 19 | //适配器 20 | val fileList = FileLazy(filesDir.absolutePath+"/DlLog/").listFiles() 21 | if (fileList!=null && fileList.isNotEmpty()){ 22 | //按照时间,从新到旧排序 23 | val modifiedFileList = mutableListOf() 24 | modifiedFileList.add(fileList[0]) 25 | for (index in 1 until fileList.size){ 26 | for (i in 0 until modifiedFileList.size){ 27 | if (fileList[index].lastModified()>=modifiedFileList[i].lastModified()){ 28 | modifiedFileList.add(i,fileList[index]) 29 | break 30 | } 31 | else{ 32 | if (i+1==modifiedFileList.size){ 33 | modifiedFileList.add(fileList[index]) 34 | } 35 | } 36 | } 37 | } 38 | //将排序完成的列表送入布局 39 | val recyclerView: RecyclerView = findViewById(R.id.recycler_download) 40 | val layoutManager = LinearLayoutManager(this) 41 | recyclerView.layoutManager = layoutManager 42 | val adapter = DownloadRecyclerAdapter(this,modifiedFileList.toMutableList()) 43 | recyclerView.adapter = adapter 44 | } 45 | else{ 46 | MaterialAlertDialogBuilder(this) 47 | .setOnDismissListener { finish() } 48 | .setTitle("无下载内容") 49 | .setPositiveButton("退出") {_,_ -> } 50 | .show() 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mBZo/jar/HomeFragment.kt: -------------------------------------------------------------------------------- 1 | package com.mBZo.jar 2 | 3 | import android.app.Activity 4 | import android.content.Intent 5 | import android.content.pm.PackageManager 6 | import android.graphics.drawable.Drawable 7 | import android.os.Build 8 | import android.os.Bundle 9 | import android.text.Html 10 | import android.text.method.LinkMovementMethod 11 | import android.view.LayoutInflater 12 | import android.view.View 13 | import android.view.ViewGroup 14 | import android.widget.Toast 15 | import androidx.fragment.app.Fragment 16 | import coil.load 17 | import com.google.android.material.dialog.MaterialAlertDialogBuilder 18 | import com.google.android.material.textview.MaterialTextView 19 | import com.mBZo.jar.databinding.FragmentHomeBinding 20 | import com.mBZo.jar.tool.FileLazy 21 | import com.mBZo.jar.tool.GetArchive 22 | import com.mBZo.jar.tool.imageLoad 23 | import com.mBZo.jar.tool.isPlay 24 | import com.mBZo.jar.tool.otherOpen 25 | import com.microsoft.appcenter.AppCenter 26 | import okhttp3.OkHttpClient 27 | import okhttp3.Request 28 | import java.io.File 29 | 30 | 31 | // TODO: Rename parameter arguments, choose names that match 32 | // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER 33 | private const val ARG_PARAM1 = "param1" 34 | private const val ARG_PARAM2 = "param2" 35 | 36 | /** 37 | * A simple [Fragment] subclass. 38 | * Use the [HomeFragment.newInstance] factory method to 39 | * create an instance of this fragment. 40 | */ 41 | class HomeFragment : Fragment() { 42 | // TODO: Rename and change types of parameters 43 | private var param1: String? = null 44 | private var param2: String? = null 45 | 46 | override fun onCreate(savedInstanceState: Bundle?) { 47 | super.onCreate(savedInstanceState) 48 | arguments?.let { 49 | param1 = it.getString(ARG_PARAM1) 50 | param2 = it.getString(ARG_PARAM2) 51 | } 52 | } 53 | 54 | 55 | private var _binding: FragmentHomeBinding? = null 56 | private val binding: FragmentHomeBinding get() = _binding!! 57 | private val activity: Activity get() = requireActivity() 58 | override fun onCreateView( 59 | inflater: LayoutInflater, container: ViewGroup?, 60 | savedInstanceState: Bundle? 61 | ): View { 62 | // Inflate the layout for this fragment 63 | _binding = FragmentHomeBinding.inflate(inflater, container, false) 64 | return binding.root 65 | } 66 | override fun onDestroyView() { 67 | super.onDestroyView() 68 | _binding = null 69 | } 70 | 71 | 72 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 73 | super.onViewCreated(view, savedInstanceState) 74 | val pathArchiveVer = "${view.context.filesDir.absolutePath}/mBZo/java/list/0.list" 75 | //设置顶栏菜单 76 | binding.toolbar.inflateMenu(R.menu.home_toolbar_menu) 77 | binding.toolbar.setOnMenuItemClickListener { 78 | when(it.itemId){ 79 | //下载管理 80 | R.id.toolbar_download -> { 81 | val intent = Intent() 82 | intent.setClass(view.context,DownloadActivity::class.java) 83 | startActivity(intent) 84 | } 85 | //捐赠页 86 | R.id.toolbar_thanks -> { 87 | val toolbarDialog = MaterialAlertDialogBuilder(view.context) 88 | .setTitle("支持和鼓励") 89 | .setOnDismissListener { binding.progressBar.visibility = View.INVISIBLE } 90 | .setMessage("正在获取……") 91 | .setPositiveButton("确认"){_,_ -> } 92 | .show() 93 | binding.progressBar.visibility = View.VISIBLE 94 | Thread{ 95 | try { 96 | val client = OkHttpClient() 97 | val request = Request.Builder() 98 | .url("$netWorkRoot/jarlist/thanks_donate.long") 99 | .build() 100 | val response = client.newCall(request).execute() 101 | activity.runOnUiThread { 102 | binding.progressBar.visibility = View.INVISIBLE 103 | toolbarDialog.setTitle("感谢这些朋友的捐赠支持") 104 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { 105 | toolbarDialog.setMessage(Html.fromHtml(response.body.string().replace("\n","
"),Html.FROM_HTML_MODE_LEGACY)) 106 | } else { 107 | @Suppress("DEPRECATION") 108 | toolbarDialog.setMessage(Html.fromHtml(response.body.string().replace("\n","
"))) 109 | } 110 | } 111 | } catch (e: Exception) { 112 | //请求错误 113 | activity.runOnUiThread { 114 | binding.progressBar.visibility = View.INVISIBLE 115 | toolbarDialog.setTitle("错误") 116 | toolbarDialog.setMessage("网络连接失败") 117 | } 118 | } 119 | }.start() 120 | } 121 | //AppCenter 122 | R.id.toolbar_app_center -> { 123 | MaterialAlertDialogBuilder(view.context) 124 | .setTitle("AppCenterSDK") 125 | .setIcon(R.drawable.ic_app_center) 126 | .setMessage("SDK版本\n${AppCenter.getSdkVersion()}\n\n" + 127 | "运行状态\n${AppCenter.isEnabled().get()}\n\n" + 128 | "设备识别码\n${AppCenter.getInstallId().get()}\n\n"+ 129 | "使用AppCenter匿名收集崩溃日志") 130 | .show() 131 | } 132 | //更新日志 133 | R.id.toolbar_updateLog -> { 134 | binding.progressBar.visibility = View.VISIBLE 135 | val toolbarDialog = MaterialAlertDialogBuilder(view.context) 136 | .setTitle("更新日志") 137 | .setOnDismissListener { binding.progressBar.visibility = View.INVISIBLE } 138 | .setMessage("正在获取……") 139 | .setPositiveButton("确认"){_,_ -> } 140 | .show() 141 | Thread{ 142 | try { 143 | val client = OkHttpClient() 144 | val request = Request.Builder() 145 | .url("$netWorkRoot/jarlist/update.log") 146 | .build() 147 | val response = client.newCall(request).execute() 148 | val updateLogRaw = response.body.string() 149 | var updateLogDecode = "" 150 | activity.runOnUiThread { 151 | binding.progressBar.visibility = View.INVISIBLE 152 | for (index in updateLogRaw.substringAfter("更新日志").split("\n")) { 153 | if (index.contains(Regex("^### "))) { 154 | updateLogDecode += "

${index.substringAfter("###")}

" 155 | continue 156 | } 157 | if (index.contains(Regex("^\\* "))) { 158 | updateLogDecode += "
  • ${index.substringAfter("*")}
  • " 159 | continue 160 | } 161 | } 162 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { 163 | toolbarDialog.setMessage(Html.fromHtml(updateLogDecode,Html.FROM_HTML_MODE_LEGACY)) 164 | } 165 | else{ 166 | @Suppress("DEPRECATION") 167 | toolbarDialog.setMessage(Html.fromHtml(updateLogDecode)) 168 | } 169 | } 170 | } catch (e: Exception) { 171 | //请求错误 172 | activity.runOnUiThread { 173 | binding.progressBar.visibility = View.INVISIBLE 174 | toolbarDialog.setTitle("错误") 175 | toolbarDialog.setMessage("网络连接失败") 176 | } 177 | } 178 | }.start() 179 | } 180 | //关于 181 | R.id.toolbar_about -> { 182 | val dialog = MaterialAlertDialogBuilder(view.context) 183 | .setView(R.layout.dialog_about) 184 | .show() 185 | val dialogAboutVersion: MaterialTextView? = dialog.findViewById(R.id.dialog_about_version) 186 | val dialogAboutAdd: MaterialTextView? = dialog.findViewById(R.id.dialog_about_add) 187 | val versionText = "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})" 188 | val addText = "前往 Github 查看源代码
    通过 腾讯兔小巢 反馈问题

    酷安@没空的人Zero
    哔哩哔哩@没空的人" 189 | dialogAboutVersion?.text = versionText 190 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { 191 | dialogAboutAdd?.text = Html.fromHtml(addText,Html.FROM_HTML_MODE_LEGACY) 192 | } else { 193 | @Suppress("DEPRECATION") 194 | dialogAboutAdd?.text = Html.fromHtml(addText) 195 | } 196 | dialogAboutAdd?.movementMethod = LinkMovementMethod.getInstance() 197 | } 198 | else -> Toast.makeText(view.context,"invalid", Toast.LENGTH_SHORT).show() 199 | } 200 | true 201 | } 202 | 203 | //检测谷歌play 204 | val metaData: Bundle? = requireActivity().packageManager.getApplicationInfo( 205 | requireActivity().packageName, 206 | PackageManager.GET_META_DATA 207 | ).metaData 208 | val play = metaData?.getBoolean("com.android.vending.splits.required",false) 209 | isPlay = play != null 210 | 211 | 212 | //获取软件版本 213 | val versionText = "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})" 214 | binding.versionTypeLite.text = versionText 215 | binding.versionCard.setOnClickListener { 216 | when (binding.versionType.text) { 217 | getString(R.string.findNewArchive),getString(R.string.findNewArchiveUnexpectedStop) -> { 218 | GetArchive(activity,this).start() 219 | } 220 | getString(R.string.findNewApp) -> { 221 | otherOpen(activity, otaUrl()) 222 | } 223 | getString(R.string.allReady) -> { 224 | val archiveFile = File("${view.context.filesDir.absolutePath}/mBZo/java/list/0.list") 225 | val archiveVer = if (archiveFile.exists()){ 226 | archiveFile.readText() 227 | } else{ 228 | archiveFile.writeText("000000") 229 | "000000" 230 | } 231 | MaterialAlertDialogBuilder(view.context) 232 | .setMessage("版本\n${BuildConfig.VERSION_CODE} (云端${appCVer.invoke()})\n\n库存\n${archiveVer}\n\n通道\n${if(isPlay==true) "play" else if(isPlay==false) BuildConfig.BUILD_TYPE else "checking..."}\n\n系统\n${Build.VERSION.RELEASE}(${Build.VERSION.SDK_INT})\n\n目标\n${view.context.applicationInfo.targetSdkVersion}") 233 | .setPositiveButton("更改库存"){_,_ -> GetArchive(activity,this).start()} 234 | .show() 235 | } 236 | else -> { } 237 | } 238 | } 239 | 240 | //联网获取配置 241 | Thread{ 242 | getRemoteConfig(object :RemoteConfigListener{ 243 | override fun onSucceed() { 244 | activity.runOnUiThread { 245 | //公告 246 | binding.noticeCard.visibility = View.VISIBLE 247 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { 248 | binding.noticeContent.text = Html.fromHtml(notice.invoke().replace("\n","
    "),Html.FROM_HTML_MODE_LEGACY) 249 | } else { 250 | @Suppress("DEPRECATION") 251 | binding.noticeContent.text = Html.fromHtml(notice.invoke().replace("\n","
    ")) 252 | } 253 | binding.noticeContent.movementMethod = LinkMovementMethod.getInstance() 254 | //更新控制器 255 | if (BuildConfig.VERSION_CODE >= appCVer.invoke()) { 256 | if (!File(pathArchiveVer).exists()){ 257 | FileLazy(pathArchiveVer).writeNew("000000") 258 | } 259 | val localAuth = FileLazy(pathArchiveVer).read() 260 | if (localAuth == archiveCVer.invoke()) { 261 | binding.versionType.text = activity.getString(R.string.allReady) 262 | imageLoad(activity,binding.versionImg, R.drawable.ic_baseline_check_24) 263 | binding.progressBar.visibility = View.GONE 264 | } 265 | else{ 266 | if (localAuth == "process") { 267 | binding.versionType.text = getString(R.string.findNewArchiveUnexpectedStop) 268 | } 269 | else { 270 | binding.versionType.text = getString(R.string.findNewArchive) 271 | } 272 | imageLoad(activity,binding.versionImg,R.drawable.ic_baseline_update_24) 273 | binding.progressBar.visibility = View.GONE 274 | } 275 | } 276 | else{ 277 | when (isPlay) { 278 | false -> { 279 | binding.versionType.text = resources.getString(R.string.findNewApp) 280 | imageLoad(activity,binding.versionImg, R.drawable.ic_baseline_update_24) 281 | binding.versionType.visibility = View.GONE 282 | } 283 | else -> { 284 | //play商店,不提示更新 285 | binding.versionType.text = activity.getString(R.string.allReady) 286 | imageLoad(activity,binding.versionImg, R.drawable.ic_baseline_check_24) 287 | binding.progressBar.visibility = View.GONE 288 | } 289 | } 290 | } 291 | } 292 | } 293 | }) 294 | }.start() 295 | 296 | 297 | 298 | 299 | } 300 | 301 | fun setWave(show: Boolean){ 302 | if (show){ 303 | binding.waveView.visibility = View.VISIBLE 304 | } 305 | else{ 306 | binding.waveView.visibility = View.INVISIBLE 307 | } 308 | } 309 | 310 | fun setLoading(show: Boolean){ 311 | if (show){ 312 | binding.progressBar.visibility = View.VISIBLE 313 | } 314 | else{ 315 | binding.progressBar.visibility = View.INVISIBLE 316 | } 317 | } 318 | 319 | fun setType(str: String?= null,img: Drawable?= null){ 320 | if (str!=null){ 321 | binding.versionType.text = str 322 | } 323 | if (img!=null){ 324 | binding.versionImg.load(img) 325 | } 326 | } 327 | 328 | fun getType(): Pair { 329 | return Pair( 330 | binding.versionType.text.toString(), 331 | binding.versionImg.drawable 332 | ) 333 | } 334 | 335 | private fun getRemoteConfig(listener: RemoteConfigListener){ 336 | try { 337 | val client = OkHttpClient() 338 | val request = Request.Builder() 339 | .url("$netWorkRoot/jarlist/ready.set") 340 | .build() 341 | val response = client.newCall(request).execute() 342 | val data = response.body.string() 343 | onlineInfo = data 344 | listener.onSucceed() 345 | } catch (_: Exception){ 346 | Thread{ 347 | getRemoteConfig(listener) 348 | }.start() 349 | } 350 | } 351 | 352 | interface RemoteConfigListener { 353 | fun onSucceed() 354 | } 355 | 356 | companion object { 357 | /** 358 | * Use this factory method to create a new instance of 359 | * this fragment using the provided parameters. 360 | * 361 | * @param param1 Parameter 1. 362 | * @param param2 Parameter 2. 363 | * @return A new instance of fragment HomeFragment. 364 | */ 365 | // TODO: Rename and change types and number of parameters 366 | @JvmStatic 367 | fun newInstance(param1: String, param2: String) = 368 | HomeFragment().apply { 369 | arguments = Bundle().apply { 370 | putString(ARG_PARAM1, param1) 371 | putString(ARG_PARAM2, param2) 372 | } 373 | } 374 | } 375 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mBZo/jar/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.mBZo.jar 2 | 3 | import android.content.Intent 4 | import android.content.SharedPreferences 5 | import android.os.Bundle 6 | import android.view.KeyEvent 7 | import android.view.MenuItem 8 | import androidx.appcompat.app.AppCompatActivity 9 | import androidx.appcompat.widget.Toolbar 10 | import androidx.core.view.WindowCompat 11 | import androidx.fragment.app.Fragment 12 | import androidx.fragment.app.FragmentActivity 13 | import androidx.viewpager2.adapter.FragmentStateAdapter 14 | import androidx.viewpager2.widget.ViewPager2 15 | import com.google.android.material.bottomnavigation.BottomNavigationView 16 | import com.mBZo.jar.R.id 17 | import com.mBZo.jar.databinding.ActivityMainBinding 18 | import com.mBZo.jar.tool.attachDynamicColor 19 | import com.microsoft.appcenter.AppCenter 20 | import com.microsoft.appcenter.analytics.Analytics 21 | import com.microsoft.appcenter.crashes.Crashes 22 | import rikka.insets.WindowInsetsHelper 23 | import rikka.layoutinflater.view.LayoutInflaterFactory 24 | 25 | 26 | const val netWorkRoot="https://dev.azure.com/CA0115/e189f55c-a98a-4d73-bc09-4a5b822b9563/_apis/git/repositories/589e5978-bff8-4f4d-a328-c045f4237299/items?path=" 27 | var onlineInfo = "" 28 | //更新地址 29 | val otaUrl={ onlineInfo.substringAfter("更新地址★").substringBefore("☆更新地址") } 30 | //云端库存版本 31 | val archiveCVer={ onlineInfo.substringAfter("有效日期★").substringBefore("☆有效日期") } 32 | //云端库存数 33 | val archiveCNum={ onlineInfo.substringAfter("热更新★").substringBefore("☆热更新").toInt() } 34 | //云端软件版本 35 | val appCVer={ onlineInfo.substringAfter("云端版号★").substringBefore("☆云端版号").toInt() } 36 | //公告 37 | val notice={ onlineInfo.substringAfter("公告板★\r\n").substringBefore("\r\n☆公告板") } 38 | 39 | 40 | class MainActivity : AppCompatActivity(){ 41 | private lateinit var binding: ActivityMainBinding 42 | override fun onCreate(savedInstanceState: Bundle?) { 43 | layoutInflater.factory2 = LayoutInflaterFactory(delegate).addOnViewCreatedListener(WindowInsetsHelper.LISTENER) 44 | super.onCreate(savedInstanceState) 45 | attachDynamicColor() 46 | binding = ActivityMainBinding.inflate(layoutInflater) 47 | AppCenter.start(application, AppCenterSecret, Analytics::class.java, Crashes::class.java) 48 | WindowCompat.setDecorFitsSystemWindows(window, false) 49 | setContentView(binding.root) 50 | val sp: SharedPreferences = getSharedPreferences("${packageName}_preferences", MODE_PRIVATE) 51 | //布置viewpager2 52 | val mFragments = ArrayList() 53 | binding.homePageTree.offscreenPageLimit = 3 54 | mFragments.add(ArchiveFragment()) 55 | mFragments.add(HomeFragment()) 56 | mFragments.add(SettingRootFragment()) 57 | binding.homePageTree.adapter = MainFragmentPagerAdapter(this, mFragments) 58 | //绑定底栏和viewpager,设置默认主页为第二个 59 | val startPage = sp.getString("startPage","home") 60 | if (startPage=="home"){ 61 | binding.homePageTree.setCurrentItem(1,false) 62 | binding.homeNav.menu.getItem(1).isChecked = true 63 | } 64 | //底栏按钮监听 65 | binding.homeNav.setOnItemSelectedListener { 66 | when (it.itemId) { 67 | id.nav_search -> { 68 | binding.homePageTree.currentItem = 0 69 | } 70 | id.nav_main -> { 71 | binding.homePageTree.currentItem = 1 72 | } 73 | id.nav_setting -> { 74 | binding.homePageTree.currentItem = 2 75 | } 76 | } 77 | return@setOnItemSelectedListener true 78 | } 79 | //viewpager滑动监听 80 | binding.homePageTree.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() { 81 | override fun onPageSelected(position: Int) { 82 | binding.homeNav.menu.getItem(position).isChecked = true 83 | } 84 | }) 85 | //结束了,这样就绑定好了 86 | 87 | //允许左右滑动嘛? 88 | val usefulFun = sp.getBoolean("viewpagerIsBad",false) 89 | if (usefulFun) { 90 | binding.homePageTree.isUserInputEnabled = false 91 | } 92 | 93 | //附加 94 | binding.homeNav.getOrCreateBadge(id.nav_search).isVisible = false 95 | } 96 | 97 | //按键事件 98 | override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { 99 | val nav: BottomNavigationView = findViewById(id.home_nav) 100 | val viewpager: ViewPager2 = findViewById(id.home_page_tree) 101 | if (keyCode == KeyEvent.KEYCODE_BACK) { 102 | val spfRecord: SharedPreferences = getSharedPreferences("${packageName}_preferences", MODE_PRIVATE) 103 | val keepApp = spfRecord.getBoolean("keepActivity",true) 104 | if (viewpager.currentItem!=1){ 105 | //关闭搜索页的搜索栏 106 | val toolbar: Toolbar = findViewById(id.archive_toolbar) 107 | val searchItem: MenuItem? = toolbar.menu.findItem(id.toolbar_search) 108 | searchItem?.collapseActionView() 109 | //回到主页面 110 | viewpager.setCurrentItem(1, false) 111 | nav.menu.getItem(1).isChecked = true 112 | } 113 | else{ 114 | if (keepApp) { 115 | val intent = Intent(Intent.ACTION_MAIN) 116 | intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK 117 | intent.addCategory(Intent.CATEGORY_HOME) 118 | startActivity(intent) 119 | } 120 | else { 121 | finish() 122 | } 123 | } 124 | return true 125 | } 126 | else{ 127 | return super.onKeyDown(keyCode, event) 128 | } 129 | } 130 | 131 | class MainFragmentPagerAdapter(fragmentActivity: FragmentActivity, private val mFragments: List 132 | ) : FragmentStateAdapter(fragmentActivity) { 133 | override fun createFragment(position: Int): Fragment { 134 | return mFragments[position] 135 | } 136 | 137 | override fun getItemCount(): Int { 138 | return mFragments.size 139 | } 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /app/src/main/java/com/mBZo/jar/SettingRootFragment.kt: -------------------------------------------------------------------------------- 1 | package com.mBZo.jar 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import androidx.fragment.app.Fragment 8 | 9 | // TODO: Rename parameter arguments, choose names that match 10 | // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER 11 | private const val ARG_PARAM1 = "param1" 12 | private const val ARG_PARAM2 = "param2" 13 | 14 | /** 15 | * A simple [Fragment] subclass. 16 | * Use the [SettingRootFragment.newInstance] factory method to 17 | * create an instance of this fragment. 18 | */ 19 | class SettingRootFragment : Fragment() { 20 | // TODO: Rename and change types of parameters 21 | private var param1: String? = null 22 | private var param2: String? = null 23 | 24 | override fun onCreate(savedInstanceState: Bundle?) { 25 | super.onCreate(savedInstanceState) 26 | arguments?.let { 27 | param1 = it.getString(ARG_PARAM1) 28 | param2 = it.getString(ARG_PARAM2) 29 | } 30 | } 31 | 32 | override fun onCreateView( 33 | inflater: LayoutInflater, container: ViewGroup?, 34 | savedInstanceState: Bundle? 35 | ): View? { 36 | // Inflate the layout for this fragment 37 | return inflater.inflate(R.layout.fragment_settingroot, container, false) 38 | } 39 | 40 | companion object { 41 | /** 42 | * Use this factory method to create a new instance of 43 | * this fragment using the provided parameters. 44 | * 45 | * @param param1 Parameter 1. 46 | * @param param2 Parameter 2. 47 | * @return A new instance of fragment settingrootFragment. 48 | */ 49 | // TODO: Rename and change types and number of parameters 50 | @JvmStatic 51 | fun newInstance(param1: String, param2: String) = 52 | SettingRootFragment().apply { 53 | arguments = Bundle().apply { 54 | putString(ARG_PARAM1, param1) 55 | putString(ARG_PARAM2, param2) 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mBZo/jar/SettingsFragment.kt: -------------------------------------------------------------------------------- 1 | package com.mBZo.jar 2 | 3 | import android.content.Intent 4 | import android.os.Bundle 5 | import android.view.View 6 | import androidx.preference.Preference 7 | import androidx.preference.PreferenceFragmentCompat 8 | import androidx.preference.SwitchPreferenceCompat 9 | import androidx.viewpager2.widget.ViewPager2 10 | import com.google.android.material.color.DynamicColors 11 | import com.mBZo.jar.tool.FileLazy 12 | import com.mBZo.jar.tool.askReloadArchive 13 | import com.mBZo.jar.tool.isPlay 14 | 15 | 16 | class SettingsFragment : PreferenceFragmentCompat() { 17 | 18 | override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { 19 | setPreferencesFromResource(R.xml.root_preferences, rootKey) 20 | } 21 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 22 | super.onViewCreated(view, savedInstanceState) 23 | //设置左右滑动 24 | val viewpagerSdSet: Preference? = findPreference("viewpagerIsBad") 25 | val viewpager: ViewPager2? = activity?.findViewById(R.id.home_page_tree) 26 | viewpagerSdSet?.setOnPreferenceChangeListener { _, newValue -> 27 | viewpager?.isUserInputEnabled = (newValue as Boolean).not() 28 | return@setOnPreferenceChangeListener true 29 | } 30 | //动态主题 31 | val dynamicTheme: SwitchPreferenceCompat? = findPreference("dynamicTheme") 32 | if (DynamicColors.isDynamicColorAvailable()){ 33 | dynamicTheme?.setOnPreferenceClickListener { 34 | askReloadArchive = true 35 | requireActivity().recreate() 36 | return@setOnPreferenceClickListener true 37 | } 38 | } 39 | else{ 40 | dynamicTheme?.isEnabled = false 41 | dynamicTheme?.summary = "系统不支持此功能" 42 | } 43 | //下载管理和自动安装 44 | val downloadManager: Preference? = findPreference("downloadManager") 45 | val downloader: SwitchPreferenceCompat? = findPreference("smartDownloader") 46 | downloadManager?.isVisible = (downloader?.isChecked == true) 47 | downloader?.setOnPreferenceChangeListener { _, newValue -> 48 | downloadManager?.isVisible = newValue as Boolean 49 | return@setOnPreferenceChangeListener true 50 | } 51 | if (isPlay != false){ 52 | downloader?.isChecked = false 53 | downloader?.isEnabled = false 54 | downloader?.summary = "谷歌play模式不允许使用该功能" 55 | } 56 | //判断是否有下载管理是否为空,为空不可点 57 | downloadManager?.setOnPreferenceClickListener { 58 | if (downloadManager.summary!="无下载内容"){ 59 | val fileList = FileLazy(view.context.filesDir.absolutePath+"/DlLog/").listFiles() 60 | if (fileList!=null && fileList.isNotEmpty()){ 61 | val intent = Intent() 62 | intent.setClass(requireContext(),DownloadActivity::class.java) 63 | activity?.startActivity(intent) 64 | } 65 | else{ 66 | downloadManager.summary = "无下载内容" 67 | Thread{ 68 | Thread.sleep(300) 69 | activity?.runOnUiThread { 70 | downloadManager.summary = "" 71 | } 72 | }.start() 73 | } 74 | } 75 | return@setOnPreferenceClickListener true 76 | } 77 | // 78 | 79 | 80 | } 81 | } 82 | 83 | -------------------------------------------------------------------------------- /app/src/main/java/com/mBZo/jar/StoreActivity.kt: -------------------------------------------------------------------------------- 1 | package com.mBZo.jar 2 | 3 | import android.content.Context 4 | import android.content.Intent 5 | import android.content.SharedPreferences 6 | import android.os.Bundle 7 | import android.view.View 8 | import android.widget.TextView 9 | import androidx.appcompat.app.AppCompatActivity 10 | import com.google.android.material.dialog.MaterialAlertDialogBuilder 11 | import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton 12 | import com.mBZo.jar.store.apidecode.apiDecode52emu 13 | import com.mBZo.jar.store.apidecode.apiDecodeBzyun 14 | import com.mBZo.jar.store.apidecode.apiDecodeEjJava 15 | import com.mBZo.jar.store.apidecode.apiDecodeIniche 16 | import com.mBZo.jar.store.apidecode.apiDecodeJoyin 17 | import com.mBZo.jar.tool.attachDynamicColor 18 | import rikka.insets.WindowInsetsHelper 19 | import rikka.layoutinflater.view.LayoutInflaterFactory 20 | 21 | 22 | class StoreActivity : AppCompatActivity() { 23 | override fun onCreate(savedInstanceState: Bundle?) { 24 | layoutInflater.factory2 = LayoutInflaterFactory(delegate).addOnViewCreatedListener(WindowInsetsHelper.LISTENER) 25 | super.onCreate(savedInstanceState) 26 | attachDynamicColor() 27 | setContentView(R.layout.activity_store) 28 | //找组件 29 | val title = findViewById(R.id.storeTitle) 30 | val copyFrom = findViewById(R.id.storeFrom) 31 | val sp: SharedPreferences = getSharedPreferences("com.mBZo.jar_preferences", Context.MODE_PRIVATE) 32 | val smartDownloader = sp.getBoolean("smartDownloader",false) 33 | val downloadManager = findViewById(R.id.storeDownloadManager) 34 | if (smartDownloader){ 35 | downloadManager.setOnClickListener { 36 | val intent = Intent() 37 | intent.setClass(this,DownloadActivity::class.java) 38 | startActivity(intent) 39 | } 40 | } 41 | else{ 42 | downloadManager.visibility = View.GONE 43 | } 44 | //读参数 45 | val name = intent.getStringExtra("name") 46 | val from = intent.getStringExtra("from") 47 | val path = intent.getStringExtra("path") 48 | //不知道干嘛 49 | title.text = name 50 | val copyFromText = "来源:$from" 51 | copyFrom.text = copyFromText 52 | //通过from判断解析方法吧,找不到对应from就返回不支持 53 | if (name != null && from != null && path != null) {//虽然做了防毒,但不这样写不能编译 54 | if (from.contains("没空云")){ apiDecodeBzyun(this,path,name) }//匹配规则,没空云(OneIndexApi) 55 | else if (from.contains("Joyin的jar游戏下载站")){ apiDecodeJoyin(this,path) }//匹配规则,Joyin (Lanzou) 56 | else if (from.contains("e简网")){ apiDecodeEjJava(this,path) } 57 | else if (from.contains("小众网")){ apiDecodeIniche(this,path) } 58 | else if (from.contains("52emu")){ apiDecode52emu(this,path) }//匹配规则,52emu (专属混合Lanzou规则) 59 | else if (from=="损坏") {//库存本身出意外都是在这里解决 60 | MaterialAlertDialogBuilder(this) 61 | .setCancelable(false) 62 | .setMessage("当前资源损坏,截图向我反馈") 63 | .setPositiveButton("退出"){ _,_ -> this.finish() } 64 | .show() 65 | } 66 | else {//查了一圈也不认识 67 | MaterialAlertDialogBuilder(this) 68 | .setCancelable(false) 69 | .setMessage("暂不支持解析该仓库内容,请等待更新") 70 | .setPositiveButton("退出"){ _,_ -> this.finish() } 71 | .show() 72 | } 73 | } 74 | else{//如果说,真的有毒的话,给一个提示 75 | MaterialAlertDialogBuilder(this) 76 | .setCancelable(false) 77 | .setMessage("触发了意料之外的情况,无法提供内容") 78 | .setPositiveButton("退出"){ _,_ -> this.finish() } 79 | .show() 80 | } 81 | //应该没啥要写了吧 82 | } 83 | } 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /app/src/main/java/com/mBZo/jar/adapter/ArchiveRecyclerAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.mBZo.jar.adapter 2 | 3 | import android.app.Activity 4 | import android.content.Intent 5 | import android.view.LayoutInflater 6 | import android.view.View 7 | import android.view.ViewGroup 8 | import android.widget.TextView 9 | import androidx.recyclerview.widget.RecyclerView 10 | import com.google.android.material.bottomnavigation.BottomNavigationView 11 | import com.mBZo.jar.R 12 | import com.mBZo.jar.StoreActivity 13 | import com.mBZo.jar.tool.ArchiveItem 14 | 15 | class ArchiveRecyclerAdapter(private val activity: Activity?, private val list: ArrayList) : 16 | RecyclerView.Adapter() { 17 | fun getList(): ArrayList { 18 | return list 19 | } 20 | 21 | override fun onCreateViewHolder( 22 | parent: ViewGroup, 23 | viewType: Int 24 | ): MyViewHolder { 25 | val nav: BottomNavigationView? = activity?.findViewById(R.id.home_nav) 26 | nav?.getOrCreateBadge(R.id.nav_search)?.number = itemCount 27 | val view = LayoutInflater.from(parent.context).inflate(R.layout.item_archive, parent, false) 28 | return MyViewHolder(view) 29 | } 30 | 31 | override fun getItemCount(): Int = list.size 32 | 33 | override fun onBindViewHolder(holder: MyViewHolder, position: Int) { 34 | val itemName = list[position].name 35 | val itemFrom = list[position].from 36 | //显示 37 | holder.name.text = itemName 38 | holder.from.text = itemFrom 39 | //点击 40 | holder.itemView.setOnClickListener { 41 | val intent = Intent(holder.itemView.context, StoreActivity::class.java) 42 | intent.putExtra("name",list[position].name) 43 | intent.putExtra("from",list[position].from) 44 | intent.putExtra("path",list[position].path) 45 | activity?.startActivity(intent) 46 | } 47 | } 48 | 49 | 50 | class MyViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { 51 | val name: TextView = itemView.findViewById(R.id.archiveItemName) 52 | val from: TextView = itemView.findViewById(R.id.archiveItemFrom) 53 | } 54 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mBZo/jar/adapter/DownloadRecyclerAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.mBZo.jar.adapter 2 | 3 | import android.annotation.SuppressLint 4 | import android.net.Uri 5 | import android.os.Build 6 | import android.view.LayoutInflater 7 | import android.view.View 8 | import android.view.ViewGroup 9 | import android.widget.ProgressBar 10 | import android.widget.TextView 11 | import android.widget.Toast 12 | import androidx.core.app.ShareCompat 13 | import androidx.core.content.FileProvider 14 | import androidx.recyclerview.widget.RecyclerView 15 | import com.google.android.material.chip.Chip 16 | import com.mBZo.jar.BuildConfig 17 | import com.mBZo.jar.DownloadActivity 18 | import com.mBZo.jar.R 19 | import com.mBZo.jar.tool.DownloadProgressListener 20 | import com.mBZo.jar.tool.downloadFile 21 | import com.mBZo.jar.tool.formatSize 22 | import com.mBZo.jar.tool.installJar 23 | import com.mBZo.jar.tool.isDestroy 24 | import java.io.File 25 | import java.util.* 26 | 27 | 28 | class DownloadRecyclerAdapter( 29 | private val activity: DownloadActivity, 30 | private val fileList: MutableList 31 | ) : 32 | RecyclerView.Adapter() { 33 | override fun getItemCount(): Int = fileList.size 34 | 35 | override fun onBindViewHolder(holder: ViewHolder, position: Int) { 36 | holder.itemView.setOnClickListener { } 37 | //文件名 38 | holder.taskName.text = fileList[holder.adapterPosition].name 39 | //判断是否已下载 40 | val downloadedFilePath = activity.filesDir.absolutePath+"/Download/"+fileList[holder.adapterPosition].name 41 | if (File(downloadedFilePath.substringBeforeLast("/")).exists().not()){ 42 | File(downloadedFilePath.substringBeforeLast("/")).mkdirs() 43 | } 44 | if (File(downloadedFilePath).exists()){ 45 | viewSucceed(holder,holder.adapterPosition) 46 | } 47 | else{ 48 | //下载监听 49 | Thread{ 50 | downloadFile(fileList[position].readText(),activity.filesDir.absolutePath+"/Download/"+fileList[holder.adapterPosition].name,object :DownloadProgressListener{ 51 | override fun onProgress(totalBytes: Long, downloadedBytes: Long) { 52 | viewInDownloading(holder,holder.adapterPosition,downloadedBytes,totalBytes) 53 | } 54 | override fun onSucceed() { 55 | viewSucceed(holder,holder.adapterPosition) 56 | } 57 | }) 58 | }.start() 59 | } 60 | 61 | //onBindViewHolder 62 | } 63 | 64 | // private fun viewFailed(downloadTask: DownloadTask, holder: ViewHolder, position: Int) { 65 | // activity.runOnUiThread { 66 | // holder.chipOpen.text = "重试" 67 | // holder.chipDel.text = "删除" 68 | // holder.chipOpen.setOnClickListener { 69 | // downloadTask.start() 70 | // } 71 | // holder.chipDel.setOnClickListener { 72 | // notifyItemRemoved(position) 73 | // if (fileList[position].exists()){ 74 | // fileList[position].delete() 75 | // } 76 | // fileList.remove(fileList[position]) 77 | // downloadTask.remove() 78 | // notifyItemRangeChanged(position,itemCount) 79 | // } 80 | // holder.loading.visibility = View.GONE 81 | // holder.chipOpen.visibility = View.VISIBLE 82 | // holder.chipShare.visibility = View.GONE 83 | // holder.chipDel.visibility = View.VISIBLE 84 | // } 85 | // } 86 | 87 | private fun viewInDownloading( 88 | holder: ViewHolder, 89 | position: Int, 90 | downloadedBytes: Long, 91 | totalBytes: Long 92 | ) { 93 | activity.runOnUiThread { 94 | holder.chipOpen.visibility = View.GONE 95 | // holder.chipOpen.text = "取消" 96 | // holder.chipOpen.setOnClickListener { 97 | // notifyItemRemoved(position) 98 | // if (fileList[position].exists()){ 99 | // fileList[position].delete() 100 | // } 101 | // fileList.remove(fileList[position]) 102 | // downloadTask.remove() 103 | // notifyItemRangeChanged(position,itemCount) 104 | // } 105 | @SuppressLint("SetTextI18n") 106 | holder.chipShare.text = "${downloadedBytes.formatSize()}/${totalBytes.formatSize()}" 107 | holder.chipShare.setOnClickListener { } 108 | 109 | val progress = (downloadedBytes.toDouble() / totalBytes.toDouble() * 100).toInt() 110 | val progressStr = "$progress%" 111 | holder.chipDel.text = progressStr 112 | holder.chipDel.setOnClickListener { } 113 | holder.loading.isIndeterminate = false 114 | holder.loading.progress = progress 115 | holder.chipOpen.visibility = View.VISIBLE 116 | holder.chipShare.visibility = View.VISIBLE 117 | holder.chipDel.visibility = View.VISIBLE 118 | } 119 | } 120 | 121 | private fun viewSucceed(holder: ViewHolder, position: Int) { 122 | activity.runOnUiThread { 123 | val fileDownloaded = File(activity.filesDir.absolutePath+"/Download/"+fileList[position].name) 124 | holder.chipOpen.text = "安装" 125 | holder.chipOpen.setOnClickListener{ 126 | installJar(activity,fileDownloaded) 127 | } 128 | holder.chipShare.text = "分享" 129 | holder.chipShare.setOnClickListener { 130 | try { 131 | val uri = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { 132 | FileProvider.getUriForFile(activity, BuildConfig.APPLICATION_ID +".fileProvider",fileDownloaded) 133 | } else { 134 | Uri.fromFile(fileDownloaded) 135 | } 136 | ShareCompat.IntentBuilder(activity) 137 | .setChooserTitle(fileList[position].name) 138 | .setType("*/*") 139 | .setStream(uri) 140 | .startChooser() 141 | } catch (e: Exception) { 142 | if (isDestroy(activity).not()){ 143 | activity.runOnUiThread { 144 | Toast.makeText(activity,"未找到支持分享的软件", Toast.LENGTH_SHORT).show() 145 | } 146 | } 147 | } 148 | } 149 | @SuppressLint("SetTextI18n") 150 | holder.chipDel.text = "删除(${File(activity.filesDir.absolutePath+"/Download/"+fileList[position].name).length().formatSize()})" 151 | holder.chipDel.setOnClickListener { 152 | notifyItemRemoved(position) 153 | val downloadedFile = File(activity.filesDir.absolutePath+"/Download/"+fileList[position].name) 154 | if (fileList[position].exists()){ 155 | fileList[position].delete() 156 | } 157 | fileList.remove(fileList[position]) 158 | if (downloadedFile.exists()){ 159 | downloadedFile.delete() 160 | } 161 | notifyItemRangeChanged(position,itemCount) 162 | } 163 | holder.loading.visibility = View.GONE 164 | holder.chipOpen.visibility = View.VISIBLE 165 | holder.chipShare.visibility = View.VISIBLE 166 | holder.chipDel.visibility = View.VISIBLE 167 | } 168 | } 169 | 170 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder 171 | = ViewHolder( 172 | LayoutInflater.from(parent.context) 173 | .inflate(R.layout.item_download, parent, false)) 174 | inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { 175 | val taskName: TextView = view.findViewById(R.id.name) 176 | val loading: ProgressBar = view.findViewById(R.id.loading) 177 | val chipOpen: Chip = view.findViewById(R.id.chipOpen) 178 | val chipShare: Chip = view.findViewById(R.id.chipShare) 179 | val chipDel: Chip = view.findViewById(R.id.chipDel) 180 | } 181 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mBZo/jar/adapter/ImgShowRecyclerAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.mBZo.jar.adapter 2 | 3 | import android.app.Activity 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import android.widget.ImageView 8 | import androidx.recyclerview.widget.RecyclerView 9 | import coil.load 10 | import com.mBZo.jar.R 11 | import com.mBZo.jar.tool.imageLoad 12 | import com.stfalcon.imageviewer.StfalconImageViewer 13 | 14 | class ImgShowRecyclerAdapter( 15 | private val activity: Activity, 16 | private val imgUrlList: List) : 17 | RecyclerView.Adapter() { 18 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder { 19 | val view = 20 | LayoutInflater.from(parent.context).inflate(R.layout.item_image, parent, false) 21 | return MyViewHolder(view) 22 | } 23 | 24 | override fun getItemCount(): Int = imgUrlList.size 25 | 26 | override fun onBindViewHolder(holder: MyViewHolder, position: Int) { 27 | val iconLink = imgUrlList[position] 28 | //显示 29 | (holder.itemView as ImageView).load(iconLink){ 30 | placeholder(R.drawable.ic_load_waiting_image) 31 | error(R.drawable.ic_load_error_image) 32 | } 33 | //点击 34 | holder.itemView.setOnClickListener { 35 | StfalconImageViewer.Builder(holder.itemView.context, imgUrlList) { view, image -> imageLoad(activity,view,image) } 36 | .withStartPosition(position) 37 | .withTransitionFrom(holder.itemView as ImageView) 38 | .show() 39 | } 40 | } 41 | 42 | class MyViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) 43 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mBZo/jar/store/apidecode/52emu.kt: -------------------------------------------------------------------------------- 1 | package com.mBZo.jar.store.apidecode 2 | 3 | import com.google.android.material.dialog.MaterialAlertDialogBuilder 4 | import com.google.android.material.snackbar.Snackbar 5 | import com.mBZo.jar.R 6 | import com.mBZo.jar.StoreActivity 7 | import com.mBZo.jar.store.storeManage 8 | import com.mBZo.jar.tool.isDestroy 9 | import okhttp3.OkHttpClient 10 | import okhttp3.Request 11 | 12 | fun apiDecode52emu(activity: StoreActivity, path: String) { 13 | Thread { 14 | try { 15 | val client = OkHttpClient() 16 | val request = Request.Builder() 17 | .url("http://java.52emu.cn/xq.php?id=$path") 18 | .build() 19 | val response = client.newCall(request).execute() 20 | var info = response.body.string() 21 | val downLinkList = mutableListOf() 22 | val downLinkNameList = mutableListOf() 23 | val imagesList = mutableListOf() 24 | //解析下载地址 25 | if (info.contains("暂无下载地址")) { 26 | Snackbar.make(activity.findViewById(R.id.storeDownload),"暂无下载地址", Snackbar.LENGTH_LONG).show() 27 | } 28 | else if (info.contains("【下载地址】")){ 29 | for (index in info.substringAfter("【下载地址】:") 30 | .split("|").substringBefore("")) 32 | downLinkList.add("http://java.52emu.cn/" + index.substringBefore("\'>")) 33 | } 34 | } 35 | //解析预览图 36 | for (index in info.split("img")){ 37 | if (index.contains("src=\"")){ 38 | imagesList.add(index.substringAfter("src=\"").substringBefore("\">")) 39 | } 40 | } 41 | //解析简介 42 | if (info.contains("游戏简介")){ 43 | info = info.substringAfter("【游戏简介】").substringAfter("").substringBefore("
    ") 44 | } 45 | else{ 46 | info = "未找到简介" 47 | } 48 | activity.runOnUiThread { 49 | if (downLinkList.size == 0){ 50 | storeManage(activity,null,imagesList,about = info, loading = false) 51 | } 52 | else{ 53 | storeManage(activity,null,imagesList,downLinkList,downLinkNameList,null,info,false) 54 | } 55 | } 56 | }catch (e: Exception) { 57 | if (isDestroy(activity).not()){ 58 | activity.runOnUiThread { 59 | MaterialAlertDialogBuilder(activity) 60 | .setCancelable(false) 61 | .setTitle("加载失败") 62 | .setMessage("您的网络可能存在问题!") 63 | .setNegativeButton("重试"){_,_ -> apiDecode52emu(activity,path) } 64 | .setPositiveButton("退出"){_,_ -> activity.finish() } 65 | .show() 66 | } 67 | } 68 | } 69 | }.start() 70 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mBZo/jar/store/apidecode/bzyun.kt: -------------------------------------------------------------------------------- 1 | package com.mBZo.jar.store.apidecode 2 | 3 | import com.google.android.material.dialog.MaterialAlertDialogBuilder 4 | import com.mBZo.jar.StoreActivity 5 | import com.mBZo.jar.store.storeManage 6 | import com.mBZo.jar.tool.isDestroy 7 | import okhttp3.FormBody 8 | import okhttp3.OkHttpClient 9 | import okhttp3.Request 10 | import org.json.JSONObject 11 | 12 | fun apiDecodeBzyun(activity: StoreActivity, path: String, name: String ,failedNum: Int = 0) { 13 | Thread { 14 | val maxFailed = 3 15 | val rootUrl = "https://alist.bzyun.top" 16 | try { 17 | val requestBody: FormBody = FormBody.Builder() 18 | .add("path","/分享/bzyun/J2ME应用商店$path/$name") 19 | .add("password","") 20 | .add("page","1") 21 | .add("per_page","100") 22 | .add("refresh","false") 23 | .build() 24 | val client = OkHttpClient() 25 | val request = Request.Builder() 26 | .url("${rootUrl}/api/fs/list") 27 | .post(requestBody) 28 | .build() 29 | val response = client.newCall(request).execute() 30 | val result = response.body.string() 31 | //解析 32 | val data = JSONObject(result).getJSONObject("data").getJSONArray("content") 33 | val downLinkList = mutableListOf() 34 | val downLinkNameList = mutableListOf() 35 | val fileSizeList = mutableListOf() 36 | val imagesList = mutableListOf() 37 | for (index in 0 until data.length()){ 38 | val indexName=data.getJSONObject(index).getString("name").toString() 39 | if (data.getJSONObject(index).getBoolean("is_dir").not()){//确认项目不是文件夹 40 | //下载列表 41 | if (indexName.contains(name.substringBefore("_"))){//确认是可下载文件 42 | downLinkNameList.add(indexName.substringAfterLast("_")) 43 | downLinkList.add("${rootUrl}/d/分享/bzyun/J2ME应用商店$path/$name/$indexName") 44 | fileSizeList.add("${data.getJSONObject(index).getString("size").toInt().div(1024)}kb") 45 | } 46 | //预览图 47 | if (indexName.contains("img") && indexName.contains("ErrLog.txt").not()){imagesList.add("${rootUrl}/d/J2ME应用商店$path/$name/$indexName") } 48 | //图标 49 | if (indexName.contains("pic") && indexName.contains("ErrLog.txt").not()){ 50 | storeManage(activity,"${rootUrl}/d/分享/bzyun/J2ME应用商店$path/$name/$indexName", loading = true) 51 | } 52 | //简介 53 | if (indexName=="gameInfo.html"){ 54 | val requestInfo = Request.Builder() 55 | .url("${rootUrl}/d/分享/bzyun/J2ME应用商店$path/$name/$indexName") 56 | .build() 57 | Thread { 58 | try { 59 | val responseInfo = client.newCall(requestInfo).execute() 60 | storeManage(activity,about = responseInfo.body.string(), loading = false) 61 | } catch (_: Exception) { } 62 | }.start() 63 | } 64 | //一次判断结束 65 | } 66 | }//循环结束 67 | storeManage(activity,null,imagesList,downLinkList,downLinkNameList,fileSizeList, loading = true) 68 | } catch (e: Exception) { 69 | if (isDestroy(activity).not()){ 70 | if (failedNum apiDecodeBzyun(activity,path,name) } 80 | .setPositiveButton("退出"){_,_ -> activity.finish() } 81 | .show() 82 | } 83 | } 84 | } 85 | } 86 | }.start() 87 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mBZo/jar/store/apidecode/iniche.kt: -------------------------------------------------------------------------------- 1 | package com.mBZo.jar.store.apidecode 2 | 3 | import com.google.android.material.dialog.MaterialAlertDialogBuilder 4 | import com.mBZo.jar.StoreActivity 5 | import com.mBZo.jar.store.storeManage 6 | import com.mBZo.jar.tool.isDestroy 7 | import okhttp3.OkHttpClient 8 | import okhttp3.Request 9 | 10 | fun apiDecodeIniche(activity: StoreActivity, path: String) { 11 | Thread { 12 | try { 13 | val client = OkHttpClient() 14 | val request = Request.Builder() 15 | .url(path) 16 | .build() 17 | val response = client.newCall(request).execute() 18 | var stepDate=response.body.string() 19 | //简介 20 | stepDate = stepDate.substringAfter("
    ") 21 | val gameInfoRude = stepDate 22 | .substringBefore("
      ") 25 | var gameInfo = "" 26 | for (index in gameInfoRude){ 27 | if (index.contains(":")){ 28 | if (index.contains("厂商") || index.contains("分类") || index.contains("平台") || index.contains("容量") || index.contains("版本") || index.contains("下载") || index.contains("分辨率") || index.contains("单机联机") || index.contains("官方简介")){ 29 | gameInfo += index.replace("","") + "\n" 30 | } 31 | } 32 | } 33 | //图片 34 | stepDate = stepDate 35 | .substringAfter("
        ") 37 | .substringBefore("
      ") 38 | val imageList = mutableListOf() 39 | if (stepDate.contains("img src")){ 40 | val imageRudeList = stepDate.split("
    • apiDecodeIniche(activity,path) } 57 | .setPositiveButton("退出"){_,_ -> activity.finish() } 58 | .show() 59 | } 60 | } 61 | } 62 | }.start() 63 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mBZo/jar/store/apidecode/lanzou.kt: -------------------------------------------------------------------------------- 1 | package com.mBZo.jar.store.apidecode 2 | 3 | import android.util.Log 4 | import com.google.android.material.dialog.MaterialAlertDialogBuilder 5 | import com.mBZo.jar.StoreActivity 6 | import com.mBZo.jar.store.WebViewListen2Download 7 | import com.mBZo.jar.store.storeManage 8 | import com.mBZo.jar.tool.isDestroy 9 | import com.mBZo.jar.tool.otherOpen 10 | import okhttp3.MediaType.Companion.toMediaType 11 | import okhttp3.OkHttpClient 12 | import okhttp3.Request 13 | import okhttp3.RequestBody.Companion.toRequestBody 14 | import org.json.JSONObject 15 | 16 | 17 | fun lanzouApi(activity: StoreActivity,type: String,url: String,pwd: String) { 18 | //蓝奏云解析kotlin版 by.mBZo ver1.3 19 | Thread { 20 | var finLink="";var data="";val about: String 21 | try { 22 | //第一次请求 23 | val client = OkHttpClient() 24 | var request = Request.Builder() 25 | .url(url) 26 | .build() 27 | var response = client.newCall(request).execute() 28 | finLink = response.body.string() 29 | if(finLink.contains("passwd").not()) { 30 | //无密码 31 | //获取信息 32 | val info = finLink.split("") 33 | about = "${info[1].split("
      ")[0]}\n${info[2].split("
      ")[0]}\n${info[3].split("
      ")[0]}\n${info[4].split("
      ")[0]}\n${info[5].split("
      ")[0]}".replace("
      ","",ignoreCase = true).replace("","",ignoreCase = true).replace("","",ignoreCase = true) 34 | //拼接二次请求连接 35 | finLink = "https://wwr.lanzoux.com${finLink.split("")[1].split("src=\"")[1].split("\"")[0]}" 36 | //无密码状态二次请求 37 | request = Request.Builder() 38 | .url(finLink) 39 | .build() 40 | response = client.newCall(request).execute() 41 | //拼接最终请求数据 42 | val lanzouRaw = Regex("//.*\n").replace(response.body.string(),"") 43 | finLink = lanzouRaw 44 | Log.i("lanzouRaw-Np",finLink) 45 | //有多个data,筛选出有回调的那个 46 | var valueStore = ""//因为data需要的变量一定是在ajax之前的,所以用这个储存正确的ajax之前的数据 47 | for (i in finLink.split("\$.ajax")){ 48 | val j = i.replace("\\s".toRegex(), "").substringBefore("});") 49 | if (j.contains("success:function")){ 50 | finLink = j 51 | Log.i("data-check-Np",finLink) 52 | break 53 | } 54 | valueStore = i 55 | } 56 | data = finLink.substringAfter("data:{").substringBefore("},") 57 | Log.i("data-Np",data) 58 | finLink="" 59 | for (index in data.split(",")){ 60 | finLink+="${index.substringAfter("\'").substringBefore("\':")}=" + 61 | if (index.contains("\':\'")) { 62 | index.substringAfter(":\'").substringBefore("\'") 63 | } 64 | else { 65 | if (Regex("^[0-9]*\$").matches(index.substringAfter("\':"))) { 66 | index.substringAfter("\':") 67 | } 68 | else { 69 | valueStore.substringAfter("var ${index.substringAfter("\':")} = '").substringBefore("';") 70 | } 71 | } + "&" 72 | } 73 | finLink = finLink.substringBeforeLast("&") 74 | Log.i("fin-Np",finLink) 75 | } 76 | else { 77 | //有密码,拼接请求数据 78 | about = "${finLink.split("").substringBefore("")}" 79 | Log.i("raw-Hp",finLink) 80 | //有多个data,筛选出有回调的那个 81 | var valueStore = ""//因为data需要的变量一定是在ajax之前的,所以用这个储存正确的ajax之前的数据 82 | for (i in finLink.split("\$.ajax")){ 83 | val j = i.replace("\\s".toRegex(), "").substringBefore("});") 84 | if (j.contains("success:function")){ 85 | finLink = j 86 | Log.i("data-check-Hp",finLink) 87 | break 88 | } 89 | valueStore = i 90 | } 91 | data = finLink.substringAfter("data:{").substringBefore("},") 92 | Log.i("data-Hp",data) 93 | finLink="" 94 | for (index in data.split(",")){ 95 | finLink+="${index.substringAfter("\'").substringBefore("\':")}=" + 96 | if (index.contains("\':\'")) { 97 | index.substringAfter(":\'").substringBefore("\'") 98 | } 99 | else { 100 | if (Regex("^[0-9]*\$").matches(index.substringAfter("\':"))) { 101 | index.substringAfter("\':") 102 | } 103 | else { 104 | if (index.substringAfter("\':") == "pwd"){ 105 | pwd 106 | } 107 | else{ 108 | valueStore.substringAfter("var ${index.substringAfter("\':")} = '").substringBefore("';") 109 | } 110 | } 111 | } + "&" 112 | } 113 | finLink = finLink.substringBeforeLast("&") 114 | Log.i("fin-Hp",finLink) 115 | } 116 | //发起最终请求 117 | request = Request.Builder() 118 | .url("https://wwr.lanzoux.com/ajaxm.php") 119 | .header("referer", url) 120 | .post(finLink.toRequestBody("application/x-www-form-urlencoded".toMediaType())) 121 | .build() 122 | response = client.newCall(request).execute() 123 | finLink = response.body.string() 124 | finLink = "${JSONObject(finLink).getString("dom")}/file/${JSONObject(finLink).getString("url")}" 125 | activity.runOnUiThread{ 126 | if (type == "only"){ 127 | //作为唯一信息来源 128 | val linkNameList = listOf(about) 129 | val linkList = listOf(finLink) 130 | storeManage(activity,null,null,linkList,linkNameList,null,about,false) 131 | } 132 | else if (type == "web2download"){ 133 | //传回web2download 134 | storeManage(activity, loading = false) 135 | WebViewListen2Download(activity,finLink) 136 | } 137 | } 138 | }catch (e: Exception) { 139 | if (isDestroy(activity).not()){ 140 | activity.runOnUiThread { 141 | MaterialAlertDialogBuilder(activity) 142 | .setCancelable(false) 143 | .setTitle("加载失败") 144 | .setMessage("您的网络可能存在问题!\n若多次重试均无效则不排除蓝奏云api变动的可能性。") 145 | .setNegativeButton("重试") {_,_ -> lanzouApi(activity,type,url,pwd) } 146 | .setPositiveButton("退出") {_,_ -> activity.finish()} 147 | .setNeutralButton("显示日志") {_,_ -> 148 | MaterialAlertDialogBuilder(activity) 149 | .setCancelable(false) 150 | .setTitle("失败详情") 151 | .setMessage("auto:$data\n" + 152 | "finLink:\n$finLink") 153 | .setNegativeButton("仍然重试") {_,_ -> lanzouApi(activity,type,url,pwd) } 154 | .setPositiveButton("退出") {_,_ -> activity.finish()} 155 | .setNeutralButton("原始网页") {_,_ -> otherOpen(activity,url) ;activity.finish()} 156 | .show() 157 | } 158 | .show() 159 | } 160 | } 161 | 162 | } 163 | }.start() 164 | } 165 | 166 | 167 | 168 | fun apiDecodeJoyin(activity: StoreActivity, path: String) { 169 | lanzouApi(activity,"only",path,"1234") 170 | } 171 | 172 | fun apiDecodeEjJava(activity: StoreActivity, path: String) { 173 | lanzouApi(activity,"only",path,"") 174 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mBZo/jar/store/storeManage.kt: -------------------------------------------------------------------------------- 1 | package com.mBZo.jar.store 2 | 3 | import android.app.Activity 4 | import android.content.Context 5 | import android.content.SharedPreferences 6 | import android.os.Build 7 | import android.text.Html 8 | import android.text.method.LinkMovementMethod 9 | import android.view.View 10 | import android.widget.ImageView 11 | import android.widget.ProgressBar 12 | import android.widget.TextView 13 | import androidx.recyclerview.widget.LinearLayoutManager 14 | import androidx.recyclerview.widget.RecyclerView 15 | import com.google.android.material.button.MaterialButton 16 | import com.google.android.material.dialog.MaterialAlertDialogBuilder 17 | import com.mBZo.jar.R 18 | import com.mBZo.jar.adapter.ImgShowRecyclerAdapter 19 | import com.mBZo.jar.tool.imageLoad 20 | 21 | fun storeManage(activity: Activity, iconLink: String?=null, imageList: List?=null, linkList: List?=null, linkNameList: List?=null, fileSizeList: List?=null, about: String?=null, loading: Boolean) { 22 | //loading为false时停止加载 23 | val info = activity.findViewById(R.id.storeInfo) 24 | val icon = activity.findViewById(R.id.ico) 25 | val loadingProgressBar = activity.findViewById(R.id.storeLoadingMain) 26 | val recyclerView: RecyclerView = activity.findViewById(R.id.storeImages) 27 | val downloadButton: MaterialButton = activity.findViewById(R.id.storeDownload) 28 | val sp: SharedPreferences = activity.getSharedPreferences("com.mBZo.jar_preferences", Context.MODE_PRIVATE) 29 | val smartDownloader = sp.getBoolean("smartDownloader",false) 30 | activity.runOnUiThread { 31 | //简介 32 | if (about != null){ 33 | info.visibility = View.VISIBLE 34 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { 35 | info.text = Html.fromHtml(about.replace("\n","
      "), Html.FROM_HTML_MODE_LEGACY) 36 | } else { 37 | @Suppress("DEPRECATION") 38 | info.text = Html.fromHtml(about.replace("\n","
      ")) 39 | } 40 | info.movementMethod = LinkMovementMethod.getInstance() 41 | } 42 | //图标 43 | if (iconLink != null){ 44 | icon.visibility = View.VISIBLE 45 | imageLoad(activity,icon,iconLink) 46 | } 47 | //预览图 48 | if (imageList != null) { 49 | if (imageList.isNotEmpty()) { 50 | recyclerView.visibility = View.VISIBLE 51 | //设置recyclerView 52 | val layoutManager = LinearLayoutManager(activity, RecyclerView.HORIZONTAL,false) 53 | recyclerView.layoutManager = layoutManager 54 | val adapter = ImgShowRecyclerAdapter(activity,imageList) 55 | recyclerView.adapter = adapter 56 | } 57 | } 58 | //下载链接 59 | if (linkNameList?.isNotEmpty() == true) { 60 | if (linkList?.isNotEmpty() == true) { 61 | //处理下载相关交互 62 | downloadButton.visibility = View.VISIBLE 63 | downloadButton.text = "下载" 64 | if (linkNameList.size>1) { 65 | var linkDialogShowNameList = mutableListOf() 66 | if (fileSizeList?.isNotEmpty() == true){ 67 | for (p in 1..linkNameList.size){ 68 | linkDialogShowNameList.add("[${fileSizeList[p-1]}] ${linkNameList[p-1]}") 69 | } 70 | } 71 | else{ 72 | linkDialogShowNameList = linkNameList.toMutableList() 73 | } 74 | downloadButton.setOnClickListener { 75 | MaterialAlertDialogBuilder(activity) 76 | .setTitle("下载列表") 77 | .setItems(linkDialogShowNameList.toTypedArray()){_,p -> 78 | if (smartDownloader){ 79 | WebViewListen2Download(activity,linkList[p]) 80 | } 81 | else{ 82 | if (!fileSizeList.isNullOrEmpty()){ 83 | MaterialAlertDialogBuilder(activity) 84 | .setTitle("详情") 85 | .setMessage("\n${linkNameList[p]}\n大小:${fileSizeList[p]}") 86 | .setPositiveButton("立即下载"){_,_ -> WebViewListen2Download(activity,linkList[p]) } 87 | .show() 88 | } 89 | else { 90 | MaterialAlertDialogBuilder(activity) 91 | .setTitle("详情") 92 | .setMessage("\n${linkNameList[p]}") 93 | .setPositiveButton("立即下载"){_,_ -> WebViewListen2Download(activity,linkList[p]) } 94 | .show() 95 | } 96 | } 97 | } 98 | .show() 99 | } 100 | } 101 | else{ 102 | downloadButton.setOnClickListener { 103 | if (smartDownloader){ 104 | WebViewListen2Download(activity,linkList[0]) 105 | } 106 | else{ 107 | MaterialAlertDialogBuilder(activity) 108 | .setTitle("详情") 109 | .setMessage("\n${linkNameList[0]}") 110 | .setPositiveButton("立即下载"){_,_ -> WebViewListen2Download(activity,linkList[0]) } 111 | .show() 112 | } 113 | } 114 | } 115 | } 116 | } 117 | //隐藏加载 118 | if (loading){ loadingProgressBar.visibility = View.VISIBLE } 119 | else { loadingProgressBar.visibility = View.INVISIBLE } 120 | } 121 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mBZo/jar/store/webViewTools.kt: -------------------------------------------------------------------------------- 1 | package com.mBZo.jar.store 2 | 3 | import android.annotation.SuppressLint 4 | import android.app.Activity 5 | import android.content.* 6 | import android.view.View 7 | import android.webkit.URLUtil 8 | import android.webkit.WebSettings 9 | import android.webkit.WebView 10 | import android.webkit.WebViewClient 11 | import com.google.android.material.dialog.MaterialAlertDialogBuilder 12 | import com.google.android.material.snackbar.Snackbar 13 | import com.mBZo.jar.R 14 | import com.mBZo.jar.StoreActivity 15 | import com.mBZo.jar.store.apidecode.lanzouApi 16 | import com.mBZo.jar.tool.FileLazy 17 | import com.mBZo.jar.tool.formatSize 18 | import com.mBZo.jar.tool.isDestroy 19 | import com.mBZo.jar.tool.otherOpen 20 | import kotlinx.coroutines.DelicateCoroutinesApi 21 | import okhttp3.OkHttpClient 22 | import okhttp3.Request 23 | import java.io.File 24 | import java.net.URLDecoder 25 | 26 | @OptIn(DelicateCoroutinesApi::class) 27 | class WebViewListen2Download(activity: Activity, link: String){ 28 | init { 29 | if (link.contains("52emu") && link.contains("xid=1")){ 30 | //这是一个特殊情况,用于处理52emu中的高速下载,使其变得可用 31 | storeManage(activity,loading = true) 32 | Snackbar.make(activity.findViewById(R.id.storeDownloadManager),"检测到特殊链接,正在重处理", Snackbar.LENGTH_LONG).setAnchorView(activity.findViewById(R.id.storeDownloadManager)).show() 33 | Thread { 34 | try { 35 | val client = OkHttpClient.Builder() 36 | .followRedirects(false) 37 | .build() 38 | val request = Request.Builder() 39 | .url(link) 40 | .build() 41 | val response = client.newCall(request).execute() 42 | var finLink = response.header("Location") 43 | if (finLink != null) { 44 | finLink = "https://wwr.lanzoux.com/${finLink.substringAfter("https://pan.lanzou.com/tp/")}" 45 | lanzouApi(activity as StoreActivity,"web2download",finLink,"") 46 | } 47 | else{ 48 | activity.runOnUiThread { 49 | Snackbar.make(activity.findViewById(R.id.storeDownload),"未能修复52emu的高速下载", Snackbar.LENGTH_LONG) 50 | .setAnchorView(activity.findViewById(R.id.storeDownloadManager)) 51 | .show() 52 | } 53 | } 54 | } catch (e: Exception) { 55 | activity.runOnUiThread { 56 | Snackbar.make(activity.findViewById(R.id.storeDownload),"下载出错,请检查网络状况", 57 | Snackbar.LENGTH_LONG).setAnchorView(activity.findViewById(R.id.storeDownloadManager)).show() 58 | } 59 | } 60 | }.start() 61 | //52emu针对处理部分结束 62 | } 63 | else{ 64 | //这里是正常的下载,获取相关参数,决定是否需要内置下载器 65 | val spfRecord: SharedPreferences = activity.getSharedPreferences("com.mBZo.jar_preferences", Context.MODE_PRIVATE) 66 | val downloader = spfRecord.getBoolean("smartDownloader",false) 67 | 68 | //下载判断开始,用户是否使用内置下载 69 | if (downloader.not()) { 70 | //用户关闭内置下载 71 | otherOpen(activity,link) 72 | } 73 | else{ 74 | //用户开启内置下载 75 | //创建webView窗口 76 | val webViewDialog = MaterialAlertDialogBuilder(activity) 77 | .setView(R.layout.dialog_webview) 78 | .show() 79 | //使用webView最终处理,确保url是最终下载链接 80 | val webView: WebView? = webViewDialog.findViewById(R.id.webview) 81 | webView?.loadUrl(link) 82 | val webClient = object : WebViewClient() { 83 | @Deprecated("Deprecated in Java") 84 | override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean { 85 | if (url != null) { 86 | view?.loadUrl(url) 87 | webView?.visibility = View.GONE 88 | } 89 | return true 90 | } 91 | 92 | override fun onPageFinished(view: WebView?, url: String?) { 93 | super.onPageFinished(view, url) 94 | webView?.visibility = View.VISIBLE 95 | } 96 | } 97 | webView?.webViewClient= webClient 98 | @SuppressLint("SetJavaScriptEnabled") 99 | webView?.settings?.javaScriptEnabled = true 100 | webView?.settings?.domStorageEnabled = true 101 | webView?.settings?.cacheMode = WebSettings.LOAD_DEFAULT 102 | //监听webView下载 103 | webView?.setDownloadListener { url,_, contentDisposition,_, contentLength -> 104 | //成功获得下载链接,关闭webView窗口并隐藏加载进度条 105 | webViewDialog?.dismiss() 106 | storeManage(activity,loading = false) 107 | //传参,然后去下载 108 | if (isDestroy(activity).not()){ 109 | if (contentDisposition==""){ 110 | val filename = URLUtil.guessFileName(url,null,null) 111 | download(activity, url, filename, contentLength) 112 | } 113 | else{ 114 | val filename = URLDecoder.decode(Regex("\"$").replace(contentDisposition.substringAfter(Regex("filename\\s*=\\s*\"?").find(contentDisposition)!!.value),""),"utf-8") 115 | download(activity, url, filename, contentLength) 116 | } 117 | } 118 | } 119 | } 120 | } 121 | } 122 | 123 | 124 | private fun download( 125 | activity: Activity, 126 | url: String, 127 | filename: String, 128 | size: Long 129 | ) 130 | { 131 | if (filename.endsWith(".jar")){ 132 | MaterialAlertDialogBuilder(activity) 133 | .setMessage("$filename\n\n大小:${size.formatSize()}") 134 | .setPositiveButton("开始下载"){_,_-> 135 | val logFile = File(activity.filesDir.absolutePath+"/DlLog/"+filename) 136 | if (logFile.exists()){ 137 | Snackbar.make(activity.findViewById(R.id.storeDownload),"无法添加重复任务",Snackbar.LENGTH_LONG) 138 | .setAnchorView(activity.findViewById(R.id.storeDownloadManager)) 139 | .show() 140 | } 141 | else{ 142 | FileLazy(logFile.absolutePath).writeNew(url) 143 | Snackbar.make(activity.findViewById(R.id.storeDownload),"已添加,前往下载管理获取",Snackbar.LENGTH_LONG) 144 | .setAnchorView(activity.findViewById(R.id.storeDownloadManager)) 145 | .show() 146 | } 147 | } 148 | .setNegativeButton("通过外部软件下载"){_,_-> otherOpen(activity,url) } 149 | .show() 150 | } 151 | else{ 152 | MaterialAlertDialogBuilder(activity) 153 | .setMessage("$filename\n\n大小:${size.formatSize()} kb\n\n(内置下载器不允许下载此格式文件)") 154 | .setPositiveButton("通过外部软件下载"){_,_-> otherOpen(activity, url) } 155 | .show() 156 | } 157 | storeManage(activity,loading = false) 158 | } 159 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mBZo/jar/tool/FileLazy.kt: -------------------------------------------------------------------------------- 1 | package com.mBZo.jar.tool 2 | 3 | import java.io.File 4 | 5 | class FileLazy(path: String){ 6 | init { 7 | //自动创建 8 | if (File(path.substringBeforeLast("/")).exists().not()){ 9 | File(path.substringBeforeLast("/")).mkdirs() 10 | } 11 | if (path.endsWith("/").not()){ 12 | if (File(path).exists().not()){ 13 | File(path).writeText("") 14 | } 15 | } 16 | } 17 | 18 | //文件操作 19 | private val file: File = File(path) 20 | fun writeNew(content: String = ""){ 21 | file.writeText(content) 22 | } 23 | fun writeAddonStart(content: String){ 24 | file.writeText("${content}${file.readText()}") 25 | } 26 | fun writeReplace(oldValue: String,newValue: String){ 27 | file.writeText(file.readText().replace(oldValue,newValue)) 28 | } 29 | fun writeRemove(content: String){ 30 | file.writeText(file.readText().replace(content,"")) 31 | } 32 | fun read(): String { 33 | return file.readText() 34 | } 35 | fun readLines(): List { 36 | return file.readLines() 37 | } 38 | fun listFiles(): Array? { 39 | return file.listFiles() 40 | } 41 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mBZo/jar/tool/GetArchive.kt: -------------------------------------------------------------------------------- 1 | package com.mBZo.jar.tool 2 | 3 | import android.app.Activity 4 | import androidx.core.content.ContextCompat 5 | import com.google.android.material.dialog.MaterialAlertDialogBuilder 6 | import com.mBZo.jar.HomeFragment 7 | import com.mBZo.jar.R 8 | import com.mBZo.jar.archiveCVer 9 | import com.mBZo.jar.netWorkRoot 10 | import net.lingala.zip4j.ZipFile 11 | import net.lingala.zip4j.io.inputstream.ZipInputStream 12 | import okhttp3.OkHttpClient 13 | import okhttp3.Request 14 | import java.io.ByteArrayOutputStream 15 | import java.io.File 16 | import java.nio.charset.StandardCharsets 17 | 18 | 19 | class GetArchive( 20 | private val activity: Activity?, 21 | private val home: HomeFragment 22 | ){ 23 | fun start() { 24 | if (activity!=null) { 25 | val value = home.getType() 26 | home.setLoading(true) 27 | home.setType( 28 | activity.getString(R.string.updateNewArchive), 29 | ContextCompat.getDrawable(activity,R.drawable.ic_baseline_query_builder_24) 30 | ) 31 | Thread { 32 | getArchiveDetail(object :OkHttpListener{ 33 | override fun onSucceed(result: String) { 34 | activity.runOnUiThread { 35 | home.setLoading(false) 36 | home.setType(value.first,value.second) 37 | selectArchiveDetail(activity,result) 38 | } 39 | } 40 | }) 41 | }.start() 42 | } 43 | } 44 | 45 | private fun selectArchiveDetail(activity: Activity, data: String) { 46 | val must = mutableListOf()//必选path列表 47 | val path = mutableListOf()//path列表 48 | val name = mutableListOf()//name列表 49 | val select = mutableListOf()//选择结果列表 50 | for (index in data.split("\n")) { 51 | if (index.contains("{") && index.contains("//close").not()) { 52 | if (index.contains(",")) { 53 | path.add(index.substringAfter("{").substringBefore(",")) 54 | name.add(index.substringAfter(",").substringBefore("}")) 55 | select.add(false) 56 | } else { 57 | must.add("${netWorkRoot}/jarlist/Archive/raw/${index.substringAfter("{").substringBefore("}")}.zip") 58 | } 59 | } 60 | } 61 | MaterialAlertDialogBuilder(activity) 62 | .setTitle("额外库存源(可以不选)") 63 | .setMultiChoiceItems(name.toTypedArray(), null) { _, index, state -> 64 | select[index] = state 65 | } 66 | .setPositiveButton("开始同步") { _, _ -> 67 | FileLazy("${activity.filesDir.absolutePath}/mBZo/java/list/0.list").writeNew( 68 | "process" 69 | ) 70 | FileLazy("${activity.filesDir.absolutePath}/mBZo/java/list/1.list").writeNew() 71 | for (pos in 0 until select.size){ 72 | if (select[pos]){ 73 | must.add("${netWorkRoot}/jarlist/Archive/raw/${path[pos]}.zip") 74 | } 75 | } 76 | startDownloadArchive(activity,must) 77 | } 78 | .show() 79 | } 80 | 81 | 82 | private fun startDownloadArchive(activity: Activity, list: List) { 83 | home.setLoading(true) 84 | home.setWave(true) 85 | home.setType( 86 | activity.getString(R.string.updateNewArchive), 87 | ContextCompat.getDrawable(activity,R.drawable.ic_baseline_query_builder_24) 88 | ) 89 | Thread{ 90 | val fileRn = File("${activity.filesDir.absolutePath}/mBZo/java/list/1.list") 91 | val savePath = "${activity.filesDir.absolutePath}/mBZo/java/list/" 92 | var tipTemp = "" 93 | for (i in list.indices){ 94 | val saveName = list[i].substringAfterLast("/").substringBefore(".zip") 95 | downloadFile(list[i],"$savePath$saveName.zip",object :DownloadProgressListener{ 96 | override fun onProgress(totalBytes: Long, downloadedBytes: Long) { 97 | val progress = (downloadedBytes/totalBytes * 100).toInt() 98 | val tip = "${activity.getString(R.string.updateNewArchive)}[${i+1}($progress%)/${list.size}]" 99 | if (tip!=tipTemp){ 100 | tipTemp = tip 101 | activity.runOnUiThread { 102 | home.setType( 103 | tip, 104 | ContextCompat.getDrawable(activity,R.drawable.ic_baseline_query_builder_24) 105 | ) 106 | } 107 | } 108 | } 109 | override fun onSucceed() { 110 | val zipFile = ZipFile(File("$savePath$saveName.zip")) 111 | zipFile.isRunInThread = false 112 | for (index in zipFile.fileHeaders){ 113 | if (index.fileName=="$saveName.txt") { 114 | val inputStream: ZipInputStream = zipFile.getInputStream(index) 115 | //流转字符串 116 | val result = ByteArrayOutputStream() 117 | val buffer = ByteArray(1024) 118 | var length: Int 119 | while ( 120 | inputStream.read(buffer).also { length = it } != -1 121 | ) { 122 | result.write(buffer, 0, length) 123 | } 124 | //写入 125 | fileRn.appendText("\n${result.toString(StandardCharsets.UTF_8.name())}") 126 | } 127 | } 128 | } 129 | }) 130 | } 131 | FileLazy("${activity.filesDir.absolutePath}/mBZo/java/list/0.list") 132 | .writeNew(archiveCVer.invoke()) 133 | activity.runOnUiThread { 134 | home.setLoading(false) 135 | home.setWave(false) 136 | home.setType( 137 | activity.getString(R.string.allReady), 138 | ContextCompat.getDrawable(activity,R.drawable.ic_baseline_check_24) 139 | ) 140 | } 141 | askReloadArchive = true 142 | }.start() 143 | } 144 | 145 | 146 | private fun getArchiveDetail(listener: OkHttpListener){ 147 | try { 148 | val client = OkHttpClient() 149 | val request = Request.Builder() 150 | .url("$netWorkRoot/jarlist/Archive/setup.hanpi") 151 | .build() 152 | val response = client.newCall(request).execute() 153 | val data = response.body.string() 154 | listener.onSucceed(data) 155 | } catch (e: Exception) { 156 | Thread{ 157 | getArchiveDetail(listener) 158 | }.start() 159 | } 160 | } 161 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mBZo/jar/tool/util.kt: -------------------------------------------------------------------------------- 1 | package com.mBZo.jar.tool 2 | 3 | import android.app.Activity 4 | import android.content.Intent 5 | import android.content.SharedPreferences 6 | import android.net.Uri 7 | import android.os.Build 8 | import android.widget.ImageView 9 | import android.widget.Toast 10 | import androidx.appcompat.app.AppCompatActivity 11 | import androidx.core.content.ContextCompat 12 | import androidx.core.content.FileProvider 13 | import coil.load 14 | import com.google.android.material.color.DynamicColors 15 | import com.mBZo.jar.BuildConfig 16 | import com.mBZo.jar.R 17 | import okhttp3.MediaType 18 | import okhttp3.OkHttpClient 19 | import okhttp3.Request 20 | import okhttp3.ResponseBody 21 | import okio.Buffer 22 | import okio.BufferedSource 23 | import okio.ForwardingSource 24 | import okio.Source 25 | import okio.buffer 26 | import java.io.File 27 | import java.io.FileOutputStream 28 | import kotlin.math.log10 29 | import kotlin.math.pow 30 | 31 | fun Activity.attachDynamicColor(){ 32 | val sp: SharedPreferences = getSharedPreferences("${packageName}_preferences", 33 | AppCompatActivity.MODE_PRIVATE 34 | ) 35 | val dynamicColors = sp.getBoolean("dynamicTheme",false) 36 | if (DynamicColors.isDynamicColorAvailable() && dynamicColors){ 37 | DynamicColors.applyToActivityIfAvailable(this) 38 | } 39 | } 40 | fun isDestroy(mActivity: Activity?): Boolean { 41 | return mActivity == null || mActivity.isFinishing || mActivity.isDestroyed 42 | } 43 | 44 | fun imageLoad(activity: Activity, view: ImageView?, img: Any){ 45 | if (isDestroy(activity).not()){ 46 | view?.load(img) 47 | } 48 | } 49 | 50 | fun otherOpen(activity: Activity, url:String) {//跳转浏览器 51 | try { 52 | val intent = Intent(Intent.ACTION_VIEW) 53 | intent.data = Uri.parse(url) 54 | ContextCompat.startActivity(activity, intent, null) 55 | } catch (e: Exception) { 56 | if (isDestroy(activity).not()){ 57 | activity.runOnUiThread { 58 | Toast.makeText(activity,activity.getString(R.string.notFindBrowser), Toast.LENGTH_SHORT).show() 59 | } 60 | } 61 | } 62 | } 63 | 64 | fun installJar(activity: Activity, file: File) { 65 | try { 66 | val mIntent = Intent(Intent.ACTION_VIEW) 67 | mIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) 68 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { 69 | mIntent.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION 70 | 71 | mIntent.setDataAndType(FileProvider.getUriForFile(activity, BuildConfig.APPLICATION_ID +".fileProvider",file), "application/java-archive") 72 | } else { 73 | mIntent.setDataAndType(Uri.fromFile(file),"application/java-archive") 74 | } 75 | activity.startActivity(mIntent) 76 | } catch (e: Exception) { 77 | if (isDestroy(activity).not()){ 78 | activity.runOnUiThread { 79 | Toast.makeText(activity,"没装模拟器啊,兄弟?", Toast.LENGTH_SHORT).show() 80 | } 81 | } 82 | } 83 | } 84 | fun downloadFile(url: String, filePath: String, listener: DownloadProgressListener) { 85 | 86 | val client = OkHttpClient.Builder() 87 | .addNetworkInterceptor { chain -> 88 | val originalResponse = chain.proceed(chain.request()) 89 | originalResponse.newBuilder() 90 | .body( 91 | ProgressResponseBody( 92 | originalResponse.body, 93 | listener 94 | ) 95 | ) 96 | .build() 97 | } 98 | .build() 99 | 100 | val request = Request.Builder() 101 | .url(url) 102 | .build() 103 | 104 | val response = client.newCall(request).execute() 105 | if (!response.isSuccessful) throw RuntimeException("Unexpected code $response") 106 | 107 | val inputStream = response.body.byteStream() 108 | val outputStream = FileOutputStream(File(filePath)) 109 | 110 | val buffer = ByteArray(1024) 111 | var read: Int 112 | while (inputStream.read(buffer).also { read = it } != -1) { 113 | outputStream.write(buffer, 0, read) 114 | listener.onProgress(response.body.contentLength(), outputStream.channel.size()) 115 | } 116 | 117 | outputStream.flush() 118 | outputStream.close() 119 | inputStream.close() 120 | listener.onSucceed() 121 | } 122 | 123 | interface DownloadProgressListener { 124 | fun onProgress(totalBytes: Long, downloadedBytes: Long) 125 | fun onSucceed() 126 | } 127 | 128 | class ProgressResponseBody( 129 | private val responseBody: ResponseBody, 130 | private val progressListener: DownloadProgressListener 131 | ) : ResponseBody() { 132 | 133 | private var bufferedSource: BufferedSource? = null 134 | 135 | override fun contentType(): MediaType? { 136 | return responseBody.contentType() 137 | } 138 | 139 | override fun contentLength(): Long { 140 | return responseBody.contentLength() 141 | } 142 | 143 | override fun source(): BufferedSource { 144 | if (bufferedSource == null) { 145 | bufferedSource = source(responseBody.source()).buffer() 146 | } 147 | return bufferedSource!! 148 | } 149 | 150 | private fun source(source: Source): Source { 151 | return object : ForwardingSource(source) { 152 | var totalBytesRead = 0L 153 | override fun read(sink: Buffer, byteCount: Long): Long { 154 | val bytesRead = super.read(sink, byteCount) 155 | totalBytesRead += if (bytesRead != -1L) bytesRead else 0L 156 | progressListener.onProgress(responseBody.contentLength(), totalBytesRead) 157 | return bytesRead 158 | } 159 | } 160 | } 161 | } 162 | 163 | fun Long.formatSize(): String { 164 | if (this <= 0) { 165 | return "0B" 166 | } 167 | val units = arrayOf("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB") 168 | val digitGroups = (log10(this.toDouble()) / log10(1024.0)).toInt() 169 | return String.format("%.1f %s", this / 1024.0.pow(digitGroups.toDouble()), units[digitGroups]) 170 | } 171 | 172 | data class ArchiveItem( 173 | val name: String, 174 | val nameFC: String, 175 | val from: String, 176 | val path: String 177 | ) 178 | 179 | interface OkHttpListener{ 180 | fun onSucceed(result: String) 181 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mBZo/jar/tool/value.kt: -------------------------------------------------------------------------------- 1 | package com.mBZo.jar.tool 2 | 3 | var askReloadArchive = true //重载库存指示器 4 | var isPlay: Boolean? = null //play检测 -------------------------------------------------------------------------------- /app/src/main/res/drawable/baseline_palette_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_app_center.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_archive_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_block_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_check_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_exit_to_app_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_get_app_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_home_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_login_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_query_builder_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_sd_storage_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_search_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_settings_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_update_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 11 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_load_error_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zf1234d/J2me-res-store/32ea482573f5a6f86ba6f0f4aac92af4b87a8167/app/src/main/res/drawable/ic_load_error_image.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_load_waiting_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zf1234d/J2me-res-store/32ea482573f5a6f86ba6f0f4aac92af4b87a8167/app/src/main/res/drawable/ic_load_waiting_image.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_outline_archive_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_outline_home_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_outline_settings_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_select_archive.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_select_home.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_select_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_download.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 12 | 13 | 20 | 25 | 26 | 27 | 28 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 16 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_store.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 19 | 27 | 36 | 37 | 45 | 46 | 52 | 53 | 61 | 68 | 69 | 70 | 71 | 78 | 79 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /app/src/main/res/layout/dialog_about.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 18 | 19 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/layout/dialog_webview.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 17 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_archive.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 13 | 14 | 21 | 22 | 28 | 29 | 34 | 35 | 36 | 37 | 38 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_home.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 13 | 14 | 20 | 21 | 27 | 32 | 33 | 34 | 41 | 45 | 46 | 54 | 55 | 56 | 57 | 65 | 74 | 80 | 90 | 91 | 96 | 97 | 105 | 106 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 128 | 129 | 135 | 136 | 143 | 144 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_settingroot.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 13 | 20 | 21 | 27 | 28 | 33 | 34 | 35 | 36 | 37 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_archive.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 20 | 21 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_download.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 15 | 16 | 22 | 23 | 29 | 30 | 33 | 38 | 43 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_image.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/menu/archive_toolbar_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/menu/home_toolbar_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 11 | 16 | 22 | 27 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/menu/main_nav_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 13 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v33/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zf1234d/J2me-res-store/32ea482573f5a6f86ba6f0f4aac92af4b87a8167/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zf1234d/J2me-res-store/32ea482573f5a6f86ba6f0f4aac92af4b87a8167/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zf1234d/J2me-res-store/32ea482573f5a6f86ba6f0f4aac92af4b87a8167/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zf1234d/J2me-res-store/32ea482573f5a6f86ba6f0f4aac92af4b87a8167/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zf1234d/J2me-res-store/32ea482573f5a6f86ba6f0f4aac92af4b87a8167/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zf1234d/J2me-res-store/32ea482573f5a6f86ba6f0f4aac92af4b87a8167/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zf1234d/J2me-res-store/32ea482573f5a6f86ba6f0f4aac92af4b87a8167/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zf1234d/J2me-res-store/32ea482573f5a6f86ba6f0f4aac92af4b87a8167/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zf1234d/J2me-res-store/32ea482573f5a6f86ba6f0f4aac92af4b87a8167/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zf1234d/J2me-res-store/32ea482573f5a6f86ba6f0f4aac92af4b87a8167/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values-night-v23/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values-night-v27/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values-night-v29/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/values-night-v31/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/values-v19/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values-v23/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values-v27/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values-v29/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/values-v31/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 主页 5 | 仓库 6 | 7 | 8 | 9 | home 10 | search 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3C5874 4 | #00629D 5 | #FFFFFF 6 | #CFE5FF 7 | #001D34 8 | #526070 9 | #FFFFFF 10 | #D5E4F7 11 | #0E1D2A 12 | #695779 13 | #FFFFFF 14 | #F0DBFF 15 | #231533 16 | #BA1A1A 17 | #FFDAD6 18 | #FFFFFF 19 | #410002 20 | #FCFCFF 21 | #1A1C1E 22 | #FCFCFF 23 | #1A1C1E 24 | #DEE3EB 25 | #42474E 26 | #72777F 27 | #F1F0F4 28 | #2F3033 29 | #99CBFF 30 | #99CBFF 31 | #003354 32 | #004A78 33 | #CFE5FF 34 | #B9C8DA 35 | #243240 36 | #3A4857 37 | #D5E4F7 38 | #D4BEE6 39 | #392A49 40 | #504060 41 | #F0DBFF 42 | #FFB4AB 43 | #93000A 44 | #690005 45 | #FFDAD6 46 | #1A1C1E 47 | #E2E2E5 48 | #1A1C1E 49 | #E2E2E5 50 | #42474E 51 | #C2C7CF 52 | #8C9199 53 | #1A1C1E 54 | #E2E2E5 55 | #00629D 56 | 57 | -------------------------------------------------------------------------------- /app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #61B5D9 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | J2ME下载 3 | J2ME应用商店 4 | 主页 5 | 仓库 6 | 设置 7 | 库存有变化,点击修改 8 | 同步意外中止,点击修复 9 | 正在同步…… 10 | 发现新版本,点击更新 11 | 已连接 12 | 图标 13 | 下载管理器 14 | 当前手机未安装浏览器 15 | 支持和鼓励 16 | 更新日志 17 | 关于 18 | 搜索 19 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/xml/backup_rules.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/xml/data_extraction_rules.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 12 | 13 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/xml/file_paths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/xml/root_preferences.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 12 | 17 | 25 | 26 | 29 | 35 | 41 | 42 | 45 | 52 | 53 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | plugins { 3 | id 'com.android.application' version '8.1.0' apply false 4 | id 'com.android.library' version '8.1.0' apply false 5 | id 'org.jetbrains.kotlin.android' version '1.9.0' apply false 6 | } 7 | 8 | 9 | tasks.register('clean', Delete) { 10 | delete rootProject.buildDir 11 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=2048m -XX:+UseParallelGC -Dfile.encoding=UTF-8 10 | org.gradle.parallel=true 11 | # When configured, Gradle will run in incubating parallel mode. 12 | # This option should only be used with decoupled projects. More details, visit 13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 14 | # org.gradle.parallel=true 15 | # AndroidX package structure to make it clearer which packages are bundled with the 16 | # Android operating system, and which are packaged with your app"s APK 17 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 18 | android.useAndroidX=true 19 | # Kotlin code style for this project: "official" or "obsolete": 20 | kotlin.code.style=official 21 | # Enables namespacing of each library's R class so that its R class includes only the 22 | # resources declared in the library itself and none from the library's dependencies, 23 | # thereby reducing the size of the R class for that library 24 | android.nonTransitiveRClass=true 25 | android.defaults.buildfeatures.buildconfig=true 26 | android.nonFinalResIds=false -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zf1234d/J2me-res-store/32ea482573f5a6f86ba6f0f4aac92af4b87a8167/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Jul 15 10:38:04 CST 2023 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | google() 5 | mavenCentral() 6 | } 7 | } 8 | dependencyResolutionManagement { 9 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 10 | repositories { 11 | google() 12 | mavenCentral() 13 | maven { url "https://jitpack.io" } 14 | } 15 | } 16 | rootProject.name = "J2ME下载" 17 | include ':app' 18 | --------------------------------------------------------------------------------