光环助手V3.5-游戏详情问题汇总(完成:7.8.9.11.12.13.14.15) https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/374
This commit is contained in:
@ -108,6 +108,7 @@ public class EntranceUtils {
|
||||
public static final String KEY_ARTICLE_COMMENT_ID = "articleCommentId";
|
||||
public static final String KEY_DEVICE_NAME = "deviceName";
|
||||
public static final String KEY_SHOW_ARTICLE_COMMENT = "showArticleComment";
|
||||
public static final String KEY_RATING_STAR_COUNT = "ratingStarCount";
|
||||
|
||||
public static void jumpActivity(Context context, Bundle bundle) {
|
||||
|
||||
|
||||
@ -1073,13 +1073,13 @@ public class MainActivity extends BaseActivity {
|
||||
mDownloadEntity.getUrl(), false); // 默认不删除安装包 sp.getBoolean("autodelete", true)
|
||||
}
|
||||
|
||||
if (sp.getBoolean("concerngame", true)) { //设置页面控制是否安装后自动关注
|
||||
GameManager gameManager = new GameManager(getApplicationContext());
|
||||
GameInfo gameInfo = gameManager.findGame(packageName);
|
||||
if (gameInfo != null) {
|
||||
mInstallManager.updateByEntity(gameInfo);
|
||||
}
|
||||
GameManager gameManager = new GameManager(getApplicationContext());
|
||||
GameInfo gameInfo = gameManager.findGame(packageName);
|
||||
if (gameInfo != null) {
|
||||
mInstallManager.updateByEntity(gameInfo);
|
||||
}
|
||||
|
||||
if (sp.getBoolean("concerngame", true)) { //设置页面控制是否安装后自动关注
|
||||
// 安装后关注游戏
|
||||
RetrofitManager.getInstance(this).getApi().getGameDigestByPackageName(UrlFilterUtils.getFilterQuery("package", packageName))
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
||||
@ -6,7 +6,7 @@ class Rating(val star: Star = Star(),
|
||||
var isExistComment: Boolean = true,
|
||||
val comment: RatingComment? = null)
|
||||
|
||||
class Star(val average: Float = 0.0F,
|
||||
class Star(var average: Float = 0F,
|
||||
val total: Int = 0,
|
||||
val one: Int = 0,
|
||||
val two: Int = 0,
|
||||
|
||||
@ -480,7 +480,7 @@ public class GameDetailFragment extends NormalFragment {
|
||||
|
||||
public void showRatingScore(float ratingScore) {
|
||||
ratingScoreContainer.setVisibility(View.VISIBLE);
|
||||
ratingScoreAverage.setText(String.valueOf(ratingScore));
|
||||
ratingScoreAverage.setText(ratingScore == 10.0 ? "10" : String.valueOf(ratingScore));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -7,6 +7,7 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.gh.common.constant.ItemViewType
|
||||
import com.gh.common.util.CheckLoginUtils
|
||||
import com.gh.common.util.ClickUtils
|
||||
import com.gh.common.util.CommentUtils
|
||||
import com.gh.common.util.MtaHelper
|
||||
import com.gh.gamecenter.PersonalHomeActivity
|
||||
@ -80,19 +81,17 @@ class RatingAdapter(context: Context,
|
||||
data = ratingData
|
||||
ratingSelector.setOnRatingChangeListener { ratingBar, rating ->
|
||||
MtaHelper.onEvent("游戏详情", "评论Tab_点击星星", mListViewModel.game.name + "- ${rating.toInt()}")
|
||||
if (!ClickUtils.isFastDoubleClick(ratingBar.id, 1000)) {
|
||||
skipRatingEdit(rating)
|
||||
// 与传进评论编辑的星星保持一致
|
||||
ratingSelector.postDelayed({
|
||||
ratingSelector.rating = rating
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
ratingEditBtn.setOnClickListener {
|
||||
MtaHelper.onEvent("游戏详情", "评论Tab_点击我来评论", mListViewModel.game.name)
|
||||
CheckLoginUtils.checkLogin(mContext) {
|
||||
if (InstallManager(mContext).findInstallById(mListViewModel.game.id) != null) {
|
||||
if (mContext is Activity) {
|
||||
val intent = RatingEditActivity.getIntent(mContext, mListViewModel.game.id!!, ratingData?.device)
|
||||
(mContext as Activity).startActivityForResult(intent, 1)
|
||||
}
|
||||
} else {
|
||||
Utils.toast(mContext, "安装游戏后才能评论哦")
|
||||
}
|
||||
}
|
||||
skipRatingEdit(0.0F)
|
||||
}
|
||||
includeComment.run {
|
||||
if (this != null && ratingData?.comment != null) {
|
||||
@ -111,6 +110,18 @@ class RatingAdapter(context: Context,
|
||||
}
|
||||
}
|
||||
|
||||
private fun skipRatingEdit(starCount: Float) {
|
||||
CheckLoginUtils.checkLogin(mContext) {
|
||||
if (InstallManager(mContext).findInstallById(mListViewModel.game.id) != null) {
|
||||
if (mContext is Activity) {
|
||||
val intent = RatingEditActivity.getIntent(mContext, mListViewModel.game.id!!, ratingData?.device, starCount)
|
||||
(mContext as Activity).startActivityForResult(intent, RatingFragment.RATING_EDIT_REQUEST)
|
||||
}
|
||||
} else {
|
||||
Utils.toast(mContext, "安装游戏后才能评论哦")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setCommentClick(binding: RatingCommentItemBinding, comment: RatingComment) {
|
||||
binding.run {
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package com.gh.gamecenter.gamedetail.rating
|
||||
|
||||
import android.app.Activity
|
||||
import android.arch.lifecycle.Observer
|
||||
import android.arch.lifecycle.ViewModelProviders
|
||||
import android.content.Intent
|
||||
import android.databinding.BindingAdapter
|
||||
import android.os.Bundle
|
||||
import android.support.v7.widget.RecyclerView
|
||||
@ -20,6 +22,13 @@ class RatingFragment : ListFragment<RatingComment, RatingViewModel>() {
|
||||
|
||||
private var mAdapter: RatingAdapter? = null
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (requestCode == RATING_EDIT_REQUEST && resultCode == Activity.RESULT_OK) {
|
||||
mListViewModel.initData()
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemDecoration(): RecyclerView.ItemDecoration? {
|
||||
return null
|
||||
}
|
||||
@ -103,5 +112,8 @@ class RatingFragment : ListFragment<RatingComment, RatingViewModel>() {
|
||||
}
|
||||
progress.progress = ((targetScore / star.total.toFloat()) * 100).toInt()
|
||||
}
|
||||
|
||||
|
||||
const val RATING_EDIT_REQUEST = 222
|
||||
}
|
||||
}
|
||||
@ -15,10 +15,7 @@ import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import okhttp3.MediaType
|
||||
import okhttp3.RequestBody
|
||||
import okhttp3.ResponseBody
|
||||
import org.json.JSONObject
|
||||
import retrofit2.HttpException
|
||||
|
||||
class RatingViewModel(application: Application, val game: GameEntity) : ListViewModel<RatingComment, RatingComment>(application) {
|
||||
@ -80,24 +77,6 @@ class RatingViewModel(application: Application, val game: GameEntity) : ListView
|
||||
})
|
||||
}
|
||||
|
||||
fun reportComment(commentId: String, reason: String) {
|
||||
val jsonObject = JSONObject()
|
||||
jsonObject.put("reason", reason)
|
||||
val body = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString())
|
||||
mApi.reportGameComment(game.id, commentId, body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Response<ResponseBody>() {
|
||||
override fun onResponse(response: ResponseBody?) {
|
||||
|
||||
}
|
||||
|
||||
override fun onFailure(e: HttpException?) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
class Factory(private val mApplication: Application,
|
||||
private val game: GameEntity) : ViewModelProvider.NewInstanceFactory() {
|
||||
override fun <T : ViewModel> create(modelClass: Class<T>): T {
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
package com.gh.gamecenter.gamedetail.rating.edit
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.text.InputFilter
|
||||
import android.text.TextUtils
|
||||
import android.view.MenuItem
|
||||
import android.widget.EditText
|
||||
import com.gh.base.BaseActivity
|
||||
import com.gh.base.fragment.WaitingDialogFragment
|
||||
import com.gh.common.util.DeviceUtils
|
||||
@ -42,8 +41,8 @@ class RatingEditActivity : BaseActivity() {
|
||||
setToolbarMenu(R.menu.menu_game_comment)
|
||||
mGameId = intent.getStringExtra(EntranceUtils.KEY_GAMEID)
|
||||
mBinding = ActivityRatingEditBinding.bind(mContentView)
|
||||
mBinding?.ratingScore?.rating = intent.getFloatExtra(EntranceUtils.KEY_RATING_STAR_COUNT, 1.0F)
|
||||
mBinding?.deviceName?.text = intent.getStringExtra(EntranceUtils.KEY_DEVICE_NAME)
|
||||
setEditTextInputSpace(mBinding?.content!!)
|
||||
}
|
||||
|
||||
override fun onMenuItemClick(item: MenuItem?): Boolean {
|
||||
@ -81,6 +80,7 @@ class RatingEditActivity : BaseActivity() {
|
||||
.subscribe(object : Response<ResponseBody>() {
|
||||
override fun onResponse(response: ResponseBody?) {
|
||||
postDialog?.dismiss()
|
||||
setResult(Activity.RESULT_OK)
|
||||
finish()
|
||||
}
|
||||
|
||||
@ -97,22 +97,12 @@ class RatingEditActivity : BaseActivity() {
|
||||
})
|
||||
}
|
||||
|
||||
fun setEditTextInputSpace(editText: EditText) {
|
||||
val filter = InputFilter { source, _, _, _, _, _ ->
|
||||
if (source == " " || source.toString().contentEquals("\n")) {
|
||||
""
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
editText.filters = arrayOf(filter)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getIntent(context: Context, gameId: String, deviceName: String?): Intent {
|
||||
fun getIntent(context: Context, gameId: String, deviceName: String?, starCount: Float): Intent {
|
||||
val intent = Intent(context, RatingEditActivity::class.java)
|
||||
intent.putExtra(EntranceUtils.KEY_GAMEID, gameId)
|
||||
intent.putExtra(EntranceUtils.KEY_DEVICE_NAME, deviceName)
|
||||
intent.putExtra(EntranceUtils.KEY_RATING_STAR_COUNT, starCount)
|
||||
return intent
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ class AskColumnAdapter(context: Context) : BaseRecyclerAdapter<AskColumnAdapter.
|
||||
} else {
|
||||
DataUtils.onMtaEvent(mContext, "问答页面",
|
||||
UserManager.getInstance().community.name, "专栏-" + entity?.name)
|
||||
mContext.startActivity(AskColumnDetailActivity.getIntentByColumn(mContext, entity!!, UserManager.getInstance().community, "", "(问答-专栏)"))
|
||||
mContext.startActivity(AskColumnDetailActivity.getIntentByColumn(mContext, entity!!, UserManager.getInstance().community, "", "问答-专栏"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1368,7 +1368,7 @@ public interface ApiService {
|
||||
/**
|
||||
* 获取社区内容列表(推荐最新)
|
||||
*/
|
||||
@GET("communities/{community_id}/answers")
|
||||
@GET("communities/{community_id}/contents")
|
||||
Observable<List<AnswerEntity>> getCommunitiesRecommendNewest(@Path("community_id") String communityId, @Query("page") int page);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user