refactor(layout): 删除多余布局文件并优化代码结构
- 删除了多个未使用的布局文件,包括活动和片段的布局 - 移除了相关的适配器和片段类 - 简化了项目结构,提高了代码的可维护性
This commit is contained in:
parent
3c913282c0
commit
39a4913a32
|
@ -66,11 +66,7 @@
|
|||
<activity
|
||||
android:name=".BrowserActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/built_in_browser" /> <!-- 适配全面屏 -->
|
||||
<activity
|
||||
android:name=".OrderListActivity"
|
||||
android:exported="false" />
|
||||
|
||||
android:label="@string/built_in_browser" />
|
||||
<activity
|
||||
android:name=".PayActivity"
|
||||
android:exported="false" />
|
||||
|
@ -81,9 +77,6 @@
|
|||
<activity
|
||||
android:name=".ErrorInfoActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".UserListActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ThanksActivity"
|
||||
android:exported="false" />
|
||||
|
@ -99,9 +92,6 @@
|
|||
<activity
|
||||
android:name=".ReportActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".WebModInfoActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ErrorActivity"
|
||||
android:exported="false" />
|
||||
|
|
|
@ -1,182 +0,0 @@
|
|||
package com.coldmint.rust.pro
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.PopupMenu
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.coldmint.dialog.CoreDialog
|
||||
import com.coldmint.rust.core.dataBean.ApiResponse
|
||||
import com.coldmint.rust.core.dataBean.OrderListDataBean
|
||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||
import com.coldmint.rust.core.web.ActivationApp
|
||||
import com.coldmint.rust.core.web.ServerConfiguration
|
||||
import com.coldmint.rust.pro.adapters.OrderAdapter
|
||||
import com.coldmint.rust.pro.base.BaseActivity
|
||||
import com.coldmint.rust.pro.base.BaseAdapter
|
||||
import com.coldmint.rust.pro.databinding.ActivityOrderListBinding
|
||||
import com.coldmint.rust.pro.tool.AppSettings
|
||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||
import com.coldmint.rust.pro.ui.StableLinearLayoutManager
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
|
||||
/**
|
||||
* @author Cold Mint
|
||||
* @date 2022/1/12 17:52
|
||||
*/
|
||||
class OrderListActivity : BaseActivity<ActivityOrderListBinding>() {
|
||||
private var loadAll = false
|
||||
val account by lazy {
|
||||
AppSettings.getValue(AppSettings.Setting.Account, "")
|
||||
}
|
||||
val appId by lazy {
|
||||
AppSettings.getValue(AppSettings.Setting.AppID, "")
|
||||
}
|
||||
|
||||
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
|
||||
if (canUseView) {
|
||||
title = getText(R.string.order_list)
|
||||
setReturnButton()
|
||||
if (account.isBlank()) {
|
||||
showError(getString(R.string.please_login_first))
|
||||
return
|
||||
}
|
||||
val thisIntent = intent
|
||||
loadAll = thisIntent.getBooleanExtra("loadAll", false)
|
||||
viewBinding.recyclerview.layoutManager = StableLinearLayoutManager(this)
|
||||
loadList(loadAll)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun loadList(canLoadAll: Boolean) {
|
||||
ActivationApp.instance.getOrderList(
|
||||
object : ApiCallBack<OrderListDataBean> {
|
||||
override fun onResponse(t: OrderListDataBean) {
|
||||
val dataList = t.data
|
||||
if (t.code == ServerConfiguration.Success_Code && dataList != null && dataList.isNotEmpty()) {
|
||||
viewBinding.progressBar.isVisible = false
|
||||
viewBinding.recyclerview.isVisible = true
|
||||
viewBinding.tipView.isVisible = false
|
||||
viewBinding.toolbar.title =
|
||||
getString(R.string.order_list) + "(" + dataList.size + ")"
|
||||
val adapter = OrderAdapter(this@OrderListActivity, dataList)
|
||||
adapter.loadAll = canLoadAll
|
||||
adapter.setItemEvent { i, itemOrderBinding, viewHolder, data ->
|
||||
itemOrderBinding.root.setOnClickListener {
|
||||
if (canLoadAll) {
|
||||
//如果可以加载全部用户资料(是管理员模式)
|
||||
val popupMenu =
|
||||
GlobalMethod.createPopMenu(itemOrderBinding.root)
|
||||
popupMenu.menu.add("设置订单")
|
||||
popupMenu.menu.add("查看用户资料")
|
||||
popupMenu.show()
|
||||
popupMenu.setOnMenuItemClickListener {
|
||||
val title = it.title
|
||||
when (title) {
|
||||
"设置订单" -> {
|
||||
when (data.state) {
|
||||
"false" -> {
|
||||
CoreDialog(this@OrderListActivity).setTitle(data.name).setMessage("确认收到" + data.account + "的付款了嘛?\n订单创建时间:" + data.createTime).setPositiveButton(R.string.pay_yes){
|
||||
confirmOrder(data.flag, true)
|
||||
}.setNegativeButton(R.string.pay_no){
|
||||
confirmOrder(data.flag, false)
|
||||
}.show()
|
||||
}
|
||||
else -> {
|
||||
showToast("无需处理")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
} else {
|
||||
CoreDialog(this@OrderListActivity).setTitle(String.format(
|
||||
getString(R.string.copy_orderid),
|
||||
data.flag
|
||||
)).setPositiveButton(R.string.copy){
|
||||
val flag = data.flag
|
||||
GlobalMethod.copyText(this@OrderListActivity, flag)
|
||||
Snackbar.make(
|
||||
viewBinding.progressBar,
|
||||
String.format(
|
||||
getString(R.string.copy_complete),
|
||||
flag
|
||||
),
|
||||
Snackbar.LENGTH_SHORT
|
||||
).show()
|
||||
}.setNegativeButton(R.string.dialog_cancel){
|
||||
|
||||
}.setCancelable(false).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
viewBinding.recyclerview.adapter = adapter
|
||||
} else {
|
||||
showInfoToView(text = t.message)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(e: Exception) {
|
||||
showInfoToView(R.string.network_error)
|
||||
}
|
||||
|
||||
}, if (canLoadAll) {
|
||||
null
|
||||
} else {
|
||||
account
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 激活订单
|
||||
* @param flag String
|
||||
* @param payState Boolean
|
||||
*/
|
||||
fun confirmOrder(flag: String, payState: Boolean) {
|
||||
ActivationApp.instance.confirmOrder(
|
||||
account,
|
||||
appId,
|
||||
flag,
|
||||
payState,
|
||||
object : ApiCallBack<ApiResponse> {
|
||||
override fun onResponse(t: ApiResponse) {
|
||||
showToast(t.message)
|
||||
}
|
||||
|
||||
override fun onFailure(e: Exception) {
|
||||
showToast(getString(R.string.network_error))
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 在视图里显示内容
|
||||
* @param resId Int?
|
||||
* @param text String?
|
||||
*/
|
||||
fun showInfoToView(resId: Int? = null, text: String? = null) {
|
||||
viewBinding.progressBar.isVisible = false
|
||||
viewBinding.recyclerview.isVisible = false
|
||||
viewBinding.tipView.isVisible = true
|
||||
if (resId != null) {
|
||||
viewBinding.tipView.setText(resId)
|
||||
}
|
||||
if (text != null) {
|
||||
viewBinding.tipView.text = text
|
||||
}
|
||||
}
|
||||
|
||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): ActivityOrderListBinding {
|
||||
return ActivityOrderListBinding.inflate(layoutInflater)
|
||||
}
|
||||
|
||||
}
|
|
@ -84,15 +84,7 @@ class TagActivity : BaseActivity<ActivityTagBinding>() {
|
|||
if (t.code == ServerConfiguration.Success_Code && dataList != null) {
|
||||
val adapter = WebModAdapter(this, dataList)
|
||||
adapter.setItemEvent { i, webModItemBinding, viewHolder, data ->
|
||||
webModItemBinding.root.setOnClickListener {
|
||||
val bundle = Bundle()
|
||||
bundle.putString("modId", data.id)
|
||||
bundle.putString("modName", data.name)
|
||||
val intent =
|
||||
Intent(this@TagActivity, WebModInfoActivity::class.java)
|
||||
intent.putExtra("data", bundle)
|
||||
this@TagActivity.startActivity(intent)
|
||||
}
|
||||
|
||||
}
|
||||
viewBinding.recyclerView.adapter = adapter
|
||||
viewBinding.recyclerView.isVisible = true
|
||||
|
|
|
@ -1,182 +0,0 @@
|
|||
package com.coldmint.rust.pro
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import androidx.core.view.isVisible
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.materialdialogs.checkbox.BooleanCallback
|
||||
import com.afollestad.materialdialogs.checkbox.checkBoxPrompt
|
||||
import com.coldmint.rust.core.dataBean.ApiResponse
|
||||
import com.coldmint.rust.core.dataBean.follow.FollowUserListData
|
||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||
import com.coldmint.rust.core.web.Community
|
||||
import com.coldmint.rust.core.web.ServerConfiguration
|
||||
import com.coldmint.rust.pro.adapters.UserAdapter
|
||||
import com.coldmint.rust.pro.base.BaseActivity
|
||||
import com.coldmint.rust.pro.databinding.ActivityUserListBinding
|
||||
import com.coldmint.rust.pro.ui.StableLinearLayoutManager
|
||||
import com.google.android.material.divider.MaterialDividerItemDecoration
|
||||
|
||||
class UserListActivity : BaseActivity<ActivityUserListBinding>() {
|
||||
|
||||
/**
|
||||
* 显示加载失败的错误提示
|
||||
* @param tip String 提示
|
||||
*/
|
||||
fun showErrorTip(tip: String) {
|
||||
viewBinding.progressBar.isVisible = false
|
||||
viewBinding.tipView.isVisible = true
|
||||
viewBinding.tipView.text = tip
|
||||
}
|
||||
|
||||
|
||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): ActivityUserListBinding {
|
||||
return ActivityUserListBinding.inflate(layoutInflater)
|
||||
}
|
||||
|
||||
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
|
||||
if (canUseView) {
|
||||
setReturnButton()
|
||||
val thisIntent = intent
|
||||
val bundle = thisIntent.getBundleExtra("data")
|
||||
if (bundle == null) {
|
||||
showError("请输入data")
|
||||
return
|
||||
} else {
|
||||
val account = bundle.getString("account")
|
||||
if (account == null) {
|
||||
showError("请输入account")
|
||||
return
|
||||
}
|
||||
val isFollowMode = bundle.getBoolean("isFollowMode", true)
|
||||
val canRemoveFans = if (isFollowMode) {
|
||||
false
|
||||
} else {
|
||||
bundle.getBoolean("canRemoveFans", false)
|
||||
}
|
||||
title = if (isFollowMode) {
|
||||
getString(R.string.follow)
|
||||
} else {
|
||||
if (canRemoveFans) {
|
||||
getString(R.string.fans_management)
|
||||
} else {
|
||||
getString(R.string.fans)
|
||||
}
|
||||
}
|
||||
viewBinding.recyclerView.layoutManager =
|
||||
StableLinearLayoutManager(this@UserListActivity)
|
||||
val divider = MaterialDividerItemDecoration(
|
||||
this,
|
||||
MaterialDividerItemDecoration.VERTICAL
|
||||
)
|
||||
|
||||
viewBinding.recyclerView.addItemDecoration(
|
||||
divider
|
||||
)
|
||||
loadList(account, isFollowMode, canRemoveFans)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载列表
|
||||
* @param account String
|
||||
* @param isFollowMode Boolean
|
||||
* @param canRemoveFans Boolean
|
||||
*/
|
||||
fun loadList(account: String, isFollowMode: Boolean, canRemoveFans: Boolean) {
|
||||
Community.getUserList(
|
||||
account,
|
||||
isFollowMode,
|
||||
apiCallBack = object : ApiCallBack<FollowUserListData> {
|
||||
override fun onResponse(t: FollowUserListData) {
|
||||
if (t.code == ServerConfiguration.Success_Code) {
|
||||
val dataList = t.data
|
||||
if (dataList != null && dataList.size > 0) {
|
||||
viewBinding.loadLayout.isVisible = false
|
||||
viewBinding.recyclerView.isVisible = true
|
||||
val adapter = UserAdapter(this@UserListActivity, dataList)
|
||||
|
||||
adapter.setItemEvent { i, itemUserBinding, viewHolder, data ->
|
||||
itemUserBinding.root.setOnClickListener {
|
||||
}
|
||||
if (canRemoveFans) {
|
||||
itemUserBinding.actionView.isVisible = true
|
||||
itemUserBinding.actionView.setText(R.string.remove_fans)
|
||||
var check = false
|
||||
itemUserBinding.actionView.setOnClickListener {
|
||||
MaterialDialog(this@UserListActivity).show {
|
||||
title(R.string.remove_fans).checkBoxPrompt(
|
||||
res = R.string.ban_fans,
|
||||
onToggle = object : BooleanCallback {
|
||||
override fun invoke(p1: Boolean) {
|
||||
check = p1
|
||||
}
|
||||
}
|
||||
).message(
|
||||
text = String.format(
|
||||
getString(R.string.remove_fans_tip),
|
||||
data.userName
|
||||
)
|
||||
)
|
||||
.positiveButton(R.string.dialog_ok)
|
||||
.positiveButton {
|
||||
Community.removeFans(
|
||||
account,
|
||||
data.account,
|
||||
object : ApiCallBack<ApiResponse> {
|
||||
override fun onResponse(t: ApiResponse) {
|
||||
if (t.code == ServerConfiguration.Success_Code) {
|
||||
val index =
|
||||
dataList.indexOf(
|
||||
data
|
||||
)
|
||||
dataList.removeAt(index)
|
||||
adapter.notifyItemRemoved(
|
||||
index
|
||||
)
|
||||
if (dataList.isEmpty()) {
|
||||
loadList(
|
||||
account,
|
||||
isFollowMode,
|
||||
canRemoveFans
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(e: Exception) {
|
||||
showInternetError(
|
||||
viewBinding.recyclerView,
|
||||
e
|
||||
)
|
||||
}
|
||||
},
|
||||
check
|
||||
)
|
||||
}
|
||||
.negativeButton(R.string.dialog_cancel)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
viewBinding.recyclerView.adapter = adapter
|
||||
} else {
|
||||
showErrorTip(t.message)
|
||||
}
|
||||
} else {
|
||||
showErrorTip(t.message)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onFailure(e: Exception) {
|
||||
showErrorTip(getString(R.string.network_error))
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,413 +0,0 @@
|
|||
package com.coldmint.rust.pro
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.Environment
|
||||
import android.view.*
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.coldmint.dialog.CoreDialog
|
||||
import com.coldmint.rust.core.dataBean.AppUpdateData
|
||||
import com.coldmint.rust.core.tool.AppOperator
|
||||
import com.coldmint.rust.core.tool.FileLoader
|
||||
import com.coldmint.rust.core.tool.ProgressResponseBody
|
||||
import com.coldmint.rust.core.web.ServerConfiguration
|
||||
import com.coldmint.rust.core.web.WebMod
|
||||
import com.coldmint.rust.pro.adapters.ModPageDetailsAdapter
|
||||
import com.coldmint.rust.pro.base.BaseActivity
|
||||
import com.coldmint.rust.pro.databinding.ActivityWebModInfoBinding
|
||||
import com.coldmint.rust.pro.databinding.LoadFileLayoutBinding
|
||||
import com.coldmint.rust.pro.fragments.WebModDetailsFragment
|
||||
import com.coldmint.rust.pro.tool.AppSettings
|
||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||
import com.coldmint.rust.pro.tool.Tools
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
import com.google.gson.Gson
|
||||
import java.io.File
|
||||
import java.text.NumberFormat
|
||||
|
||||
class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
|
||||
|
||||
lateinit var modId: String
|
||||
lateinit var tip: String
|
||||
private val targetFile: File by lazy {
|
||||
val modFolderPath = AppSettings.getValue(
|
||||
AppSettings.Setting.ModFolder,
|
||||
Environment.getExternalStorageDirectory().absolutePath + "/rustedWarfare/units/"
|
||||
)
|
||||
val modFolder = File(modFolderPath)
|
||||
if (!modFolder.exists()) {
|
||||
modFolder.mkdirs()
|
||||
}
|
||||
val modFilePath = "$modFolderPath$modId.rwmod"
|
||||
File(modFilePath)
|
||||
}
|
||||
val token by lazy {
|
||||
""
|
||||
}
|
||||
lateinit var adapter: ModPageDetailsAdapter
|
||||
|
||||
val modName: MutableLiveData<String> by lazy {
|
||||
MutableLiveData()
|
||||
}
|
||||
|
||||
@SuppressLint("CommitTransaction")
|
||||
private fun initView() {
|
||||
setReturnButton()
|
||||
val activityIntent = intent
|
||||
val bundle = activityIntent.getBundleExtra("data")
|
||||
if (bundle == null) {
|
||||
showError("意外的请求")
|
||||
return
|
||||
} else {
|
||||
val name = bundle.getString("modName")
|
||||
title = name
|
||||
val temId = bundle.getString("modId")
|
||||
if (temId == null) {
|
||||
showError("未知的模组id")
|
||||
return
|
||||
}
|
||||
modId = temId
|
||||
if (targetFile.exists()) {
|
||||
viewBinding.button.isEnabled = false
|
||||
viewBinding.button.text = getString(R.string.installated)
|
||||
}
|
||||
modName.observe(this) {
|
||||
title = it
|
||||
}
|
||||
val webModDetailsFragment = WebModDetailsFragment(modId, modName)
|
||||
// 检测是否处于平板模式
|
||||
if (Tools.isTabletMode(this)) {
|
||||
adapter = ModPageDetailsAdapter(this, modId)
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(R.id.fragment, webModDetailsFragment)
|
||||
.commit()
|
||||
viewBinding.viewPager2.adapter = adapter
|
||||
|
||||
TabLayoutMediator(viewBinding.tabLayout, viewBinding.viewPager2) { tab, i ->
|
||||
tab.text = when (i) {
|
||||
0 -> {
|
||||
getString(R.string.insert_coins)
|
||||
}
|
||||
|
||||
1 -> {
|
||||
getString(R.string.discussion)
|
||||
}
|
||||
|
||||
else -> {
|
||||
getString(R.string.title)
|
||||
}
|
||||
}
|
||||
}.attach()
|
||||
} else {
|
||||
adapter = ModPageDetailsAdapter(this, modId, webModDetailsFragment)
|
||||
viewBinding.viewPager2.adapter = adapter
|
||||
TabLayoutMediator(viewBinding.tabLayout, viewBinding.viewPager2) { tab, i ->
|
||||
tab.text = when (i) {
|
||||
0 -> {
|
||||
getString(R.string.details)
|
||||
}
|
||||
|
||||
1 -> {
|
||||
getString(R.string.insert_coins)
|
||||
}
|
||||
|
||||
2 -> {
|
||||
getString(R.string.discussion)
|
||||
}
|
||||
|
||||
else -> {
|
||||
getString(R.string.title)
|
||||
}
|
||||
}
|
||||
}.attach()
|
||||
}
|
||||
viewBinding.button.setOnClickListener {
|
||||
val type = viewBinding.button.text
|
||||
val installation = getString(R.string.installation)
|
||||
when (type) {
|
||||
installation -> {
|
||||
downloadAction(adapter.getLink())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
tip = getString(R.string.file_download_progress)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载事件
|
||||
* @param t WebModInfoData
|
||||
*/
|
||||
private fun downloadAction(link: String?) {
|
||||
if (link == null) {
|
||||
return
|
||||
}
|
||||
val fileLink = ServerConfiguration.getRealLink(link)
|
||||
when (AppOperator.getNetworkType(this)) {
|
||||
AppOperator.NetWorkType.NetWorkType_Moble -> {
|
||||
val useMobileNetWork =
|
||||
AppSettings.getValue(AppSettings.Setting.UseMobileNetwork, false)
|
||||
if (useMobileNetWork) {
|
||||
downloadWork(fileLink)
|
||||
} else {
|
||||
CoreDialog(this).setTitle(R.string.using_mobile_networks)
|
||||
.setMessage(R.string.using_mobile_networks_msg)
|
||||
.setPositiveButton(R.string.only_one) {
|
||||
downloadWork(fileLink)
|
||||
}.setNegativeButton(R.string.always_allow) {
|
||||
AppSettings.setValue(AppSettings.Setting.UseMobileNetwork, true)
|
||||
downloadWork(fileLink)
|
||||
}.setNeutralButton(R.string.dialog_cancel) {
|
||||
|
||||
}.show()
|
||||
}
|
||||
}
|
||||
|
||||
AppOperator.NetWorkType.NetWorkType_Wifi -> {
|
||||
downloadWork(fileLink)
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
val inflater = menuInflater
|
||||
inflater.inflate(R.menu.menu_webmod, menu)
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("StringFormatInvalid")
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.report_item -> {
|
||||
if (token.isBlank()) {
|
||||
Snackbar.make(
|
||||
viewBinding.button,
|
||||
R.string.please_login_first,
|
||||
Snackbar.LENGTH_SHORT
|
||||
).show()
|
||||
return true
|
||||
}
|
||||
if (adapter.isOpen()) {
|
||||
val thisIntent = Intent(this, ReportActivity::class.java)
|
||||
val bundle = Bundle()
|
||||
bundle.putString("target", modId)
|
||||
bundle.putString("type", "mod")
|
||||
bundle.putString("name", title.toString())
|
||||
thisIntent.putExtra("data", bundle)
|
||||
startActivity(thisIntent)
|
||||
} else {
|
||||
//不能举报未公开的模组
|
||||
Snackbar.make(
|
||||
viewBinding.button,
|
||||
R.string.unable_to_report,
|
||||
Snackbar.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
|
||||
R.id.share_item -> {
|
||||
val link = ""
|
||||
val updateData = AppSettings.getValue(AppSettings.Setting.UpdateData, "")
|
||||
var appUpdateLink = ""
|
||||
if (updateData.isNotBlank()) {
|
||||
val gson = Gson()
|
||||
val updateDataObj = gson.fromJson(updateData, AppUpdateData.Data::class.java)
|
||||
appUpdateLink = updateDataObj.link
|
||||
}
|
||||
|
||||
val s = String.format(
|
||||
getString(R.string.share_mod_msg),
|
||||
title,
|
||||
link + "website/pages/modPage.php?&modId=" + modId, appUpdateLink
|
||||
)
|
||||
|
||||
AppOperator.shareText(this, getString(R.string.share_mod), s)
|
||||
}
|
||||
|
||||
R.id.update_record -> {
|
||||
GlobalMethod.showUpdateLog(this, modId)
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下载工作
|
||||
* @param fileLink String
|
||||
*/
|
||||
private fun downloadWork(fileLink: String) {
|
||||
GlobalMethod.requestStoragePermissions(this) {
|
||||
if (it) {
|
||||
viewBinding.button.setText(R.string.installation_ing)
|
||||
val loadFileLayoutBinding = LoadFileLayoutBinding.inflate(layoutInflater)
|
||||
loadFileLayoutBinding.LinearProgressIndicator.max = 100
|
||||
var progress = 0
|
||||
|
||||
val fileLoader = FileLoader.getInstantiate(fileLink, targetFile.absolutePath)
|
||||
fileLoader.download(object : ProgressResponseBody.ResponseProgressListener {
|
||||
override fun update(bytesRead: Long, contentLength: Long, done: Boolean) {
|
||||
//计算百分比并更新ProgressBar
|
||||
val numberFormat = NumberFormat.getNumberInstance()
|
||||
numberFormat.maximumFractionDigits = 2
|
||||
val trueProgress =
|
||||
numberFormat.format(bytesRead.toDouble() / contentLength.toDouble() * 100)
|
||||
progress = trueProgress.toFloat().toInt()
|
||||
runOnUiThread {
|
||||
val progressTip = String.format(tip, progress)
|
||||
viewBinding.button.text = progressTip
|
||||
}
|
||||
}
|
||||
|
||||
override fun downloadFail(exception: Exception?) {
|
||||
viewBinding.button.setText(R.string.installation)
|
||||
}
|
||||
|
||||
override fun downloadSuccess() {
|
||||
viewBinding.button.isEnabled = false
|
||||
viewBinding.button.setText(R.string.installated)
|
||||
WebMod.instance.addDownloadNum(modId)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 加载评论列表
|
||||
// * @param modId String
|
||||
// */
|
||||
// fun loadModCommentList(modId: String) {
|
||||
// viewBinding.commentLinearProgressIndicator.isVisible = true
|
||||
// WebMod.instance.getCommentsList(modId, object : ApiCallBack<WebModCommentData> {
|
||||
// override fun onResponse(t: WebModCommentData) {
|
||||
// viewBinding.commentLinearProgressIndicator.isVisible = false
|
||||
// val data = t.data
|
||||
// if (data == null) {
|
||||
// viewBinding.modCommentRecyclerView.isVisible = false
|
||||
// } else {
|
||||
// val adapter = CommentAdapter(this@WebModInfoActivity, data)
|
||||
// viewBinding.discussion.text =
|
||||
// String.format(getString(R.string.discussion_num), data.size)
|
||||
// adapter.setItemEvent { i, itemCommentBinding, viewHolder, data ->
|
||||
// itemCommentBinding.iconView.setOnClickListener {
|
||||
// gotoUserPage(data.account)
|
||||
// }
|
||||
// }
|
||||
// viewBinding.modCommentRecyclerView.isVisible = true
|
||||
// viewBinding.modCommentRecyclerView.adapter = adapter
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onFailure(e: Exception) {
|
||||
// viewBinding.commentLinearProgressIndicator.isVisible = false
|
||||
// viewBinding.modCommentRecyclerView.isVisible = false
|
||||
// }
|
||||
//
|
||||
// })
|
||||
// }
|
||||
//
|
||||
// fun loadDeveloperInfo(userId: String) {
|
||||
// User.getSpaceInfo(userId, object : ApiCallBack<SpaceInfoData> {
|
||||
// override fun onResponse(t: SpaceInfoData) {
|
||||
// if (t.code == ServerConfiguration.Success_Code) {
|
||||
// val icon = t.data.headIcon
|
||||
// if (icon != null) {
|
||||
// Glide.with(this@WebModInfoActivity)
|
||||
// .load(ServerConfiguration.getRealLink(icon))
|
||||
// .apply(GlobalMethod.getRequestOptions(true))
|
||||
// .into(viewBinding.headIconView)
|
||||
// }
|
||||
// viewBinding.userNameView.text = t.data.userName
|
||||
// val info = String.format(
|
||||
// getString(R.string.fans_information),
|
||||
// ServerConfiguration.numberToString(t.data.fans),
|
||||
// ServerConfiguration.numberToString(t.data.follower),
|
||||
// ServerConfiguration.numberToString(t.data.praise)
|
||||
// )
|
||||
// viewBinding.userInfoView.text = info
|
||||
//
|
||||
// viewBinding.cardView.postDelayed({
|
||||
// viewBinding.cardView.isVisible = true
|
||||
// viewBinding.openUserSpace.setOnClickListener {
|
||||
// gotoUserPage(t.data.account)
|
||||
// }
|
||||
// }, 300)
|
||||
// }
|
||||
//// else {
|
||||
//// viewBinding.cardView.isVisible = false
|
||||
//// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// override fun onFailure(e: Exception) {
|
||||
//// viewBinding.cardView.isVisible = false
|
||||
// }
|
||||
//
|
||||
// })
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// private fun initAction() {
|
||||
// viewBinding.sendDiscussion.setOnClickListener {
|
||||
// val account = AppSettings.getValue(AppSettings.Setting.Account, "")
|
||||
// if (account.isBlank()) {
|
||||
// showError(getString(R.string.please_login_first))
|
||||
// return@setOnClickListener
|
||||
// }
|
||||
//
|
||||
//
|
||||
// CommentDialog(this).setCancelable(false)
|
||||
// .setSubmitFun { button, textInputLayout, s, alertDialog ->
|
||||
// button.isEnabled = false
|
||||
// WebMod.instance.sendComment(
|
||||
// AppSettings.getValue(AppSettings.Setting.Token, ""),
|
||||
// modId,
|
||||
// s,
|
||||
// object : ApiCallBack<ApiResponse> {
|
||||
// override fun onResponse(t: ApiResponse) {
|
||||
// if (t.code == ServerConfiguration.Success_Code) {
|
||||
// alertDialog.dismiss()
|
||||
// loadModCommentList(modId)
|
||||
// Snackbar.make(
|
||||
// viewBinding.button,
|
||||
// R.string.release_ok,
|
||||
// Snackbar.LENGTH_SHORT
|
||||
// ).show()
|
||||
// } else {
|
||||
// textInputLayout.error = t.message
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onFailure(e: Exception) {
|
||||
// textInputLayout.error = e.toString()
|
||||
// }
|
||||
//
|
||||
// })
|
||||
// }.show()
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): ActivityWebModInfoBinding {
|
||||
return ActivityWebModInfoBinding.inflate(layoutInflater)
|
||||
}
|
||||
|
||||
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
|
||||
if (canUseView) {
|
||||
initView()
|
||||
// initData()
|
||||
// initAction()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -100,15 +100,6 @@ class WorkManagementActivity : BaseActivity<ActivityWorkmangementBinding>() {
|
|||
val title = it.title.toString()
|
||||
when (title) {
|
||||
getString(R.string.work_of_home_page) -> {
|
||||
val bundle = Bundle()
|
||||
bundle.putString("modId", data.id)
|
||||
bundle.putString("modName", data.name)
|
||||
val intent = Intent(
|
||||
this@WorkManagementActivity,
|
||||
WebModInfoActivity::class.java
|
||||
)
|
||||
intent.putExtra("data", bundle)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
getString(R.string.update_record) -> {
|
||||
|
|
|
@ -1,19 +1,12 @@
|
|||
package com.coldmint.rust.pro.adapters
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import android.view.ViewGroup
|
||||
import android.view.LayoutInflater
|
||||
import com.coldmint.rust.pro.R
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import android.widget.TextView
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import com.coldmint.rust.pro.R
|
||||
import com.coldmint.rust.pro.base.BaseAdapter
|
||||
import com.coldmint.rust.pro.databinding.AttachFileItemBinding
|
||||
import java.io.File
|
||||
import java.util.ArrayList
|
||||
|
||||
class AttachFileAdapter( context: Context, dataList: MutableList<File>) :
|
||||
BaseAdapter<AttachFileItemBinding, File>(context, dataList) {
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
package com.coldmint.rust.pro.adapters
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import com.bumptech.glide.Glide
|
||||
import com.coldmint.rust.core.dataBean.mod.WebModListData
|
||||
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.ItemAuditModBinding
|
||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||
|
||||
/**
|
||||
* @author Cold Mint
|
||||
* @date 2022/1/10 8:49
|
||||
*/
|
||||
class AuditModAdapter( context: Context, dataList: MutableList<WebModListData.Data>) :
|
||||
BaseAdapter<ItemAuditModBinding, WebModListData.Data>(context, dataList) {
|
||||
override fun getViewBindingObject(
|
||||
layoutInflater: LayoutInflater,
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): ItemAuditModBinding {
|
||||
return ItemAuditModBinding.inflate(layoutInflater, parent, false)
|
||||
}
|
||||
|
||||
override fun onBingView(
|
||||
data: WebModListData.Data,
|
||||
viewBinding: ItemAuditModBinding,
|
||||
viewHolder: ViewHolder<ItemAuditModBinding>,
|
||||
position: Int
|
||||
) {
|
||||
val info = String.format(
|
||||
context.getString(R.string.publisher_information),
|
||||
data.developer,
|
||||
data.updateTime
|
||||
)
|
||||
viewBinding.modInfo.text = info
|
||||
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)
|
||||
}
|
||||
viewBinding.modNameView.text = data.name
|
||||
viewBinding.modIntroductionView.text = data.describe
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
package com.coldmint.rust.pro.adapters
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import com.bumptech.glide.Glide
|
||||
import com.coldmint.dialog.CoreDialog
|
||||
import com.coldmint.rust.core.dataBean.ApiResponse
|
||||
import com.coldmint.rust.core.dataBean.mod.WebModCommentData
|
||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||
import com.coldmint.rust.core.tool.AppOperator
|
||||
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.ItemCommentBinding
|
||||
import com.coldmint.rust.pro.tool.AppSettings
|
||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||
import com.coldmint.rust.pro.tool.TextStyleMaker
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
|
||||
/**
|
||||
* 评论
|
||||
* @author Cold Mint
|
||||
* @date 2021/12/12 20:50
|
||||
*/
|
||||
class CommentAdapter(context: Context, dataList: MutableList<WebModCommentData.Data>) :
|
||||
BaseAdapter<ItemCommentBinding, WebModCommentData.Data>(context, dataList) {
|
||||
|
||||
override fun getViewBindingObject(
|
||||
layoutInflater: LayoutInflater,
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): ItemCommentBinding {
|
||||
return ItemCommentBinding.inflate(layoutInflater, parent, false)
|
||||
}
|
||||
|
||||
override fun onBingView(
|
||||
data: WebModCommentData.Data,
|
||||
viewBinding: ItemCommentBinding,
|
||||
viewHolder: ViewHolder<ItemCommentBinding>,
|
||||
position: Int
|
||||
) {
|
||||
val icon = data.headIcon
|
||||
Log.d("CommentAdapter", "图标路径$icon")
|
||||
if (icon.isNullOrBlank()) {
|
||||
viewBinding.iconView.setImageResource(R.drawable.head_icon)
|
||||
} else {
|
||||
Glide.with(context).load(ServerConfiguration.getRealLink(icon))
|
||||
.apply(GlobalMethod.getRequestOptions(true))
|
||||
.into(viewBinding.iconView)
|
||||
}
|
||||
viewBinding.nameView.text = data.userName
|
||||
viewBinding.timeView.text = if (data.location == null) {
|
||||
data.time
|
||||
} else {
|
||||
data.time + " " + data.location
|
||||
}
|
||||
viewBinding.thumbUpImageView.setOnClickListener {
|
||||
Snackbar.make(
|
||||
viewBinding.thumbUpImageView,
|
||||
R.string.temporarily_unavailable,
|
||||
Snackbar.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
viewBinding.shareImageView.setOnClickListener {
|
||||
AppOperator.shareText(context, context.getString(R.string.share_message), data.content)
|
||||
}
|
||||
viewBinding.contentView.setOnLongClickListener {
|
||||
GlobalMethod.copyText(context, viewBinding.contentView.text.toString())
|
||||
false
|
||||
}
|
||||
viewBinding.moreImageView.setOnClickListener { view ->
|
||||
val menu = GlobalMethod.createPopMenu(view)
|
||||
// menu.menu.add(R.string.copy)
|
||||
menu.menu.add(R.string.delete_title)
|
||||
menu.menu.add(R.string.report)
|
||||
menu.setOnMenuItemClickListener {
|
||||
when (it.title) {
|
||||
context.getString(R.string.copy) -> {
|
||||
GlobalMethod.copyText(context, data.content, view)
|
||||
}
|
||||
context.getString(R.string.delete_title) -> {
|
||||
CoreDialog(context).setTitle(R.string.delete_comment).setMessage(
|
||||
String.format(
|
||||
context.getString(R.string.delete_comment_tip),
|
||||
data.userName
|
||||
)
|
||||
).setPositiveButton(R.string.dialog_ok) {
|
||||
}.setNegativeButton(R.string.dialog_cancel) {
|
||||
|
||||
}.show()
|
||||
}
|
||||
context.getString(R.string.report) -> {
|
||||
Snackbar.make(
|
||||
context,view,
|
||||
"暂不可用,请等待下一个版本!",
|
||||
Snackbar.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
menu.show()
|
||||
}
|
||||
TextStyleMaker.instance.load(viewBinding.contentView, data.content) { type, a ->
|
||||
TextStyleMaker.instance.clickEvent(context, type, a)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package com.coldmint.rust.pro.adapters
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import com.coldmint.rust.pro.fragments.FollowFragment
|
||||
import com.coldmint.rust.pro.fragments.NullFragment
|
||||
import com.coldmint.rust.pro.fragments.RankingFragment
|
||||
import com.coldmint.rust.pro.fragments.RecommendedFragment
|
||||
import com.coldmint.rust.pro.fragments.UserInfoFragment
|
||||
|
||||
class CommunityAdapter(fragment: Fragment) : FragmentStateAdapter(fragment) {
|
||||
override fun getItemCount(): Int {
|
||||
return 4
|
||||
}
|
||||
//
|
||||
// // java.lang.IllegalStateException: Fragment no longer exists for key f0:
|
||||
// override fun saveState(): Parcelable? {
|
||||
// return null
|
||||
// }
|
||||
|
||||
|
||||
|
||||
override fun createFragment(position: Int): Fragment {
|
||||
return when (position) {
|
||||
0 -> {
|
||||
RecommendedFragment()
|
||||
}
|
||||
1 -> {
|
||||
FollowFragment()
|
||||
}
|
||||
2->{
|
||||
RankingFragment()
|
||||
}
|
||||
3 -> {
|
||||
UserInfoFragment()
|
||||
}
|
||||
else -> {
|
||||
NullFragment()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,45 +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.pro.base.BaseAdapter
|
||||
import com.coldmint.rust.pro.databean.CommunityServiceInfo
|
||||
import com.coldmint.rust.pro.databinding.ItemServiceBinding
|
||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||
|
||||
/**
|
||||
*社区服务适配器
|
||||
*/
|
||||
class CommunityServiceAdapter(
|
||||
context: Context,
|
||||
dataList: MutableList<CommunityServiceInfo>
|
||||
) :
|
||||
BaseAdapter<ItemServiceBinding, CommunityServiceInfo>(context, dataList) {
|
||||
|
||||
override fun getViewBindingObject(
|
||||
layoutInflater: LayoutInflater,
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): ItemServiceBinding {
|
||||
return ItemServiceBinding.inflate(layoutInflater, parent, false)
|
||||
}
|
||||
|
||||
override fun onBingView(
|
||||
data: CommunityServiceInfo,
|
||||
viewBinding: ItemServiceBinding,
|
||||
viewHolder: BaseAdapter.ViewHolder<ItemServiceBinding>,
|
||||
position: Int
|
||||
) {
|
||||
viewBinding.iconView.setImageResource(data.iconRes)
|
||||
//
|
||||
// Glide.with(context).load(data.iconRes).apply(GlobalMethod.getRequestOptions())
|
||||
// .into(viewBinding.iconView)
|
||||
viewBinding.titleView.setText(data.titleRes)
|
||||
// holder.itemView.setOnClickListener {
|
||||
// val listener = itemListener
|
||||
// listener?.onClickItem(communityServiceInfo)
|
||||
// }
|
||||
}
|
||||
}
|
|
@ -1,58 +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.CouponListDataBean
|
||||
import com.coldmint.rust.pro.R
|
||||
import com.coldmint.rust.pro.base.BaseAdapter
|
||||
import com.coldmint.rust.pro.databinding.ItemCouponBinding
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
/**
|
||||
* @author Cold Mint
|
||||
* @date 2022/1/10 20:47
|
||||
*/
|
||||
class CouponAdapter( context: Context, dataList: MutableList<CouponListDataBean.Data>) :
|
||||
BaseAdapter<ItemCouponBinding, CouponListDataBean.Data>(context, dataList) {
|
||||
val timeLimit: String by lazy {
|
||||
context.getString(R.string.time_limit)
|
||||
}
|
||||
val infinite: String by lazy {
|
||||
context.getString(R.string.infinite)
|
||||
}
|
||||
|
||||
override fun getViewBindingObject(
|
||||
layoutInflater: LayoutInflater,
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): ItemCouponBinding {
|
||||
return ItemCouponBinding.inflate(layoutInflater, parent, false)
|
||||
}
|
||||
|
||||
override fun onBingView(
|
||||
data: CouponListDataBean.Data,
|
||||
viewBinding: ItemCouponBinding,
|
||||
viewHolder: ViewHolder<ItemCouponBinding>,
|
||||
position: Int
|
||||
) {
|
||||
viewBinding.titleView.text = data.name
|
||||
viewBinding.descriptionView.text = data.describe
|
||||
val numTip = if (data.num == -1) {
|
||||
infinite
|
||||
} else {
|
||||
data.num.toString()
|
||||
}
|
||||
viewBinding.expirationTimeView.text =
|
||||
String.format(timeLimit, data.expirationTime, numTip)
|
||||
val value = data.value
|
||||
val tip = if (value >= 1) {
|
||||
"-${value}元"
|
||||
} else {
|
||||
"-${100 - (value * 100)}%"
|
||||
}
|
||||
viewBinding.numView.text = tip
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,128 +0,0 @@
|
|||
package com.coldmint.rust.pro.adapters
|
||||
|
||||
import android.content.Context
|
||||
import android.text.Html
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.PopupMenu
|
||||
import android.widget.PopupWindow
|
||||
import android.widget.Toast
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.request.RequestOptions
|
||||
import com.coldmint.dialog.CoreDialog
|
||||
import com.coldmint.rust.core.dataBean.ApiResponse
|
||||
import com.coldmint.rust.core.dataBean.DynamicItemDataBean
|
||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||
import com.coldmint.rust.core.tool.AppOperator
|
||||
import com.coldmint.rust.core.web.Dynamic
|
||||
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.ItemDynamicBinding
|
||||
import com.coldmint.rust.pro.tool.AppSettings
|
||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||
import com.coldmint.rust.pro.tool.TextStyleMaker
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import org.w3c.dom.Text
|
||||
|
||||
/**
|
||||
* @author Cold Mint
|
||||
* @date 2021/12/28 18:29
|
||||
*/
|
||||
class DynamicAdapter(context: Context, dataList: MutableList<DynamicItemDataBean.Data>) :
|
||||
BaseAdapter<ItemDynamicBinding, DynamicItemDataBean.Data>(context, dataList) {
|
||||
|
||||
|
||||
override fun getViewBindingObject(
|
||||
layoutInflater: LayoutInflater,
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): ItemDynamicBinding {
|
||||
return ItemDynamicBinding.inflate(layoutInflater, parent, false)
|
||||
}
|
||||
|
||||
override fun onBingView(
|
||||
data: DynamicItemDataBean.Data,
|
||||
viewBinding: ItemDynamicBinding,
|
||||
viewHolder: ViewHolder<ItemDynamicBinding>,
|
||||
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 = if (data.location == null) {
|
||||
data.time
|
||||
} else {
|
||||
data.time + " " + data.location
|
||||
}
|
||||
viewBinding.nameView.text = data.userName
|
||||
TextStyleMaker.instance.load(viewBinding.contentView, data.content) { type, data ->
|
||||
TextStyleMaker.instance.clickEvent(context, type, data)
|
||||
}
|
||||
viewBinding.shareImageView.setOnClickListener {
|
||||
AppOperator.shareText(context, context.getString(R.string.share_message), data.content);
|
||||
}
|
||||
viewBinding.thumbUpImageView.setOnClickListener {
|
||||
Snackbar.make(viewBinding.thumbUpImageView,R.string.temporarily_unavailable,Snackbar.LENGTH_SHORT).show()
|
||||
}
|
||||
viewBinding.moreImageView.setOnClickListener { view ->
|
||||
val menu = GlobalMethod.createPopMenu(view)
|
||||
menu.menu.add(R.string.copy)
|
||||
menu.menu.add(R.string.delete_title)
|
||||
menu.setOnMenuItemClickListener {
|
||||
val title = it.title
|
||||
when (title) {
|
||||
context.getString(R.string.copy) -> {
|
||||
GlobalMethod.copyText(context, data.content, view)
|
||||
}
|
||||
context.getString(R.string.delete_title) -> {
|
||||
CoreDialog(context).setTitle(R.string.delete_dynamic)
|
||||
.setMessage(R.string.delete_dynamic_tip)
|
||||
.setPositiveButton(R.string.dialog_ok) {
|
||||
val account = AppSettings.getValue(AppSettings.Setting.Account, "")
|
||||
val appId =
|
||||
AppSettings
|
||||
.getValue(AppSettings.Setting.AppID, "")
|
||||
Dynamic.instance.deleteDynamic(
|
||||
account,
|
||||
appId,
|
||||
data.id,
|
||||
object : ApiCallBack<ApiResponse> {
|
||||
override fun onResponse(t: ApiResponse) {
|
||||
//成功与否执行都一样
|
||||
if (t.code == ServerConfiguration.Success_Code) {
|
||||
removeItem(viewHolder.adapterPosition)
|
||||
}
|
||||
Snackbar.make(
|
||||
viewBinding.root,
|
||||
t.message,
|
||||
Snackbar.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
|
||||
override fun onFailure(e: Exception) {
|
||||
Snackbar.make(
|
||||
viewBinding.root,
|
||||
R.string.network_error,
|
||||
Snackbar.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
|
||||
})
|
||||
}.setNegativeButton(R.string.dialog_cancel) {
|
||||
|
||||
}.show()
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
menu.show()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -3,7 +3,6 @@ package com.coldmint.rust.pro.adapters
|
|||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.isVisible
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
|
||||
import com.coldmint.rust.pro.R
|
||||
|
@ -29,12 +28,6 @@ class ErrorInfoAdapter( context: Context, dataList: ArrayList<ErrorInfo>) :
|
|||
position: Int
|
||||
) {
|
||||
viewBinding.timeView.text = data.time
|
||||
// if (des == null || des.isBlank()) {
|
||||
// viewBinding.describeView.isVisible = false
|
||||
// } else {
|
||||
// viewBinding.describeView.isVisible = true
|
||||
// viewBinding.describeView.text = des
|
||||
// }
|
||||
viewBinding.root.setOnClickListener { view ->
|
||||
MaterialDialog(context, BottomSheet()).show {
|
||||
title(text = data.time).message(text = data.allErrorDetails)
|
||||
|
|
|
@ -1,28 +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.HotSearchData
|
||||
import com.coldmint.rust.pro.base.BaseAdapter
|
||||
import com.coldmint.rust.pro.databinding.ItemHotSearchBinding
|
||||
|
||||
class HotSearchAdapter(context: Context, dataList: MutableList<HotSearchData.Data>) :
|
||||
BaseAdapter<ItemHotSearchBinding, HotSearchData.Data>(context, dataList) {
|
||||
override fun getViewBindingObject(
|
||||
layoutInflater: LayoutInflater,
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): ItemHotSearchBinding {
|
||||
return ItemHotSearchBinding.inflate(layoutInflater,parent,false)
|
||||
}
|
||||
|
||||
override fun onBingView(
|
||||
data: HotSearchData.Data,
|
||||
viewBinding: ItemHotSearchBinding,
|
||||
viewHolder: ViewHolder<ItemHotSearchBinding>,
|
||||
position: Int
|
||||
) {
|
||||
viewBinding.titleView.text = data.keyword
|
||||
}
|
||||
}
|
|
@ -1,53 +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.InsertCoinHistoryData
|
||||
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.ItemInsertCoinsBinding
|
||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||
|
||||
|
||||
/**
|
||||
* 投币记录适配器
|
||||
* @constructor
|
||||
*/
|
||||
class InsertCoinsAdapter(context: Context, dataList: MutableList<InsertCoinHistoryData.Data>) :
|
||||
BaseAdapter<ItemInsertCoinsBinding, InsertCoinHistoryData.Data>(context, dataList) {
|
||||
|
||||
private val insertCoinsTip by lazy {
|
||||
context.getString(R.string.insert_coins_tip)
|
||||
}
|
||||
|
||||
override fun getViewBindingObject(
|
||||
layoutInflater: LayoutInflater,
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): ItemInsertCoinsBinding {
|
||||
return ItemInsertCoinsBinding.inflate(layoutInflater, parent, false)
|
||||
}
|
||||
|
||||
override fun onBingView(
|
||||
data: InsertCoinHistoryData.Data,
|
||||
viewBinding: ItemInsertCoinsBinding,
|
||||
viewHolder: ViewHolder<ItemInsertCoinsBinding>,
|
||||
position: Int
|
||||
) {
|
||||
val icon = data.headIcon
|
||||
if (icon == null) {
|
||||
viewBinding.imageView.setImageResource(R.drawable.head_icon)
|
||||
|
||||
} else {
|
||||
Glide.with(context).load(ServerConfiguration.getRealLink(icon))
|
||||
.apply(GlobalMethod.getRequestOptions(true)).into(viewBinding.imageView)
|
||||
}
|
||||
viewBinding.numberOfCoinView.text = String.format(insertCoinsTip, data.number)
|
||||
viewBinding.timeView.text = data.time
|
||||
viewBinding.nameView.text = data.userName
|
||||
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ import java.util.ArrayList
|
|||
|
||||
class MapAndMusicAdapter(context: Context, dataList: ArrayList<File>, val isMusic: Boolean) :
|
||||
BaseAdapter<MapAndMusicItemBinding, File>(context, dataList) {
|
||||
val prefixName = "[noloop]"
|
||||
private val prefixName = "[noloop]"
|
||||
|
||||
|
||||
fun onClickItem(
|
||||
|
|
|
@ -193,15 +193,6 @@ class ModActionAdapter(
|
|||
* 打开作品首页
|
||||
*/
|
||||
private fun openHomePage() {
|
||||
val modId = modConfigurationData?.modId
|
||||
if (modId != null) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString("modId", modId)
|
||||
bundle.putString("modName", modId)
|
||||
val intent = Intent(mContext, WebModInfoActivity::class.java)
|
||||
intent.putExtra("data", bundle)
|
||||
mContext.startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,101 +0,0 @@
|
|||
package com.coldmint.rust.pro.adapters
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import com.coldmint.rust.core.dataBean.mod.WebModInfoData
|
||||
import com.coldmint.rust.core.tool.DebugHelper
|
||||
import com.coldmint.rust.pro.fragments.InsertCoinsFragment
|
||||
import com.coldmint.rust.pro.fragments.ModCommentsFragment
|
||||
import com.coldmint.rust.pro.fragments.NullFragment
|
||||
import com.coldmint.rust.pro.fragments.WebModDetailsFragment
|
||||
|
||||
/**
|
||||
* 模组详情页面适配器
|
||||
* @constructor
|
||||
*/
|
||||
class ModPageDetailsAdapter(fragmentActivity: FragmentActivity, val modId: String, var A: WebModDetailsFragment? = null) :
|
||||
FragmentStateAdapter(fragmentActivity) {
|
||||
private lateinit var webModDetailsFragment: WebModDetailsFragment
|
||||
private lateinit var modCommentsFragment: ModCommentsFragment
|
||||
override fun getItemCount(): Int {
|
||||
if (A == null) {
|
||||
return 2
|
||||
} else
|
||||
return 3
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取下载链接
|
||||
* @return String?
|
||||
*/
|
||||
fun getLink(): String? {
|
||||
return if (this::webModDetailsFragment.isInitialized) {
|
||||
webModDetailsFragment.getLink()
|
||||
} else {
|
||||
DebugHelper.printLog("获取下载路径", "详情碎片未初始化,返回null", isError = true)
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取此模组是否对外开放
|
||||
* @return Boolean
|
||||
*/
|
||||
fun isOpen(): Boolean {
|
||||
return if (this::webModDetailsFragment.isInitialized) {
|
||||
webModDetailsFragment.isOpen()
|
||||
} else {
|
||||
DebugHelper.printLog("获取模组公开状态", "详情碎片未初始化,返回false", isError = true)
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
override fun createFragment(position: Int): Fragment {
|
||||
if (A == null) {
|
||||
return when (position) {
|
||||
0 -> {
|
||||
InsertCoinsFragment(modId)
|
||||
}
|
||||
|
||||
1 -> {
|
||||
if (!this::modCommentsFragment.isInitialized) {
|
||||
modCommentsFragment = ModCommentsFragment(modId)
|
||||
}
|
||||
modCommentsFragment
|
||||
}else -> {
|
||||
NullFragment()
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
return when (position) {
|
||||
0 -> {
|
||||
if (!this::webModDetailsFragment.isInitialized) {
|
||||
webModDetailsFragment = A as WebModDetailsFragment
|
||||
}
|
||||
webModDetailsFragment
|
||||
}
|
||||
|
||||
1 -> {
|
||||
InsertCoinsFragment(modId)
|
||||
}
|
||||
|
||||
2 -> {
|
||||
if (!this::modCommentsFragment.isInitialized) {
|
||||
modCommentsFragment = ModCommentsFragment(modId)
|
||||
}
|
||||
modCommentsFragment
|
||||
}else -> {
|
||||
NullFragment()
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// else -> {
|
||||
// NullFragment()
|
||||
// }
|
||||
}
|
||||
}
|
|
@ -1,70 +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.OrderListDataBean
|
||||
import com.coldmint.rust.core.web.ActivationApp
|
||||
import com.coldmint.rust.pro.base.BaseAdapter
|
||||
import com.coldmint.rust.pro.databinding.ItemOrderBinding
|
||||
|
||||
/**
|
||||
* @author Cold Mint
|
||||
* @date 2022/1/12 16:09
|
||||
*/
|
||||
class OrderAdapter(context: Context, dataList: MutableList<OrderListDataBean.Data>) :
|
||||
BaseAdapter<ItemOrderBinding, OrderListDataBean.Data>(context, dataList) {
|
||||
val stringBuilder = StringBuilder()
|
||||
var loadAll = false
|
||||
override fun getViewBindingObject(
|
||||
layoutInflater: LayoutInflater,
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): ItemOrderBinding {
|
||||
return ItemOrderBinding.inflate(layoutInflater, parent, false)
|
||||
}
|
||||
|
||||
override fun onBingView(
|
||||
data: OrderListDataBean.Data,
|
||||
viewBinding: ItemOrderBinding,
|
||||
viewHolder: ViewHolder<ItemOrderBinding>,
|
||||
position: Int
|
||||
) {
|
||||
viewBinding.titleView.text = data.name
|
||||
stringBuilder.clear()
|
||||
stringBuilder.append("订单名:")
|
||||
stringBuilder.append(data.name)
|
||||
stringBuilder.append("\n订单号:")
|
||||
stringBuilder.append(data.flag)
|
||||
stringBuilder.append("\n创建日期:")
|
||||
stringBuilder.append(data.createTime)
|
||||
stringBuilder.append("\n应付款:")
|
||||
stringBuilder.append(data.price)
|
||||
stringBuilder.append("元")
|
||||
if (data.originalPrice != data.price) {
|
||||
stringBuilder.append("\n原价:")
|
||||
stringBuilder.append(data.originalPrice)
|
||||
stringBuilder.append("元")
|
||||
}
|
||||
if (loadAll) {
|
||||
stringBuilder.append("\n账号:")
|
||||
stringBuilder.append(data.account)
|
||||
}
|
||||
val state = when (data.state) {
|
||||
"true" -> {
|
||||
"已完成"
|
||||
}
|
||||
"ignore" -> {
|
||||
"已过期"
|
||||
}
|
||||
else -> {
|
||||
"未完成"
|
||||
}
|
||||
}
|
||||
stringBuilder.append("\n订单状态:")
|
||||
stringBuilder.append(state)
|
||||
viewBinding.info.text = stringBuilder.toString()
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
package com.coldmint.rust.pro.adapters
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.isVisible
|
||||
import com.coldmint.rust.core.dataBean.CouponListDataBean
|
||||
import com.coldmint.rust.core.dataBean.PlanDataBean
|
||||
import com.coldmint.rust.pro.R
|
||||
import com.coldmint.rust.pro.base.BaseAdapter
|
||||
import com.coldmint.rust.pro.databinding.ItemPlanBinding
|
||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||
|
||||
/**
|
||||
* @author Cold Mint
|
||||
* @date 2021/12/19 20:32
|
||||
*/
|
||||
class PlanAdapter(context: Context, dataList: MutableList<PlanDataBean.Data>) :
|
||||
BaseAdapter<ItemPlanBinding, PlanDataBean.Data>(context, dataList) {
|
||||
private val money: String = context.getString(R.string.money)
|
||||
|
||||
//选中位置
|
||||
private var selectedIndex = 0
|
||||
get() = field
|
||||
|
||||
/**
|
||||
* 选择项目
|
||||
* @param index Int
|
||||
*/
|
||||
fun selectItem(index: Int) {
|
||||
if (index != selectedIndex) {
|
||||
//如果选中位置是新位置
|
||||
val oldIndex = selectedIndex
|
||||
selectedIndex = index
|
||||
notifyItemChanged(oldIndex)
|
||||
notifyItemChanged(index)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getViewBindingObject(
|
||||
layoutInflater: LayoutInflater,
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): ItemPlanBinding {
|
||||
return ItemPlanBinding.inflate(layoutInflater, parent, false)
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加人民币符号
|
||||
* @param num Double
|
||||
* @return String
|
||||
*/
|
||||
private fun addSymbol(num: Double): String {
|
||||
return String.format(money, num)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置优惠券
|
||||
* @param coupon Data?
|
||||
*/
|
||||
fun setCoupon(coupon: CouponListDataBean.Data?) {
|
||||
dataList.forEach {
|
||||
it.setCoupon(coupon)
|
||||
}
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
override fun onBingView(
|
||||
data: PlanDataBean.Data,
|
||||
viewBinding: ItemPlanBinding,
|
||||
viewHolder: ViewHolder<ItemPlanBinding>,
|
||||
position: Int
|
||||
) {
|
||||
if (selectedIndex == position) {
|
||||
viewBinding.linearLayout.setBackgroundResource(R.drawable.round_background_true)
|
||||
} else {
|
||||
viewBinding.linearLayout.setBackgroundResource(R.drawable.round_background_false)
|
||||
}
|
||||
viewBinding.titleView.text = data.name
|
||||
if (data.originalPrice < data.price) {
|
||||
viewBinding.originalPriceView.isVisible = false
|
||||
} else {
|
||||
viewBinding.originalPriceView.isVisible = true
|
||||
viewBinding.originalPriceView.text = addSymbol(data.originalPrice)
|
||||
GlobalMethod.addDeleteLine(viewBinding.originalPriceView)
|
||||
}
|
||||
viewBinding.priceView.text = addSymbol(data.price)
|
||||
}
|
||||
}
|
|
@ -1,25 +1,17 @@
|
|||
package com.coldmint.rust.pro.adapters
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.request.RequestOptions
|
||||
import com.coldmint.rust.core.dataBean.ApiResponse
|
||||
import com.coldmint.rust.core.dataBean.report.ReportItemDataBean
|
||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||
import com.coldmint.rust.core.web.Report
|
||||
import com.coldmint.rust.core.web.ServerConfiguration
|
||||
import com.coldmint.rust.pro.R
|
||||
import com.coldmint.rust.pro.WebModInfoActivity
|
||||
import com.coldmint.rust.pro.base.BaseAdapter
|
||||
import com.coldmint.rust.pro.databinding.ItemReportBinding
|
||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||
import java.lang.StringBuilder
|
||||
|
||||
/**
|
||||
* @author Cold Mint
|
||||
|
@ -59,13 +51,7 @@ class ReportAdapter(
|
|||
viewBinding.typeView.setText(R.string.report_mod)
|
||||
viewBinding.actionView.setText(R.string.sold_out_mod)
|
||||
viewBinding.openView.setOnClickListener {
|
||||
val intent = Intent(context, WebModInfoActivity::class.java)
|
||||
val target = data.target
|
||||
val bundle = Bundle()
|
||||
bundle.putString("modName", target)
|
||||
bundle.putString("modId", target)
|
||||
intent.putExtra("data", bundle)
|
||||
context.startActivity(intent)
|
||||
|
||||
}
|
||||
}
|
||||
"user" -> {
|
||||
|
|
|
@ -1,52 +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.ItemPlanBinding
|
||||
import com.coldmint.rust.pro.databinding.ItemUserBinding
|
||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||
|
||||
/**
|
||||
* @author Cold Mint
|
||||
* @date 2021/12/23 22:44
|
||||
*/
|
||||
class UserAdapter( context: Context, dataList: MutableList<FollowUserListData.Data>) :
|
||||
BaseAdapter<ItemUserBinding, FollowUserListData.Data>(context, dataList) {
|
||||
val defaultIntroduced = context.getString(R.string.defaultIntroduced)
|
||||
override fun getViewBindingObject(
|
||||
layoutInflater: LayoutInflater,
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): ItemUserBinding {
|
||||
return ItemUserBinding.inflate(layoutInflater, parent, false)
|
||||
}
|
||||
|
||||
override fun onBingView(
|
||||
data: FollowUserListData.Data,
|
||||
viewBinding: ItemUserBinding,
|
||||
viewHolder: ViewHolder<ItemUserBinding>,
|
||||
position: Int
|
||||
) {
|
||||
viewBinding.nameView.text = data.userName
|
||||
val introduce = data.introduce
|
||||
if (introduce == null || introduce.isBlank()) {
|
||||
viewBinding.describeView.text = defaultIntroduced
|
||||
} else {
|
||||
viewBinding.describeView.text = introduce
|
||||
}
|
||||
val icon = data.headIcon
|
||||
if (icon != null) {
|
||||
Glide.with(context).load(ServerConfiguration.getRealLink(icon)).apply(GlobalMethod.getRequestOptions(true))
|
||||
.into(viewBinding.iconView)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,34 +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.DynamicFragment
|
||||
import com.coldmint.rust.pro.fragments.PersonalHomeFragment
|
||||
|
||||
class UserHomeStateAdapter(activity: FragmentActivity, val userId: String) :
|
||||
FragmentStateAdapter(activity) {
|
||||
private val dynamicFragment: DynamicFragment by lazy {
|
||||
DynamicFragment(this.userId)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = 2
|
||||
|
||||
override fun createFragment(position: Int): Fragment {
|
||||
return when (position) {
|
||||
0 -> {
|
||||
PersonalHomeFragment(this.userId)
|
||||
}
|
||||
else -> {
|
||||
dynamicFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新动态列表
|
||||
*/
|
||||
fun updataDynamicList() {
|
||||
dynamicFragment.loadList()
|
||||
}
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
package com.coldmint.rust.pro.fragments
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import com.coldmint.rust.pro.R
|
||||
import com.coldmint.rust.pro.adapters.CommunityAdapter
|
||||
import com.coldmint.rust.pro.tool.Tools
|
||||
import com.google.android.material.navigation.NavigationBarView
|
||||
import com.google.android.material.navigationrail.NavigationRailView
|
||||
|
||||
class CommunityFragment : Fragment() {
|
||||
|
||||
/**
|
||||
* 加载tab
|
||||
*/
|
||||
private fun loadTab() {
|
||||
if (!isAdded) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
val inflate = inflater.inflate(R.layout.fragment_community, container, false)
|
||||
onViewCreated(inflate)
|
||||
return inflate
|
||||
|
||||
}
|
||||
|
||||
private fun onViewCreated(view: View) {
|
||||
val navigationBarView : NavigationBarView = view.findViewById(R.id.bottomnavigationView)
|
||||
val pager : ViewPager2 = view.findViewById(R.id.pager)
|
||||
// 是否是平板模式
|
||||
val tabletMode = Tools.isTabletMode(requireContext())
|
||||
if (tabletMode){
|
||||
}
|
||||
pager.adapter = CommunityAdapter(this)
|
||||
pager.isSaveEnabled = false
|
||||
pager.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() {
|
||||
override fun onPageSelected(position: Int) {
|
||||
when (position) {
|
||||
0 -> {
|
||||
navigationBarView.selectedItemId = R.id.action_recommended
|
||||
}
|
||||
1 -> {
|
||||
navigationBarView.selectedItemId = R.id.action_follow
|
||||
}
|
||||
2 -> {
|
||||
navigationBarView.selectedItemId = R.id.action_ranking
|
||||
}
|
||||
3 -> {
|
||||
navigationBarView.selectedItemId = R.id.action_my
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
navigationBarView.setOnItemSelectedListener {
|
||||
when (it.itemId) {
|
||||
R.id.action_recommended -> {
|
||||
pager.setCurrentItem(0, !tabletMode)
|
||||
}
|
||||
R.id.action_follow -> {
|
||||
pager.setCurrentItem(1, !tabletMode)
|
||||
}
|
||||
R.id.action_ranking -> {
|
||||
pager.setCurrentItem(2, !tabletMode)
|
||||
}
|
||||
R.id.action_my -> {
|
||||
pager.setCurrentItem(3, !tabletMode)
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package com.coldmint.rust.pro.fragments
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.coldmint.rust.core.dataBean.DynamicItemDataBean
|
||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||
import com.coldmint.rust.core.web.Dynamic
|
||||
import com.coldmint.rust.core.web.ServerConfiguration
|
||||
import com.coldmint.rust.pro.R
|
||||
import com.coldmint.rust.pro.adapters.DynamicAdapter
|
||||
import com.coldmint.rust.pro.base.BaseFragment
|
||||
import com.coldmint.rust.pro.databinding.FragmentDynamicBinding
|
||||
import com.coldmint.rust.pro.ui.StableLinearLayoutManager
|
||||
|
||||
/**
|
||||
* @author Cold Mint
|
||||
* @date 2021/12/30 9:43
|
||||
*/
|
||||
class DynamicFragment(val userId: String) : BaseFragment<FragmentDynamicBinding>() {
|
||||
|
||||
/**
|
||||
* 加载列表方法(公开)
|
||||
*/
|
||||
fun loadList() {
|
||||
Dynamic.instance.getList(object : ApiCallBack<DynamicItemDataBean> {
|
||||
override fun onResponse(t: DynamicItemDataBean) {
|
||||
val data = t.data?.toMutableList()
|
||||
if (t.code == ServerConfiguration.Success_Code && data != null) {
|
||||
val adapter = DynamicAdapter(requireContext(), data)
|
||||
viewBinding.recyclerView.adapter = adapter
|
||||
viewBinding.recyclerView.isVisible = true
|
||||
viewBinding.progressBar.isVisible = false
|
||||
viewBinding.textview.isVisible = false
|
||||
} else {
|
||||
viewBinding.recyclerView.isVisible = false
|
||||
viewBinding.progressBar.isVisible = false
|
||||
viewBinding.textview.isVisible = true
|
||||
viewBinding.textview.text = t.message
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(e: Exception) {
|
||||
viewBinding.recyclerView.isVisible = false
|
||||
viewBinding.progressBar.isVisible = false
|
||||
viewBinding.textview.isVisible = true
|
||||
viewBinding.textview.text = requireContext().getText(R.string.network_error)
|
||||
}
|
||||
|
||||
}, account = userId)
|
||||
}
|
||||
|
||||
|
||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentDynamicBinding {
|
||||
return FragmentDynamicBinding.inflate(layoutInflater)
|
||||
}
|
||||
|
||||
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
||||
viewBinding.recyclerView.layoutManager = StableLinearLayoutManager(requireContext())
|
||||
loadList()
|
||||
}
|
||||
}
|
|
@ -1,227 +0,0 @@
|
|||
package com.coldmint.rust.pro.fragments
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.coldmint.rust.core.dataBean.DynamicItemDataBean
|
||||
import com.coldmint.rust.core.dataBean.follow.FollowUserListData
|
||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||
import com.coldmint.rust.core.web.Community
|
||||
import com.coldmint.rust.core.web.Dynamic
|
||||
import com.coldmint.rust.core.web.ServerConfiguration
|
||||
import com.coldmint.rust.pro.R
|
||||
import com.coldmint.rust.pro.adapters.DynamicAdapter
|
||||
import com.coldmint.rust.pro.adapters.UserHeadAdapter
|
||||
import com.coldmint.rust.pro.base.BaseFragment
|
||||
import com.coldmint.rust.pro.databinding.FragmentFollowBinding
|
||||
import com.coldmint.rust.pro.tool.AppSettings
|
||||
import com.coldmint.rust.pro.ui.StableLinearLayoutManager
|
||||
|
||||
/**
|
||||
* 关注者
|
||||
* @author Cold Mint
|
||||
* @date 2021/12/28 10:23
|
||||
*/
|
||||
class FollowFragment : BaseFragment<FragmentFollowBinding>() {
|
||||
|
||||
var oldSize: Int = 0
|
||||
var lastIndex = 0
|
||||
|
||||
/**
|
||||
* 加载视图如果需要更新的话
|
||||
*/
|
||||
private fun loadViewIfNeed() {
|
||||
val loginStatus = AppSettings.getValue(AppSettings.Setting.LoginStatus, false)
|
||||
if (loginStatus) {
|
||||
val account = AppSettings.getValue(AppSettings.Setting.Account, "")
|
||||
Community.getUserList(
|
||||
account,
|
||||
limit = -1,
|
||||
apiCallBack = object : ApiCallBack<FollowUserListData> {
|
||||
override fun onResponse(t: FollowUserListData) {
|
||||
if (t.code == ServerConfiguration.Success_Code) {
|
||||
val data = t.data
|
||||
if (data == null) {
|
||||
showTip(R.string.no_followers)
|
||||
} else {
|
||||
try {
|
||||
viewBinding.tipView.isVisible = false
|
||||
viewBinding.progressBar.isVisible = false
|
||||
viewBinding.linearLayout.isVisible = true
|
||||
if (oldSize != data.size + 1 && data.isNotEmpty()) {
|
||||
data.add(
|
||||
0,
|
||||
FollowUserListData.Data(
|
||||
account = "",
|
||||
enable = "",
|
||||
email = "",
|
||||
cover = "",
|
||||
headIcon = null,
|
||||
loginTime = "",
|
||||
gender = 0,
|
||||
userName = getString(R.string.all_dynamic),
|
||||
permission = ""
|
||||
)
|
||||
)
|
||||
val adapter = UserHeadAdapter(requireContext(), data)
|
||||
adapter.setItemEvent { i, itemUserHeadBinding, viewHolder, data ->
|
||||
itemUserHeadBinding.root.setOnClickListener {
|
||||
lastIndex = viewHolder.adapterPosition
|
||||
loadDynamic(data.account)
|
||||
}
|
||||
|
||||
itemUserHeadBinding.root.setOnLongClickListener {
|
||||
val account = data.account
|
||||
if (account.isNotBlank()) {
|
||||
openHomePage(data.account)
|
||||
}
|
||||
return@setOnLongClickListener true
|
||||
}
|
||||
}
|
||||
oldSize = data.size
|
||||
viewBinding.headRecyclerView.adapter = adapter
|
||||
//如果最后查看的位置小于总长度(不会下标越界),则加载上次的位置
|
||||
if (lastIndex < oldSize) {
|
||||
loadDynamic(data[lastIndex].account)
|
||||
} else {
|
||||
//等于或大于(加载末尾)
|
||||
loadDynamic(data[oldSize - 1].account)
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
showTip(R.string.network_error)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
showTip(content = t.message)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onFailure(e: Exception) {
|
||||
showTip(R.string.network_error)
|
||||
}
|
||||
|
||||
})
|
||||
} else {
|
||||
showTip(R.string.follow_introduction)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开某个用户主页
|
||||
* @param account String
|
||||
*/
|
||||
fun openHomePage(account: String) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 动态获取完成事件
|
||||
* @param t DynamicItemDataBean
|
||||
*/
|
||||
fun getDynamicSuccess(t: DynamicItemDataBean) {
|
||||
if (!isAdded) {
|
||||
return
|
||||
}
|
||||
val data = t.data?.toMutableList()
|
||||
if (t.code == ServerConfiguration.Success_Code && data != null) {
|
||||
val adapter = DynamicAdapter(requireContext(), data)
|
||||
adapter.setItemEvent { i, itemDynamicBinding, viewHolder, data ->
|
||||
itemDynamicBinding.headIconView.setOnClickListener {
|
||||
openHomePage(data.account)
|
||||
}
|
||||
}
|
||||
viewBinding.textview.isVisible = false
|
||||
viewBinding.progressBar2.isVisible = false
|
||||
viewBinding.recyclerView.isVisible = true
|
||||
viewBinding.recyclerView.adapter = adapter
|
||||
} else {
|
||||
viewBinding.progressBar2.isVisible = false
|
||||
viewBinding.textview.isVisible = true
|
||||
viewBinding.recyclerView.isVisible = false
|
||||
viewBinding.textview.text = t.message
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取动态失败
|
||||
*/
|
||||
fun getDynamicFailure() {
|
||||
viewBinding.progressBar2.isVisible = false
|
||||
viewBinding.textview.isVisible = true
|
||||
viewBinding.recyclerView.isVisible = false
|
||||
viewBinding.textview.setText(R.string.network_error)
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载动态
|
||||
* @param account String 账号
|
||||
*/
|
||||
fun loadDynamic(account: String) {
|
||||
if (account.isBlank()) {
|
||||
val selfAccount = AppSettings.getValue(AppSettings.Setting.Account, "")
|
||||
Dynamic.instance.getFollowAllDynamic(selfAccount,
|
||||
object : ApiCallBack<DynamicItemDataBean> {
|
||||
override fun onResponse(t: DynamicItemDataBean) {
|
||||
getDynamicSuccess(t)
|
||||
}
|
||||
|
||||
override fun onFailure(e: Exception) {
|
||||
getDynamicFailure()
|
||||
}
|
||||
|
||||
})
|
||||
} else {
|
||||
Dynamic.instance.getList(object : ApiCallBack<DynamicItemDataBean> {
|
||||
override fun onResponse(t: DynamicItemDataBean) {
|
||||
getDynamicSuccess(t)
|
||||
}
|
||||
|
||||
override fun onFailure(e: Exception) {
|
||||
getDynamicFailure()
|
||||
}
|
||||
|
||||
}, account = account)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
loadViewIfNeed()
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示提示
|
||||
* @param resId Int 资源ID
|
||||
* @param content String? 内容
|
||||
*/
|
||||
fun showTip(resId: Int = R.string.network_error, content: String? = null) {
|
||||
viewBinding.linearLayout.isVisible = false
|
||||
viewBinding.progressBar.isVisible = false
|
||||
viewBinding.tipView.isVisible = true
|
||||
if (content == null) {
|
||||
viewBinding.tipView.setText(resId)
|
||||
} else {
|
||||
viewBinding.tipView.text = content
|
||||
}
|
||||
}
|
||||
|
||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentFollowBinding {
|
||||
return FragmentFollowBinding.inflate(layoutInflater)
|
||||
}
|
||||
|
||||
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
||||
viewBinding.rootLayout.layoutTransition.setAnimateParentHierarchy(false)
|
||||
viewBinding.linearLayout2.layoutTransition.setAnimateParentHierarchy(false)
|
||||
val linearLayoutManager = LinearLayoutManager(requireContext(), RecyclerView.HORIZONTAL, false)
|
||||
viewBinding.headRecyclerView.layoutManager = linearLayoutManager
|
||||
viewBinding.headRecyclerView.isNestedScrollingEnabled = false
|
||||
val linearLayoutManager2 = StableLinearLayoutManager(requireContext())
|
||||
viewBinding.recyclerView.layoutManager = linearLayoutManager2
|
||||
loadViewIfNeed()
|
||||
}
|
||||
}
|
|
@ -1,144 +0,0 @@
|
|||
package com.coldmint.rust.pro.fragments
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import androidx.core.view.isVisible
|
||||
import com.coldmint.rust.core.dataBean.mod.CoinStatusData
|
||||
import com.coldmint.rust.core.dataBean.mod.InsertCoinHistoryData
|
||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||
import com.coldmint.rust.core.web.WebMod
|
||||
import com.coldmint.rust.pro.R
|
||||
import com.coldmint.rust.pro.adapters.InsertCoinsAdapter
|
||||
import com.coldmint.rust.pro.base.BaseFragment
|
||||
import com.coldmint.rust.pro.databinding.FragmentInsertCoinsBinding
|
||||
import com.coldmint.rust.pro.ui.StableLinearLayoutManager
|
||||
import com.google.android.material.divider.MaterialDividerItemDecoration
|
||||
|
||||
/**
|
||||
* 投币碎片
|
||||
*/
|
||||
class InsertCoinsFragment(val modId: String) : BaseFragment<FragmentInsertCoinsBinding>() {
|
||||
private val token by lazy {
|
||||
""
|
||||
}
|
||||
|
||||
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
||||
viewBinding.recyclerView.layoutManager = StableLinearLayoutManager(requireContext())
|
||||
val divider = MaterialDividerItemDecoration(
|
||||
requireContext(),
|
||||
MaterialDividerItemDecoration.VERTICAL
|
||||
)
|
||||
|
||||
viewBinding.recyclerView.addItemDecoration(
|
||||
divider
|
||||
)
|
||||
viewBinding.swipeRefreshLayout.setOnRefreshListener {
|
||||
loadList(false)
|
||||
viewBinding.swipeRefreshLayout.isRefreshing = false
|
||||
}
|
||||
viewBinding.button.setOnClickListener {
|
||||
InsertCoinsDialog(requireContext(), modId).setCallBackListener {
|
||||
if (it) {
|
||||
viewBinding.button.isEnabled = false
|
||||
viewBinding.tipView.text = getString(R.string.insert_coins_ok)
|
||||
loadList()
|
||||
}
|
||||
}.show()
|
||||
}
|
||||
loadButton()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
loadList()
|
||||
}
|
||||
|
||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentInsertCoinsBinding {
|
||||
return FragmentInsertCoinsBinding.inflate(layoutInflater)
|
||||
}
|
||||
|
||||
|
||||
fun loadList(useLinearProgressIndicator: Boolean = true) {
|
||||
if (useLinearProgressIndicator) {
|
||||
viewBinding.linearProgressIndicator.isVisible = true
|
||||
}
|
||||
WebMod.instance.getInsertCoinHistory(modId, object : ApiCallBack<InsertCoinHistoryData> {
|
||||
override fun onResponse(t: InsertCoinHistoryData) {
|
||||
if (isAdded) {
|
||||
val dataList = t.data
|
||||
if (dataList.isNullOrEmpty()) {
|
||||
viewBinding.recyclerView.isVisible = false
|
||||
if (useLinearProgressIndicator) {
|
||||
viewBinding.linearProgressIndicator.isVisible = false
|
||||
}
|
||||
viewBinding.loadLayout.isVisible = true
|
||||
viewBinding.coinRecordsView.text = getString(R.string.coin_records)
|
||||
} else {
|
||||
val adapter = InsertCoinsAdapter(requireContext(), dataList)
|
||||
adapter.setItemEvent { i, itemInsertCoinsBinding, viewHolder, data ->
|
||||
itemInsertCoinsBinding.imageView.setOnClickListener {
|
||||
gotoUserPage(data.account)
|
||||
}
|
||||
}
|
||||
viewBinding.recyclerView.adapter =
|
||||
adapter
|
||||
val data = getString(R.string.coin_records) + "(" + dataList.size + ")"
|
||||
viewBinding.coinRecordsView.text = data
|
||||
viewBinding.recyclerView.isVisible = true
|
||||
if (useLinearProgressIndicator) {
|
||||
viewBinding.linearProgressIndicator.isVisible = false
|
||||
}
|
||||
viewBinding.loadLayout.isVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(e: Exception) {
|
||||
e.printStackTrace()
|
||||
viewBinding.recyclerView.isVisible = false
|
||||
viewBinding.coinRecordsView.text = getString(R.string.coin_records)
|
||||
if (useLinearProgressIndicator) {
|
||||
viewBinding.linearProgressIndicator.isVisible = false
|
||||
}
|
||||
viewBinding.loadLayout.isVisible = true
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开用户主页
|
||||
* @param userId String
|
||||
*/
|
||||
fun gotoUserPage(userId: String) {
|
||||
|
||||
}
|
||||
|
||||
fun loadButton() {
|
||||
if (token.isBlank()) {
|
||||
viewBinding.tipView.text = getString(R.string.please_login_first)
|
||||
viewBinding.button.isEnabled = false
|
||||
return
|
||||
}
|
||||
WebMod.instance.getCoinStatus(token, modId, object : ApiCallBack<CoinStatusData> {
|
||||
override fun onResponse(t: CoinStatusData) {
|
||||
viewBinding.button.isEnabled = !t.data
|
||||
if (t.data) {
|
||||
viewBinding.tipView.text = getString(R.string.insert_coins_ok)
|
||||
} else {
|
||||
viewBinding.tipView.text = getString(R.string.insert_coins_no)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(e: Exception) {
|
||||
e.printStackTrace()
|
||||
viewBinding.button.isEnabled = false
|
||||
viewBinding.tipView.text = getString(R.string.insert_coins_no)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,171 +0,0 @@
|
|||
package com.coldmint.rust.pro.fragments
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.core.view.isVisible
|
||||
import com.coldmint.rust.core.dataBean.ApiResponse
|
||||
import com.coldmint.rust.core.dataBean.mod.WebModCommentData
|
||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||
import com.coldmint.rust.core.tool.DebugHelper
|
||||
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.adapters.CommentAdapter
|
||||
import com.coldmint.rust.pro.base.BaseFragment
|
||||
import com.coldmint.rust.pro.databinding.FragmentModCommentsBinding
|
||||
import com.coldmint.rust.pro.dialog.CommentDialog
|
||||
import com.coldmint.rust.pro.tool.AppSettings
|
||||
import com.coldmint.rust.pro.ui.StableLinearLayoutManager
|
||||
import com.google.android.material.divider.MaterialDividerItemDecoration
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
|
||||
/**
|
||||
* 模组评论
|
||||
*/
|
||||
class ModCommentsFragment(val modId: String) : BaseFragment<FragmentModCommentsBinding>() {
|
||||
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
||||
viewBinding.recyclerView.layoutManager = StableLinearLayoutManager(requireContext())
|
||||
val divider = MaterialDividerItemDecoration(
|
||||
requireContext(),
|
||||
MaterialDividerItemDecoration.VERTICAL
|
||||
)
|
||||
|
||||
viewBinding.recyclerView.addItemDecoration(
|
||||
divider
|
||||
)
|
||||
//刷新评论区
|
||||
viewBinding.swipeRefreshLayout.setOnRefreshListener {
|
||||
loadCommentList(modId, false)
|
||||
viewBinding.swipeRefreshLayout.isRefreshing = false
|
||||
}
|
||||
viewBinding.sendDiscussion.setOnClickListener {
|
||||
val token = ""
|
||||
if (token.isBlank()) {
|
||||
Snackbar.make(
|
||||
viewBinding.sendDiscussion,
|
||||
R.string.please_login_first,
|
||||
Snackbar.LENGTH_SHORT
|
||||
).show()
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
|
||||
CommentDialog(requireContext()).setCancelable(false)
|
||||
.setSubmitFun { button, textInputLayout, s, alertDialog ->
|
||||
button.isEnabled = false
|
||||
WebMod.instance.sendComment(
|
||||
token,
|
||||
modId,
|
||||
s,
|
||||
object : ApiCallBack<ApiResponse> {
|
||||
override fun onResponse(t: ApiResponse) {
|
||||
if (t.code == ServerConfiguration.Success_Code) {
|
||||
alertDialog.dismiss()
|
||||
loadCommentList(modId)
|
||||
Snackbar.make(
|
||||
viewBinding.sendDiscussion,
|
||||
R.string.release_ok,
|
||||
Snackbar.LENGTH_SHORT
|
||||
).show()
|
||||
} else {
|
||||
textInputLayout.error = t.message
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(e: Exception) {
|
||||
textInputLayout.error = e.toString()
|
||||
}
|
||||
|
||||
})
|
||||
}.show()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开用户主页
|
||||
* @param userId String
|
||||
*/
|
||||
fun gotoUserPage(userId: String) {
|
||||
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
loadCommentList(modId)
|
||||
}
|
||||
|
||||
fun commentSizeChange(size: Int){
|
||||
if (size == 0){
|
||||
viewBinding.titleView.text = getString(R.string.discussion)
|
||||
viewBinding.recyclerView.isVisible = false
|
||||
viewBinding.noContentLayout.isVisible = true
|
||||
}else{
|
||||
viewBinding.titleView.text =
|
||||
getString(R.string.discussion) + "(" + size + ")"
|
||||
|
||||
viewBinding.recyclerView.isVisible = true
|
||||
viewBinding.noContentLayout.isVisible = false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载评论列表
|
||||
* @param modId String
|
||||
*/
|
||||
fun loadCommentList(modId: String, useLinearProgressIndicator: Boolean = true) {
|
||||
val key = "加载评论列表"
|
||||
if (useLinearProgressIndicator) {
|
||||
viewBinding.linearProgressIndicator.visibility = View.VISIBLE
|
||||
}
|
||||
WebMod.instance.getCommentsList(modId, object : ApiCallBack<WebModCommentData> {
|
||||
override fun onResponse(t: WebModCommentData) {
|
||||
val list = t.data
|
||||
if (list.isNullOrEmpty()) {
|
||||
DebugHelper.printLog(key, "为空", isError = true)
|
||||
if (useLinearProgressIndicator) {
|
||||
viewBinding.linearProgressIndicator.visibility = View.INVISIBLE
|
||||
}
|
||||
commentSizeChange(0)
|
||||
} else {
|
||||
DebugHelper.printLog(key, "共${list.size}条数据")
|
||||
commentSizeChange(list.size)
|
||||
if (useLinearProgressIndicator) {
|
||||
viewBinding.linearProgressIndicator.visibility = View.INVISIBLE
|
||||
}
|
||||
val adapter = CommentAdapter(requireContext(), list)
|
||||
adapter.setItemEvent { i, itemCommentBinding, viewHolder, data ->
|
||||
itemCommentBinding.iconView.setOnClickListener {
|
||||
gotoUserPage(data.account)
|
||||
}
|
||||
}
|
||||
adapter.setItemChangeEvent { changeType, i, data, i2 ->
|
||||
viewBinding.titleView.text =
|
||||
getString(R.string.discussion) + "(" + i2 + ")"
|
||||
commentSizeChange(i2)
|
||||
}
|
||||
viewBinding.recyclerView.adapter = adapter
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(e: Exception) {
|
||||
DebugHelper.printLog(key, "加载失败", isError = true)
|
||||
if (useLinearProgressIndicator) {
|
||||
viewBinding.linearProgressIndicator.visibility = View.INVISIBLE
|
||||
}
|
||||
viewBinding.titleView.text = getString(R.string.discussion)
|
||||
viewBinding.recyclerView.isVisible = false
|
||||
viewBinding.noContentLayout.isVisible = true
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentModCommentsBinding {
|
||||
return FragmentModCommentsBinding.inflate(layoutInflater)
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,120 +0,0 @@
|
|||
package com.coldmint.rust.pro.fragments
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.coldmint.rust.core.dataBean.mod.WebModListData
|
||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||
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.TagActivity
|
||||
import com.coldmint.rust.pro.WebModInfoActivity
|
||||
import com.coldmint.rust.pro.adapters.WebModAdapter
|
||||
import com.coldmint.rust.pro.base.BaseFragment
|
||||
import com.coldmint.rust.pro.databinding.FragmentPersonalHomeBinding
|
||||
import com.coldmint.rust.pro.ui.ScrollLinearLayoutManager
|
||||
import com.coldmint.rust.pro.ui.StableLinearLayoutManager
|
||||
|
||||
/**
|
||||
* @author Cold Mint
|
||||
* @date 2021/12/14 8:55
|
||||
*/
|
||||
class PersonalHomeFragment(val userId: String) : BaseFragment<FragmentPersonalHomeBinding>() {
|
||||
|
||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentPersonalHomeBinding {
|
||||
return FragmentPersonalHomeBinding.inflate(LayoutInflater.from(requireContext()))
|
||||
}
|
||||
|
||||
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
||||
viewBinding.latestWorkRecycleView.layoutManager =
|
||||
ScrollLinearLayoutManager(requireContext())
|
||||
viewBinding.highestScoreRecycleView.layoutManager =
|
||||
ScrollLinearLayoutManager(requireContext())
|
||||
viewBinding.highestScoreActionView.setOnClickListener {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(
|
||||
"title", viewBinding.highestScoreView.text.toString()
|
||||
)
|
||||
bundle.putString("action", "user-download")
|
||||
bundle.putString("account", userId)
|
||||
val thisIntent =
|
||||
Intent(requireContext(), TagActivity::class.java)
|
||||
thisIntent.putExtra("data", bundle)
|
||||
startActivity(thisIntent)
|
||||
}
|
||||
viewBinding.latestWorkActionView.setOnClickListener {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(
|
||||
"title", viewBinding.latestWorkView.text.toString()
|
||||
)
|
||||
bundle.putString("action", "user-time")
|
||||
bundle.putString("account", userId)
|
||||
val thisIntent =
|
||||
Intent(requireContext(), TagActivity::class.java)
|
||||
thisIntent.putExtra("data", bundle)
|
||||
startActivity(thisIntent)
|
||||
}
|
||||
|
||||
WebMod.instance.getUserModList(userId, object : ApiCallBack<WebModListData> {
|
||||
override fun onResponse(t: WebModListData) {
|
||||
val dataList = t.data?.toMutableList()
|
||||
if (t.code == ServerConfiguration.Success_Code && dataList != null && dataList.isNotEmpty()) {
|
||||
val adapter = WebModAdapter(requireContext(), dataList)
|
||||
adapter.setItemEvent { i, webModItemBinding, viewHolder, data ->
|
||||
webModItemBinding.root.setOnClickListener {
|
||||
val bundle = Bundle()
|
||||
bundle.putString("modId", data.id)
|
||||
bundle.putString("modName", data.name)
|
||||
val intent = Intent(requireContext(), WebModInfoActivity::class.java)
|
||||
intent.putExtra("data", bundle)
|
||||
requireContext().startActivity(intent)
|
||||
}
|
||||
}
|
||||
viewBinding.latestWorkRecycleView.adapter = adapter
|
||||
} else {
|
||||
viewBinding.latestWorkView.text = t.message
|
||||
viewBinding.latestWorkActionView.isVisible = false
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(e: Exception) {
|
||||
viewBinding.latestWorkView.setText(R.string.network_error)
|
||||
viewBinding.latestWorkActionView.isVisible = false
|
||||
}
|
||||
|
||||
}, limit = "4", sortMode = WebMod.SortMode.Latest_Time)
|
||||
|
||||
WebMod.instance.getUserModList(userId, object : ApiCallBack<WebModListData> {
|
||||
override fun onResponse(t: WebModListData) {
|
||||
val dataList = t.data?.toMutableList()
|
||||
if (t.code == ServerConfiguration.Success_Code && dataList != null && dataList.isNotEmpty()) {
|
||||
val adapter = WebModAdapter(requireContext(), dataList)
|
||||
adapter.setItemEvent { i, webModItemBinding, viewHolder, data ->
|
||||
webModItemBinding.root.setOnClickListener {
|
||||
val bundle = Bundle()
|
||||
bundle.putString("modId", data.id)
|
||||
bundle.putString("modName", data.name)
|
||||
val intent = Intent(requireContext(), WebModInfoActivity::class.java)
|
||||
intent.putExtra("data", bundle)
|
||||
requireContext().startActivity(intent)
|
||||
}
|
||||
}
|
||||
viewBinding.highestScoreRecycleView.adapter = adapter
|
||||
} else {
|
||||
viewBinding.highestScoreView.text = t.message
|
||||
viewBinding.highestScoreActionView.isVisible = false
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(e: Exception) {
|
||||
viewBinding.highestScoreView.setText(R.string.network_error)
|
||||
viewBinding.highestScoreActionView.isVisible = false
|
||||
}
|
||||
|
||||
}, limit = "4", sortMode = WebMod.SortMode.Download_Number)
|
||||
}
|
||||
}
|
|
@ -1,173 +0,0 @@
|
|||
package com.coldmint.rust.pro.fragments
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.coldmint.rust.core.dataBean.mod.WebModListData
|
||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||
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.WebModInfoActivity
|
||||
import com.coldmint.rust.pro.adapters.WebModAdapter
|
||||
import com.coldmint.rust.pro.base.BaseFragment
|
||||
import com.coldmint.rust.pro.databinding.FragmentRankingBinding
|
||||
import com.coldmint.rust.pro.ui.StableLinearLayoutManager
|
||||
import com.google.android.material.chip.Chip
|
||||
import me.zhanghai.android.fastscroll.FastScrollerBuilder
|
||||
|
||||
|
||||
/**
|
||||
* 排行榜
|
||||
*/
|
||||
class RankingFragment : BaseFragment<FragmentRankingBinding>() {
|
||||
private var webModAdapter: WebModAdapter? = null
|
||||
var lastOffset = 0
|
||||
var lastPosition = 0
|
||||
var linearLayoutManager: StableLinearLayoutManager? = null
|
||||
private var sortMode: WebMod.SortMode = WebMod.SortMode.Download_Number
|
||||
|
||||
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
||||
linearLayoutManager = StableLinearLayoutManager(requireContext())
|
||||
viewBinding.recyclerView.layoutManager = linearLayoutManager
|
||||
/* viewBinding.recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
||||
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
|
||||
super.onScrollStateChanged(recyclerView, newState)
|
||||
val layoutManager = viewBinding.recyclerView.layoutManager
|
||||
if (layoutManager != null) {
|
||||
//获取第一个可视视图
|
||||
val topView = layoutManager.getChildAt(0)
|
||||
if (topView != null) {
|
||||
lastOffset = topView.top
|
||||
lastPosition = layoutManager.getPosition(topView)
|
||||
}
|
||||
}
|
||||
}
|
||||
})*/
|
||||
viewBinding.refreshLayout.setOnRefreshListener {
|
||||
it.finishRefresh(true)//传入false表示刷新失败
|
||||
loadMods()
|
||||
}
|
||||
viewBinding.refreshLayout.setOnLoadMoreListener {
|
||||
it.finishLoadMore(false) //传入false表示加载失败
|
||||
}
|
||||
/* viewBinding.swipeRefreshLayout.setOnRefreshListener {
|
||||
loadMods()
|
||||
viewBinding.swipeRefreshLayout.isRefreshing = false
|
||||
}*/
|
||||
for (i in 0 until viewBinding.chipGroup.childCount) {
|
||||
val childView = viewBinding.chipGroup.getChildAt(i) as Chip
|
||||
// 根据 Chip 的 ID 或 Tag 映射到对应的 SortMode
|
||||
childView.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked) {
|
||||
sortMode = when (i) {
|
||||
0 -> WebMod.SortMode.Download_Number
|
||||
1 -> WebMod.SortMode.Unit_Number
|
||||
2 -> WebMod.SortMode.Coin_Number
|
||||
3 -> WebMod.SortMode.Update_Number
|
||||
else -> sortMode // 保持当前模式不变
|
||||
}
|
||||
loadMods()
|
||||
}
|
||||
for (j in 0 until viewBinding.chipGroup.childCount) {
|
||||
val chip = viewBinding.chipGroup.getChildAt(j) as Chip
|
||||
chip.isEnabled = chip != childView
|
||||
}
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
// childView.isChecked = true
|
||||
childView.isEnabled = false
|
||||
loadMods()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun loadMods() {
|
||||
viewBinding.progressBar.isVisible = true
|
||||
viewBinding.textview.isVisible = false
|
||||
WebMod.instance.list(object : ApiCallBack<WebModListData> {
|
||||
override fun onResponse(t: WebModListData) {
|
||||
if (!isAdded) {
|
||||
return
|
||||
}
|
||||
if (t.code == ServerConfiguration.Success_Code) {
|
||||
val list = t.data
|
||||
if (!list.isNullOrEmpty()) {
|
||||
viewBinding.progressBar.isVisible = false
|
||||
viewBinding.textview.isVisible = false
|
||||
// viewBinding.swipeRefreshLayout.isVisible = true
|
||||
val adapter = createAdapter(list)
|
||||
viewBinding.recyclerView.adapter = adapter
|
||||
linearLayoutManager?.scrollToPositionWithOffset(
|
||||
lastPosition,
|
||||
lastOffset
|
||||
)
|
||||
/* FastScrollerBuilder(viewBinding.recyclerView).useMd2Style()
|
||||
.setPopupTextProvider(adapter).build()*/
|
||||
} else {
|
||||
showInfoToView(R.string.network_error)
|
||||
}
|
||||
} else {
|
||||
showInfoToView(text = t.message)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(e: Exception) {
|
||||
showInfoToView(R.string.network_error)
|
||||
}
|
||||
|
||||
}, sortMode = sortMode, limit = "10", sum = "0")
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建适配器
|
||||
* @param dataList MutableList<Data>
|
||||
* @return WebModAdapter
|
||||
*/
|
||||
fun createAdapter(dataList: MutableList<WebModListData.Data>): WebModAdapter {
|
||||
val adapter: WebModAdapter = if (webModAdapter == null) {
|
||||
webModAdapter = WebModAdapter(context = requireContext(), dataList = dataList)
|
||||
webModAdapter!!
|
||||
} else {
|
||||
webModAdapter!!.setNewDataList(dataList)
|
||||
webModAdapter!!
|
||||
}
|
||||
adapter.setItemEvent { _, webModItemBinding, _, data ->
|
||||
webModItemBinding.root.setOnClickListener {
|
||||
val bundle = Bundle()
|
||||
bundle.putString("modId", data.id)
|
||||
bundle.putString("modName", data.name)
|
||||
val intent = Intent(requireContext(), WebModInfoActivity::class.java)
|
||||
intent.putExtra("data", bundle)
|
||||
requireContext().startActivity(intent)
|
||||
}
|
||||
}
|
||||
return adapter
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示信息到视图
|
||||
* @param textRes Int?
|
||||
* @param text String?
|
||||
*/
|
||||
fun showInfoToView(textRes: Int? = null, text: String? = null) {
|
||||
viewBinding.progressBar.isVisible = false
|
||||
// viewBinding.swipeRefreshLayout.isVisible = false
|
||||
viewBinding.textview.isVisible = true
|
||||
if (textRes == null) {
|
||||
viewBinding.textview.text = textRes
|
||||
} else {
|
||||
viewBinding.textview.text = text ?: ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentRankingBinding {
|
||||
return FragmentRankingBinding.inflate(layoutInflater)
|
||||
}
|
||||
}
|
|
@ -1,242 +0,0 @@
|
|||
package com.coldmint.rust.pro.fragments
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import androidx.core.view.isVisible
|
||||
import com.bumptech.glide.Glide
|
||||
import com.coldmint.dialog.CoreDialog
|
||||
import com.coldmint.rust.core.dataBean.BannerItemDataBean
|
||||
import com.coldmint.rust.core.dataBean.mod.WebModListData
|
||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||
import com.coldmint.rust.core.web.BannerManager
|
||||
import com.coldmint.rust.core.web.ServerConfiguration
|
||||
import com.coldmint.rust.core.web.WebMod
|
||||
import com.coldmint.rust.pro.MainActivity
|
||||
import com.coldmint.rust.pro.R
|
||||
import com.coldmint.rust.pro.WebModInfoActivity
|
||||
import com.coldmint.rust.pro.adapters.WebModAdapter
|
||||
import com.coldmint.rust.pro.base.BaseFragment
|
||||
import com.coldmint.rust.pro.databinding.FragmentRecommendedBinding
|
||||
import com.coldmint.rust.pro.tool.AppSettings
|
||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||
import com.coldmint.rust.pro.tool.TextStyleMaker
|
||||
import com.coldmint.rust.pro.ui.ScrollLinearLayoutManager
|
||||
import com.youth.banner.adapter.BannerImageAdapter
|
||||
import com.youth.banner.holder.BannerImageHolder
|
||||
import com.youth.banner.indicator.CircleIndicator
|
||||
|
||||
|
||||
class RecommendedFragment : BaseFragment<FragmentRecommendedBinding>() {
|
||||
|
||||
/**
|
||||
* 加载最近更新
|
||||
*/
|
||||
fun loadList() {
|
||||
//如果进度条可见那么为首次加载
|
||||
val isFirst = viewBinding.progressBar.isVisible
|
||||
viewBinding.latestReleaseProgressIndicator.isVisible = true
|
||||
WebMod.instance.list(object : ApiCallBack<WebModListData> {
|
||||
override fun onResponse(t: WebModListData) {
|
||||
if (t.code == ServerConfiguration.Success_Code) {
|
||||
val data = t.data?.toMutableList()
|
||||
if (!data.isNullOrEmpty()) {
|
||||
viewBinding.progressBar.postDelayed({
|
||||
viewBinding.latestReleaseProgressIndicator.isVisible = false
|
||||
if (isFirst) {
|
||||
viewBinding.progressBar.isVisible = false
|
||||
viewBinding.nestedScrollView.isVisible = true
|
||||
}
|
||||
viewBinding.latestReleaseView.adapter = createAdapter(data)
|
||||
}, MainActivity.hideViewDelay)
|
||||
}
|
||||
} else {
|
||||
viewBinding.latestReleaseProgressIndicator.isVisible = false
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(e: Exception) {
|
||||
viewBinding.latestReleaseProgressIndicator.isVisible = false
|
||||
}
|
||||
|
||||
}, limit = "6", sortMode = WebMod.SortMode.Latest_Time)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 加载随机推荐
|
||||
*/
|
||||
private fun loadRandomRecommended() {
|
||||
viewBinding.randomRecommendedProgressIndicator.isVisible = true
|
||||
WebMod.instance.randomRecommended(6, object : ApiCallBack<WebModListData> {
|
||||
override fun onResponse(t: WebModListData) {
|
||||
val data = t.data?.toMutableList()
|
||||
if (data.isNullOrEmpty()) {
|
||||
viewBinding.randomRecommendedProgressIndicator.isVisible = false
|
||||
viewBinding.swipeRefreshLayout.isRefreshing = false
|
||||
} else {
|
||||
viewBinding.randomRecommendedProgressIndicator.isVisible = false
|
||||
viewBinding.randomRecommendedView.isVisible = true
|
||||
viewBinding.randomRecommendedView.adapter = createAdapter(data)
|
||||
viewBinding.swipeRefreshLayout.isRefreshing = false
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(e: Exception) {
|
||||
e.printStackTrace()
|
||||
viewBinding.randomRecommendedProgressIndicator.isVisible = false
|
||||
viewBinding.swipeRefreshLayout.isRefreshing = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载个性化推荐
|
||||
*/
|
||||
private fun loadSoleRecommended() {
|
||||
viewBinding.soleRecommendedCardView.isVisible = false
|
||||
viewBinding.soleRecommendedProgressIndicator.isVisible = true
|
||||
val account = AppSettings.getValue(AppSettings.Setting.Account, "")
|
||||
if (account.isNotBlank()) {
|
||||
WebMod.instance.soleRecommended(account, object : ApiCallBack<WebModListData> {
|
||||
override fun onResponse(t: WebModListData) {
|
||||
if (isAdded) {
|
||||
val data = t.data?.toMutableList()
|
||||
if (!data.isNullOrEmpty()) {
|
||||
viewBinding.soleRecommendedCardView.isVisible = true
|
||||
viewBinding.soleRecommendedProgressIndicator.isVisible = false
|
||||
viewBinding.soleRecommendedRecyclerView.adapter = createAdapter(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(e: Exception) {
|
||||
if (isAdded) {
|
||||
viewBinding.soleRecommendedCardView.isVisible = false
|
||||
viewBinding.soleRecommendedProgressIndicator.isVisible = false
|
||||
}
|
||||
}
|
||||
|
||||
}, limit = "6")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载轮播图数据
|
||||
*/
|
||||
private fun loadBannerData() {
|
||||
BannerManager.instance.getItems(object : ApiCallBack<BannerItemDataBean> {
|
||||
override fun onResponse(t: BannerItemDataBean) {
|
||||
if (t.code == ServerConfiguration.Success_Code) {
|
||||
val dataList = t.data
|
||||
if (!dataList.isNullOrEmpty()) {
|
||||
val textStyleMaker = TextStyleMaker.instance
|
||||
val showList = dataList.filter {
|
||||
var show = true
|
||||
val type = textStyleMaker.getType(it.link)
|
||||
//如果点击事件为激活助手,但此用户已经永久激活,那么隐藏轮播图
|
||||
if (type == "activate") {
|
||||
show = false
|
||||
}
|
||||
show
|
||||
}
|
||||
viewBinding.banner.setAdapter(object :
|
||||
BannerImageAdapter<BannerItemDataBean.Data>(showList) {
|
||||
override fun onBindView(
|
||||
holder: BannerImageHolder?,
|
||||
data: BannerItemDataBean.Data?,
|
||||
position: Int,
|
||||
size: Int
|
||||
) {
|
||||
if (holder != null && data != null) {
|
||||
Glide.with(holder.itemView).load(data.picture)
|
||||
.apply(GlobalMethod.getRequestOptions())
|
||||
.into(holder.imageView)
|
||||
holder.imageView.setOnClickListener {
|
||||
val type = textStyleMaker.getType(data.link)
|
||||
val linkData = textStyleMaker.getData(data.link)
|
||||
if (type == null || linkData == null) {
|
||||
CoreDialog(requireContext()).setTitle(data.title)
|
||||
.setMessage(data.link)
|
||||
.setPositiveButton(R.string.dialog_ok) {
|
||||
|
||||
}.setCancelable(false).show()
|
||||
} else {
|
||||
textStyleMaker.clickEvent(
|
||||
requireContext(),
|
||||
type,
|
||||
linkData
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
// viewBinding.banner.setBannerGalleryEffect(16, 16, 8)
|
||||
// viewBinding.banner.addPageTransformer(DepthPageTransformer())
|
||||
if (activity != null) {
|
||||
viewBinding.banner.addBannerLifecycleObserver(activity)
|
||||
viewBinding.banner.indicator = CircleIndicator(activity)
|
||||
// viewBinding.banner.setIndicatorSelectedColorRes(R.color.pink_500)
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(e: Exception) {
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
fun createAdapter(dataList: MutableList<WebModListData.Data>): WebModAdapter? {
|
||||
if (isAdded) {
|
||||
val adapter = WebModAdapter(context = requireContext(), dataList = dataList)
|
||||
adapter.setItemEvent { i, webModItemBinding, viewHolder, data ->
|
||||
webModItemBinding.root.setOnClickListener {
|
||||
val bundle = Bundle()
|
||||
bundle.putString("modId", data.id)
|
||||
bundle.putString("modName", data.name)
|
||||
val intent = Intent(requireContext(), WebModInfoActivity::class.java)
|
||||
intent.putExtra("data", bundle)
|
||||
requireContext().startActivity(intent)
|
||||
}
|
||||
}
|
||||
return adapter
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
loadList()
|
||||
loadSoleRecommended()
|
||||
loadBannerData()
|
||||
}
|
||||
|
||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentRecommendedBinding {
|
||||
return FragmentRecommendedBinding.inflate(layoutInflater)
|
||||
}
|
||||
|
||||
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
||||
viewBinding.latestReleaseView.layoutManager = ScrollLinearLayoutManager(requireContext())
|
||||
viewBinding.soleRecommendedRecyclerView.layoutManager =
|
||||
ScrollLinearLayoutManager(requireContext())
|
||||
viewBinding.randomRecommendedView.layoutManager = ScrollLinearLayoutManager(requireContext())
|
||||
loadRandomRecommended()
|
||||
// 下拉刷新随机推荐的模组
|
||||
viewBinding.swipeRefreshLayout.setOnRefreshListener {
|
||||
loadRandomRecommended()
|
||||
}
|
||||
// 动态设置Banner高度
|
||||
viewBinding.bannerCardView.layoutParams.height = (resources.displayMetrics.heightPixels / 2.5).toInt()
|
||||
viewBinding.bannerCardView.requestLayout()
|
||||
|
||||
}
|
||||
}
|
|
@ -1,131 +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.GridLayoutManager
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.request.RequestOptions
|
||||
import com.coldmint.rust.core.dataBean.user.ActivationInfo
|
||||
import com.coldmint.rust.core.dataBean.user.UserData
|
||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||
import com.coldmint.rust.core.web.ServerConfiguration
|
||||
import com.coldmint.rust.core.web.User
|
||||
import com.coldmint.rust.pro.*
|
||||
import com.coldmint.rust.pro.adapters.CommunityServiceAdapter
|
||||
import com.coldmint.rust.pro.base.BaseFragment
|
||||
import com.coldmint.rust.pro.databean.CommunityServiceInfo
|
||||
import com.coldmint.rust.pro.databinding.FragmentUserInfoBinding
|
||||
import com.coldmint.rust.pro.tool.AppSettings
|
||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||
|
||||
class UserInfoFragment : BaseFragment<FragmentUserInfoBinding>() {
|
||||
lateinit var account: String
|
||||
|
||||
/**
|
||||
* 加载列表
|
||||
*/
|
||||
fun loadRecyclerView(permission: Int) {
|
||||
|
||||
val layoutManager = GridLayoutManager(RustApplication.getInstance(), 4)
|
||||
viewBinding.recyclerView.layoutManager = layoutManager
|
||||
viewBinding.recyclerView.isNestedScrollingEnabled = false
|
||||
val dataList = ArrayList<CommunityServiceInfo>()
|
||||
dataList.add(CommunityServiceInfo(R.string.work_management, R.drawable.work_management))
|
||||
// dataList.add(CommunityServiceInfo(R.string.little_black_house, R.drawable.ban))
|
||||
// dataList.add(CommunityServiceInfo(R.string.feedback, R.drawable.feedback))
|
||||
dataList.add(CommunityServiceInfo(R.string.fans_management, R.drawable.fans_management))
|
||||
// dataList.add(CommunityServiceInfo(R.string.exchange, R.drawable.prize))
|
||||
if (permission < 3) {
|
||||
//管理员
|
||||
dataList.add(CommunityServiceInfo(R.string.report_to_deal, R.drawable.report))
|
||||
dataList.add(CommunityServiceInfo(R.string.review_mod, R.drawable.review_mod))
|
||||
if (permission == 1) {
|
||||
//超级管理员
|
||||
dataList.add(CommunityServiceInfo(R.string.order_manager, R.drawable.order_manager))
|
||||
}
|
||||
}
|
||||
val adapter = CommunityServiceAdapter(RustApplication.getInstance(), dataList)
|
||||
adapter.setItemEvent { i, itemServiceBinding, viewHolder, communityServiceInfo ->
|
||||
itemServiceBinding.root.setOnClickListener {
|
||||
when (communityServiceInfo.titleRes) {
|
||||
R.string.work_management -> {
|
||||
val gotoIntent =
|
||||
Intent(requireContext(), WorkManagementActivity::class.java)
|
||||
startActivity(gotoIntent)
|
||||
}
|
||||
R.string.order_manager -> {
|
||||
val sIntent = Intent(requireContext(), OrderListActivity::class.java)
|
||||
sIntent.putExtra("loadAll", true)
|
||||
startActivity(sIntent)
|
||||
}
|
||||
R.string.fans_management -> {
|
||||
openUserList(account, false)
|
||||
}
|
||||
R.string.report_to_deal -> {
|
||||
val startIntent = Intent(requireContext(), ReportListActivity::class.java)
|
||||
startActivity(startIntent)
|
||||
}
|
||||
else -> {
|
||||
Toast.makeText(context, communityServiceInfo.titleRes, Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
viewBinding.recyclerView.adapter = adapter
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 打开用户列表
|
||||
* @param account String 账号
|
||||
* @param isFollowMode Boolean 是否加载偶像
|
||||
*/
|
||||
fun openUserList(account: String, isFollowMode: Boolean) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString("account", account)
|
||||
bundle.putBoolean("isFollowMode", isFollowMode)
|
||||
bundle.putBoolean("canRemoveFans", true)
|
||||
val intent = Intent(requireContext(), UserListActivity::class.java)
|
||||
intent.putExtra("data", bundle)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentUserInfoBinding {
|
||||
return FragmentUserInfoBinding.inflate(layoutInflater)
|
||||
}
|
||||
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
viewBinding.progressBar.isVisible = true
|
||||
viewBinding.loginLayout.root.isVisible = false
|
||||
viewBinding.contentLayout.isVisible = false
|
||||
val loginStatus = AppSettings.getValue(AppSettings.Setting.LoginStatus, false)
|
||||
if (loginStatus) {
|
||||
viewBinding.progressBar.isVisible = false
|
||||
viewBinding.loginLayout.root.isVisible = false
|
||||
viewBinding.contentLayout.isVisible = true
|
||||
// viewBinding.root.isFillViewport = false
|
||||
account = AppSettings.getValue(AppSettings.Setting.Account, "")
|
||||
viewBinding.myHomeView.setOnClickListener {
|
||||
|
||||
}
|
||||
} else {
|
||||
viewBinding.progressBar.isVisible = false
|
||||
viewBinding.loginLayout.root.isVisible = true
|
||||
viewBinding.contentLayout.isVisible = false
|
||||
// viewBinding.root.isFillViewport = true
|
||||
}
|
||||
}
|
||||
|
||||
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
||||
viewBinding.logOutButton.setOnClickListener {
|
||||
}
|
||||
viewBinding.loginLayout.logView.setOnClickListener {
|
||||
}
|
||||
}
|
||||
}
|
|
@ -245,16 +245,7 @@ class TextStyleMaker private constructor() {
|
|||
*/
|
||||
fun clickEvent(context: Context, type: String, data: String) {
|
||||
when (type) {
|
||||
"mod" -> {
|
||||
val bundle = Bundle()
|
||||
bundle.putString("modId", data)
|
||||
val intent = Intent(
|
||||
context,
|
||||
WebModInfoActivity::class.java
|
||||
)
|
||||
intent.putExtra("data", bundle)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
|
||||
"tag" -> {
|
||||
val bundle = Bundle()
|
||||
bundle.putString("tag", data)
|
||||
|
|
|
@ -1,174 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/editDrawerlayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appBarLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
<include layout="@layout/edit_start" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="3"
|
||||
android:orientation="vertical">
|
||||
|
||||
<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"
|
||||
android:contentDescription="@string/action"
|
||||
android:visibility="gone"
|
||||
app:tabMode="scrollable"
|
||||
app:tabTextAppearance="@style/TabLayoutTextStyle"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<io.github.rosemoe.sora.widget.CodeEditor
|
||||
android:id="@+id/codeEditor"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:visibility="visible"
|
||||
tools:ignore="NestedWeights" />
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/searchLayout"
|
||||
style="@style/Widget.Material3.CardView.Elevated"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="8dp"
|
||||
android:animateLayoutChanges="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:hint="@string/find">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/findEditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/replaceLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:hint="@string/replace"
|
||||
android:visibility="gone">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/replaceEditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/lastButton"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/last" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/nextButton"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/next" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/replaceButton"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/replace" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/allButton"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/all"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/closeButton"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/close" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@id/recyclerview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="visible" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/myProgressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
<!-- <include layout="@layout/edit_end" />-->
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
|
@ -1,43 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/drawerlayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="false">
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize" />
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
<fragment
|
||||
android:id="@+id/baseFragment"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:defaultNavHost="true"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
<com.google.android.material.navigation.NavigationView
|
||||
android:id="@+id/navaiagtion"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
app:elevation="2dp"
|
||||
app:menu="@menu/menu_drawer_left"
|
||||
tools:ignore="VisualLintBounds" />
|
||||
|
||||
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
|
@ -1,309 +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"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appBar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:windowBackground">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:contentScrim="?android:windowBackground"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
|
||||
app:titleCollapseMode="scale"
|
||||
app:titleEnabled="false">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/coverView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginBottom="-32dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:scaleType="centerCrop"
|
||||
android:transitionName="@string/transition_cover" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/baseInfoView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/coverView"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@drawable/user_home_background">
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/headIconView"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_alignTop="@id/baseInfoView"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:src="@drawable/head_icon"
|
||||
android:theme="@style/Theme.rust.Concept" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nameView"
|
||||
style="@style/TextAppearance.Material3.TitleMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/headIconView"
|
||||
android:layout_alignStart="@id/headIconView"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/name" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cardView"
|
||||
style="@style/Widget.Material3.CardView.Filled"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:layout_alignBottom="@id/nameView"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_toEndOf="@id/nameView"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
app:cardBackgroundColor="@color/blue_500"
|
||||
app:cardCornerRadius="4dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:padding="4dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/positionView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/path"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/genderView"
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_alignBottom="@id/cardView"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_toEndOf="@id/cardView"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/boy" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/github"
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_alignBottom="@id/genderView"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_toEndOf="@id/genderView"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/github" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/describeView"
|
||||
style="@style/TextAppearance.Material3.BodyMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/nameView"
|
||||
android:layout_alignStart="@id/headIconView"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/describe" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loginTimeView"
|
||||
style="@style/TextAppearance.Material3.BodySmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/describeView"
|
||||
android:layout_alignStart="@id/headIconView"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/user_info" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignTop="@id/baseInfoView"
|
||||
android:layout_alignBottom="@id/headIconView"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_toEndOf="@id/headIconView"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/numberLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="46dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:baselineAligned="false">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/fansLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fansNumView"
|
||||
style="@style/TextAppearance.Material3.BodyLarge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:text="0" />
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance.Material3.BodySmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/fans" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/followLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/followNumView"
|
||||
style="@style/TextAppearance.Material3.BodyLarge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:text="0" />
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance.Material3.BodySmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/follow" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/praiseNumView"
|
||||
style="@style/TextAppearance.Material3.BodyLarge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:text="0" />
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance.Material3.BodySmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/praise_number" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/numberLayout"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_gravity="bottom"
|
||||
android:text="@string/request_data" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:layout_collapseMode="pin"
|
||||
app:layout_scrollFlags="scroll|enterAlways" />
|
||||
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tabLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
app:layout_collapseMode="pin"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:tabMode="fixed"
|
||||
android:fitsSystemWindows="true"
|
||||
app:tabTextAppearance="@style/TabLayoutTextStyle" />
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/viewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fullCoverView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:importantForAccessibility="no"
|
||||
android:scaleType="matrix"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="16dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/add"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -1,71 +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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
tools:context=".WebModInfoActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true"/>
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/fragment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<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.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="投币" />
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="评论" />
|
||||
</com.google.android.material.tabs.TabLayout>
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/viewPager2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
android:id="@+id/button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="16dp"
|
||||
android:text="@string/installation"
|
||||
app:icon="@drawable/cloud_download" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -1,44 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge>
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:colorBackground">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/unableOpenView"
|
||||
style="@style/TextAppearance.Material3.TitleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/unable_to_open_this_directory" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/fileList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_margin="16dp"
|
||||
android:src="@drawable/add"
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
||||
</merge>
|
|
@ -1,21 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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="horizontal">
|
||||
|
||||
<com.google.android.material.navigationrail.NavigationRailView
|
||||
android:id="@+id/bottomnavigationView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:elevation="0dp"
|
||||
android:fitsSystemWindows="false"
|
||||
app:paddingTopSystemWindowInsets="false"
|
||||
app:menu="@menu/menu_main_bottom" />
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
|
@ -10,16 +10,19 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appBarLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@android:color/transparent">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize" />
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@id/tabLayout"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -31,12 +34,14 @@
|
|||
app:tabMode="scrollable"
|
||||
app:tabTextAppearance="@style/TabLayoutTextStyle" />
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/myProgressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true" />
|
||||
|
||||
<io.github.rosemoe.sora.widget.CodeEditor
|
||||
android:id="@+id/codeEditor"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -44,6 +49,7 @@
|
|||
android:layout_above="@id/searchLayout"
|
||||
android:layout_below="@id/appBarLayout"
|
||||
android:visibility="visible" />
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/searchLayout"
|
||||
style="@style/Widget.Material3.CardView.Elevated"
|
||||
|
@ -53,6 +59,7 @@
|
|||
android:layout_margin="8dp"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -140,14 +147,14 @@
|
|||
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@id/recyclerview"
|
||||
android:id="@+id/recyclerview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:visibility="invisible" />
|
||||
</RelativeLayout>
|
||||
<!-- <include layout="@layout/edit_end" />-->
|
||||
<include
|
||||
layout="@layout/edit_start" />
|
||||
<include layout="@layout/edit_start" />
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
||||
|
|
|
@ -1,55 +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"
|
||||
xmlns:card_view="http://schemas.android.com/tools"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".OrderListActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tipView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/code_tip"
|
||||
android:visibility="gone" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -1,71 +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"
|
||||
xmlns:card_view="http://schemas.android.com/tools"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".ActivateActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:fillViewport="true"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/loadLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tipView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/loading_data"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -1,52 +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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".WebModInfoActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true"/>
|
||||
<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.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="详情" />
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="投币" />
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="评论" />
|
||||
</com.google.android.material.tabs.TabLayout>
|
||||
</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.ExtendedFloatingActionButton
|
||||
android:id="@+id/button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="16dp"
|
||||
android:text="@string/installation"
|
||||
app:icon="@drawable/cloud_download" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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">
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
android:id="@+id/bottomnavigationView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:menu="@menu/menu_main_bottom" />
|
||||
</LinearLayout>
|
|
@ -1,32 +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:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textview"
|
||||
style="@style/TextAppearance.Material3.HeadlineSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/error"
|
||||
android:visibility="gone" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,96 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/rootLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:animateLayoutChanges="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@id/tipView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/no_followers"
|
||||
android:textSize="16sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingRight="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/my_follow"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/headRecyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:itemCount="1"
|
||||
android:layout_marginTop="8dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:animateLayoutChanges="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar2"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/no_dynamic"
|
||||
android:visibility="gone" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -1,102 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:paddingHorizontal="16dp"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="@style/Widget.Material3.CardView.Elevated"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="24dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance.Material3.HeadlineSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/insert_coins" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/button"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:enabled="true"
|
||||
android:text="@string/insert_coins" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tipView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/insert_coins_no" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/coinRecordsView"
|
||||
style="@style/TextAppearance.Material3.HeadlineSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/coin_records" />
|
||||
|
||||
<com.google.android.material.progressindicator.LinearProgressIndicator
|
||||
android:id="@+id/linearProgressIndicator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:indeterminate="true"
|
||||
android:visibility="gone" />
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipeRefreshLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/loadLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance.Material3.HeadlineSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/no_content" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -1,73 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:paddingTop="8dp"
|
||||
tools:context=".fragments.ModCommentsFragment">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/titleView"
|
||||
style="@style/TextAppearance.Material3.HeadlineSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/discussion" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/sendDiscussion"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:text="@string/send_discussion" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<com.google.android.material.progressindicator.LinearProgressIndicator
|
||||
android:id="@+id/linearProgressIndicator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:indeterminate="true"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipeRefreshLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="8dp"
|
||||
android:isScrollContainer="true"
|
||||
android:visibility="gone" />
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/noContentLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance.Material3.HeadlineSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/no_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -1,127 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView 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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- <com.google.android.material.card.MaterialCardView-->
|
||||
<!-- style="@style/Widget.Material3.CardView.Filled"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- >-->
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:animateLayoutChanges="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/highestScoreView"
|
||||
style="@style/TextAppearance.Material3.HeadlineSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/highest_score" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/highestScoreActionView"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:text="@string/load_all" />
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/highestScoreRecycleView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusableInTouchMode="false"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:layout_marginTop="8dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<!-- </com.google.android.material.card.MaterialCardView>-->
|
||||
|
||||
<!-- <com.google.android.material.card.MaterialCardView-->
|
||||
<!-- style="@style/Widget.Material3.CardView.Filled"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginHorizontal="16dp"-->
|
||||
<!-- android:layout_marginTop="16dp">-->
|
||||
|
||||
<com.google.android.material.divider.MaterialDivider
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
app:dividerThickness="0.8dp" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:animateLayoutChanges="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/latestWorkView"
|
||||
style="@style/TextAppearance.Material3.HeadlineSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/latest_work" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/latestWorkActionView"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:text="@string/load_all" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/latestWorkRecycleView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusableInTouchMode="false"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:layout_marginTop="8dp" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<!-- </com.google.android.material.card.MaterialCardView>-->
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
|
@ -1,97 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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">
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<TextView
|
||||
android:id="@+id/textview"
|
||||
style="@style/TextAppearance.Material3.HeadlineMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/no_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:visibility="gone" />
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:orientation="vertical">
|
||||
<HorizontalScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="none">
|
||||
<com.google.android.material.chip.ChipGroup
|
||||
android:id="@+id/chipGroup"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:singleLine="true"
|
||||
app:singleSelection="true">
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/downloadChip"
|
||||
style="@style/Widget.Material3.Chip.Suggestion"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/download_num"
|
||||
android:textEditSuggestionItemLayout="@array/report_entries" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/coinChip"
|
||||
style="@style/Widget.Material3.Chip.Suggestion"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/coin_num"
|
||||
android:textEditSuggestionItemLayout="@array/report_entries" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/unitChip"
|
||||
style="@style/Widget.Material3.Chip.Suggestion"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/unit_number"
|
||||
android:textEditSuggestionItemLayout="@array/report_entries" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/updateChip"
|
||||
style="@style/Widget.Material3.Chip.Suggestion"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/update_number"
|
||||
android:textEditSuggestionItemLayout="@array/report_entries" />
|
||||
|
||||
</com.google.android.material.chip.ChipGroup>
|
||||
</HorizontalScrollView>
|
||||
<com.scwang.smart.refresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/refreshLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:srlEnablePreviewInEditMode="false">
|
||||
<!--srlEnablePreviewInEditMode 可以开启和关闭预览功能-->
|
||||
<com.scwang.smart.refresh.header.ClassicsHeader
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:overScrollMode="ifContentScrolls" />
|
||||
<com.scwang.smart.refresh.footer.ClassicsFooter
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -1,172 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:animateLayoutChanges="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tipView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/info"
|
||||
android:visibility="gone" />
|
||||
|
||||
<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.core.widget.NestedScrollView
|
||||
android:id="@+id/nestedScrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/bannerCardView"
|
||||
style="@style/Widget.Material3.CardView.Filled"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp">
|
||||
|
||||
<com.youth.banner.Banner
|
||||
android:id="@+id/banner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:banner_indicator_selected_color="?attr/colorPrimary" />
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance.Material3.HeadlineSmall"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/random_recommended" />
|
||||
|
||||
<!-- <Button-->
|
||||
<!-- android:id="@+id/changeRandomRecommended"-->
|
||||
<!-- style="@style/Widget.Material3.Button.TextButton"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:text="@string/change_random_recommended"-->
|
||||
<!-- card_view:ignore="RelativeOverlap" />-->
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<com.google.android.material.progressindicator.LinearProgressIndicator
|
||||
android:id="@+id/randomRecommendedProgressIndicator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:indeterminate="true" />
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/randomRecommendedView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:focusableInTouchMode="false"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance.Material3.HeadlineSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/latest_release" />
|
||||
|
||||
<com.google.android.material.progressindicator.LinearProgressIndicator
|
||||
android:id="@+id/latestReleaseProgressIndicator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:indeterminate="true" />
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/latestReleaseView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:focusableInTouchMode="false"
|
||||
android:nestedScrollingEnabled="false" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/soleRecommendedCardView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance.Material3.HeadlineSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/pay_attention_new" />
|
||||
|
||||
<com.google.android.material.progressindicator.LinearProgressIndicator
|
||||
android:id="@+id/soleRecommendedProgressIndicator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:indeterminate="true" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/soleRecommendedRecyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:focusableInTouchMode="false"
|
||||
android:nestedScrollingEnabled="false" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -1,141 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/contentLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/materialCardView"
|
||||
style="@style/Widget.Material3.CardView.Elevated"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardUseCompatPadding="true"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/myHomeView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:animateLayoutChanges="true"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/headIconView"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/head_icon" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_toStartOf="@id/right_icon"
|
||||
android:layout_toEndOf="@id/headIconView"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nameView"
|
||||
style="@style/TextAppearance.Material3.TitleMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/coinView"
|
||||
style="@style/TextAppearance.Material3.BodyMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/email" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/right_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/ic_baseline_chevron_right_24"
|
||||
app:tint="?attr/colorControlNormal" />
|
||||
|
||||
</RelativeLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/materialCardView2"
|
||||
style="@style/Widget.Material3.CardView.Elevated"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardUseCompatPadding="true"
|
||||
app:layout_constraintTop_toBottomOf="@+id/materialCardView">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance.Material3.HeadlineSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/community_service" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
tools:itemCount="2" />
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<Button
|
||||
android:id="@+id/logOutButton"
|
||||
style="@style/Widget.Material3.Button.ElevatedButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:text="@string/log_out"
|
||||
app:iconGravity="start"
|
||||
app:icon="@drawable/logout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/materialCardView2" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:visibility="gone"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/loginLayout"
|
||||
layout="@layout/layout_log_in_first"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
|
@ -1,103 +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="8dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp">
|
||||
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/iconCardView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginTop="8dp"
|
||||
style="@style/Widget.Material3.CardView.Filled"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="8dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/mod_icon"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/image" />
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/infoLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_toEndOf="@id/iconCardView"
|
||||
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="@string/name" />
|
||||
|
||||
<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/publisher_information" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/mod_introduction_view"
|
||||
style="@style/TextAppearance.Material3.BodySmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:singleLine="true"
|
||||
android:text="@string/describe" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/infoLayout"
|
||||
android:layout_marginTop="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/refusedView"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="@string/refused" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/consentView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/consent" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
|
@ -1,104 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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="wrap_content"
|
||||
android:padding="8dp">
|
||||
|
||||
<ImageView
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:clickable="true"
|
||||
android:id="@+id/iconView"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/head_icon"
|
||||
android:focusable="true" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/headLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_toEndOf="@id/iconView"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nameView"
|
||||
style="@style/TextAppearance.Material3.TitleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/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/expiration_time_null" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/contentView"
|
||||
style="@style/TextAppearance.Material3.BodyMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/headLayout"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/no_content" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/thumb_up_image_view"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_below="@id/contentView"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:padding="2dp"
|
||||
android:src="@drawable/outline_thumb_up_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/thumb_up_text_view"
|
||||
style="@style/MaterialAlertDialog.Material3.Body.Text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@id/thumb_up_image_view"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_toEndOf="@id/thumb_up_image_view"
|
||||
android:text="0" />
|
||||
|
||||
<ImageView
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:clickable="true"
|
||||
android:id="@+id/share_image_view"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_below="@id/contentView"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_toEndOf="@+id/thumb_up_text_view"
|
||||
android:padding="2dp"
|
||||
android:src="@drawable/ic_outline_share_24"
|
||||
android:focusable="true" />
|
||||
|
||||
<ImageView
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:clickable="true"
|
||||
android:id="@+id/more_image_view"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_below="@id/contentView"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="8dp"
|
||||
android:padding="2dp"
|
||||
android:src="@drawable/more"
|
||||
android:focusable="true" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
|
@ -1,70 +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:padding="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="@drawable/round_background"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/numView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="-20%"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_toStartOf="@id/useButton"
|
||||
android:layout_toEndOf="@id/linearLayout"
|
||||
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="@string/mod_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/descriptionView"
|
||||
style="@style/TextAppearance.Material3.BodyMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/describe" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/expirationTimeView"
|
||||
style="@style/TextAppearance.Material3.BodySmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/time_limit" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/useButton"
|
||||
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/use" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -1,106 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
style="@style/Widget.Material3.CardView.Filled"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp">
|
||||
|
||||
<ImageView
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:id="@+id/headIconView"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:src="@drawable/head_icon" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/contentLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/headIconView"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_toEndOf="@id/headIconView"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nameView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/user_name"
|
||||
style="@style/TextAppearance.Material3.TitleMedium"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/timeView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/time"
|
||||
style="@style/TextAppearance.Material3.BodySmall"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/contentView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/contentLayout"
|
||||
android:layout_marginTop="16dp"
|
||||
style="@style/TextAppearance.Material3.BodyMedium"
|
||||
android:text="@string/expiration_time_null" />
|
||||
|
||||
<ImageView
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:id="@+id/thumb_up_image_view"
|
||||
android:layout_width="24dp"
|
||||
android:padding="2dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_below="@id/contentView"
|
||||
android:layout_marginTop="8dp"
|
||||
android:src="@drawable/outline_thumb_up_24"
|
||||
android:focusable="true" />
|
||||
|
||||
<TextView
|
||||
android:layout_marginStart="4dp"
|
||||
android:id="@+id/thumb_up_text_view"
|
||||
style="@style/MaterialAlertDialog.Material3.Body.Text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@id/thumb_up_image_view"
|
||||
android:layout_toEndOf="@id/thumb_up_image_view"
|
||||
android:text="0" />
|
||||
|
||||
<ImageView
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:layout_marginStart="8dp"
|
||||
android:id="@+id/share_image_view"
|
||||
android:layout_width="24dp"
|
||||
android:layout_toEndOf="@+id/thumb_up_text_view"
|
||||
android:padding="2dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_below="@id/contentView"
|
||||
android:layout_marginTop="8dp"
|
||||
android:src="@drawable/ic_outline_share_24"
|
||||
android:focusable="true" />
|
||||
|
||||
<ImageView
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:id="@+id/more_image_view"
|
||||
android:layout_width="24dp"
|
||||
android:padding="2dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_below="@id/contentView"
|
||||
android:layout_marginTop="8dp"
|
||||
android:src="@drawable/more"
|
||||
android:focusable="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
|
@ -1,14 +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">
|
||||
|
||||
<TextView
|
||||
android:layout_margin="16dp"
|
||||
android:id="@+id/titleView"
|
||||
style="@style/TextAppearance.Material3.TitleMedium"
|
||||
android:text="@string/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,50 +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">
|
||||
|
||||
<ImageView
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/head_icon" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toEndOf="@id/imageView"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nameView"
|
||||
style="@style/TextAppearance.Material3.TitleMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="名称" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/numberOfCoinView"
|
||||
style="@style/TextAppearance.Material3.BodyMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/insert_coins_tip" />
|
||||
|
||||
|
||||
<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="时间" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
|
@ -1,26 +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:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/titleView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="标题"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/info"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/describe" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_width="110dp"
|
||||
android:layout_height="140dp"
|
||||
android:layout_margin="3dp"
|
||||
android:background="@drawable/round_background_false"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/titleView"
|
||||
style="@style/TextAppearance.Material3.TitleMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/mod_title" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/priceView"
|
||||
style="@style/TextAppearance.Material3.TitleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/money"
|
||||
android:textColor="?colorPrimary" />
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance.Material3.BodyMedium"
|
||||
android:id="@+id/originalPriceView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/money" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,29 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="120dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iconView"
|
||||
android:layout_width="46dp"
|
||||
android:layout_height="46dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/image"
|
||||
android:scaleType="fitXY"
|
||||
app:tint="?attr/colorControlNormal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/titleView"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
style="@style/TextAppearance.Material3.TitleMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/name" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,54 +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:padding="8dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iconView"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:src="@drawable/image" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/iconView"
|
||||
android:layout_alignBottom="@id/iconView"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_toStartOf="@id/actionView"
|
||||
android:layout_toEndOf="@id/iconView"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nameView"
|
||||
style="@style/TextAppearance.Material3.TitleMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/describeView"
|
||||
style="@style/TextAppearance.Material3.BodySmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:text="@string/describe" />
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/actionView"
|
||||
style="@style/Widget.Material3.Button.TonalButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/action"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
Loading…
Reference in New Issue
Block a user