评论at功能

This commit is contained in:
coldmint 2022-07-16 22:41:37 +08:00
parent 1fd6b0f666
commit dc7d6882e7
43 changed files with 748 additions and 817 deletions

Binary file not shown.

View File

@ -4,6 +4,8 @@ import android.content.Intent
import android.content.pm.PackageManager
import android.os.Bundle
import android.text.Html
import android.view.Menu
import android.view.MenuItem
import android.view.View
import com.coldmint.rust.core.web.ServerConfiguration
import com.coldmint.rust.pro.base.BaseActivity
@ -12,17 +14,17 @@ import com.coldmint.rust.pro.tool.AppSettings
import java.text.SimpleDateFormat
class AboutActivity : BaseActivity<ActivityAboutBinding>() {
fun initView() {
try {
val packageInfo = packageManager.getPackageInfo(packageName, 0)
viewBinding.versionView.text = "v." + packageInfo.versionName
} catch (e: PackageManager.NameNotFoundException) {
e.printStackTrace()
}
val year = Integer.valueOf(SimpleDateFormat("yyyy").format(System.currentTimeMillis()))
val copyright = String.format(getString(R.string.copyright), year)
viewBinding.copyRightView.text = copyright
val aboutText = """<h6>起源</h6>
fun initView() {
try {
val packageInfo = packageManager.getPackageInfo(packageName, 0)
viewBinding.versionView.text = "v." + packageInfo.versionName
} catch (e: PackageManager.NameNotFoundException) {
e.printStackTrace()
}
val year = Integer.valueOf(SimpleDateFormat("yyyy").format(System.currentTimeMillis()))
val copyright = String.format(getString(R.string.copyright), year)
viewBinding.copyRightView.text = copyright
val aboutText = """<h6>起源</h6>
|<p>2020年我发现了这款游戏Rusted Warfare并开始学习制作简单的模组</p>
|
|<p>因为之前有开发过App的经验积累了一点技术导致某天突发奇想"这个游戏的模组制作好简单或许可以制作一款App来降低模组的开发门槛。"于是就起手开发1.x版本的铁锈助手了在某些方面也受到了铁锈工具的影响那时铁圈用的辅助大多数都是铁锈工具中文转换功能很方便</p>
@ -57,39 +59,58 @@ class AboutActivity : BaseActivity<ActivityAboutBinding>() {
|
|
""".trimMargin()
viewBinding.aboutView.text = Html.fromHtml(aboutText)
val time = appSettings.getValue(AppSettings.Setting.ExpirationTime, 0.toLong())
if (time == 0.toLong()) {
viewBinding.expirationTimeView.text = getString(R.string.please_login_first)
} else {
val stringTime = ServerConfiguration.toStringTime(time)
viewBinding.expirationTimeView.text =
if (stringTime == ServerConfiguration.ForeverTime) {
getString(R.string.forever_time)
} else {
String.format(
getString(R.string.expiration_time_tip),
stringTime
)
}
}
}
fun initAction(){
viewBinding.specialThanksTo.setOnClickListener {
val gotoIntent = Intent(this, ThanksActivity::class.java)
startActivity(gotoIntent)
viewBinding.aboutView.text = Html.fromHtml(aboutText)
val time = appSettings.getValue(AppSettings.Setting.ExpirationTime, 0.toLong())
if (time == 0.toLong()) {
viewBinding.expirationTimeView.text = getString(R.string.please_login_first)
} else {
val stringTime = ServerConfiguration.toStringTime(time)
viewBinding.expirationTimeView.text =
if (stringTime == ServerConfiguration.ForeverTime) {
getString(R.string.forever_time)
} else {
String.format(
getString(R.string.expiration_time_tip),
stringTime
)
}
}
viewBinding.libsView.setOnClickListener(View.OnClickListener {
startActivity(
Intent(
this@AboutActivity,
LibraryActivity::class.java
)
)
})
}
fun initAction() {
viewBinding.privacyPolicyView.setOnClickListener {
val link =
ServerConfiguration.getRealLink("/resources/agreement/privacy_policy.html")
val thisIntent = Intent(this, BrowserActivity::class.java)
thisIntent.putExtra("link", link)
startActivity(thisIntent)
}
viewBinding.serviceAgreementView.setOnClickListener {
val link =
ServerConfiguration.getRealLink("/resources/agreement/service_agreement.html")
val thisIntent = Intent(this, BrowserActivity::class.java)
thisIntent.putExtra("link", link)
startActivity(thisIntent)
}
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.menu_about, menu)
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.thanks -> {
startActivity(Intent(this, ThanksActivity::class.java))
}
R.id.libs -> {
startActivity(Intent(this, LibraryActivity::class.java))
}
}
return super.onOptionsItemSelected(item)
}
override fun getViewBindingObject(): ActivityAboutBinding {
return ActivityAboutBinding.inflate(layoutInflater)

View File

@ -167,9 +167,9 @@ class LibraryActivity : BaseActivity<ActivityLibraryBinding>() {
setReturnButton()
title = getString(R.string.libs)
viewBinding.libsView.addItemDecoration(
MaterialDividerItemDecoration(
DividerItemDecoration(
this,
MaterialDividerItemDecoration.VERTICAL
DividerItemDecoration.VERTICAL
)
)
viewBinding.libsView.layoutManager = LinearLayoutManager(this@LibraryActivity)

View File

@ -64,14 +64,14 @@ class SearchActivity : BaseActivity<ActivitySearchBinding>() {
override fun onQueryTextChange(newText: String?): Boolean {
if (newText != null && newText.isNotBlank()) {
viewBinding.searchSuggestionsView.setText(R.string.search_suggestions_loading)
// viewBinding.searchSuggestionsView.setText(R.string.search_suggestions_loading)
Search.instance.suggestions(newText,
object : ApiCallBack<SearchSuggestionsData> {
override fun onResponse(t: SearchSuggestionsData) {
val dataList = t.data
if (dataList.isNullOrEmpty()) {
viewBinding.recyclerView.isVisible = false
viewBinding.searchSuggestionsView.setText(R.string.search_suggestions_null)
// viewBinding.searchSuggestionsView.setText(R.string.search_suggestions_null)
} else {
val adapter =
SearchSuggestionsAdapter(
@ -91,20 +91,20 @@ class SearchActivity : BaseActivity<ActivitySearchBinding>() {
}
viewBinding.recyclerView.adapter = adapter
viewBinding.recyclerView.isVisible = true
val s = String.format(getString(R.string.search_suggestions_number),dataList.size)
viewBinding.searchSuggestionsView.text = s
// val s = String.format(getString(R.string.search_suggestions_number),dataList.size)
// viewBinding.searchSuggestionsView.text = s
}
}
override fun onFailure(e: Exception) {
viewBinding.recyclerView.isVisible = false
viewBinding.searchSuggestionsView.setText(R.string.search_suggestions_null)
// viewBinding.searchSuggestionsView.setText(R.string.search_suggestions_null)
}
})
} else {
viewBinding.searchSuggestionsView.setText(R.string.search_suggestions_null)
// viewBinding.searchSuggestionsView.setText(R.string.search_suggestions_null)
viewBinding.recyclerView.isVisible = false
}
return true

View File

@ -24,9 +24,9 @@ class ThanksActivity : BaseActivity<ActivityThanksBinding>() {
title = getString(R.string.special_thanks_to)
setReturnButton()
viewBinding.recyclerView.addItemDecoration(
MaterialDividerItemDecoration(
DividerItemDecoration(
this,
MaterialDividerItemDecoration.VERTICAL
DividerItemDecoration.VERTICAL
)
)
viewBinding.recyclerView.layoutManager = LinearLayoutManager(this)

View File

@ -43,6 +43,7 @@ import com.coldmint.rust.pro.databinding.ActivityWebModInfoBinding
import com.coldmint.rust.pro.tool.AppSettings
import com.coldmint.rust.pro.base.BaseActivity
import com.coldmint.rust.pro.databinding.LoadFileLayoutBinding
import com.coldmint.rust.pro.dialog.CommentDialog
import com.coldmint.rust.pro.tool.GlobalMethod
import com.coldmint.rust.pro.tool.TextStyleMaker
import com.google.android.material.snackbar.Snackbar
@ -377,7 +378,7 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
* 加载评论列表
* @param modId String
*/
fun loadModCommentList(modId: String, delay: Long = 0) {
fun loadModCommentList(modId: String) {
viewBinding.commentLinearProgressIndicator.isVisible = true
WebMod.instance.getCommentsList(modId, object : ApiCallBack<WebModCommentData> {
override fun onResponse(t: WebModCommentData) {
@ -471,52 +472,36 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
return@setOnClickListener
}
MaterialDialog(this, BottomSheet(LayoutMode.WRAP_CONTENT)).show {
input(maxLength = 255).title(R.string.send_discussion)
.positiveButton(R.string.dialog_ok)
.positiveButton {
val inputField: EditText = it.getInputField()
val text = inputField.text.toString()
if (!text.isBlank()) {
WebMod.instance.sendComment(
appSettings.getValue(AppSettings.Setting.Token, ""),
modId,
text,
object : ApiCallBack<ApiResponse> {
override fun onResponse(t: ApiResponse) {
if (t.code == ServerConfiguration.Success_Code) {
loadModCommentList(modId)
Snackbar.make(
viewBinding.button,
R.string.release_ok,
Snackbar.LENGTH_SHORT
).show()
} else {
Snackbar.make(
viewBinding.button,
t.message,
Snackbar.LENGTH_SHORT
).show()
}
}
override fun onFailure(e: Exception) {
showInternetError(viewBinding.button, e)
}
})
CommentDialog(this).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
}
}
}.negativeButton(R.string.dialog_cancel)
val editText = this.getInputField()
editText.inputType =
EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE
editText.minLines = 3
editText.gravity = Gravity.TOP
editText.isSingleLine = false
}
override fun onFailure(e: Exception) {
textInputLayout.error = e.toString()
}
})
}.show()
}
}
override fun getViewBindingObject(): ActivityWebModInfoBinding {

View File

@ -4,12 +4,21 @@ import android.R
import android.content.Context
import android.text.Editable
import android.text.TextWatcher
import android.util.Log
import android.view.*
import android.widget.ArrayAdapter
import android.widget.Button
import androidx.appcompat.app.AlertDialog
import androidx.core.view.isVisible
import com.coldmint.dialog.AppDialog
import com.coldmint.dialog.BaseAppDialog
import com.coldmint.dialog.BaseBottomDialog
import com.coldmint.dialog.InputDialog
import com.coldmint.rust.pro.databinding.DialogCommentBinding
import com.coldmint.rust.pro.tool.LinkAutoCompleteHelper
import com.coldmint.rust.pro.tool.TextStyleMaker
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.textfield.TextInputLayout
/**
@ -18,32 +27,96 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior
* @property inputCanBeEmpty Boolean
* @property errorTipFunction Function2<String, TextInputLayout, Unit>?
*/
class CommentDialog(context: Context) : BaseBottomDialog<DialogCommentBinding>(context) {
override fun getViewBindingObject(layoutInflater: LayoutInflater): DialogCommentBinding {
return DialogCommentBinding.inflate(layoutInflater)
class CommentDialog(context: Context) : BaseAppDialog<CommentDialog>(context) {
val viewBinding: DialogCommentBinding by lazy {
DialogCommentBinding.inflate(LayoutInflater.from(context))
}
override fun onShowDialog(viewBinding: DialogCommentBinding) {
private val adapter = ArrayAdapter<String>(
context,
R.layout.simple_expandable_list_item_1
)
private val dataList =
listOf<String>("@user{", "@mod{", "@tag{", "@link{", "@qqGroup{", "@activate{}")
private var submitFun: ((Button, TextInputLayout, String, AlertDialog) -> Unit)? = null
init {
setView(viewBinding.root)
viewBinding.textInputLayout.isExpandedHintEnabled = false
viewBinding.textInputEditText.threshold = 0
viewBinding.textInputEditText.setAdapter(adapter)
viewBinding.textInputEditText.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
}
override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
}
override fun afterTextChanged(p0: Editable?) {
if (p0 != null) {
TextStyleMaker.instance.setStyle(p0, { type, data ->
TextStyleMaker.instance.clickEvent(context, type, data)
},context)
adapter.clear()
val text = p0.toString()
if (text.isNotBlank()) {
val laseIndex = text.lastIndexOf('@')
if (laseIndex > -1) {
val sIndex = text.lastIndexOf('{')
if (sIndex > laseIndex) {
val eIndex = text.lastIndexOf('}')
if (eIndex > sIndex)
{
//已闭合{}。
}else{
//正在输入内容
adapter.add(text + '}')
}
} else {
//没有指定{开始位置
val data = text.substring(laseIndex)
dataList.forEach {
if (it.startsWith(data)) {
adapter.add(text + it.substring(data.length))
}
}
}
}
}
}
override fun afterTextChanged(p0: Editable?) {
if (p0 != null && p0.isNotBlank()) {
viewBinding.positiveButton.isEnabled = true
TextStyleMaker.instance.setStyle(p0, { type, data ->
TextStyleMaker.instance.clickEvent(context, type, data)
}, context)
} else {
viewBinding.positiveButton.isEnabled = false
}
}
})
viewBinding.negativeButton.setOnClickListener {
dialog.dismiss()
}
viewBinding.positiveButton.setOnClickListener {
if (submitFun == null) {
dialog.dismiss()
} else {
submitFun!!.invoke(
viewBinding.positiveButton,
viewBinding.textInputLayout,
viewBinding.textInputEditText.text.toString(), dialog
)
}
}
}
/**
* 设置提交函数
* 返回true则结束对话框
*/
fun setSubmitFun(submitFun: ((Button, TextInputLayout, String, AlertDialog) -> Unit)?): CommentDialog {
this.submitFun = submitFun
return this
}
}

View File

@ -138,9 +138,9 @@ class MapFragment : BaseFragment<FragmentMapBinding>() {
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
viewBinding.mapList.layoutManager = LinearLayoutManager(requireContext())
viewBinding.mapList.addItemDecoration(
MaterialDividerItemDecoration(
DividerItemDecoration(
requireContext(),
MaterialDividerItemDecoration.VERTICAL
DividerItemDecoration.VERTICAL
)
)
val path = appSettings.getValue(AppSettings.Setting.MapFolder, "")

View File

@ -355,9 +355,9 @@ class ModFragment : BaseFragment<ModFragmentBinding>() {
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
viewBinding.modList.layoutManager = LinearLayoutManager(context)
viewBinding.modList.addItemDecoration(
MaterialDividerItemDecoration(
DividerItemDecoration(
requireContext(),
MaterialDividerItemDecoration.VERTICAL
DividerItemDecoration.VERTICAL
)
)
}

View File

@ -14,10 +14,14 @@ import android.view.View
import android.widget.TextView
import android.widget.Toast
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.bumptech.glide.request.target.CustomTarget
import com.bumptech.glide.request.transition.Transition
import com.coldmint.rust.core.dataBean.user.IconData
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.User
import com.coldmint.rust.pro.*
import com.google.android.material.chip.ChipDrawable
@ -101,35 +105,59 @@ class TextStyleMaker private constructor() {
val type = spannable.subSequence(num1 + start.length, num2).toString()
val data: String = spannable.subSequence(num2 + start2.length, num3).toString()
val chipDrawable = ChipDrawable.createFromResource(context, R.xml.chip)
chipDrawable.text = data
when (type) {
"mod" -> {
chipDrawable.chipIcon = context.getDrawable(R.drawable.mod)
}
"user" -> {
Glide.with(context)
.load(ServerConfiguration.website + "user/" + data + "/icon.png")
.into(
object : CustomTarget<Drawable>() {
override fun onResourceReady(
resource: Drawable,
transition: Transition<in Drawable>?
) {
chipDrawable.chipIcon = resource
}
override fun onLoadCleared(placeholder: Drawable?) {
}
}
)
chipDrawable.chipIcon = context.getDrawable(R.drawable.head_icon)
// User.getIcon(data, object : ApiCallBack<IconData> {
// override fun onResponse(t: IconData) {
// val data2 = t.data
// if (data2 != null) {
// chipDrawable.text = data2.userName
//
// Glide.with(context)
// .load(ServerConfiguration.getRealLink(data2.headIcon!!))
// .apply(GlobalMethod.getRequestOptions(true))
// .into(
// object : CustomTarget<Drawable>() {
// override fun onResourceReady(
// resource: Drawable,
// transition: Transition<in Drawable>?
// ) {
// chipDrawable.chipIcon = resource
// }
//
// override fun onLoadCleared(placeholder: Drawable?) {
//
// }
//
// }
// )
// }
// }
//
// override fun onFailure(e: Exception) {
// }
//
// })
}
"activate"->{
chipDrawable.chipIcon =
context.getDrawable(R.drawable.store)
chipDrawable.text = context.getString(R.string.activate)
}
"link" -> {
chipDrawable.chipIcon =
context.getDrawable(R.drawable.ic_baseline_link_24)
}
else -> {
R.drawable.image
chipDrawable.chipIcon = context.getDrawable(R.drawable.image)
}
}
chipDrawable.closeIcon = null
chipDrawable.text = data
chipDrawable.setBounds(
0,
0,

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M3.9,12c0,-1.71 1.39,-3.1 3.1,-3.1h4L11,7L7,7c-2.76,0 -5,2.24 -5,5s2.24,5 5,5h4v-1.9L7,15.1c-1.71,0 -3.1,-1.39 -3.1,-3.1zM8,13h8v-2L8,11v2zM17,7h-4v1.9h4c1.71,0 3.1,1.39 3.1,3.1s-1.39,3.1 -3.1,3.1h-4L13,17h4c2.76,0 5,-2.24 5,-5s-2.24,-5 -5,-5z"/>
</vector>

View File

@ -24,7 +24,7 @@
<com.google.android.material.card.MaterialCardView
android:id="@+id/appInfoCardView"
style="@style/Widget.Material3.CardView.Filled"
style="@style/Widget.Material3.CardView.Elevated"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -36,19 +36,20 @@
android:orientation="vertical">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@mipmap/ic_launcher" />
<TextView
style="@style/TextAppearance.Material3.HeadlineSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/app_name"
android:textSize="24dp" />
android:text="@string/app_name" />
<TextView
android:id="@+id/versionView"
style="@style/TextAppearance.Material3.TitleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
@ -56,6 +57,7 @@
<TextView
android:id="@+id/expirationTimeView"
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
@ -65,69 +67,70 @@
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Filled"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_above="@id/copyRightView"
android:layout_below="@id/appInfoCardView"
android:layout_marginTop="8dp">
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp">
<RelativeLayout
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/libsView"
android:layout_alignParentTop="true"
android:layout_marginBottom="8dp">
<TextView
android:id="@+id/aboutView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="关于" />
</ScrollView>
android:layout_above="@id/action_divider"
android:layout_alignParentTop="true"
android:layout_marginBottom="8dp">
<TextView
android:id="@+id/specialThanksTo"
android:id="@+id/aboutView"
style="@style/TextAppearance.Material3.BodyMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="16dp"
android:layout_toLeftOf="@id/libsView"
android:text="@string/special_thanks_to"
android:textColor="?colorPrimary" />
android:text="关于" />
<TextView
android:id="@+id/libsView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginLeft="16dp"
android:text="@string/libs"
android:textColor="?colorPrimary" />
</androidx.core.widget.NestedScrollView>
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.divider.MaterialDivider
android:id="@+id/action_divider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/privacyPolicyView" />
<Button
android:id="@+id/serviceAgreementView"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toStartOf="@id/privacyPolicyView"
android:text="@string/service_agreement" />
<Button
android:id="@+id/privacyPolicyView"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="8dp"
android:text="@string/privacy_policy" />
</RelativeLayout>
<TextView
android:id="@+id/copyRightView"
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:text="版权"
android:textSize="8dp" />
android:text="版权" />
</RelativeLayout>

View File

@ -24,9 +24,6 @@
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginRight="8dp"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<LinearLayout
@ -38,7 +35,8 @@
style="@style/Widget.Material3.CardView.Outlined"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp">
android:layout_margin="8dp"
android:layout_marginHorizontal="16dp">
<LinearLayout
android:layout_width="match_parent"
@ -55,13 +53,13 @@
android:queryBackground="@null"
android:queryHint="@string/search" />
<TextView
android:id="@+id/searchSuggestionsView"
android:layout_marginTop="8dp"
style="@style/TextAppearance.Material3.BodySmall"
android:text="@string/search_suggestions_null"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<!-- <TextView-->
<!-- android:id="@+id/searchSuggestionsView"-->
<!-- style="@style/TextAppearance.Material3.BodySmall"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="8dp"-->
<!-- android:text="@string/search_suggestions_null" />-->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
@ -76,34 +74,26 @@
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Filled"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp"
android:layout_marginTop="16dp">
android:layout_marginTop="16dp"
android:layout_marginHorizontal="16dp"
android:orientation="vertical">
<LinearLayout
<TextView
style="@style/TextAppearance.Material3.HeadlineMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hotSearch" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/hotSearchView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:orientation="vertical">
android:layout_marginTop="16dp" />
<TextView
style="@style/TextAppearance.Material3.HeadlineMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hotSearch" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/hotSearchView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
</LinearLayout>

View File

@ -53,7 +53,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:visibility="gone" />
android:visibility="visible" />
</LinearLayout>
@ -63,7 +63,7 @@
android:layout_height="match_parent"
android:layout_marginBottom="60dp"
android:animateLayoutChanges="true"
android:visibility="visible">
android:visibility="gone">
<LinearLayout
android:id="@+id/auditLayout"
@ -83,7 +83,7 @@
<com.google.android.material.card.MaterialCardView
android:id="@+id/cardView"
style="@style/Widget.Material3.CardView.Filled"
style="@style/Widget.Material3.CardView.Elevated"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/auditLayout"
@ -94,7 +94,8 @@
android:id="@+id/openUserSpace"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:layout_marginHorizontal="8dp"
android:layout_marginVertical="16dp"
android:orientation="vertical">
<ImageView
@ -143,163 +144,154 @@
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
<LinearLayout
android:id="@+id/cardView2"
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/cardView"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="16dp"
android:orientation="vertical"
android:visibility="visible">
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:orientation="vertical">
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iconView"
android:layout_width="90dp"
android:layout_height="90dp"
android:padding="8dp"
android:src="@drawable/image" />
<ImageView
android:id="@+id/iconView"
android:layout_width="90dp"
android:layout_height="90dp"
android:padding="8dp"
android:src="@drawable/image" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_marginStart="8dp"
android:layout_toEndOf="@id/iconView"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/titleView"
style="@style/TextAppearance.Material3.TitleMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="标题" />
<TextView
android:id="@+id/numView"
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="单位数" />
<TextView
android:id="@+id/updateTimeView"
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="上次更新时间" />
</LinearLayout>
</RelativeLayout>
<com.kongzue.stacklabelview.StackLabel
android:id="@+id/belongStackLabelView"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="8dp"
android:layout_toEndOf="@id/iconView"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/titleView"
style="@style/TextAppearance.Material3.TitleMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="标题" />
<TextView
android:id="@+id/numView"
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="单位数" />
<TextView
android:id="@+id/updateTimeView"
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="上次更新时间" />
</LinearLayout>
</RelativeLayout>
<com.kongzue.stacklabelview.StackLabel
android:id="@+id/belongStackLabelView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" />
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.youth.banner.Banner
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_marginTop="8dp" />
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.youth.banner.Banner
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_marginTop="8dp" />
</com.google.android.material.card.MaterialCardView>
</com.google.android.material.card.MaterialCardView>
<TextView
android:id="@+id/modInfoView"
style="@style/TextAppearance.Material3.BodyMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="描述" />
<TextView
android:id="@+id/modInfoView"
style="@style/TextAppearance.Material3.BodyMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="描述" />
</LinearLayout>
<com.google.android.material.divider.MaterialDivider
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp" />
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Filled"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/cardView2"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="16dp"
android:orientation="vertical"
android:visibility="visible">
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/discussion"
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.MaterialComponents.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:text="@string/send_discussion" />
</RelativeLayout>
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/commentLinearProgressIndicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:orientation="vertical">
android:layout_marginTop="8dp"
android:indeterminate="true" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/modCommentRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" />
<TextView
android:id="@+id/discussion"
style="@style/TextAppearance.Material3.HeadlineSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="@string/discussion" />
</LinearLayout>
<Button
android:id="@+id/sendDiscussion"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:text="@string/send_discussion" />
</RelativeLayout>
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/commentLinearProgressIndicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:indeterminate="true" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/modCommentRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</RelativeLayout>
</LinearLayout>
@ -310,10 +302,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_margin="16dp"
android:text="@string/installation"
android:visibility="visible"
android:visibility="gone"
app:icon="@drawable/cloud_download" />

View File

@ -28,6 +28,7 @@
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInputLayout"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
@ -35,7 +36,7 @@
app:counterEnabled="true"
app:counterMaxLength="255">
<com.google.android.material.textfield.TextInputEditText
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/textInputEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -66,6 +67,7 @@
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginStart="8dp"
android:enabled="false"
android:text="@string/dialog_ok" />
</RelativeLayout>

View File

@ -8,6 +8,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no_content"
android:textSize="16sp" />
style="@style/TextAppearance.Material3.HeadlineMedium"/>
</LinearLayout>

View File

@ -12,100 +12,108 @@
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Filled"
<!-- <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:layout_marginTop="8dp"
android:orientation="vertical">
<LinearLayout
<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:orientation="vertical"
android:padding="8dp">
android:layout_marginTop="8dp" />
<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:layout_marginTop="8dp" />
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<!-- </com.google.android.material.card.MaterialCardView>-->
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Filled"
<!-- <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_marginTop="16dp"
android:layout_marginHorizontal="16dp"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="16dp">
android:layout_marginTop="16dp"
android:orientation="vertical">
<LinearLayout
<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:orientation="vertical"
android:padding="8dp">
<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" />
android:layout_marginTop="8dp" />
</LinearLayout>
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/latestWorkRecycleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<!-- </com.google.android.material.card.MaterialCardView>-->
</LinearLayout>

View File

@ -16,6 +16,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/no_content"
style="@style/TextAppearance.Material3.HeadlineMedium"
android:visibility="gone" />
<androidx.recyclerview.widget.RecyclerView

View File

@ -3,27 +3,25 @@
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:paddingLeft="16dp"
android:paddingTop="8dp"
android:paddingRight="16dp">
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.cardview.widget.CardView
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Elevated"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardElevation="2dp"
card_view:cardCornerRadius="2dp">
android:layout_margin="8dp">
<LinearLayout
<RelativeLayout
android:id="@+id/myHomeView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:layout_marginHorizontal="8dp"
android:layout_marginVertical="16dp"
android:animateLayoutChanges="true"
android:orientation="horizontal">
@ -31,81 +29,77 @@
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="match_parent"
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"
android:textSize="16sp" />
android:text="@string/name" />
<TextView
style="@style/TextAppearance.Material3.BodyMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/my_space"
android:textColor="?android:attr/colorPrimary" />
android:text="@string/email" />
</LinearLayout>
<!-- <TextView-->
<!-- android:id="@+id/expirationTimeView"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_below="@id/nameView"-->
<!-- android:layout_alignLeft="@id/nameView"-->
<!-- android:layout_marginTop="8dp"-->
<!-- android:text="@string/expiration_time_null" />-->
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:cardElevation="2dp"
card_view:cardCornerRadius="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:orientation="vertical">
<TextView
<ImageView
android:id="@+id/right_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/community_service"
android:textSize="16sp" />
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_baseline_chevron_right_24" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" />
</LinearLayout>
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.cardview.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="16dp"
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" />
</LinearLayout>
<Button
android:id="@+id/logOutButton"
style="@style/Widget.Material3.Button.OutlinedButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="16dp"
android:text="@string/log_out" />

View File

@ -32,10 +32,10 @@
android:visibility="visible">
<LinearLayout
android:padding="8dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:orientation="vertical"
android:padding="8dp">
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Filled"
@ -49,127 +49,109 @@
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Filled"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp">
android:layout_height="match_parent"
android:layout_marginTop="16dp"
android:orientation="vertical"
android:padding="8dp">
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
style="@style/TextAppearance.Material3.HeadlineSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
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:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:text="@string/change_random_recommended" />
</RelativeLayout>
<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:visibility="gone" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<androidx.cardview.widget.CardView
android:id="@+id/latestReleaseCard"
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp">
android:layout_height="wrap_content">
<TextView
style="@style/TextAppearance.Material3.HeadlineSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/latest_release" />
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:text="@string/random_recommended" />
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/latestReleaseProgressIndicator"
android:layout_width="match_parent"
<Button
android:id="@+id/changeRandomRecommended"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:indeterminate="true" />
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:text="@string/change_random_recommended" />
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/latestReleaseView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<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.cardview.widget.CardView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/randomRecommendedView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
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" />
</LinearLayout>
<LinearLayout
android:id="@+id/soleRecommendedCardView"
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp">
android:layout_height="match_parent"
android:layout_marginTop="16dp"
android:orientation="vertical"
android:padding="8dp">
<LinearLayout
<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="match_parent"
android:orientation="vertical"
android:padding="8dp">
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:indeterminate="true" />
<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" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/soleRecommendedRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/libs"
android:title="@string/libs" />
<item
android:id="@+id/thanks"
android:title="@string/special_thanks_to" />
</menu>

View File

@ -633,7 +633,7 @@
<string name="export_this">Export to the</string>
<string name="preview_static_code">Looking at static code</string>
<string name="set_note">Set the annotation</string>
<string name="activate">The activation</string>
<string name="activate">Activation</string>
<string name="money">¥%1$.2f</string>
<string name="discount_prompt">%1$s has saved %2$.2f</string>
<string name="night_mode_follow_system">Follow the system to turn on the dark mode</string>

View File

@ -849,8 +849,7 @@
<string name="search_type_purchase_plan">套餐</string>
<string name="search_type_mod_all">全部</string>
<string name="hotSearch">热门搜索</string>
<string name="search_suggestions_null">无搜索建议。</string>
<string name="search_suggestions_number">共%1$d个搜索建议。</string>
<string name="search_suggestions_loading">获取建议...</string>
<!-- <string name="search_suggestions_null">无搜索建议。</string>-->
<!-- <string name="search_suggestions_number">共%1$d个搜索建议。</string>-->
</resources>

View File

@ -0,0 +1,27 @@
package com.coldmint.rust.core.dataBean.user
import com.google.gson.annotations.SerializedName
/**
* 用户图标数据
* @property code Int
* @property `data` Data
* @property message String
* @constructor
*/
data class IconData(
@SerializedName("code")
val code: Int,
@SerializedName("data")
val `data`: Data?,
@SerializedName("message")
val message: String
) {
data class Data(
@SerializedName("headIcon")
val headIcon: String?,
@SerializedName("userName")
val userName: String
)
}

View File

@ -5,10 +5,7 @@ import android.os.Looper
import com.coldmint.rust.core.dataBean.ApiResponse
import com.coldmint.rust.core.dataBean.LoginRequestData
import com.coldmint.rust.core.dataBean.RegisterRequestData
import com.coldmint.rust.core.dataBean.user.ActivationInfo
import com.coldmint.rust.core.dataBean.user.SocialInfoData
import com.coldmint.rust.core.dataBean.user.SpaceInfoData
import com.coldmint.rust.core.dataBean.user.UserData
import com.coldmint.rust.core.dataBean.user.*
import com.google.gson.Gson
import com.coldmint.rust.core.interfaces.ApiCallBack
@ -135,6 +132,52 @@ object User {
})
}
/**
* 获取用户头像
* @param account String
* @param apiCallBack ApiCallBack<IconData>
*/
@Deprecated("不建议使用")
fun getIcon(
account: String,
apiCallBack: ApiCallBack<IconData>,
) {
val okHttpClient = ServerConfiguration.initOkHttpClient()
val requestBody: FormBody =
FormBody.Builder().add("account", account)
.build()
val request =
Request.Builder()
.url(ServerConfiguration.website + "php/user.php?action=getUserIcon")
.post(requestBody).build()
val call = okHttpClient.newCall(request)
val handler = Handler(Looper.getMainLooper())
val gson = Gson()
call.enqueue(object : Callback {
override fun onFailure(call: Call, e: IOException) {
e.printStackTrace()
handler.post { apiCallBack.onFailure(e) }
}
override fun onResponse(call: Call, response: Response) {
try {
val data = response.body!!.string()
val finalUserIcon =
gson.fromJson(data, IconData::class.java)
handler.post {
apiCallBack.onResponse(finalUserIcon)
}
} catch (e: Exception) {
e.printStackTrace()
handler.post {
apiCallBack.onFailure(e)
}
}
}
})
}
/**
* 更新用户资料
* @param account String 账号

View File

@ -111,6 +111,9 @@ abstract class BaseAppDialog<DialogType : AppDialog>(context: Context) :
return this as DialogType
}
override fun setAutoDismiss(enable: Boolean): DialogType {
return this as DialogType
}
override fun setView(view: View): DialogType {
materialAlertDialogBuilder.setView(view)

View File

@ -4,5 +4,5 @@
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Wed Jul 13 11:04:51 CST 2022
sdk.dir=D\:\\Android_SDK
#Wed Jul 13 20:20:51 CST 2022
sdk.dir=D\:\\Document\\AndroidSdk

View File

@ -1 +0,0 @@
/build

View File

@ -1,43 +0,0 @@
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
}
android {
compileSdk 32
defaultConfig {
minSdk 21
targetSdk 32
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation project(path: ':assistantCoreLibrary')
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

View File

@ -1,21 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -1,24 +0,0 @@
package com.coldmint.rust.networkapi
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.coldmint.rust.networkapi.test", appContext.packageName)
}
}

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.coldmint.rust.networkapi">
</manifest>

View File

@ -1,14 +0,0 @@
package com.coldmint.rust.networkapi
/**
* 网络回调
* @param T
*/
interface NetworkCallback<T> {
fun onSuccess(response: T)
fun onFail(throwable: Throwable? = null)
}

View File

@ -1,109 +0,0 @@
package com.coldmint.rust.networkapi
import com.coldmint.rust.core.tool.DebugHelper
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
/**
* 网络管理器
*/
@Deprecated("已废弃", level = DeprecationLevel.HIDDEN)
object NetworkManager {
private var baseUrl: String? = null
private var retrofit: Retrofit? = null
const val debugKey = "网络管理器"
/**
* 设置BaseUrl
* @param url String
*/
fun setBaseUrl(url: String) {
if (retrofit == null) {
baseUrl = url
} else {
retrofit = createRetrofit(url)
}
DebugHelper.printLog(debugKey, "已设置Url:${url}", "设置Url")
}
/**
* 创建接口实例
* @param service Class<T> 类名
* @return T
*/
fun <T> create(service: Class<T>): T {
if (retrofit == null) {
retrofit = createRetrofit(baseUrl!!)
}
DebugHelper.printLog(debugKey, "已创建${service.name}接口实例。", "创建")
return retrofit!!.create(service)
}
/**
* 执行异步请求
* @receiver Call<T>
*/
fun <T> Call<T>.doEnqueue(networkCallback: NetworkCallback<T>) {
val key = "异步请求"
this.enqueue(object : Callback<T> {
override fun onResponse(call: Call<T>, response: Response<T>) {
if (response.isSuccessful) {
val responseBody = response.body()
if (responseBody == null) {
DebugHelper.printLog(
debugKey,
"${call.request().url.toString()},响应体为空。",
key,
true
)
networkCallback.onFail(null)
} else {
DebugHelper.printLog(
debugKey,
"${call.request().url.toString()},响应成功。",
key
)
networkCallback.onSuccess(responseBody)
}
} else {
DebugHelper.printLog(
debugKey,
"${call.request().url.toString()},错误的响应码:${response.code()}",
key,
true
)
networkCallback.onFail(null)
}
}
override fun onFailure(call: Call<T>, t: Throwable) {
DebugHelper.printLog(debugKey, "${call.request().url.toString()},请求失败。", key, true)
networkCallback.onFail(t)
}
})
}
/**
* 创建Retrofit对象
* @param url String baseUrl
* @return Retrofit
*/
private fun createRetrofit(url: String): Retrofit {
return Retrofit.Builder().baseUrl(url)
.addConverterFactory(GsonConverterFactory.create())
.build()
}
}

View File

@ -1,17 +0,0 @@
package com.coldmint.rust.networkapi
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}