修复原创文章闪退bug,换肤文案后台控制
This commit is contained in:
@ -296,7 +296,7 @@ public class MessageDetailActivity extends BaseActivity implements MessageDetail
|
||||
if (mMessageDetailCommentRl.getVisibility() == View.VISIBLE) {
|
||||
setSoftInput(false);
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@OnClick(R.id.comment_send)
|
||||
@ -316,7 +316,11 @@ public class MessageDetailActivity extends BaseActivity implements MessageDetail
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (newsId == null) {
|
||||
if (newsId == null && mConcernEntity == null ||
|
||||
newsId == null && mConcernEntity!= null && mConcernEntity.getId() == null) {
|
||||
Utils.toast(this, "评论异常");
|
||||
return;
|
||||
} else if(newsId == null) {
|
||||
newsId = mConcernEntity.getId();
|
||||
}
|
||||
PostCommentUtils.addCommentData(MessageDetailActivity.this,
|
||||
@ -393,6 +397,7 @@ public class MessageDetailActivity extends BaseActivity implements MessageDetail
|
||||
Utils.toast(MessageDetailActivity.this, "评论失败,未知原因");
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
Utils.toast(MessageDetailActivity.this, "评论异常");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
@ -72,6 +72,8 @@ public class GameDetailAdapter extends RecyclerView.Adapter {
|
||||
private GameEntity gameEntity;
|
||||
private GameDetailEntity gameDetailEntity;
|
||||
|
||||
private HashMap<String, String> skinMap;
|
||||
|
||||
private String entrance;
|
||||
|
||||
private int position_top = -1;
|
||||
@ -111,6 +113,10 @@ public class GameDetailAdapter extends RecyclerView.Adapter {
|
||||
getGameNews();
|
||||
|
||||
getNewsServer();
|
||||
|
||||
if (gameDetailEntity.isSkinTest()) {
|
||||
getSkinDigest();
|
||||
}
|
||||
} else if (listener != null) {
|
||||
listener.loadError();
|
||||
}
|
||||
@ -126,6 +132,33 @@ public class GameDetailAdapter extends RecyclerView.Adapter {
|
||||
AppController.addToRequestQueue(request);
|
||||
}
|
||||
|
||||
private void getSkinDigest() {
|
||||
JsonObjectExtendedRequest request = new JsonObjectExtendedRequest(Config.HOST + "skin/gameInfo/" + gameEntity.getId(),
|
||||
new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
skinMap = new HashMap<>();
|
||||
try {
|
||||
String des = response.getString("des");
|
||||
String name = response.getString("name");
|
||||
skinMap.put("des", des);
|
||||
skinMap.put("name", name);
|
||||
notifyDataSetChanged();
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
|
||||
}
|
||||
});
|
||||
AppController.addToRequestQueue(request);
|
||||
}
|
||||
|
||||
// 获取游戏新闻
|
||||
private void getGameNews() {
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(
|
||||
@ -261,6 +294,10 @@ public class GameDetailAdapter extends RecyclerView.Adapter {
|
||||
}
|
||||
|
||||
private void initSkinViewHolder(GameDetailSkinViewHolder holder) {
|
||||
if (skinMap.get("des") != null && skinMap.get("name") != null) {
|
||||
holder.skinDownloadDes.setText(skinMap.get("des"));
|
||||
holder.skinDownloadName.setText(skinMap.get("name"));
|
||||
}
|
||||
ChangeSkinUtils.changeSkinControl(holder, context);
|
||||
}
|
||||
|
||||
|
||||
@ -17,6 +17,8 @@ public class GameDetailSkinViewHolder extends RecyclerView.ViewHolder{
|
||||
@BindView(R.id.skin_tv_download) public TextView skinDownloadTv;
|
||||
@BindView(R.id.skin_pb_progressbar) public ProgressBar skinDownloadPb;
|
||||
@BindView(R.id.skin_tv_per) public TextView skinDownloadPerTv;
|
||||
@BindView(R.id.skin_tv_des) public TextView skinDownloadDes;
|
||||
@BindView(R.id.skin_tv_name) public TextView skinDownloadName;
|
||||
|
||||
public GameDetailSkinViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
||||
@ -105,8 +105,11 @@ public class NewsDetailAdapter extends RecyclerView.Adapter {
|
||||
public void onNext(List<CommentnumEntity> response) {
|
||||
super.onNext(response);
|
||||
if (response.size() > 0) {
|
||||
commentNum = response.get(0).getNum();
|
||||
notifyItemInserted(getItemCount() - 1);
|
||||
if (gameEntity != null && gameEntity.getId() != null &&
|
||||
!gameEntity.getId().isEmpty()){
|
||||
commentNum = response.get(0).getNum();
|
||||
notifyItemInserted(getItemCount() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/skin_tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
@ -34,6 +35,7 @@
|
||||
android:layout_marginBottom="12dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/skin_tv_des"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:textSize="13sp"
|
||||
|
||||
Reference in New Issue
Block a user