加入点赞按钮。
This commit is contained in:
parent
cfc3a6eb90
commit
528efe3f83
|
@ -116,7 +116,7 @@ dependencies {
|
|||
implementation 'cat.ereza:customactivityoncrash:2.3.0'
|
||||
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
|
||||
implementation 'androidx.appcompat:appcompat:1.5.0'
|
||||
implementation 'com.google.android.material:material:1.7.0-rc01'
|
||||
implementation 'com.google.android.material:material:1.9.0-beta01'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
|
||||
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
|
||||
|
|
|
@ -194,7 +194,6 @@ class UserHomePageActivity : BaseActivity<ActivityUserHomePageBinding>() {
|
|||
viewBinding.loginTimeView.text = String.format(
|
||||
getString(R.string.user_info),
|
||||
spaceInfoData.data.loginTime,
|
||||
spaceInfoData.data.account,
|
||||
spaceInfoData.data.location
|
||||
)
|
||||
|
||||
|
|
|
@ -59,10 +59,10 @@ class DynamicAdapter(context: Context, dataList: MutableList<DynamicItemDataBean
|
|||
data.time + " " + data.location
|
||||
}
|
||||
viewBinding.nameView.text = data.userName
|
||||
TextStyleMaker.instance.load(viewBinding.textview, data.content) { type, data ->
|
||||
TextStyleMaker.instance.load(viewBinding.contentView, data.content) { type, data ->
|
||||
TextStyleMaker.instance.clickEvent(context, type, data)
|
||||
}
|
||||
viewBinding.textview.setOnLongClickListener { view ->
|
||||
viewBinding.contentView.setOnLongClickListener { view ->
|
||||
val menu = GlobalMethod.createPopMenu(view)
|
||||
menu.menu.add(R.string.copy)
|
||||
menu.menu.add(R.string.delete_title)
|
||||
|
|
|
@ -49,6 +49,7 @@ abstract class BaseActivity<ViewBingType : ViewBinding> :
|
|||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
try {
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
super.onCreate(savedInstanceState)
|
||||
whenCreateActivity(savedInstanceState, false)
|
||||
|
@ -58,6 +59,17 @@ abstract class BaseActivity<ViewBingType : ViewBinding> :
|
|||
setSupportActionBar(toolBar)
|
||||
}
|
||||
whenCreateActivity(savedInstanceState, true)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
val dialog = CoreDialog(this)
|
||||
dialog.setTitle(R.string.error)
|
||||
dialog.setMessage(e.toString())
|
||||
dialog.setPositiveButton(R.string.dialog_close) {
|
||||
finish()
|
||||
}
|
||||
dialog.show()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -104,71 +104,71 @@ class TextStyleMaker private constructor() {
|
|||
val num3 = start3Index
|
||||
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" -> {
|
||||
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
|
||||
// val chipDrawable = ChipDrawable.createFromResource(context, R.xml.chip)
|
||||
// chipDrawable.text = data
|
||||
// when (type) {
|
||||
// "mod" -> {
|
||||
// chipDrawable.chipIcon = context.getDrawable(R.drawable.mod)
|
||||
// }
|
||||
//
|
||||
// override fun onLoadCleared(placeholder: Drawable?) {
|
||||
//
|
||||
// "user" -> {
|
||||
// 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 -> {
|
||||
// chipDrawable.chipIcon = context.getDrawable(R.drawable.image)
|
||||
// }
|
||||
// }
|
||||
// chipDrawable.closeIcon = null
|
||||
// chipDrawable.setBounds(
|
||||
// 0,
|
||||
// 0,
|
||||
// chipDrawable.intrinsicWidth,
|
||||
// chipDrawable.intrinsicHeight
|
||||
// )
|
||||
// val span = ImageSpan(chipDrawable)
|
||||
// spannable.setSpan(
|
||||
// span, startIndex,
|
||||
// start3Index + start3.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// 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 -> {
|
||||
chipDrawable.chipIcon = context.getDrawable(R.drawable.image)
|
||||
}
|
||||
}
|
||||
chipDrawable.closeIcon = null
|
||||
chipDrawable.setBounds(
|
||||
0,
|
||||
0,
|
||||
chipDrawable.intrinsicWidth,
|
||||
chipDrawable.intrinsicHeight
|
||||
)
|
||||
val span = ImageSpan(chipDrawable)
|
||||
spannable.setSpan(
|
||||
span, startIndex,
|
||||
start3Index + start3.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
)
|
||||
spannable.setSpan(
|
||||
object : ClickableSpan() {
|
||||
override fun onClick(p0: View) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
|
|
10
app/src/main/res/drawable/outline_thumb_up_24.xml
Normal file
10
app/src/main/res/drawable/outline_thumb_up_24.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M9,21h9c0.83,0 1.54,-0.5 1.84,-1.22l3.02,-7.05c0.09,-0.23 0.14,-0.47 0.14,-0.73v-2c0,-1.1 -0.9,-2 -2,-2h-6.31l0.95,-4.57 0.03,-0.32c0,-0.41 -0.17,-0.79 -0.44,-1.06L14.17,1 7.58,7.59C7.22,7.95 7,8.45 7,9v10c0,1.1 0.9,2 2,2zM9,9l4.34,-4.34L12,10h9v2l-3,7H9V9zM1,9h4v12H1z" />
|
||||
</vector>
|
|
@ -110,6 +110,8 @@
|
|||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_margin="8dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:clickable="false"
|
||||
android:src="@drawable/next" />
|
||||
|
||||
|
||||
|
|
|
@ -7,12 +7,15 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:clickable="true"
|
||||
android:layout_marginTop="32dp"
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:src="@drawable/head_icon" />
|
||||
android:src="@drawable/head_icon"
|
||||
android:focusable="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nameView"
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
<?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:src="@drawable/head_icon"
|
||||
android:focusable="true" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/headLayout"
|
||||
|
@ -43,8 +47,58 @@
|
|||
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:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:layout_below="@id/contentView"
|
||||
android:layout_marginTop="8dp"
|
||||
android:padding="2dp"
|
||||
android:clickable="true"
|
||||
android:src="@drawable/outline_thumb_up_24"
|
||||
android:focusable="true" />
|
||||
|
||||
<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>
|
|
@ -11,6 +11,7 @@
|
|||
android:layout_margin="16dp">
|
||||
|
||||
<ImageView
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:id="@+id/headIconView"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
|
@ -44,7 +45,7 @@
|
|||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textview"
|
||||
android:id="@+id/contentView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/contentLayout"
|
||||
|
@ -52,6 +53,54 @@
|
|||
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>
|
|
@ -4,6 +4,9 @@
|
|||
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"
|
||||
|
|
|
@ -35,10 +35,14 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/linkView"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_alignBottom="@id/titleView"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:padding="2dp"
|
||||
android:src="@drawable/link" />
|
||||
|
||||
<ImageView
|
||||
|
|
|
@ -24,19 +24,19 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/nameView"
|
||||
style="@style/TextAppearance.Material3.TitleMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/name"
|
||||
style="@style/TextAppearance.Material3.TitleMedium" />
|
||||
android:text="@string/name" />
|
||||
|
||||
<TextView
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
style="@style/TextAppearance.Material3.BodySmall"
|
||||
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>
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:id="@+id/headIconView"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
|
|
|
@ -788,7 +788,6 @@
|
|||
<string name="change_server_complete">The server has changed.</string>
|
||||
<string name="order_manager">The order management</string>
|
||||
<string name="log_out">logout</string>
|
||||
<string name="user_info">%1$s uid:%2$s location:%3$s</string>
|
||||
<string name="use_coupon">Will use coupons to create orders, still continue\? (After creating the order, use the coupon)</string>
|
||||
<string name="use">use</string>
|
||||
<string name="account_or_email">Account/email</string>
|
||||
|
|
|
@ -788,7 +788,6 @@
|
|||
<string name="change_server_complete">サーバーを変更しました。</string>
|
||||
<string name="order_manager">注文管理</string>
|
||||
<string name="log_out">掲載</string>
|
||||
<string name="user_info">最近ログイン:%1$s uid:%2$s 住所:%3$s</string>
|
||||
<string name="use_coupon">クーポンを使った注文を作成しますが、継続しますか\?(注文作成完了後、クーポンを消費)</string>
|
||||
<string name="use">使用</string>
|
||||
<string name="account_or_email">アカウント/ eメール</string>
|
||||
|
|
|
@ -787,7 +787,6 @@
|
|||
<string name="change_server_complete">Сервер был изменен.</string>
|
||||
<string name="order_manager">Управление заказом</string>
|
||||
<string name="log_out">напечата</string>
|
||||
<string name="user_info">Зарегистрировано недавно :%1$s uid:%2$s местожительство:%3$s</string>
|
||||
<string name="use_coupon">Мы используем купоны, чтобы создать порядок. (после создания заказа, купоны будут расходуться)</string>
|
||||
<string name="use">использова</string>
|
||||
<string name="account_or_email">Номер счета/письмо</string>
|
||||
|
|
|
@ -826,7 +826,7 @@
|
|||
<string name="change_server_complete">已更改服务器。</string>
|
||||
<string name="order_manager">订单管理</string>
|
||||
<string name="log_out">登出</string>
|
||||
<string name="user_info">最近登录:%1$s uid:%2$s ip归属地:%3$s</string>
|
||||
<string name="user_info">最近登录:%1$s ip归属地:%2$s</string>
|
||||
<string name="use_coupon">将使用优惠券创建订单,仍继续嘛?(创建订单完成后,将优惠券消耗)</string>
|
||||
<string name="use">使用</string>
|
||||
<string name="account_or_email">账号/电子邮件</string>
|
||||
|
@ -956,4 +956,5 @@
|
|||
<string name="public_mod">公开</string>
|
||||
<string name="private_mod">私有</string>
|
||||
<string name="minVersion">最低游戏版本</string>
|
||||
<string name="thumbs_up">点赞</string>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user