")
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 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/home_toolbar_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/main_nav_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------