角色list请求
This commit is contained in:
parent
1bcccd38e5
commit
15fb8dcc4f
|
|
@ -315,6 +315,12 @@ dependencies {
|
||||||
implementation(Deps.BytePlusRTC)
|
implementation(Deps.BytePlusRTC)
|
||||||
|
|
||||||
|
|
||||||
|
// immersion bar
|
||||||
|
implementation(Deps.immersionbar)
|
||||||
|
implementation(Deps.immersionbarktx)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
implementation(project(mapOf("path" to ":loadingstateview")))
|
implementation(project(mapOf("path" to ":loadingstateview")))
|
||||||
implementation(project(mapOf("path" to ":loadingstateview-ktx")))
|
implementation(project(mapOf("path" to ":loadingstateview-ktx")))
|
||||||
implementation(project(mapOf("path" to ":viewbinding-base")))
|
implementation(project(mapOf("path" to ":viewbinding-base")))
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,6 @@ package com.remax.visualnovel.entity.request
|
||||||
|
|
||||||
data class ParamActorList(
|
data class ParamActorList(
|
||||||
var index: Int = 0,
|
var index: Int = 0,
|
||||||
var limit: Int = 2,
|
var limit: Int = 5,
|
||||||
var tagIds: List<Long> = listOf<Long>(),
|
var tagIds: List<Long> = listOf<Long>(),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.remax.visualnovel.ui.main.actor
|
package com.remax.visualnovel.ui.main.actor
|
||||||
|
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide
|
||||||
import com.chad.library.adapter.base.module.LoadMoreModule
|
import com.chad.library.adapter.base.module.LoadMoreModule
|
||||||
import com.remax.visualnovel.R
|
import com.remax.visualnovel.R
|
||||||
import com.remax.visualnovel.app.BaseBindingQuickAdapter
|
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.entity.response.ActorBean
|
||||||
import com.remax.visualnovel.extension.glide.load
|
import com.remax.visualnovel.extension.glide.load
|
||||||
import com.remax.visualnovel.ui.chat.ChatActivity
|
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 {
|
class ActorsAdapter : BaseBindingQuickAdapter<ActorBean, FragmentMainActorItemBinding>(FragmentMainActorItemBinding::inflate), LoadMoreModule {
|
||||||
init {
|
init {
|
||||||
|
|
@ -27,9 +30,15 @@ class ActorsAdapter : BaseBindingQuickAdapter<ActorBean, FragmentMainActorItemBi
|
||||||
override fun convert(holder: BaseBindingHolder, item: ActorBean) {
|
override fun convert(holder: BaseBindingHolder, item: ActorBean) {
|
||||||
holder.getViewBinding<FragmentMainActorItemBinding>().run {
|
holder.getViewBinding<FragmentMainActorItemBinding>().run {
|
||||||
var imgUrl = item.coverImage
|
var imgUrl = item.coverImage
|
||||||
ivCharacter.load(if (imgUrl.contains(".png")) imgUrl.substring(0, imgUrl.indexOf(".png") + 4) else imgUrl)
|
var validUrl = if (imgUrl.contains(".png")) imgUrl.substring(0, imgUrl.indexOf(".png") + 4) else imgUrl
|
||||||
ivFrom.setImageResource(R.mipmap.icon_search_on)
|
|
||||||
|
|
||||||
|
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()
|
tvScore.text = item.commonCount.toString()
|
||||||
tvFrom.text = item.sourceId.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,19 +1,10 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.cardview.widget.CardView
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/root_card"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:cardElevation="@dimen/dp_4"
|
android:orientation="vertical" >
|
||||||
app:cardCornerRadius="@dimen/dp_5" >
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:background="@color/white">
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/top_container"
|
android:id="@+id/top_container"
|
||||||
|
|
@ -164,6 +155,7 @@
|
||||||
android:textColor="#666666"
|
android:textColor="#666666"
|
||||||
android:textSize="@dimen/sp_12"
|
android:textSize="@dimen/sp_12"
|
||||||
android:maxLines="5"
|
android:maxLines="5"
|
||||||
|
android:text="description-1"
|
||||||
android:ellipsize="end" />
|
android:ellipsize="end" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|
@ -173,9 +165,9 @@
|
||||||
android:layout_marginTop="@dimen/dp_5"
|
android:layout_marginTop="@dimen/dp_5"
|
||||||
android:textColor="#999999"
|
android:textColor="#999999"
|
||||||
android:textSize="@dimen/sp_10"
|
android:textSize="@dimen/sp_10"
|
||||||
|
android:text="description-2"
|
||||||
android:textStyle="italic" />
|
android:textStyle="italic" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
Binary file not shown.
|
|
@ -274,5 +274,9 @@ object Deps {
|
||||||
const val inputViewCompat = "com.github.xiaocydx.InputView:inputview-compat:${Version.inputView}"
|
const val inputViewCompat = "com.github.xiaocydx.InputView:inputview-compat:${Version.inputView}"
|
||||||
const val inputViewTransform = "com.github.xiaocydx.InputView:inputview-transform:${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