角色list请求
This commit is contained in:
parent
1bcccd38e5
commit
15fb8dcc4f
|
|
@ -315,6 +315,12 @@ dependencies {
|
|||
implementation(Deps.BytePlusRTC)
|
||||
|
||||
|
||||
// immersion bar
|
||||
implementation(Deps.immersionbar)
|
||||
implementation(Deps.immersionbarktx)
|
||||
|
||||
|
||||
|
||||
implementation(project(mapOf("path" to ":loadingstateview")))
|
||||
implementation(project(mapOf("path" to ":loadingstateview-ktx")))
|
||||
implementation(project(mapOf("path" to ":viewbinding-base")))
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@ package com.remax.visualnovel.entity.request
|
|||
|
||||
data class ParamActorList(
|
||||
var index: Int = 0,
|
||||
var limit: Int = 2,
|
||||
var limit: Int = 5,
|
||||
var tagIds: List<Long> = listOf<Long>(),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.remax.visualnovel.ui.main.actor
|
||||
|
||||
|
||||
import com.bumptech.glide.Glide
|
||||
import com.chad.library.adapter.base.module.LoadMoreModule
|
||||
import com.remax.visualnovel.R
|
||||
import com.remax.visualnovel.app.BaseBindingQuickAdapter
|
||||
|
|
@ -8,6 +9,8 @@ import com.remax.visualnovel.databinding.FragmentMainActorItemBinding
|
|||
import com.remax.visualnovel.entity.response.ActorBean
|
||||
import com.remax.visualnovel.extension.glide.load
|
||||
import com.remax.visualnovel.ui.chat.ChatActivity
|
||||
import com.remax.visualnovel.utils.ResUtil
|
||||
import com.remax.visualnovel.widget.glidetransformation.DiffCornersTransformation
|
||||
|
||||
class ActorsAdapter : BaseBindingQuickAdapter<ActorBean, FragmentMainActorItemBinding>(FragmentMainActorItemBinding::inflate), LoadMoreModule {
|
||||
init {
|
||||
|
|
@ -27,9 +30,15 @@ class ActorsAdapter : BaseBindingQuickAdapter<ActorBean, FragmentMainActorItemBi
|
|||
override fun convert(holder: BaseBindingHolder, item: ActorBean) {
|
||||
holder.getViewBinding<FragmentMainActorItemBinding>().run {
|
||||
var imgUrl = item.coverImage
|
||||
ivCharacter.load(if (imgUrl.contains(".png")) imgUrl.substring(0, imgUrl.indexOf(".png") + 4) else imgUrl)
|
||||
ivFrom.setImageResource(R.mipmap.icon_search_on)
|
||||
var validUrl = if (imgUrl.contains(".png")) imgUrl.substring(0, imgUrl.indexOf(".png") + 4) else imgUrl
|
||||
|
||||
var radius: Float = ResUtil.getPixelSize(R.dimen.dp_25).toFloat()
|
||||
Glide.with(context)
|
||||
.load(validUrl)
|
||||
.transform(DiffCornersTransformation(0f, radius, radius, radius))
|
||||
.into(ivCharacter);
|
||||
|
||||
ivFrom.setImageResource(R.mipmap.icon_search_on)
|
||||
tvScore.text = item.commonCount.toString()
|
||||
tvFrom.text = item.sourceId.toString()
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,89 @@
|
|||
package com.remax.visualnovel.widget.glidetransformation;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.RectF;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
|
||||
import jp.wasabeef.glide.transformations.BitmapTransformation;
|
||||
|
||||
public class DiffCornersTransformation extends BitmapTransformation {
|
||||
|
||||
private float topLeft, topRight, bottomRight, bottomLeft;
|
||||
|
||||
public DiffCornersTransformation(float topLeft, float topRight,
|
||||
float bottomRight, float bottomLeft) {
|
||||
this.topLeft = topLeft;
|
||||
this.topRight = topRight;
|
||||
this.bottomRight = bottomRight;
|
||||
this.bottomLeft = bottomLeft;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Bitmap transform(@NonNull Context context, @NonNull BitmapPool pool, @NonNull Bitmap toTransform, int outWidth, int outHeight) {
|
||||
|
||||
Bitmap result = pool.get(outWidth, outHeight, Bitmap.Config.ARGB_8888);
|
||||
if (result == null) {
|
||||
result = Bitmap.createBitmap(outWidth, outHeight, Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
|
||||
Canvas canvas = new Canvas(result);
|
||||
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
|
||||
// 创建圆角路径
|
||||
Path path = new Path();
|
||||
float[] radii = new float[] {
|
||||
topLeft, topLeft, topRight, topRight,
|
||||
bottomRight, bottomRight, bottomLeft, bottomLeft
|
||||
};
|
||||
|
||||
RectF rect = new RectF(0, 0, outWidth, outHeight);
|
||||
path.addRoundRect(rect, radii, Path.Direction.CW);
|
||||
|
||||
canvas.clipPath(path);
|
||||
canvas.drawBitmap(toTransform, null, rect, paint);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||
messageDigest.update(getCacheKey().getBytes());
|
||||
}
|
||||
|
||||
private String getCacheKey() {
|
||||
return "DifferentCornersTransformation-" + topLeft + "-" + topRight + "-" + bottomRight + "-" + bottomLeft;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
DiffCornersTransformation that = (DiffCornersTransformation) o;
|
||||
|
||||
if (Float.compare(that.topLeft, topLeft) != 0) return false;
|
||||
if (Float.compare(that.topRight, topRight) != 0) return false;
|
||||
if (Float.compare(that.bottomRight, bottomRight) != 0) return false;
|
||||
return Float.compare(that.bottomLeft, bottomLeft) == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = (topLeft != +0.0f ? Float.floatToIntBits(topLeft) : 0);
|
||||
result = 31 * result + (topRight != +0.0f ? Float.floatToIntBits(topRight) : 0);
|
||||
result = 31 * result + (bottomRight != +0.0f ? Float.floatToIntBits(bottomRight) : 0);
|
||||
result = 31 * result + (bottomLeft != +0.0f ? Float.floatToIntBits(bottomLeft) : 0);
|
||||
result = 31 * result + getCacheKey().hashCode();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,181 +1,173 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/root_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardElevation="@dimen/dp_4"
|
||||
app:cardCornerRadius="@dimen/dp_5" >
|
||||
android:orientation="vertical" >
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/top_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivCharacter"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/character_placeholder"
|
||||
app:layout_constraintDimensionRatio="H,172:229"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:visibility="visible"
|
||||
/>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/top_container_left_top"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:padding="@dimen/dp_3"
|
||||
android:background="@mipmap/actor_item_from_bg_1"
|
||||
>
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="@dimen/dp_8"
|
||||
>
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageView
|
||||
android:id="@+id/iv_from"
|
||||
android:layout_width="@dimen/dp_33"
|
||||
android:layout_height="@dimen/dp_44"
|
||||
android:scaleType="centerCrop"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_from"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="centerCrop"
|
||||
android:gravity="center"
|
||||
android:background="@mipmap/actor_item_from_small"
|
||||
android:text="@string/from"
|
||||
android:textSize="@dimen/sp_9"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_from_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="centerCrop"
|
||||
android:padding="@dimen/dp_3"
|
||||
android:layout_gravity="right|bottom"
|
||||
android:src="@mipmap/actor_item_video_small"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/score"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_score"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_5"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/sp_15"
|
||||
android:textColor="@color/yellow"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/top_container_bottom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/tv_chapter_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_lables"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textColor="@color/yellow_light_1"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<!-- 底部描述文本 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/white">
|
||||
android:padding="@dimen/dp_10"
|
||||
>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/top_container"
|
||||
<TextView
|
||||
android:id="@+id/tvDescription"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
android:lineSpacingExtra="@dimen/dp_4"
|
||||
android:textColor="#666666"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:maxLines="5"
|
||||
android:text="description-1"
|
||||
android:ellipsize="end" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivCharacter"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/character_placeholder"
|
||||
app:layout_constraintDimensionRatio="H,172:229"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:visibility="visible"
|
||||
/>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/top_container_left_top"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:padding="@dimen/dp_3"
|
||||
android:background="@mipmap/actor_item_from_bg_1"
|
||||
>
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="@dimen/dp_8"
|
||||
>
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageView
|
||||
android:id="@+id/iv_from"
|
||||
android:layout_width="@dimen/dp_33"
|
||||
android:layout_height="@dimen/dp_44"
|
||||
android:scaleType="centerCrop"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_from"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="centerCrop"
|
||||
android:gravity="center"
|
||||
android:background="@mipmap/actor_item_from_small"
|
||||
android:text="@string/from"
|
||||
android:textSize="@dimen/sp_9"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_from_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="centerCrop"
|
||||
android:padding="@dimen/dp_3"
|
||||
android:layout_gravity="right|bottom"
|
||||
android:src="@mipmap/actor_item_video_small"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/score"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_score"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_5"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/sp_15"
|
||||
android:textColor="@color/yellow"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/top_container_bottom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/tv_chapter_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_lables"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textColor="@color/yellow_light_1"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<!-- 底部描述文本 -->
|
||||
<LinearLayout
|
||||
<TextView
|
||||
android:id="@+id/tv_last"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/dp_10"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDescription"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:lineSpacingExtra="@dimen/dp_4"
|
||||
android:textColor="#666666"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:maxLines="5"
|
||||
android:ellipsize="end" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_last"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:textColor="#999999"
|
||||
android:textSize="@dimen/sp_10"
|
||||
android:textStyle="italic" />
|
||||
</LinearLayout>
|
||||
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:textColor="#999999"
|
||||
android:textSize="@dimen/sp_10"
|
||||
android:text="description-2"
|
||||
android:textStyle="italic" />
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -274,5 +274,9 @@ object Deps {
|
|||
const val inputViewCompat = "com.github.xiaocydx.InputView:inputview-compat:${Version.inputView}"
|
||||
const val inputViewTransform = "com.github.xiaocydx.InputView:inputview-transform:${Version.inputView}"
|
||||
|
||||
// immersionbar
|
||||
const val immersionbar = "com.geyifeng.immersionbar:immersionbar:3.2.2"
|
||||
const val immersionbarktx = "com.geyifeng.immersionbar:immersionbar-ktx:3.2.2"
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue