完成1225测试问题:1,2,3,5 https://gitlab.ghzs.com/pm/halo-app-issues/issues/719
This commit is contained in:
@ -3,7 +3,6 @@ package com.gh.common.util;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import android.text.TextUtils;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
@ -22,6 +21,8 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
/**
|
||||
* @author 温冠超
|
||||
* @email 294299195@qq.com
|
||||
@ -53,6 +54,28 @@ public class GameViewUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void setLabelList(Context context, LinearLayout labelLayout, String tagType, List<TagStyleEntity> tagStyle) {
|
||||
labelLayout.removeAllViews();
|
||||
if (tagStyle == null || tagStyle.isEmpty()) {
|
||||
labelLayout.addView(getGameTagView(context, "官方版", 0, tagType, null));
|
||||
} else {
|
||||
for (int i = 0; i < tagStyle.size() - 1; i++) {
|
||||
View view;
|
||||
if (i == tagStyle.size() - 1) {
|
||||
view = getGameTagView(context, tagStyle.get(i).getName(), 0, tagType, tagStyle.size() > i ? tagStyle.get(i) : null);
|
||||
} else {
|
||||
view = getGameTagView(context, tagStyle.get(i).getName(), DisplayUtils.dip2px(context, 8), tagType, tagStyle.size() > i ? tagStyle.get(i) : null);
|
||||
}
|
||||
if (view != null) {
|
||||
labelLayout.addView(view);
|
||||
}
|
||||
if (labelLayout.getChildCount() == 3) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static TextView getGameTagView(Context context, String tagStr, int rightMargin, String tagType, TagStyleEntity tagEntity) {
|
||||
LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams(
|
||||
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package com.gh.gamecenter.entity
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.gh.gamecenter.qa.entity.CommunityVideoEntity
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
data class PersonalHistoryEntity(
|
||||
@SerializedName("_id")
|
||||
@ -38,6 +40,7 @@ data class PersonalHistoryEntity(
|
||||
val content: String = "",
|
||||
val game: Game = Game())
|
||||
|
||||
@Parcelize
|
||||
data class Game(
|
||||
@SerializedName("_id")
|
||||
val id: String = "",
|
||||
@ -46,7 +49,8 @@ data class PersonalHistoryEntity(
|
||||
val nameSuffix: String = "",
|
||||
|
||||
val icon: String = "",
|
||||
@SerializedName(value = "tag",alternate = ["tag_style"])
|
||||
val tag: List<TagStyleEntity>? = null,
|
||||
val star: Float = 0F
|
||||
)
|
||||
): Parcelable
|
||||
}
|
||||
@ -46,7 +46,8 @@ class MyRatingAdapter(context: Context) : ListAdapter<MyRating>(context) {
|
||||
} else {
|
||||
holder.itemView.tv_comment.setTextWithHighlightedTextWrappedInsideWrapper(text = rating.content, copyClickedText = true)
|
||||
}
|
||||
GameViewUtils.setLabelList(mContext, holder.itemView.label_list, null, "", rating.game.tag)
|
||||
GameViewUtils.setLabelList(mContext, holder.itemView.label_list, "", rating.game.tag)
|
||||
holder.itemView.label_list.goneIf(holder.itemView.label_list.childCount == 0)
|
||||
|
||||
holder.itemView.apply {
|
||||
game_info.setOnClickListener {
|
||||
@ -55,7 +56,8 @@ class MyRatingAdapter(context: Context) : ListAdapter<MyRating>(context) {
|
||||
}
|
||||
comment_info.setOnClickListener {
|
||||
MtaHelper.onEvent("我的光环_新", "我的游戏评论", "评论详情")
|
||||
mContext.startActivity(RatingReplyActivity.getIntent(mContext, rating.game.id, rating.id, "我的游戏评论", ""))
|
||||
val intent = RatingReplyActivity.getIntent(mContext, rating.game.id, rating.id, "我的游戏评论", "")
|
||||
SyncDataBetweenPageHelper.startActivityForResult(mContext, intent, 100, position)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -73,4 +75,8 @@ class MyRatingAdapter(context: Context) : ListAdapter<MyRating>(context) {
|
||||
override fun getItemCount(): Int {
|
||||
return if (mEntityList.isNullOrEmpty()) 0 else mEntityList.size + FOOTER_ITEM_COUNT
|
||||
}
|
||||
|
||||
fun getEntityList(): List<MyRating> {
|
||||
return mEntityList
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,11 @@
|
||||
package com.gh.gamecenter.gamedetail.myrating
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import com.gh.gamecenter.baselist.ListAdapter
|
||||
import com.gh.gamecenter.baselist.ListFragment
|
||||
import com.gh.gamecenter.entity.RatingComment
|
||||
import com.gh.gamecenter.personalhome.rating.MyRating
|
||||
|
||||
class MyRatingFragment : ListFragment<MyRating, MyRatingViewModel>() {
|
||||
@ -18,4 +21,16 @@ class MyRatingFragment : ListFragment<MyRating, MyRatingViewModel>() {
|
||||
override fun provideListViewModel(): MyRatingViewModel {
|
||||
return ViewModelProviders.of(this).get(MyRatingViewModel::class.java)
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (100 == requestCode && resultCode == Activity.RESULT_OK) {
|
||||
val dataPosition = data?.getIntExtra("DATA_POSITION_TAG", -1) ?: -1
|
||||
val myRating = mAdapter?.getEntityList()?.get(dataPosition)
|
||||
val resultData = data?.getParcelableExtra<RatingComment>(RatingComment::class.java.simpleName)
|
||||
myRating?.vote = resultData?.vote ?: 0
|
||||
myRating?.reply = resultData?.reply ?: 0
|
||||
mAdapter?.notifyItemChanged(dataPosition)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -14,8 +14,8 @@ data class MyRating(@SerializedName("_id")
|
||||
val star: Int = 0,
|
||||
val content: String = "",
|
||||
val time: Long = 0,
|
||||
val vote: Int = -1,
|
||||
val reply: Int = -1,
|
||||
var vote: Int = -1,
|
||||
var reply: Int = -1,
|
||||
var user: PersonalEntity? = null,
|
||||
val game: PersonalHistoryEntity.Game = PersonalHistoryEntity.Game()) {
|
||||
|
||||
|
||||
@ -37,32 +37,37 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
fresco:roundedCornerRadius="10dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/game_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_weight="1"
|
||||
android:includeFontPadding="false"
|
||||
android:singleLine="true"
|
||||
android:text="@{rating.game.name}"
|
||||
android:textColor="@color/text_333333"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toEndOf="@+id/game_icon"
|
||||
app:layout_constraintTop_toTopOf="@+id/game_icon"
|
||||
fresco:text="冒险岛3" />
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toEndOf="@+id/game_icon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
<TextView
|
||||
android:id="@+id/game_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_weight="1"
|
||||
android:includeFontPadding="false"
|
||||
android:singleLine="true"
|
||||
android:text="@{rating.game.name}"
|
||||
android:textColor="@color/text_333333"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
fresco:text="冒险岛3" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/label_list"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/game_icon"
|
||||
app:layout_constraintStart_toEndOf="@+id/game_icon" />
|
||||
<LinearLayout
|
||||
android:id="@+id/label_list"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:orientation="horizontal"
|
||||
android:layout_below="@+id/game_name"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="45dp"
|
||||
@ -88,16 +93,24 @@
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/comment_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@color/white">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_rating"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="我的评分:"
|
||||
android:textColor="@color/text_999999"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/game_icon" />
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.gh.common.view.materialratingbar.MaterialRatingBar
|
||||
style="@style/Widget.MaterialRatingBar.RatingBar"
|
||||
@ -112,19 +125,12 @@
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_rating"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_rating"
|
||||
app:mrb_progressTint="@color/theme" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/comment_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@color/white">
|
||||
|
||||
<com.gh.common.view.ExpendTextView
|
||||
android:id="@+id/tv_comment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:ellipsize="end"
|
||||
android:includeFontPadding="false"
|
||||
android:lineSpacingMultiplier="1.5"
|
||||
@ -133,7 +139,7 @@
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_rating"
|
||||
fresco:text="经典移植,画面比例稍微有拉伸,看起来有些不适。扣一星。操作基本还原,因为没有手柄的关系,需要一段时间去适应。需要不支持中文,但是基本上不影响体验" />
|
||||
|
||||
<TextView
|
||||
|
||||
Reference in New Issue
Block a user