refactor(app): 重构应用适配器和相关代码
-优化 ApplicationListAdapter,使用 Coroutine 替代 Thread - 重构 AppSettings,修改数据目录路径 - 删除未使用的 CommunityServiceInfo 类 - 移除未使用的数据库和模板相关代码 - 优化 ErrorInfo 类,使用 SimpleDateFormat 的正确方式
This commit is contained in:
parent
07b5ab73ec
commit
c65c684997
|
@ -106,6 +106,7 @@ dependencies {
|
||||||
implementation 'com.github.getActivity:MultiLanguages:8.0'
|
implementation 'com.github.getActivity:MultiLanguages:8.0'
|
||||||
// 权限请求框架:https://github.com/getActivity/XXPermissions
|
// 权限请求框架:https://github.com/getActivity/XXPermissions
|
||||||
implementation 'com.github.getActivity:XXPermissions:20.0'
|
implementation 'com.github.getActivity:XXPermissions:20.0'
|
||||||
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'
|
||||||
|
|
||||||
implementation "androidx.room:room-runtime:2.4.0"
|
implementation "androidx.room:room-runtime:2.4.0"
|
||||||
//注释处理器加上Room
|
//注释处理器加上Room
|
||||||
|
|
|
@ -69,7 +69,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
*/
|
*/
|
||||||
private fun initNav() {
|
private fun initNav() {
|
||||||
appBarConfiguration = AppBarConfiguration(
|
appBarConfiguration = AppBarConfiguration(
|
||||||
setOf(R.id.mod_item, R.id.database_item, R.id.template_item),
|
setOf(R.id.mod_item),
|
||||||
viewBinding.drawerlayout
|
viewBinding.drawerlayout
|
||||||
)
|
)
|
||||||
val navController = findNavController(R.id.baseFragment)
|
val navController = findNavController(R.id.baseFragment)
|
||||||
|
@ -237,18 +237,12 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
*/
|
*/
|
||||||
private fun initNavigationMenu(isActive: Boolean = GlobalMethod.isActive) {
|
private fun initNavigationMenu(isActive: Boolean = GlobalMethod.isActive) {
|
||||||
val menu = viewBinding.navaiagtion.menu
|
val menu = viewBinding.navaiagtion.menu
|
||||||
val dataBase = menu.findItem(R.id.database_item)
|
|
||||||
val template = menu.findItem(R.id.template_item)
|
|
||||||
val codeTable = menu.findItem(R.id.code_table)
|
val codeTable = menu.findItem(R.id.code_table)
|
||||||
val gitHub = menu.findItem(R.id.github)
|
val gitHub = menu.findItem(R.id.github)
|
||||||
gitHub.setOnMenuItemClickListener {
|
gitHub.setOnMenuItemClickListener {
|
||||||
AppOperator.useBrowserAccessWebPage(this, "https://github.com/Cold-Mint/RustAssistant")
|
AppOperator.useBrowserAccessWebPage(this, "https://github.com/Cold-Mint/RustAssistant")
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
//管理可见性
|
|
||||||
dataBase.isVisible = isActive
|
|
||||||
template.isVisible = isActive
|
|
||||||
// help.isVisible = isActive
|
|
||||||
codeTable.isVisible = isActive
|
codeTable.isVisible = isActive
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
//数据库
|
//数据库
|
||||||
|
|
|
@ -2,36 +2,29 @@ package com.coldmint.rust.pro.adapters
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.pm.PackageInfo
|
import android.content.pm.PackageInfo
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import com.coldmint.rust.pro.R
|
|
||||||
import android.content.pm.PackageManager
|
|
||||||
import android.os.Build
|
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.ViewGroup
|
||||||
import android.widget.ImageView
|
|
||||||
import android.widget.PopupMenu
|
import android.widget.PopupMenu
|
||||||
import com.bumptech.glide.Glide
|
|
||||||
import com.coldmint.rust.pro.tool.AppSettings
|
|
||||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
|
||||||
import android.widget.TextView
|
|
||||||
import android.widget.Toast
|
|
||||||
import com.afollestad.materialdialogs.MaterialDialog
|
import com.afollestad.materialdialogs.MaterialDialog
|
||||||
import com.afollestad.materialdialogs.WhichButton
|
import com.afollestad.materialdialogs.WhichButton
|
||||||
import com.afollestad.materialdialogs.actions.setActionButtonEnabled
|
import com.afollestad.materialdialogs.actions.setActionButtonEnabled
|
||||||
import com.coldmint.rust.core.CompressionManager
|
import com.bumptech.glide.Glide
|
||||||
import com.coldmint.rust.core.GameSynchronizer
|
import com.coldmint.rust.core.GameSynchronizer
|
||||||
import com.coldmint.rust.core.interfaces.GameSynchronizerListener
|
import com.coldmint.rust.core.interfaces.GameSynchronizerListener
|
||||||
import com.coldmint.rust.core.interfaces.UnzipListener
|
|
||||||
import com.coldmint.rust.core.tool.AppOperator
|
import com.coldmint.rust.core.tool.AppOperator
|
||||||
|
import com.coldmint.rust.pro.R
|
||||||
import com.coldmint.rust.pro.base.BaseAdapter
|
import com.coldmint.rust.pro.base.BaseAdapter
|
||||||
import com.coldmint.rust.pro.databinding.ApplicationItemBinding
|
import com.coldmint.rust.pro.databinding.ApplicationItemBinding
|
||||||
|
import com.coldmint.rust.pro.tool.AppSettings
|
||||||
|
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
import kotlinx.coroutines.Dispatchers.IO
|
||||||
|
import kotlinx.coroutines.Dispatchers.Main
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.zip.ZipEntry
|
|
||||||
import kotlin.concurrent.thread
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 应用适配器
|
* 应用适配器
|
||||||
|
@ -42,15 +35,10 @@ class ApplicationListAdapter(
|
||||||
context: Context, dataList: MutableList<PackageInfo>
|
context: Context, dataList: MutableList<PackageInfo>
|
||||||
) : BaseAdapter<ApplicationItemBinding, PackageInfo>(context, dataList) {
|
) : BaseAdapter<ApplicationItemBinding, PackageInfo>(context, dataList) {
|
||||||
|
|
||||||
val handler: Handler by lazy {
|
private val materialDialog: MaterialDialog by lazy {
|
||||||
Handler(Looper.getMainLooper())
|
|
||||||
}
|
|
||||||
|
|
||||||
val materialDialog: MaterialDialog by lazy {
|
|
||||||
MaterialDialog(context)
|
MaterialDialog(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun getViewBindingObject(
|
override fun getViewBindingObject(
|
||||||
layoutInflater: LayoutInflater,
|
layoutInflater: LayoutInflater,
|
||||||
parent: ViewGroup,
|
parent: ViewGroup,
|
||||||
|
@ -116,40 +104,37 @@ class ApplicationListAdapter(
|
||||||
} else if (title == context.getString(R.string.application_information)) {
|
} else if (title == context.getString(R.string.application_information)) {
|
||||||
context.startActivity(AppOperator.openSettings(data.packageName))
|
context.startActivity(AppOperator.openSettings(data.packageName))
|
||||||
} else if (title == context.getString(R.string.exportApk)) {
|
} else if (title == context.getString(R.string.exportApk)) {
|
||||||
Thread {
|
CoroutineScope(IO).launch {
|
||||||
val gameSynchronizer = GameSynchronizer(context, data)
|
val gameSynchronizer = GameSynchronizer(context, data)
|
||||||
val folder = AppSettings.dataRootDirectory + "/apk"
|
val folder = AppSettings.dataRootDirectory + "/apk"
|
||||||
val apkFolder = File(folder)
|
val apkFolder = File(folder)
|
||||||
if (!apkFolder.exists()) {
|
if (!apkFolder.exists()) {
|
||||||
apkFolder.mkdirs()
|
apkFolder.mkdirs()
|
||||||
}
|
}
|
||||||
handler.post {
|
withContext(Main) {
|
||||||
try {
|
try {
|
||||||
materialDialog.show {
|
materialDialog.show {
|
||||||
title(R.string.export_apk_title).message(
|
title(R.string.export_apk_title)
|
||||||
R.string.export_apk_load
|
message(R.string.export_apk_load)
|
||||||
).positiveButton(R.string.dialog_close).cancelable(false)
|
positiveButton(R.string.dialog_close)
|
||||||
|
cancelable(false)
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val path = folder + "/" + appName + "_" + data.versionName + ".apk"
|
val path = folder + "/" + appName + "_" + data.versionName + ".apk"
|
||||||
val result =
|
val result = gameSynchronizer.exportApk(path)
|
||||||
gameSynchronizer.exportApk(path)
|
withContext(Main) {
|
||||||
if (result) {
|
if (result) {
|
||||||
handler.post {
|
|
||||||
materialDialog.message(
|
materialDialog.message(
|
||||||
text =
|
text = String.format(
|
||||||
String.format(
|
context.getString(R.string.export_apk_path),
|
||||||
context.getString(
|
path
|
||||||
R.string.export_apk_path
|
|
||||||
), path
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
} else {
|
||||||
} else {
|
|
||||||
handler.post {
|
|
||||||
try {
|
try {
|
||||||
materialDialog.dismiss()
|
materialDialog.dismiss()
|
||||||
Snackbar.make(
|
Snackbar.make(
|
||||||
|
@ -162,7 +147,7 @@ class ApplicationListAdapter(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.start()
|
}
|
||||||
} else if (title == context.getString(R.string.synchronous)) {
|
} else if (title == context.getString(R.string.synchronous)) {
|
||||||
val materialDialog = MaterialDialog(context).show {
|
val materialDialog = MaterialDialog(context).show {
|
||||||
title(text = appName).message(R.string.synchronous_ing)
|
title(text = appName).message(R.string.synchronous_ing)
|
||||||
|
|
|
@ -36,14 +36,5 @@ class BookmarkAdapter( context: Context, dataList: MutableList<Bookmark>) :
|
||||||
) {
|
) {
|
||||||
viewBinding.fileName.text = data.name
|
viewBinding.fileName.text = data.name
|
||||||
viewBinding.filePath.text = data.path
|
viewBinding.filePath.text = data.path
|
||||||
// holder.del.setOnClickListener {
|
|
||||||
// if (bookmarkListener != null) {
|
|
||||||
// if (bookmarkListener!!.onClickRemoveButton(holder.del, bookmark)) {
|
|
||||||
// arrayList.remove(bookmark)
|
|
||||||
// notifyItemRemoved(position)
|
|
||||||
// bookmarkListener!!.afterRemoveItem(arrayList.size)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,32 +0,0 @@
|
||||||
package com.coldmint.rust.pro.adapters
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import com.coldmint.rust.core.dataBean.WebTemplatePackageListData
|
|
||||||
import com.coldmint.rust.pro.base.BaseAdapter
|
|
||||||
import com.coldmint.rust.pro.databinding.ItemMyWebTemplateBinding
|
|
||||||
|
|
||||||
class MyWebTemplateAdapter(
|
|
||||||
context: Context,
|
|
||||||
dataList: MutableList<WebTemplatePackageListData.Data>
|
|
||||||
) : BaseAdapter<ItemMyWebTemplateBinding, WebTemplatePackageListData.Data>(context, dataList) {
|
|
||||||
override fun getViewBindingObject(
|
|
||||||
layoutInflater: LayoutInflater,
|
|
||||||
parent: ViewGroup,
|
|
||||||
viewType: Int
|
|
||||||
): ItemMyWebTemplateBinding {
|
|
||||||
return ItemMyWebTemplateBinding.inflate(layoutInflater, parent, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBingView(
|
|
||||||
data: WebTemplatePackageListData.Data,
|
|
||||||
viewBinding: ItemMyWebTemplateBinding,
|
|
||||||
viewHolder: ViewHolder<ItemMyWebTemplateBinding>,
|
|
||||||
position: Int
|
|
||||||
) {
|
|
||||||
viewBinding.timeView.text = data.modificationTime
|
|
||||||
viewBinding.titleView.text = data.getName()
|
|
||||||
viewBinding.subTitleView.text = data.describe
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,65 +0,0 @@
|
||||||
package com.coldmint.rust.pro.adapters
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import com.bumptech.glide.Glide
|
|
||||||
import com.coldmint.rust.core.dataBean.report.ReportItemDataBean
|
|
||||||
import com.coldmint.rust.core.web.ServerConfiguration
|
|
||||||
import com.coldmint.rust.pro.R
|
|
||||||
import com.coldmint.rust.pro.base.BaseAdapter
|
|
||||||
import com.coldmint.rust.pro.databinding.ItemReportBinding
|
|
||||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Cold Mint
|
|
||||||
* @date 2022/1/9 11:03
|
|
||||||
*/
|
|
||||||
class ReportAdapter(
|
|
||||||
context: Context,
|
|
||||||
dataList: MutableList<ReportItemDataBean.Data>
|
|
||||||
) :
|
|
||||||
BaseAdapter<ItemReportBinding, ReportItemDataBean.Data>(context, dataList) {
|
|
||||||
override fun getViewBindingObject(
|
|
||||||
layoutInflater: LayoutInflater,
|
|
||||||
parent: ViewGroup,
|
|
||||||
viewType: Int
|
|
||||||
): ItemReportBinding {
|
|
||||||
return ItemReportBinding.inflate(layoutInflater, parent, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBingView(
|
|
||||||
data: ReportItemDataBean.Data,
|
|
||||||
viewBinding: ItemReportBinding,
|
|
||||||
viewHolder: ViewHolder<ItemReportBinding>,
|
|
||||||
position: Int
|
|
||||||
) {
|
|
||||||
val headIcon = data.headIcon
|
|
||||||
if (headIcon != null) {
|
|
||||||
Glide.with(context).load(ServerConfiguration.getRealLink(headIcon))
|
|
||||||
.apply(GlobalMethod.getRequestOptions(true))
|
|
||||||
.into(viewBinding.headIconView)
|
|
||||||
}
|
|
||||||
viewBinding.timeView.text = data.time
|
|
||||||
viewBinding.nameView.text = data.userName
|
|
||||||
viewBinding.openView.text =
|
|
||||||
context.getString(R.string.view_the_report_object)
|
|
||||||
when (data.type) {
|
|
||||||
"mod" -> {
|
|
||||||
viewBinding.typeView.setText(R.string.report_mod)
|
|
||||||
viewBinding.actionView.setText(R.string.sold_out_mod)
|
|
||||||
viewBinding.openView.setOnClickListener {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"user" -> {
|
|
||||||
viewBinding.typeView.setText(R.string.report_user)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
viewBinding.textview.text = data.why
|
|
||||||
viewBinding.describeView.text = data.describe
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,56 +0,0 @@
|
||||||
package com.coldmint.rust.pro.adapters
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import com.afollestad.materialdialogs.MaterialDialog
|
|
||||||
import com.bumptech.glide.Glide
|
|
||||||
import com.bumptech.glide.request.RequestOptions
|
|
||||||
import com.coldmint.rust.pro.R
|
|
||||||
import com.coldmint.rust.pro.base.BaseAdapter
|
|
||||||
import com.coldmint.rust.pro.databinding.ScreenshotItemBinding
|
|
||||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Cold Mint
|
|
||||||
* @date 2021/11/20 18:38
|
|
||||||
*/
|
|
||||||
class ScreenshotAdapter( context: Context, dataList: ArrayList<String>) :
|
|
||||||
BaseAdapter<ScreenshotItemBinding, String>(context, dataList) {
|
|
||||||
|
|
||||||
|
|
||||||
override fun getViewBindingObject(
|
|
||||||
layoutInflater: LayoutInflater,
|
|
||||||
parent: ViewGroup,
|
|
||||||
viewType: Int
|
|
||||||
): ScreenshotItemBinding {
|
|
||||||
return ScreenshotItemBinding.inflate(layoutInflater, parent, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBingView(
|
|
||||||
data: String,
|
|
||||||
viewBinding: ScreenshotItemBinding,
|
|
||||||
viewHolder: ViewHolder<ScreenshotItemBinding>,
|
|
||||||
position: Int
|
|
||||||
) {
|
|
||||||
Glide.with(context).load(data).apply(GlobalMethod.getRequestOptions())
|
|
||||||
.into(viewBinding.imageView)
|
|
||||||
viewBinding.imageView.setOnLongClickListener {
|
|
||||||
MaterialDialog(context).show {
|
|
||||||
title(R.string.remove).message(
|
|
||||||
text = String.format(
|
|
||||||
it.context.getString(R.string.remove_image_item),
|
|
||||||
data
|
|
||||||
)
|
|
||||||
).positiveButton(R.string.dialog_ok) {
|
|
||||||
removeItem(viewHolder.adapterPosition)
|
|
||||||
}.negativeButton(R.string.dialog_cancel).cancelable(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
return@setOnLongClickListener true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,32 +1,29 @@
|
||||||
package com.coldmint.rust.pro.adapters
|
package com.coldmint.rust.pro.adapters
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.text.Editable
|
import android.text.Editable
|
||||||
import android.text.Html
|
import android.text.Html
|
||||||
import android.text.TextWatcher
|
import android.text.TextWatcher
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import org.json.JSONArray
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.*
|
import android.widget.AdapterView
|
||||||
|
import android.widget.ArrayAdapter
|
||||||
|
import android.widget.EditText
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.viewbinding.ViewBinding
|
|
||||||
import com.coldmint.rust.pro.R
|
|
||||||
import com.afollestad.materialdialogs.MaterialDialog
|
import com.afollestad.materialdialogs.MaterialDialog
|
||||||
import com.afollestad.materialdialogs.customview.customView
|
import com.afollestad.materialdialogs.customview.customView
|
||||||
import com.coldmint.rust.core.tool.LineParser
|
import com.coldmint.rust.core.tool.LineParser
|
||||||
|
import com.coldmint.rust.pro.R
|
||||||
import com.coldmint.rust.pro.base.BaseAdapter
|
import com.coldmint.rust.pro.base.BaseAdapter
|
||||||
import com.coldmint.rust.pro.databean.CodeData
|
import com.coldmint.rust.pro.databean.CodeData
|
||||||
import com.coldmint.rust.pro.databinding.AddActionDialogBinding
|
import com.coldmint.rust.pro.databinding.AddActionDialogBinding
|
||||||
import com.coldmint.rust.pro.databinding.MarkItemBinding
|
import com.coldmint.rust.pro.databinding.MarkItemBinding
|
||||||
import com.google.gson.JsonObject
|
import org.json.JSONArray
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.util.ArrayList
|
|
||||||
|
|
||||||
|
|
||||||
//模板制作适配器
|
//模板制作适配器
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
package com.coldmint.rust.pro.adapters
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.view.View
|
|
||||||
import androidx.viewpager.widget.PagerAdapter
|
|
||||||
import android.view.ViewGroup
|
|
||||||
|
|
||||||
class TemplateMakerPagerAdapter(
|
|
||||||
private val context: Context,
|
|
||||||
private val titleId: IntArray,
|
|
||||||
private val views: Array<ViewGroup>
|
|
||||||
) : PagerAdapter() {
|
|
||||||
override fun instantiateItem(container: ViewGroup, position: Int): Any {
|
|
||||||
container.addView(views[position])
|
|
||||||
return views[position]
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
|
|
||||||
container.removeView(views[position])
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getCount(): Int {
|
|
||||||
return views.size
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun isViewFromObject(view: View, `object`: Any): Boolean {
|
|
||||||
return view === `object`
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getPageTitle(position: Int): CharSequence {
|
|
||||||
return context.getText(titleId[position])
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package com.coldmint.rust.pro.adapters
|
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
import androidx.fragment.app.FragmentActivity
|
|
||||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
|
||||||
import com.coldmint.rust.pro.fragments.LocalTemplateFragment
|
|
||||||
import com.coldmint.rust.pro.fragments.NetworkTemplateFragment
|
|
||||||
import com.coldmint.rust.pro.fragments.NullFragment
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模板页面适配器
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
class TemplatePageAdapter(fragmentActivity: FragmentActivity) :
|
|
||||||
FragmentStateAdapter(fragmentActivity) {
|
|
||||||
override fun getItemCount(): Int {
|
|
||||||
return 2
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun createFragment(position: Int): Fragment {
|
|
||||||
return if (position == 0){
|
|
||||||
LocalTemplateFragment()
|
|
||||||
}else{
|
|
||||||
NetworkTemplateFragment()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -12,7 +12,7 @@ import com.google.android.material.checkbox.MaterialCheckBox
|
||||||
class TemplateSelectAdapter(context: Context, dataList: MutableList<TemplatePackage>) :
|
class TemplateSelectAdapter(context: Context, dataList: MutableList<TemplatePackage>) :
|
||||||
BaseAdapter<ItemTemplateSelectBinding, TemplatePackage>(context, dataList) {
|
BaseAdapter<ItemTemplateSelectBinding, TemplatePackage>(context, dataList) {
|
||||||
private val selectedTemplateList: ArrayList<SelectedTemplate> by lazy {
|
private val selectedTemplateList: ArrayList<SelectedTemplate> by lazy {
|
||||||
ArrayList<SelectedTemplate>()
|
ArrayList()
|
||||||
}
|
}
|
||||||
|
|
||||||
private var change: ((Int) -> Unit)? = null
|
private var change: ((Int) -> Unit)? = null
|
||||||
|
|
|
@ -1,22 +1,19 @@
|
||||||
package com.coldmint.rust.pro.adapters
|
package com.coldmint.rust.pro.adapters
|
||||||
|
|
||||||
import com.coldmint.rust.core.SourceFile
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import com.coldmint.rust.pro.R
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
import com.coldmint.rust.pro.tool.AppSettings
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.request.RequestOptions
|
import com.coldmint.rust.core.SourceFile
|
||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
import com.coldmint.rust.pro.R
|
||||||
import com.coldmint.rust.pro.base.BaseAdapter
|
import com.coldmint.rust.pro.base.BaseAdapter
|
||||||
import com.coldmint.rust.pro.databinding.UnitItemBinding
|
import com.coldmint.rust.pro.databinding.UnitItemBinding
|
||||||
|
import com.coldmint.rust.pro.tool.AppSettings
|
||||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||||
import me.zhanghai.android.fastscroll.PopupTextProvider
|
import me.zhanghai.android.fastscroll.PopupTextProvider
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.Locale
|
||||||
import kotlin.Exception
|
|
||||||
|
|
||||||
class UnitAdapter(
|
class UnitAdapter(
|
||||||
context: Context,
|
context: Context,
|
||||||
|
@ -32,7 +29,7 @@ class UnitAdapter(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val formatter = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
|
private val formatter = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
|
||||||
|
|
||||||
init {
|
init {
|
||||||
dataList.sortBy {
|
dataList.sortBy {
|
||||||
|
@ -73,12 +70,15 @@ class UnitAdapter(
|
||||||
val imageView = viewBinding.iconView
|
val imageView = viewBinding.iconView
|
||||||
val path = sourceFile.getIcon()
|
val path = sourceFile.getIcon()
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
Glide.with(context).load(path).apply(GlobalMethod.getRequestOptions()).into(imageView)
|
Glide.with(context).load(path).apply(GlobalMethod.getRequestOptions())
|
||||||
|
.into(imageView)
|
||||||
} else {
|
} else {
|
||||||
Glide.with(context).load( GlobalMethod.tintDrawable(
|
Glide.with(context).load(
|
||||||
context.getDrawable(R.drawable.image),
|
GlobalMethod.tintDrawable(
|
||||||
ColorStateList.valueOf(GlobalMethod.getColorPrimary(context))
|
context.getDrawable(R.drawable.image),
|
||||||
)).apply(GlobalMethod.getRequestOptions().override(200)).into(imageView)
|
ColorStateList.valueOf(GlobalMethod.getColorPrimary(context))
|
||||||
|
)
|
||||||
|
).apply(GlobalMethod.getRequestOptions().override(200)).into(imageView)
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
viewBinding.unitDescribeView.text = e.toString()
|
viewBinding.unitDescribeView.text = e.toString()
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
package com.coldmint.rust.pro.adapters
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import com.bumptech.glide.Glide
|
|
||||||
import com.bumptech.glide.request.RequestOptions
|
|
||||||
import com.coldmint.rust.core.dataBean.follow.FollowUserListData
|
|
||||||
import com.coldmint.rust.core.web.ServerConfiguration
|
|
||||||
import com.coldmint.rust.pro.R
|
|
||||||
import com.coldmint.rust.pro.base.BaseAdapter
|
|
||||||
import com.coldmint.rust.pro.databinding.ItemUserHeadBinding
|
|
||||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Cold Mint
|
|
||||||
* @date 2021/12/28 10:59
|
|
||||||
*/
|
|
||||||
class UserHeadAdapter( context: Context, list: MutableList<FollowUserListData.Data>) :
|
|
||||||
BaseAdapter<ItemUserHeadBinding, FollowUserListData.Data>(context, list) {
|
|
||||||
override fun getViewBindingObject(
|
|
||||||
layoutInflater: LayoutInflater,
|
|
||||||
parent: ViewGroup,
|
|
||||||
viewType: Int
|
|
||||||
): ItemUserHeadBinding {
|
|
||||||
return ItemUserHeadBinding.inflate(layoutInflater, parent, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBingView(
|
|
||||||
data: FollowUserListData.Data,
|
|
||||||
viewBinding: ItemUserHeadBinding,
|
|
||||||
viewHolder: ViewHolder<ItemUserHeadBinding>,
|
|
||||||
position: Int
|
|
||||||
) {
|
|
||||||
val account = data.account
|
|
||||||
if (account.isBlank()) {
|
|
||||||
viewBinding.headIconView.setImageResource(R.drawable.all_dynamic)
|
|
||||||
} else {
|
|
||||||
val headIcon = data.headIcon
|
|
||||||
if (headIcon != null) {
|
|
||||||
Glide.with(context).load(ServerConfiguration.getRealLink(headIcon))
|
|
||||||
.into(viewBinding.headIconView)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
viewBinding.nameView.text = data.userName
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -25,17 +25,17 @@ class ValueAdapter(context: Context, dataList: ArrayList<ValueTypeDataBean>) :
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBingView(
|
override fun onBingView(
|
||||||
typeDataBean: ValueTypeDataBean,
|
data: ValueTypeDataBean,
|
||||||
viewBinding: ValueItemBinding,
|
viewBinding: ValueItemBinding,
|
||||||
viewHolder: ViewHolder<ValueItemBinding>,
|
viewHolder: ViewHolder<ValueItemBinding>,
|
||||||
position: Int
|
position: Int
|
||||||
) {
|
) {
|
||||||
val title = StringBuilder()
|
val title = StringBuilder()
|
||||||
title.append(typeDataBean.name)
|
title.append(data.name)
|
||||||
title.append('(')
|
title.append('(')
|
||||||
title.append(typeDataBean.type)
|
title.append(data.type)
|
||||||
title.append(')')
|
title.append(')')
|
||||||
val scope = typeDataBean.scope
|
val scope = data.scope
|
||||||
val context = viewBinding.scopeView.context
|
val context = viewBinding.scopeView.context
|
||||||
var showData: String? = null
|
var showData: String? = null
|
||||||
var scopeTitle: String? = null
|
var scopeTitle: String? = null
|
||||||
|
@ -67,7 +67,7 @@ class ValueAdapter(context: Context, dataList: ArrayList<ValueTypeDataBean>) :
|
||||||
.setPositiveButton(R.string.dialog_ok, null).show()
|
.setPositiveButton(R.string.dialog_ok, null).show()
|
||||||
}
|
}
|
||||||
viewBinding.titleView.text = title.toString()
|
viewBinding.titleView.text = title.toString()
|
||||||
viewBinding.descriptionView.text = typeDataBean.describe
|
viewBinding.descriptionView.text = data.describe
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package com.coldmint.rust.pro.adapters
|
package com.coldmint.rust.pro.adapters
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||||
import com.coldmint.rust.pro.fragments.*
|
import com.coldmint.rust.pro.fragments.MapFragment
|
||||||
|
import com.coldmint.rust.pro.fragments.ModFragment
|
||||||
|
import com.coldmint.rust.pro.fragments.NullFragment
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Cold Mint
|
* @author Cold Mint
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
package com.coldmint.rust.pro.adapters
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import com.bumptech.glide.Glide
|
|
||||||
import com.coldmint.rust.core.dataBean.mod.WebModListData
|
|
||||||
import com.coldmint.rust.core.web.ServerConfiguration
|
|
||||||
import com.coldmint.rust.core.web.WebMod
|
|
||||||
import com.coldmint.rust.pro.R
|
|
||||||
import com.coldmint.rust.pro.base.BaseAdapter
|
|
||||||
import com.coldmint.rust.pro.databinding.WebModItemBinding
|
|
||||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
|
||||||
import me.zhanghai.android.fastscroll.PopupTextProvider
|
|
||||||
|
|
||||||
class WebModAdapter( context: Context, dataList: MutableList<WebModListData.Data>) :
|
|
||||||
BaseAdapter<WebModItemBinding, WebModListData.Data>(context, dataList) , PopupTextProvider {
|
|
||||||
|
|
||||||
override fun getViewBindingObject(
|
|
||||||
layoutInflater: LayoutInflater,
|
|
||||||
parent: ViewGroup,
|
|
||||||
viewType: Int
|
|
||||||
): WebModItemBinding {
|
|
||||||
return WebModItemBinding.inflate(layoutInflater, parent, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBingView(
|
|
||||||
data: WebModListData.Data,
|
|
||||||
viewBinding: WebModItemBinding,
|
|
||||||
viewHolder: BaseAdapter.ViewHolder<WebModItemBinding>,
|
|
||||||
position: Int
|
|
||||||
) {
|
|
||||||
viewBinding.modNameView.text = data.name
|
|
||||||
viewBinding.modIntroductionView.text = data.describe
|
|
||||||
viewBinding.modInfo.text = String.format(
|
|
||||||
context.getString(R.string.web_mod_info),
|
|
||||||
data.updateTime,
|
|
||||||
data.downloadNumber
|
|
||||||
)
|
|
||||||
|
|
||||||
val icon = data.icon
|
|
||||||
if (icon != null && icon.isNotBlank()) {
|
|
||||||
val path: String = ServerConfiguration.getRealLink(icon)
|
|
||||||
Glide.with(context).load(path).apply(GlobalMethod.getRequestOptions())
|
|
||||||
.into(viewBinding.modIcon)
|
|
||||||
}else{
|
|
||||||
viewBinding.modIcon.setImageResource(R.drawable.image)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getPopupText(position: Int): String {
|
|
||||||
return dataList[position].downloadNumber.toString()
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,46 +0,0 @@
|
||||||
package com.coldmint.rust.pro.adapters
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import com.coldmint.rust.core.dataBean.WebTemplatePackageListData
|
|
||||||
import com.coldmint.rust.pro.R
|
|
||||||
import com.coldmint.rust.pro.base.BaseAdapter
|
|
||||||
import com.coldmint.rust.pro.databinding.ItemWebTemplateBinding
|
|
||||||
import me.zhanghai.android.fastscroll.PopupTextProvider
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 网络模板适配器
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
class WebTemplateAdapter(context: Context, dataList: MutableList<WebTemplatePackageListData.Data>) :
|
|
||||||
BaseAdapter<ItemWebTemplateBinding, WebTemplatePackageListData.Data>(context, dataList),
|
|
||||||
PopupTextProvider {
|
|
||||||
override fun getViewBindingObject(
|
|
||||||
layoutInflater: LayoutInflater,
|
|
||||||
parent: ViewGroup,
|
|
||||||
viewType: Int
|
|
||||||
): ItemWebTemplateBinding {
|
|
||||||
return ItemWebTemplateBinding.inflate(layoutInflater, parent, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBingView(
|
|
||||||
data: WebTemplatePackageListData.Data,
|
|
||||||
viewBinding: ItemWebTemplateBinding,
|
|
||||||
viewHolder: ViewHolder<ItemWebTemplateBinding>,
|
|
||||||
position: Int
|
|
||||||
) {
|
|
||||||
viewBinding.titleView.text = data.getName()
|
|
||||||
viewBinding.describeView.text = data.describe
|
|
||||||
viewBinding.infoView.text = data.modificationTime
|
|
||||||
if (data.subscribe){
|
|
||||||
viewBinding.button.setText(R.string.de_subscription)
|
|
||||||
}else{
|
|
||||||
viewBinding.button.setText(R.string.subscription)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getPopupText(position: Int): String {
|
|
||||||
return getInitial(dataList[position].getName()).toString()
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
package com.coldmint.rust.pro.databean
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Cold Mint
|
|
||||||
* @date 2021/11/29 22:36
|
|
||||||
*/
|
|
||||||
data class CommunityServiceInfo(
|
|
||||||
val titleRes: Int,
|
|
||||||
val iconRes: Int
|
|
||||||
) {
|
|
||||||
}
|
|
|
@ -31,12 +31,11 @@ data class ErrorInfo(
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
fun getLogFile(): File {
|
fun getLogFile(): File {
|
||||||
if (logFile == null)
|
if (logFile == null) {
|
||||||
{
|
|
||||||
val filePath = StringBuilder()
|
val filePath = StringBuilder()
|
||||||
filePath.append(AppSettings.dataRootDirectory)
|
filePath.append(AppSettings.dataRootDirectory)
|
||||||
filePath.append("/carsh/")
|
filePath.append("/carsh/")
|
||||||
val folderFormatter = SimpleDateFormat("yyyy-MM-dd")
|
val folderFormatter = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
|
||||||
val folderName = folderFormatter.format(nowTime)
|
val folderName = folderFormatter.format(nowTime)
|
||||||
filePath.append(folderName)
|
filePath.append(folderName)
|
||||||
val folder = File(filePath.toString())
|
val folder = File(filePath.toString())
|
||||||
|
@ -44,7 +43,7 @@ data class ErrorInfo(
|
||||||
folder.mkdirs()
|
folder.mkdirs()
|
||||||
}
|
}
|
||||||
filePath.append("/")
|
filePath.append("/")
|
||||||
val dateFormat = SimpleDateFormat("HH-mm-ss")
|
val dateFormat = SimpleDateFormat("HH-mm-ss", Locale.getDefault())
|
||||||
val fileName = dateFormat.format(nowTime)
|
val fileName = dateFormat.format(nowTime)
|
||||||
filePath.append(fileName)
|
filePath.append(fileName)
|
||||||
filePath.append(".log")
|
filePath.append(".log")
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
package com.coldmint.rust.pro.databean
|
|
||||||
|
|
||||||
data class FunctionInfo(val name: String, val describe: String? = null, val iconRes: Int? = null)
|
|
|
@ -1,9 +0,0 @@
|
||||||
package com.coldmint.rust.pro.databean
|
|
||||||
data class LocaTion(var i: Int, var p: Int,
|
|
||||||
var text: List<String>){
|
|
||||||
lateinit var listInt : List<Int>
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
package com.coldmint.rust.pro.databean
|
|
||||||
|
|
||||||
class ThemeInfo
|
|
||||||
/**
|
|
||||||
* 封装主题信息类
|
|
||||||
*
|
|
||||||
* @param name 名称
|
|
||||||
* @param id 主题id
|
|
||||||
* @param mainColor 主要颜色
|
|
||||||
*/(val name: String, val id: Int, val mainColor: String) {
|
|
||||||
private var mDisplaysName: String? = null
|
|
||||||
/**
|
|
||||||
* 获取显示名称,若未设置显示名称则返回名称。
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* 设置显示名称
|
|
||||||
*
|
|
||||||
* @param displaysName
|
|
||||||
*/
|
|
||||||
var displaysName: String?
|
|
||||||
get() = if (mDisplaysName == null) {
|
|
||||||
name
|
|
||||||
} else {
|
|
||||||
mDisplaysName
|
|
||||||
}
|
|
||||||
set(displaysName) {
|
|
||||||
mDisplaysName = displaysName
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
package com.coldmint.rust.pro.databean
|
|
||||||
|
|
||||||
data class UserGroupData(val iconRes: Int, val titleRes: Int)
|
|
|
@ -1,66 +0,0 @@
|
||||||
package com.coldmint.rust.pro.fragments
|
|
||||||
|
|
||||||
import android.content.Intent
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
|
||||||
import com.coldmint.rust.core.dataBean.WebTemplatePackageListData
|
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
|
||||||
import com.coldmint.rust.core.web.TemplatePhp
|
|
||||||
import com.coldmint.rust.pro.NetworkTemplatePackageDetailsActivity
|
|
||||||
import com.coldmint.rust.pro.adapters.MyWebTemplateAdapter
|
|
||||||
import com.coldmint.rust.pro.base.BaseFragment
|
|
||||||
import com.coldmint.rust.pro.databinding.FragmentNetworkTemplateBinding
|
|
||||||
import com.coldmint.rust.pro.tool.AppSettings
|
|
||||||
import com.coldmint.rust.pro.ui.StableLinearLayoutManager
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 网络模板管理器
|
|
||||||
*/
|
|
||||||
class NetworkTemplateFragment : BaseFragment<FragmentNetworkTemplateBinding>() {
|
|
||||||
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
|
||||||
viewBinding.recyclerView.layoutManager = StableLinearLayoutManager(requireContext())
|
|
||||||
loadList()
|
|
||||||
viewBinding.swipeRefreshLayout.setOnRefreshListener {
|
|
||||||
loadList()
|
|
||||||
viewBinding.swipeRefreshLayout.isRefreshing = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun loadList() {
|
|
||||||
val token = ""
|
|
||||||
TemplatePhp.instance.getTemplatePackageList(token,
|
|
||||||
object : ApiCallBack<WebTemplatePackageListData> {
|
|
||||||
override fun onResponse(t: WebTemplatePackageListData) {
|
|
||||||
if (t.data != null) {
|
|
||||||
val adapter =
|
|
||||||
MyWebTemplateAdapter(requireContext(), t.data)
|
|
||||||
adapter.setItemEvent { i, itemMyWebTemplateBinding, viewHolder, data ->
|
|
||||||
itemMyWebTemplateBinding.root.setOnClickListener {
|
|
||||||
val intent = Intent(
|
|
||||||
requireContext(),
|
|
||||||
NetworkTemplatePackageDetailsActivity::class.java
|
|
||||||
)
|
|
||||||
intent.putExtra("id", data.id)
|
|
||||||
startActivity(intent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
viewBinding.recyclerView.adapter = adapter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
loadList()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentNetworkTemplateBinding {
|
|
||||||
return FragmentNetworkTemplateBinding.inflate(layoutInflater)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,159 +0,0 @@
|
||||||
package com.coldmint.rust.pro.fragments
|
|
||||||
|
|
||||||
import android.content.Intent
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.core.view.isVisible
|
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
|
||||||
import com.coldmint.dialog.CoreDialog
|
|
||||||
import com.coldmint.rust.core.dataBean.ApiResponse
|
|
||||||
import com.coldmint.rust.core.dataBean.WebTemplatePackageListData
|
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
|
||||||
import com.coldmint.rust.core.web.ServerConfiguration
|
|
||||||
import com.coldmint.rust.core.web.TemplatePhp
|
|
||||||
import com.coldmint.rust.pro.NetworkTemplatePackageDetailsActivity
|
|
||||||
import com.coldmint.rust.pro.R
|
|
||||||
import com.coldmint.rust.pro.adapters.WebTemplateAdapter
|
|
||||||
import com.coldmint.rust.pro.base.BaseFragment
|
|
||||||
import com.coldmint.rust.pro.databinding.FragmentTemplateCommunityBinding
|
|
||||||
import com.coldmint.rust.pro.tool.AppSettings
|
|
||||||
import com.coldmint.rust.pro.ui.StableLinearLayoutManager
|
|
||||||
import com.google.android.material.divider.MaterialDividerItemDecoration
|
|
||||||
import me.zhanghai.android.fastscroll.FastScrollerBuilder
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模板社区
|
|
||||||
*/
|
|
||||||
class TemplateCommunityFragment : BaseFragment<FragmentTemplateCommunityBinding>() {
|
|
||||||
val token = ""
|
|
||||||
|
|
||||||
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
|
||||||
val divider = MaterialDividerItemDecoration(
|
|
||||||
requireContext(),
|
|
||||||
MaterialDividerItemDecoration.VERTICAL
|
|
||||||
)
|
|
||||||
viewBinding.recyclerView.addItemDecoration(
|
|
||||||
divider
|
|
||||||
)
|
|
||||||
|
|
||||||
viewBinding.recyclerView.layoutManager = StableLinearLayoutManager(requireContext())
|
|
||||||
loadData()
|
|
||||||
viewBinding.swipeRefreshLayout.setOnRefreshListener {
|
|
||||||
loadData()
|
|
||||||
viewBinding.swipeRefreshLayout.isRefreshing = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fun loadData() {
|
|
||||||
TemplatePhp.instance.getPublicTemplatePackageList(token, object :
|
|
||||||
ApiCallBack<WebTemplatePackageListData> {
|
|
||||||
override fun onResponse(t: WebTemplatePackageListData) {
|
|
||||||
if (!isAdded){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
viewBinding.swipeRefreshLayout.isVisible = true
|
|
||||||
viewBinding.loadView.isVisible = false
|
|
||||||
viewBinding.errorLayout.isVisible = false
|
|
||||||
if (t.data != null) {
|
|
||||||
val adapter = WebTemplateAdapter(requireContext(), t.data!!)
|
|
||||||
adapter.setItemEvent { i, itemWebTemplateBinding, viewHolder, data ->
|
|
||||||
itemWebTemplateBinding.root.setOnClickListener {
|
|
||||||
val intent = Intent(
|
|
||||||
requireContext(),
|
|
||||||
NetworkTemplatePackageDetailsActivity::class.java
|
|
||||||
)
|
|
||||||
intent.putExtra("id", data.id)
|
|
||||||
intent.putExtra("createDirectory", data.id)
|
|
||||||
startActivity(intent)
|
|
||||||
}
|
|
||||||
itemWebTemplateBinding.button.setOnClickListener {
|
|
||||||
var subscribe = data.subscribe
|
|
||||||
if (subscribe) {
|
|
||||||
CoreDialog(requireContext()).setTitle(R.string.de_subscription)
|
|
||||||
.setMessage(
|
|
||||||
String.format(
|
|
||||||
getString(R.string.de_subscription_msg),
|
|
||||||
data.getName()
|
|
||||||
)
|
|
||||||
).setPositiveButton(R.string.dialog_ok) {
|
|
||||||
//退订
|
|
||||||
TemplatePhp.instance.deleteSubscription(token, data.id,
|
|
||||||
object : ApiCallBack<ApiResponse> {
|
|
||||||
override fun onResponse(t: ApiResponse) {
|
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
|
||||||
itemWebTemplateBinding.button.setText(R.string.subscription)
|
|
||||||
data.subscribe = false
|
|
||||||
} else {
|
|
||||||
Toast.makeText(
|
|
||||||
requireContext(),
|
|
||||||
t.message,
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
Toast.makeText(
|
|
||||||
requireContext(),
|
|
||||||
R.string.network_error,
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}.setNegativeButton(R.string.dialog_cancel) {
|
|
||||||
|
|
||||||
}.setCancelable(false).show()
|
|
||||||
} else {
|
|
||||||
TemplatePhp.instance.subscription(token, data.id,
|
|
||||||
object : ApiCallBack<ApiResponse> {
|
|
||||||
override fun onResponse(t: ApiResponse) {
|
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
|
||||||
itemWebTemplateBinding.button.setText(R.string.de_subscription)
|
|
||||||
data.subscribe = true
|
|
||||||
} else {
|
|
||||||
Toast.makeText(
|
|
||||||
requireContext(),
|
|
||||||
t.message,
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
Toast.makeText(
|
|
||||||
requireContext(),
|
|
||||||
R.string.network_error,
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
viewBinding.recyclerView.adapter = adapter
|
|
||||||
FastScrollerBuilder(viewBinding.recyclerView).useMd2Style()
|
|
||||||
.setPopupTextProvider(adapter).build()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
viewBinding.loadView.isVisible = false
|
|
||||||
viewBinding.errorLayout.isVisible = true
|
|
||||||
viewBinding.swipeRefreshLayout.isVisible = false
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentTemplateCommunityBinding {
|
|
||||||
return FragmentTemplateCommunityBinding.inflate(layoutInflater)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
package com.coldmint.rust.pro.fragments
|
|
||||||
|
|
||||||
import android.content.Intent
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import com.coldmint.rust.pro.CreationWizardActivity
|
|
||||||
import com.coldmint.rust.pro.R
|
|
||||||
import com.coldmint.rust.pro.adapters.TemplatePageAdapter
|
|
||||||
import com.coldmint.rust.pro.base.BaseFragment
|
|
||||||
import com.coldmint.rust.pro.databinding.FragmentTemplateBinding
|
|
||||||
import com.google.android.material.tabs.TabLayoutMediator
|
|
||||||
|
|
||||||
class TemplateFragment : BaseFragment<FragmentTemplateBinding>() {
|
|
||||||
private val adapter: TemplatePageAdapter by lazy {
|
|
||||||
TemplatePageAdapter(requireActivity())
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
|
||||||
viewBinding.viewPager2.adapter = adapter
|
|
||||||
viewBinding.viewPager2.isSaveEnabled = false
|
|
||||||
loadTab()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun loadTab() {
|
|
||||||
// val mainActivity = requireActivity() as MainActivity
|
|
||||||
|
|
||||||
TabLayoutMediator(viewBinding.tabLayout, viewBinding.viewPager2)
|
|
||||||
{ tab, position ->
|
|
||||||
when (position) {
|
|
||||||
0 -> {
|
|
||||||
tab.text = getText(R.string.local)
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> {
|
|
||||||
tab.text = getText(R.string.network)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.attach()
|
|
||||||
|
|
||||||
viewBinding.mainButton.setOnClickListener {
|
|
||||||
val intent = Intent(context, CreationWizardActivity::class.java)
|
|
||||||
intent.putExtra("type", "template")
|
|
||||||
startActivity(intent)
|
|
||||||
}
|
|
||||||
/* } else {
|
|
||||||
viewBinding.viewPager2.postDelayed({ loadTab() }, MainActivity.linkInterval)
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentTemplateBinding {
|
|
||||||
return FragmentTemplateBinding.inflate(layoutInflater)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
package com.coldmint.rust.pro.interfaces
|
|
||||||
|
|
||||||
import com.coldmint.rust.pro.databean.ThemeInfo
|
|
||||||
|
|
||||||
|
|
||||||
interface ThemeItemListener {
|
|
||||||
/**
|
|
||||||
* 当选中主题更改
|
|
||||||
*
|
|
||||||
* @param info 主题信息
|
|
||||||
*/
|
|
||||||
fun whenUseTheme(info: ThemeInfo)
|
|
||||||
}
|
|
|
@ -25,8 +25,8 @@ object AppSettings {
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
val dataRootDirectory =
|
val dataRootDirectory =
|
||||||
Environment.getExternalStorageDirectory().absolutePath + "/rustAssistant"
|
Environment.getExternalStorageDirectory().absolutePath + "/rustAssistantLite"
|
||||||
val Locale_Russia = Locale("RU", "ru", "")
|
private val Locale_Russia = Locale("RU", "ru", "")
|
||||||
|
|
||||||
private val mFileName: String by lazy {
|
private val mFileName: String by lazy {
|
||||||
mApplication.packageName + "_preferences"
|
mApplication.packageName + "_preferences"
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="200dp"
|
|
||||||
android:height="200dp"
|
|
||||||
android:viewportWidth="1024"
|
|
||||||
android:viewportHeight="1024">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M870.4,57.6C780.8,19.2 652.8,0 512,0 371.2,0 243.2,19.2 153.6,57.6 51.2,102.4 0,153.6 0,211.2l0,595.2c0,57.6 51.2,115.2 153.6,153.6C243.2,1004.8 371.2,1024 512,1024c140.8,0 268.8,-19.2 358.4,-57.6 96,-38.4 153.6,-96 153.6,-153.6L1024,211.2C1024,153.6 972.8,102.4 870.4,57.6L870.4,57.6zM812.8,320C729.6,352 614.4,364.8 512,364.8 403.2,364.8 294.4,352 211.2,320 115.2,294.4 70.4,256 70.4,211.2c0,-38.4 51.2,-76.8 140.8,-108.8C294.4,76.8 403.2,64 512,64c102.4,0 217.6,19.2 300.8,44.8 89.6,32 140.8,70.4 140.8,108.8C953.6,256 908.8,294.4 812.8,320L812.8,320zM819.2,505.6C736,531.2 620.8,550.4 512,550.4c-108.8,0 -217.6,-19.2 -307.2,-44.8C115.2,473.6 64,435.2 64,396.8L64,326.4C128,352 172.8,384 243.2,396.8 326.4,416 416,428.8 512,428.8c96,0 185.6,-12.8 268.8,-32C851.2,384 896,352 960,326.4l0,76.8C960,435.2 908.8,473.6 819.2,505.6L819.2,505.6zM819.2,710.4c-83.2,25.6 -198.4,44.8 -307.2,44.8 -108.8,0 -217.6,-19.2 -307.2,-44.8C115.2,684.8 64,646.4 64,601.6L64,505.6c64,32 108.8,57.6 179.2,76.8C326.4,601.6 416,614.4 512,614.4c96,0 185.6,-12.8 268.8,-32C851.2,563.2 896,537.6 960,505.6l0,96C960,646.4 908.8,684.8 819.2,710.4L819.2,710.4zM512,960c-108.8,0 -217.6,-19.2 -307.2,-44.8C115.2,889.6 64,851.2 64,812.8l0,-96c64,32 108.8,57.6 179.2,76.8 76.8,19.2 172.8,32 262.4,32 96,0 185.6,-12.8 268.8,-32 76.8,-19.2 121.6,-44.8 185.6,-76.8l0,96c0,38.4 -51.2,76.8 -140.8,108.8C736,947.2 614.4,960 512,960L512,960zM512,960"/>
|
|
||||||
</vector>
|
|
|
@ -1,23 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
|
|
||||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
|
||||||
android:id="@+id/swipeRefreshLayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_marginHorizontal="16dp"
|
|
||||||
android:layout_marginTop="8dp">
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/recyclerView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
|
@ -1,36 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabLayout
|
|
||||||
android:id="@+id/tabLayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@android:color/transparent" />
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
|
||||||
|
|
||||||
<androidx.viewpager2.widget.ViewPager2
|
|
||||||
android:id="@+id/viewPager2"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
|
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
|
||||||
android:id="@+id/mainButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="bottom|end"
|
|
||||||
android:layout_margin="16dp"
|
|
||||||
android:layout_marginEnd="24dp"
|
|
||||||
android:layout_marginBottom="24dp"
|
|
||||||
android:fitsSystemWindows="true"
|
|
||||||
android:src="@drawable/add" />
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
|
@ -1,50 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
|
||||||
android:id="@+id/swipeRefreshLayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:visibility="gone">
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/recyclerView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
||||||
|
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/loadView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:gravity="center"
|
|
||||||
android:visibility="gone">
|
|
||||||
|
|
||||||
|
|
||||||
<ProgressBar
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/errorLayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:gravity="center">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/TextAppearance.Material3.TitleMedium"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/no_content" />
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
|
@ -1,105 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
|
||||||
style="@style/Widget.Material3.CardView.Filled"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="16dp">
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="16dp">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/headIconView"
|
|
||||||
android:layout_width="40dp"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:src="@drawable/head_icon" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/headLayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignTop="@id/headIconView"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:layout_toStartOf="@id/typeView"
|
|
||||||
android:layout_toEndOf="@id/headIconView"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/nameView"
|
|
||||||
style="@style/TextAppearance.Material3.BodyMedium"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/user_name" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/timeView"
|
|
||||||
style="@style/TextAppearance.Material3.BodySmall"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:text="@string/time" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/typeView"
|
|
||||||
style="@style/TextAppearance.Material3.BodyMedium"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:text="举报模组" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textview"
|
|
||||||
style="@style/TextAppearance.Material3.TitleMedium"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@id/headLayout"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:text="@string/expiration_time_null" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/describeView"
|
|
||||||
style="@style/TextAppearance.Material3.BodySmall"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@id/textview"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:text="@string/describe" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/open_view"
|
|
||||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignTop="@id/ignoreView"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
android:layout_toStartOf="@id/ignoreView"
|
|
||||||
android:text="@string/view_the_report_object" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/actionView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignTop="@id/open_view"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
android:layout_toStartOf="@id/open_view"
|
|
||||||
android:text="@string/operation" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/ignoreView"
|
|
||||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@id/describeView"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:text="@string/ignore" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
|
|
@ -1,29 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="90dp"
|
|
||||||
android:layout_height="100dp"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<androidx.constraintlayout.utils.widget.ImageFilterView
|
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
|
||||||
android:id="@+id/headIconView"
|
|
||||||
android:layout_width="56dp"
|
|
||||||
android:layout_height="56dp"
|
|
||||||
app:round="36dp"
|
|
||||||
android:src="@drawable/head_icon" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/nameView"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:ellipsize="end"
|
|
||||||
style="@style/TextAppearance.Material3.BodyMedium"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingStart="3dp"
|
|
||||||
android:paddingEnd="3dp"
|
|
||||||
android:text="@string/name" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
|
@ -1,53 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="8dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginRight="8dp"
|
|
||||||
android:layout_toLeftOf="@id/button"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/titleView"
|
|
||||||
style="@style/TextAppearance.Material3.TitleMedium"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="名称" />
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:id="@+id/describeView"
|
|
||||||
style="@style/TextAppearance.Material3.BodyMedium"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:text="描述" />
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/infoView"
|
|
||||||
style="@style/TextAppearance.Material3.BodySmall"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:text="发布者 时间" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button"
|
|
||||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:text="@string/subscription" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
|
@ -1,12 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/imageView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:src="@drawable/image" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
|
@ -1,60 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_vertical">
|
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
|
||||||
style="@style/Widget.Material3.CardView.Filled"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/mod_icon"
|
|
||||||
android:layout_width="56dp"
|
|
||||||
android:scaleType="centerCrop"
|
|
||||||
android:layout_height="56dp"
|
|
||||||
android:src="@drawable/image" />
|
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:paddingVertical="4dp"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/mod_name_View"
|
|
||||||
style="@style/TextAppearance.Material3.TitleMedium"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="模组名称" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:singleLine="true"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:id="@+id/mod_introduction_view"
|
|
||||||
style="@style/TextAppearance.Material3.TitleSmall"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:text="介绍" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/modInfo"
|
|
||||||
style="@style/TextAppearance.Material3.BodyMedium"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:text="@string/web_mod_info" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
|
@ -14,16 +14,6 @@
|
||||||
android:icon="@drawable/mod"
|
android:icon="@drawable/mod"
|
||||||
android:title="@string/warehouse" />
|
android:title="@string/warehouse" />
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/database_item"
|
|
||||||
android:icon="@drawable/database"
|
|
||||||
android:title="@string/menu_title3" />
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/template_item"
|
|
||||||
android:icon="@drawable/template"
|
|
||||||
android:title="@string/template_title" />
|
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<group>
|
<group>
|
||||||
|
|
|
@ -4,29 +4,9 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
app:startDestination="@id/mod_item">
|
app:startDestination="@id/mod_item">
|
||||||
|
|
||||||
<fragment
|
|
||||||
android:id="@+id/community_item"
|
|
||||||
android:name="com.coldmint.rust.pro.fragments.CommunityFragment"
|
|
||||||
android:label="@string/community"
|
|
||||||
tools:layout="@layout/fragment_community" />
|
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/mod_item"
|
android:id="@+id/mod_item"
|
||||||
android:name="com.coldmint.rust.pro.fragments.WarehouseFragment"
|
android:name="com.coldmint.rust.pro.fragments.WarehouseFragment"
|
||||||
android:label="@string/warehouse"
|
android:label="@string/warehouse"
|
||||||
tools:layout="@layout/fragment_mod" />
|
tools:layout="@layout/fragment_mod" />
|
||||||
|
|
||||||
<fragment
|
|
||||||
android:id="@+id/database_item"
|
|
||||||
android:name="com.coldmint.rust.pro.fragments.DatabaseFragment"
|
|
||||||
android:label="@string/menu_title3"
|
|
||||||
tools:layout="@layout/fragment_database" />
|
|
||||||
|
|
||||||
<fragment
|
|
||||||
android:id="@+id/template_item"
|
|
||||||
android:name="com.coldmint.rust.pro.fragments.TemplateFragment"
|
|
||||||
android:label="@string/template_title"
|
|
||||||
tools:layout="@layout/fragment_local_template" />
|
|
||||||
|
|
||||||
|
|
||||||
</navigation>
|
</navigation>
|
|
@ -102,7 +102,7 @@
|
||||||
<string name="loading_files">加载文件...</string>
|
<string name="loading_files">加载文件...</string>
|
||||||
<string name="loading_bookmarks">加载书签...</string>
|
<string name="loading_bookmarks">加载书签...</string>
|
||||||
<string name="no_bookmark">没有书签</string>
|
<string name="no_bookmark">没有书签</string>
|
||||||
<string name="filenum">%1$s个</string>
|
<string name="filenum">%1$d个</string>
|
||||||
<string name="not_find_database">没有找到数据集</string>
|
<string name="not_find_database">没有找到数据集</string>
|
||||||
<string name="use_database">使用</string>
|
<string name="use_database">使用</string>
|
||||||
<string name="create_unit">创建单位</string>
|
<string name="create_unit">创建单位</string>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user