消息评论功能 基本完成
This commit is contained in:
@ -131,11 +131,17 @@
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.CropImageActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity android:name="com.gh.gamecenter.WebActivity"
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.WebActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity android:name="com.gh.gamecenter.ShareCardPicActivity"
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.ShareCardPicActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity android:name="com.gh.gamecenter.ShareCardActivity"
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.ShareCardActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.MessageDetailActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity
|
||||
android:name="com.mob.tools.MobUIShell"
|
||||
|
||||
@ -0,0 +1,98 @@
|
||||
package com.gh.common.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.facebook.drawee.drawable.ScalingUtils;
|
||||
import com.facebook.drawee.view.SimpleDraweeView;
|
||||
import com.gh.gamecenter.ViewImageActivity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by khy on 2016/11/8.
|
||||
*
|
||||
* 初始化z资讯关注-内容图片
|
||||
*
|
||||
**/
|
||||
public class ConcernContentUtils {
|
||||
|
||||
public static void addContentPic(int width, LinearLayout linearLayout, List<String> list, Context context) {
|
||||
int count = list.size();
|
||||
LinearLayout ll;
|
||||
int index = 0;
|
||||
for (int i = 0, size = (int) Math.ceil(list.size() / 3.0f); i < size; i++) {
|
||||
switch (count % 3) {
|
||||
case 0:
|
||||
ll = new LinearLayout(context);
|
||||
ll.setOrientation(LinearLayout.HORIZONTAL);
|
||||
for (int j = 0; j < 3; j++) {
|
||||
ll.addView(getImageView(list, index, width, 0, context));
|
||||
index += 1;
|
||||
}
|
||||
linearLayout.addView(ll);
|
||||
count -= 3;
|
||||
break;
|
||||
case 1:
|
||||
linearLayout.addView(getImageView(list, index, width, 1, context));
|
||||
count -= 1;
|
||||
index += 1;
|
||||
break;
|
||||
case 2:
|
||||
ll = new LinearLayout(context);
|
||||
ll.setOrientation(LinearLayout.HORIZONTAL);
|
||||
for (int j = 0; j < 2; j++) {
|
||||
ll.addView(getImageView(list, index, width, 2, context));
|
||||
index += 1;
|
||||
}
|
||||
linearLayout.addView(ll);
|
||||
count -= 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static SimpleDraweeView getImageView(final List<String> list, final int position, int width, int type, final Context context) {
|
||||
SimpleDraweeView imageView;
|
||||
if (type == 0) {
|
||||
imageView = new SimpleDraweeView(context);
|
||||
LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams(
|
||||
0, width / 3 - DisplayUtils.dip2px(context, 4));
|
||||
lparams.setMargins(DisplayUtils.dip2px(context, 2), 0,
|
||||
DisplayUtils.dip2px(context, 2), DisplayUtils.dip2px(context, 4));
|
||||
lparams.weight = 1;
|
||||
imageView.setLayoutParams(lparams);
|
||||
ImageUtils.getInstance(context).display(list.get(position), imageView, ScalingUtils.ScaleType.CENTER_CROP, context);
|
||||
} else if (type == 1) {
|
||||
imageView = new SimpleDraweeView(context);
|
||||
LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams(width, width / 2);
|
||||
lparams.setMargins(DisplayUtils.dip2px(context, 2), 0,
|
||||
DisplayUtils.dip2px(context, 2), DisplayUtils.dip2px(context, 4));
|
||||
imageView.setLayoutParams(lparams);
|
||||
ImageUtils.getInstance(context).display(list.get(position), imageView, ScalingUtils.ScaleType.CENTER_CROP, context);
|
||||
} else {
|
||||
imageView = new SimpleDraweeView(context);
|
||||
LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams(
|
||||
0, width / 2 - DisplayUtils.dip2px(context, 4));
|
||||
lparams.setMargins(DisplayUtils.dip2px(context, 2), 0,
|
||||
DisplayUtils.dip2px(context, 2), DisplayUtils.dip2px(context, 4));
|
||||
lparams.weight = 1;
|
||||
imageView.setLayoutParams(lparams);
|
||||
ImageUtils.getInstance(context).display(list.get(position), imageView, ScalingUtils.ScaleType.CENTER_CROP, context);
|
||||
}
|
||||
imageView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent checkIntent = new Intent(context, ViewImageActivity.class);
|
||||
checkIntent.putExtra("urls", (ArrayList<String>) list);
|
||||
checkIntent.putExtra("current", position);
|
||||
checkIntent.putExtra("ScaleType", "FIT_CENTER");
|
||||
context.startActivity(checkIntent);
|
||||
}
|
||||
});
|
||||
return imageView;
|
||||
}
|
||||
}
|
||||
@ -5,7 +5,6 @@ import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Matrix;
|
||||
import android.os.Bundle;
|
||||
@ -23,10 +22,6 @@ import android.widget.PopupWindow;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.facebook.common.references.CloseableReference;
|
||||
import com.facebook.datasource.DataSource;
|
||||
import com.facebook.imagepipeline.datasource.BaseBitmapDataSubscriber;
|
||||
import com.facebook.imagepipeline.image.CloseableImage;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.tencent.connect.share.QQShare;
|
||||
import com.tencent.mm.sdk.openapi.IWXAPI;
|
||||
@ -92,7 +87,7 @@ public class MessageShareUtils {
|
||||
contentView.setFocusableInTouchMode(true);
|
||||
|
||||
RecyclerView shareRecyclerView = new RecyclerView(context);
|
||||
shareRecyclerView.setPadding(DisplayUtils.dip2px(context, 20), DisplayUtils.dip2px(context, 10), DisplayUtils.dip2px(context, 20), 0);
|
||||
shareRecyclerView.setPadding(DisplayUtils.dip2px(context, 10), DisplayUtils.dip2px(context, 10), DisplayUtils.dip2px(context, 10), 0);
|
||||
shareRecyclerView.setBackgroundColor(Color.WHITE);
|
||||
|
||||
//RecyclerView禁止滑动
|
||||
@ -115,7 +110,7 @@ public class MessageShareUtils {
|
||||
}
|
||||
|
||||
RelativeLayout.LayoutParams rlParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT
|
||||
, DisplayUtils.dip2px(context, 100));
|
||||
, DisplayUtils.dip2px(context, 106));
|
||||
rlParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
|
||||
contentView.addView(shareRecyclerView,rlParams);
|
||||
|
||||
@ -156,7 +151,7 @@ public class MessageShareUtils {
|
||||
linearLayout.setBackgroundResource(R.drawable.cardview_item_style);
|
||||
|
||||
ImageView shareLogo = new ImageView(context);
|
||||
LinearLayout.LayoutParams logoParams = new LinearLayout.LayoutParams(DisplayUtils.dip2px(context, 45), DisplayUtils.dip2px(context, 45));
|
||||
LinearLayout.LayoutParams logoParams = new LinearLayout.LayoutParams(DisplayUtils.dip2px(context, 43), DisplayUtils.dip2px(context, 43));
|
||||
logoParams.setMargins(0, DisplayUtils.dip2px(context, 10), 0, 0);
|
||||
shareLogo.setLayoutParams(logoParams);
|
||||
|
||||
@ -309,44 +304,6 @@ public class MessageShareUtils {
|
||||
return (type == null) ? String.valueOf(System.currentTimeMillis()) : type + System.currentTimeMillis();
|
||||
}
|
||||
|
||||
private void loadBitMap(final String iconUrl, final WXMediaMessage msg, final SendMessageToWX.Req req){
|
||||
ImageUtils.getInstance(context).display(iconUrl, new BaseBitmapDataSubscriber() {
|
||||
@Override
|
||||
protected void onNewResultImpl(Bitmap bitmap) {
|
||||
Bitmap compressBp = compressBitmap(bitmap);
|
||||
Bitmap resultBp = addBackGround(compressBp);
|
||||
msg.thumbData = Util.bmpToByteArray(resultBp, true);
|
||||
api.sendReq(req);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFailureImpl(DataSource<CloseableReference<CloseableImage>> dataSource) {
|
||||
Utils.log("分享获取bitmap失败");
|
||||
}
|
||||
}, context);
|
||||
}
|
||||
|
||||
//添加背景,防止图片格式为PNG的图片分享出现黑框问题
|
||||
private Bitmap addBackGround(Bitmap result) {
|
||||
Bitmap bgBitmap;
|
||||
int[] colors = new int[result.getWidth()*result.getHeight()];
|
||||
for (int i = 0; i < colors.length; i++) {
|
||||
colors[i] = Color.WHITE;
|
||||
}
|
||||
bgBitmap = Bitmap.createBitmap(colors, result.getWidth(), result.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
|
||||
Bitmap newmap = Bitmap
|
||||
.createBitmap(result.getWidth(), result.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(newmap);
|
||||
canvas.drawBitmap(bgBitmap, 0, 0, null);
|
||||
canvas.drawBitmap(result, (result.getHeight() - result.getWidth()) / 2,
|
||||
(result.getHeight() - result.getWidth()) / 2, null);
|
||||
canvas.save(Canvas.ALL_SAVE_FLAG);
|
||||
canvas.restore();
|
||||
|
||||
return newmap;
|
||||
}
|
||||
|
||||
//压缩图片
|
||||
private Bitmap compressBitmap(Bitmap bitmap) {
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
|
||||
@ -6,8 +6,10 @@ import android.content.Intent;
|
||||
import com.android.volley.Request;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.gamecenter.MessageDetailActivity;
|
||||
import com.gh.gamecenter.NewsDetailActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.entity.ConcernEntity;
|
||||
import com.gh.gamecenter.entity.NewsEntity;
|
||||
import com.gh.gamecenter.volley.extended.JsonObjectExtendedRequest;
|
||||
|
||||
@ -49,6 +51,20 @@ public class NewsUtils {
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
/*
|
||||
* 启动消息详情页面
|
||||
*/
|
||||
|
||||
public static void startMessageActivity(Context context, ConcernEntity concernEntity, String entrance) {
|
||||
AppController.put("ConcernEntity", concernEntity);
|
||||
Intent intent = new Intent(context, MessageDetailActivity.class);
|
||||
intent.putExtra("entrance", entrance);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 统计阅读量
|
||||
* @param news_id
|
||||
|
||||
87
app/src/main/java/com/gh/common/util/PostCommentUtils.java
Normal file
87
app/src/main/java/com/gh/common/util/PostCommentUtils.java
Normal file
@ -0,0 +1,87 @@
|
||||
package com.gh.common.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.volley.Request;
|
||||
import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.gamecenter.volley.extended.StringExtendedRequest;
|
||||
|
||||
/**
|
||||
* Created by khy on 2016/11/9.
|
||||
*/
|
||||
public class PostCommentUtils {
|
||||
public static void addCommentData(final String url, final String content, final Context context, final PostCommentListener listener) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Utils.log("url::" + url, "/ content::" + content);
|
||||
StringExtendedRequest request = new StringExtendedRequest(
|
||||
Request.Method.POST, url, content,
|
||||
new Response.Listener<String>() {
|
||||
@Override
|
||||
public void onResponse(String response) {
|
||||
if (listener != null){
|
||||
listener.postSucced(response.toString());
|
||||
}
|
||||
}
|
||||
},
|
||||
new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
if (listener != null){
|
||||
listener.postFailed(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
request.setShouldCache(false);
|
||||
request.addHeader("TOKEN",TokenUtils.getToken(context));
|
||||
AppController.addToRequestQueue(request);
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
|
||||
public static void addCommentVoto(final String newsId, final Context context, final PostCommentListener listener) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
StringExtendedRequest request = new StringExtendedRequest(
|
||||
Request.Method.POST, Config.COMMENT_HOST + "comment/" + newsId + "/vote" ,
|
||||
new Response.Listener<String>() {
|
||||
@Override
|
||||
public void onResponse(String response) {
|
||||
Log.e("======onResponse", "onResponse");
|
||||
if (listener != null){
|
||||
listener.postSucced(response.toString());
|
||||
}
|
||||
}
|
||||
},
|
||||
new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e("======onErrorResponse", new String(error.networkResponse.data));
|
||||
if (listener != null){
|
||||
listener.postFailed(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
request.setShouldCache(false);
|
||||
request.addHeader("TOKEN",TokenUtils.getToken(context));
|
||||
AppController.addToRequestQueue(request);
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
|
||||
public interface PostCommentListener {
|
||||
void postSucced(String str);
|
||||
void postFailed(VolleyError error);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -105,12 +105,13 @@ public class TokenUtils {
|
||||
|
||||
// 获取用户token
|
||||
public static synchronized String getToken(Context context) {
|
||||
//TODO 时间准确判断
|
||||
SharedPreferences sp = context.getSharedPreferences(Config.PREFERENCE,
|
||||
Context.MODE_PRIVATE);
|
||||
String token = sp.getString("token", null);
|
||||
if (token != null) {
|
||||
long expire = sp.getLong("token_expire", 0) * 1000 - 10 * 1000;
|
||||
long time = System.currentTimeMillis();
|
||||
long time = System.currentTimeMillis();//TODO 用户有可能修改手机时间,导致没能判断Token是否过期
|
||||
// 判断token是否过期
|
||||
if (time < expire) {
|
||||
// token未过期
|
||||
|
||||
292
app/src/main/java/com/gh/gamecenter/MessageDetailActivity.java
Normal file
292
app/src/main/java/com/gh/gamecenter/MessageDetailActivity.java
Normal file
@ -0,0 +1,292 @@
|
||||
package com.gh.gamecenter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.DiskBasedCache;
|
||||
import com.facebook.drawee.view.SimpleDraweeView;
|
||||
import com.gh.base.BaseActivity;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.util.GzipUtils;
|
||||
import com.gh.common.util.PostCommentUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.common.util.TokenUtils;
|
||||
import com.gh.common.util.Utils;
|
||||
import com.gh.gamecenter.adapter.MessageDetailAdapter;
|
||||
import com.gh.gamecenter.entity.CommentEntity;
|
||||
import com.gh.gamecenter.entity.UserEntity;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import butterknife.OnTouch;
|
||||
|
||||
/**
|
||||
* Created by khy on 2016/11/8.
|
||||
*/
|
||||
public class MessageDetailActivity extends BaseActivity{
|
||||
|
||||
@BindView(R.id.message_detail_rv) RecyclerView mMessageDetailRv;
|
||||
@BindView(R.id.message_detail_user_rl) RelativeLayout mMessageDetailUserRl;
|
||||
@BindView(R.id.message_detail_comment_rl) RelativeLayout mMessageDetailCommentRl;
|
||||
@BindView(R.id.comment_user_icon) SimpleDraweeView mMessageDetailIconDv;
|
||||
@BindView(R.id.comment_user_name) TextView mMessageDetailUserNameTv;
|
||||
@BindView(R.id.comment_send) TextView mMessageDetailCommentSend;
|
||||
@BindView(R.id.message_detail_comment_et) EditText mMessageDetailEt;
|
||||
@BindView(R.id.message_detail_comment_hint) TextView mMessageDetailCommentHint;
|
||||
|
||||
private LinearLayoutManager mLayoutManager;
|
||||
|
||||
private MessageDetailAdapter mMessageDetailAdapter;
|
||||
|
||||
private SharedPreferences sp;
|
||||
|
||||
private boolean isDone;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
View contentView = View.inflate(this, R.layout.activity_message_detail, null);
|
||||
init(contentView, "消息详情");
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
||||
sp = getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE);
|
||||
|
||||
isDone = false;
|
||||
|
||||
mMessageDetailAdapter = new MessageDetailAdapter(this);
|
||||
mLayoutManager = new LinearLayoutManager(this);
|
||||
mMessageDetailRv.setLayoutManager(mLayoutManager);
|
||||
mMessageDetailRv.setAdapter(mMessageDetailAdapter);
|
||||
|
||||
mMessageDetailIconDv.setImageURI(sp.getString("user_icon", null));
|
||||
mMessageDetailUserNameTv.setText(sp.getString("user_name", "光环用户"));
|
||||
|
||||
mMessageDetailEt.addTextChangedListener(watcher);
|
||||
mMessageDetailCommentSend.setEnabled(false);
|
||||
|
||||
mMessageDetailRv.setOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE && !isDone && !mMessageDetailAdapter.isLoading() &&
|
||||
mLayoutManager.findLastVisibleItemPosition() == mMessageDetailAdapter.getItemCount() -1) {
|
||||
|
||||
mMessageDetailAdapter.addNormalComment(mMessageDetailAdapter.getItemCount()
|
||||
- mMessageDetailAdapter.getHotCommentListSize() - 3);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private TextWatcher watcher = new TextWatcher() {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
if (s.toString().trim().length() > 0 ) {
|
||||
mMessageDetailCommentSend.setEnabled(true);
|
||||
|
||||
if (count > 140) {
|
||||
mMessageDetailEt.setText("");
|
||||
String newText = s.toString().substring(0, 140);
|
||||
mMessageDetailEt.setText(newText);
|
||||
Utils.toast(MessageDetailActivity.this, "评论不能多于140字");
|
||||
}
|
||||
} else {
|
||||
mMessageDetailCommentSend.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@OnClick(R.id.message_detail_comment_hint)
|
||||
public void OnHintClikListener() {
|
||||
mMessageDetailCommentHint.setVisibility(View.GONE);
|
||||
mMessageDetailCommentRl.setVisibility(View.VISIBLE);
|
||||
mMessageDetailUserRl.setVisibility(View.VISIBLE);
|
||||
mMessageDetailEt.setFocusable(true);
|
||||
mMessageDetailEt.setFocusableInTouchMode(true);
|
||||
mMessageDetailEt.requestFocus();
|
||||
setSoftInput(true);
|
||||
}
|
||||
|
||||
@OnTouch(R.id.message_detail_rv)
|
||||
public boolean OnRecyclerTouchListener () {
|
||||
if (mMessageDetailCommentRl.getVisibility() == View.VISIBLE) {
|
||||
mMessageDetailCommentHint.setVisibility(View.VISIBLE);
|
||||
mMessageDetailCommentRl.setVisibility(View.GONE);
|
||||
mMessageDetailUserRl.setVisibility(View.GONE);
|
||||
mMessageDetailEt.setText("");
|
||||
setSoftInput(false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@OnClick(R.id.comment_send)
|
||||
public void OnSendCommentListener() {
|
||||
final String content = mMessageDetailEt.getText().toString();
|
||||
|
||||
if (content.length() ==0) {
|
||||
Utils.toast(MessageDetailActivity.this, "评论内容不能为空!");
|
||||
return;
|
||||
}
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
try {
|
||||
jsonObject.put("content", content);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
final String newsId = mMessageDetailAdapter.getNewsId();
|
||||
PostCommentUtils.addCommentData(Config.COMMENT_HOST + "article/" + newsId + "/comment"
|
||||
, jsonObject.toString(), MessageDetailActivity.this, new PostCommentUtils.PostCommentListener() {
|
||||
@Override
|
||||
public void postSucced(String str) {
|
||||
if (str == null) return;
|
||||
|
||||
JSONObject succedJson;
|
||||
String commentId = null;
|
||||
try {
|
||||
succedJson = new JSONObject(str);
|
||||
commentId = succedJson.getString("_id");
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Utils.toast(MessageDetailActivity.this, "发表成功");
|
||||
mMessageDetailCommentHint.setVisibility(View.VISIBLE);
|
||||
mMessageDetailCommentRl.setVisibility(View.GONE);
|
||||
mMessageDetailUserRl.setVisibility(View.GONE);
|
||||
mMessageDetailEt.setText("");
|
||||
setSoftInput(false);
|
||||
|
||||
|
||||
List<CommentEntity> normalCommentList = mMessageDetailAdapter.getNormalCommentList();
|
||||
CommentEntity commentEntity = new CommentEntity();
|
||||
UserEntity userEntity = new UserEntity();
|
||||
userEntity.setIcon(sp.getString("user_icon", null));
|
||||
userEntity.setName(sp.getString("user_name", "光环用户"));
|
||||
userEntity.setId(TokenUtils.getDeviceId(MessageDetailActivity.this));
|
||||
commentEntity.setContent(content);
|
||||
commentEntity.setId(commentId);
|
||||
commentEntity.setVote(0);
|
||||
commentEntity.setTime(new Date().getTime()/1000);
|
||||
commentEntity.setUser(userEntity);
|
||||
normalCommentList.add(0, commentEntity);
|
||||
JSONObject cacheObject = new JSONObject();
|
||||
|
||||
try {
|
||||
JSONObject cacheUser = new JSONObject();
|
||||
cacheUser.put("_id", TokenUtils.getDeviceId(MessageDetailActivity.this));
|
||||
cacheUser.put("icon", sp.getString("user_icon", null));
|
||||
cacheUser.put("name", sp.getString("user_name", "光环用户"));
|
||||
cacheObject.put("_id", commentId);
|
||||
cacheObject.put("content", content);
|
||||
cacheObject.put("time", new Date().getTime()/1000);
|
||||
cacheObject.put("vote", 0);
|
||||
cacheObject.put("user", cacheUser);
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
modifyNewsCommentVolleyCache(0, cacheObject, newsId);
|
||||
mMessageDetailAdapter.notifyItemInserted(mMessageDetailAdapter.getHotCommentListSize() + 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postFailed(VolleyError error) {
|
||||
Utils.log("提交失败" + new String(error.networkResponse.data));
|
||||
|
||||
if (error.networkResponse.data == null) return;
|
||||
|
||||
String errorData = new String(error.networkResponse.data);
|
||||
try {
|
||||
JSONObject errorJson = new JSONObject(errorData);
|
||||
String detail = errorJson.getString("detail");
|
||||
if ("too frequent".equals(detail)) {
|
||||
Utils.toast(MessageDetailActivity.this, "@_@ 别话痨哦~休息一会再来评论吧~");
|
||||
} else if ("silence".equals(detail)) {
|
||||
Utils.toast(MessageDetailActivity.this, "账号状态异常,暂时无法发表评论");
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static final String DEFAULT_CACHE_DIR = "volley";
|
||||
private void modifyNewsCommentVolleyCache(int offset, JSONObject commentData, String id) {
|
||||
File cacheDir = new File(getCacheDir(), DEFAULT_CACHE_DIR);
|
||||
DiskBasedCache cache = new DiskBasedCache(cacheDir);
|
||||
String key = TimestampUtils.addTimestamp(Config.COMMENT_HOST + "article/" + id + "/comment?limit=10&offset=" + offset);
|
||||
byte[] data = cache.getData(key);
|
||||
if (data != null) {
|
||||
try {
|
||||
JSONArray jsonArray = new JSONArray(new String(GzipUtils.decompressBytes(data)));
|
||||
JSONArray newComment = new JSONArray();
|
||||
newComment.put(commentData);
|
||||
for (int i = 0, size = jsonArray.length() > 9 ? 9 : jsonArray.length(); i < size; i++) {
|
||||
newComment.put(jsonArray.get(i));
|
||||
}
|
||||
Utils.log(newComment.toString());
|
||||
cache.modify(key, GzipUtils.compressBytes(newComment.toString().getBytes()));
|
||||
if (jsonArray.length() == 10) {
|
||||
modifyNewsCommentVolleyCache(offset + 10, jsonArray.getJSONObject(9), id);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
Utils.log("modifyNewsCommentVolleyCache is null");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void loadDone() {
|
||||
super.loadDone();
|
||||
isDone = true;
|
||||
}
|
||||
|
||||
//软键盘控制
|
||||
private void setSoftInput(boolean isShow) {
|
||||
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (isShow){
|
||||
imm.showSoftInputFromInputMethod(mMessageDetailEt.getWindowToken(), 0);
|
||||
imm.toggleSoftInputFromWindow(mMessageDetailEt.getWindowToken(), 0, InputMethodManager.HIDE_NOT_ALWAYS);
|
||||
} else {
|
||||
imm.hideSoftInputFromWindow(getWindow().getDecorView().getWindowToken(), 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,585 @@
|
||||
package com.gh.gamecenter.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.Html;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.android.volley.Request;
|
||||
import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.DiskBasedCache;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.util.ConcernContentUtils;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.GzipUtils;
|
||||
import com.gh.common.util.PostCommentUtils;
|
||||
import com.gh.common.util.Utils;
|
||||
import com.gh.common.view.CardLinearLayout;
|
||||
import com.gh.gamecenter.GameNewsActivity;
|
||||
import com.gh.gamecenter.MessageDetailActivity;
|
||||
import com.gh.gamecenter.NewsDetailActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.ShareCardActivity;
|
||||
import com.gh.gamecenter.ShareCardPicActivity;
|
||||
import com.gh.gamecenter.WebActivity;
|
||||
import com.gh.gamecenter.adapter.viewholder.CommentHeadViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.CommentViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
|
||||
import com.gh.gamecenter.db.VoteDao;
|
||||
import com.gh.gamecenter.db.info.VoteInfo;
|
||||
import com.gh.gamecenter.entity.CommentEntity;
|
||||
import com.gh.gamecenter.entity.ConcernEntity;
|
||||
import com.gh.gamecenter.eventbus.EBReuse;
|
||||
import com.gh.gamecenter.listener.OnCallBackListener;
|
||||
import com.gh.gamecenter.manager.DataCollectionManager;
|
||||
import com.gh.gamecenter.news.News1Fragment;
|
||||
import com.gh.gamecenter.news.NewsConcernViewHolder;
|
||||
import com.gh.gamecenter.volley.extended.JsonArrayExtendedRequest;
|
||||
import com.gh.gamecenter.volley.extended.JsonObjectExtendedRequest;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Type;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import de.greenrobot.event.EventBus;
|
||||
|
||||
/**
|
||||
* Created by khy on 2016/11/8.
|
||||
*/
|
||||
public class MessageDetailAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private Context mContext;
|
||||
private ConcernEntity mConcernEntity;
|
||||
|
||||
private List<CommentEntity> mHotCommentList;
|
||||
private List<CommentEntity> mNormalCommentList;
|
||||
|
||||
private OnCallBackListener listener;
|
||||
|
||||
private VoteDao mVoteDao;
|
||||
|
||||
private List<VoteInfo> mVoteList;
|
||||
|
||||
private boolean isDone;
|
||||
private boolean isLoading;
|
||||
private boolean isloadError;
|
||||
|
||||
private static final int ITEM_TOP = 100;
|
||||
private static final int ITEM_TITLE = 101;
|
||||
private static final int ITEM_COMMENT = 102;
|
||||
private static final int ITEM_FOOTER = 103;
|
||||
|
||||
public MessageDetailAdapter(MessageDetailActivity context) {
|
||||
this.listener = context;
|
||||
this.mContext = context;
|
||||
|
||||
mVoteDao = new VoteDao(context);
|
||||
mVoteList = mVoteDao.getAll();
|
||||
|
||||
isDone = false;
|
||||
isLoading = false;
|
||||
isloadError = false;
|
||||
|
||||
mHotCommentList = new ArrayList<>();
|
||||
mNormalCommentList = new ArrayList<>();
|
||||
|
||||
mConcernEntity = (ConcernEntity) AppController.get("ConcernEntity", true);
|
||||
|
||||
addHotComment(0);
|
||||
}
|
||||
|
||||
private void addHotComment(int offset) {
|
||||
|
||||
String hotCommentUrl = Config.COMMENT_HOST + "article/" + mConcernEntity.getId() +
|
||||
"/comment?order=hot&limit=" + 10 + "&offset=" + offset;
|
||||
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(hotCommentUrl,
|
||||
new Response.Listener<JSONArray>() {
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
Type listType = new TypeToken<ArrayList<CommentEntity>>() {}.getType();
|
||||
Gson gson = new Gson();
|
||||
List<CommentEntity> list = gson.fromJson(response.toString(), listType);
|
||||
|
||||
if (list.size() != 0) {
|
||||
mHotCommentList.addAll(list);
|
||||
// notifyItemRangeInserted(1, mHotCommentList.size() + 1);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
addNormalComment(mNormalCommentList.size());
|
||||
}
|
||||
},
|
||||
new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
addNormalComment(mNormalCommentList.size());
|
||||
}
|
||||
});
|
||||
|
||||
AppController.addToRequestQueue(request, GameNewsActivity.TAG);
|
||||
}
|
||||
public void addNormalComment(int offset) {
|
||||
|
||||
isLoading = true;
|
||||
String commentUrl = Config.COMMENT_HOST + "article/" + mConcernEntity.getId() +
|
||||
"/comment?limit=" + 10 + "&offset=" + offset;
|
||||
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest( commentUrl,
|
||||
new Response.Listener<JSONArray>() {
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
Type listType = new TypeToken<ArrayList<CommentEntity>>() {}.getType();
|
||||
Gson gson = new Gson();
|
||||
List<CommentEntity> list = gson.fromJson(response.toString(), listType);
|
||||
|
||||
if (list.size() < 10) {
|
||||
isDone = true;
|
||||
listener.loadDone();
|
||||
}
|
||||
|
||||
if (list.size() != 0) {
|
||||
mNormalCommentList.addAll(list);
|
||||
}
|
||||
|
||||
isLoading = false;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
},
|
||||
new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
isDone = true;
|
||||
isLoading = false;
|
||||
isloadError = true;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
|
||||
AppController.addToRequestQueue(request, GameNewsActivity.TAG);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
int index;
|
||||
if (mHotCommentList.size() == 0) {
|
||||
index = 1;
|
||||
} else {
|
||||
index = 2;
|
||||
}
|
||||
|
||||
if (position == 0 && mConcernEntity != null) {
|
||||
return ITEM_TOP;
|
||||
} else if (mHotCommentList.size() != 0 && position == 1 ||
|
||||
mNormalCommentList.size() != 0 && mHotCommentList.size() + index == position ) {
|
||||
return ITEM_TITLE;
|
||||
} else if (getItemCount() == position + 1) {
|
||||
return ITEM_FOOTER;
|
||||
}
|
||||
return ITEM_COMMENT;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view;
|
||||
switch (viewType) {
|
||||
case ITEM_TOP:
|
||||
view = LayoutInflater.from(mContext).inflate(R.layout.concern_rv_item, parent, false);
|
||||
return new NewsConcernViewHolder(view);
|
||||
case ITEM_TITLE:
|
||||
view = LayoutInflater.from(mContext).inflate(R.layout.comment_head_item, parent, false);
|
||||
return new CommentHeadViewHolder(view);
|
||||
case ITEM_COMMENT:
|
||||
view = LayoutInflater.from(mContext).inflate(R.layout.comment_item, parent, false);
|
||||
return new CommentViewHolder(view);
|
||||
case ITEM_FOOTER:
|
||||
view = LayoutInflater.from(mContext).inflate(R.layout.refresh_footerview, parent, false);
|
||||
return new FooterViewHolder(view);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
|
||||
|
||||
if (holder instanceof NewsConcernViewHolder) {
|
||||
initConcernViewHolder((NewsConcernViewHolder) holder);
|
||||
} else if (holder instanceof CommentHeadViewHolder) {
|
||||
if (mHotCommentList.size() != 0 && position == 1) {
|
||||
((CommentHeadViewHolder) holder).commentHeadTitleTv.setText("热门评论");
|
||||
} else {
|
||||
((CommentHeadViewHolder) holder).commentHeadTitleTv.setText("最新评论");
|
||||
}
|
||||
} else if (holder instanceof CommentViewHolder) {
|
||||
|
||||
int index;
|
||||
if (mHotCommentList.size() == 0) {
|
||||
index = 2;
|
||||
} else {
|
||||
index = 3;
|
||||
}
|
||||
int commentPosition = 0;
|
||||
boolean isHotComment = false;
|
||||
CommentEntity commentEntity = null;
|
||||
if (mHotCommentList.size() != 0 && mHotCommentList.size() >= position -2) {
|
||||
commentEntity = mHotCommentList.get(position -2);
|
||||
commentPosition = position - 2;
|
||||
isHotComment = true;
|
||||
} else if (mNormalCommentList.size() != 0 &&
|
||||
mNormalCommentList.size() >= position - mHotCommentList.size() - index) {
|
||||
commentPosition = position - mHotCommentList.size() - index;
|
||||
commentEntity = mNormalCommentList.get(position - mHotCommentList.size() - index);
|
||||
isHotComment = false;
|
||||
}
|
||||
|
||||
initCommentViewHolder((CommentViewHolder) holder, commentEntity, commentPosition, isHotComment);
|
||||
} else if (holder instanceof FooterViewHolder) {
|
||||
FooterViewHolder viewHolder = (FooterViewHolder) holder;
|
||||
initFooterViewHolder(viewHolder);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
int itemCount = 0;
|
||||
if (mHotCommentList.size() != 0) {
|
||||
itemCount = itemCount + mHotCommentList.size() + 1;
|
||||
}
|
||||
if (mNormalCommentList.size() != 0) {
|
||||
itemCount = itemCount + mNormalCommentList.size() + 1;
|
||||
}
|
||||
if (mConcernEntity != null) {
|
||||
itemCount = itemCount + 1;
|
||||
}
|
||||
|
||||
return itemCount + 1;
|
||||
}
|
||||
private void initFooterViewHolder(final FooterViewHolder viewHolder) {
|
||||
if (!isDone) {
|
||||
viewHolder.footerview_tv_loading.setText("加载中...");
|
||||
viewHolder.footerview_progressbar.setVisibility(View.VISIBLE);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
viewHolder.footerview_item.setLayoutParams(params);
|
||||
} else if (isloadError || mNormalCommentList.size() == 0 && mHotCommentList.size() == 0) {
|
||||
viewHolder.footerview_progressbar.setVisibility(View.GONE);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, DisplayUtils.dip2px(mContext, 185));
|
||||
if (isloadError) {
|
||||
viewHolder.footerview_tv_loading.setText("网络错误,点击重试!");
|
||||
} else {
|
||||
viewHolder.footerview_item.setLayoutParams(params);
|
||||
viewHolder.footerview_tv_loading.setText("目前还没有评论");
|
||||
}
|
||||
} else{
|
||||
viewHolder.footerview_tv_loading.setText("没有更多评论啦..");
|
||||
viewHolder.footerview_progressbar.setVisibility(View.GONE);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
viewHolder.footerview_item.setLayoutParams(params);
|
||||
}
|
||||
|
||||
viewHolder.footerview_item.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (isloadError) {
|
||||
viewHolder.footerview_progressbar.setVisibility(View.VISIBLE);
|
||||
viewHolder.footerview_tv_loading.setText("加载中...");
|
||||
addHotComment(0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initConcernViewHolder(NewsConcernViewHolder viewHolder) {
|
||||
((CardLinearLayout) viewHolder.itemView).setmTop(DisplayUtils.dip2px(mContext, 8));
|
||||
((CardLinearLayout) viewHolder.itemView).setmBottom(0);
|
||||
|
||||
if (mConcernEntity.getMessageDetailViews() != 0) {
|
||||
viewHolder.concernRead.setText("阅读 " +mConcernEntity.getMessageDetailViews() );
|
||||
}
|
||||
|
||||
if (mConcernEntity.getLink() != null) {
|
||||
viewHolder.concernLinkIcon.setImageResource(R.drawable.link_iv);
|
||||
} else {
|
||||
viewHolder.concernLinkIcon.setImageResource(R.drawable.concern_message_icon);
|
||||
}
|
||||
|
||||
if (mConcernEntity.getBrief() != null) {
|
||||
viewHolder.concernContent.setText(Html.fromHtml(mConcernEntity.getBrief()));
|
||||
viewHolder.concernContent.setMaxLines(100);
|
||||
} else {
|
||||
viewHolder.concernContent.setText(Html.fromHtml(mConcernEntity.getContent()));
|
||||
viewHolder.concernContent.setMaxLines(5);
|
||||
}
|
||||
|
||||
if (mConcernEntity.getImg().size() == 0) {
|
||||
viewHolder.contentPicLl.setVisibility(View.GONE);
|
||||
viewHolder.contentPicLl.removeAllViews();
|
||||
} else {
|
||||
viewHolder.contentPicLl.setVisibility(View.VISIBLE);
|
||||
viewHolder.contentPicLl.removeAllViews();
|
||||
ConcernContentUtils.addContentPic(mContext.getResources().getDisplayMetrics().widthPixels
|
||||
- DisplayUtils.dip2px(mContext, 34), viewHolder.contentPicLl, mConcernEntity.getImg(), mContext);
|
||||
}
|
||||
|
||||
viewHolder.concernThumb.setImageURI(mConcernEntity.getGameIcon());
|
||||
viewHolder.concernTitle.setText(mConcernEntity.getGameName());
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd", Locale.getDefault());
|
||||
|
||||
try {
|
||||
long today = format.parse(format.format(new Date())).getTime();
|
||||
long day = Long.valueOf(mConcernEntity.getTime() + "000");
|
||||
if (day >= today && day < today + 86400 * 1000) {
|
||||
format.applyPattern("HH:mm");
|
||||
viewHolder.concerntTime.setText("今天 " + format.format(day));
|
||||
} else if (day >= today - 86400 * 1000 && day < today) {
|
||||
format.applyPattern("HH:mm");
|
||||
viewHolder.concerntTime.setText("昨天 " + format.format(day));
|
||||
} else {
|
||||
format.applyPattern("yyyy年MM月dd日 HH:mm");
|
||||
viewHolder.concerntTime.setText(format.format(day));
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
format.applyPattern("yyyy年MM月dd日 HH:mm");
|
||||
viewHolder.concerntTime.setText(format.format(Long.valueOf(mConcernEntity.getTime() + "000")));
|
||||
}
|
||||
|
||||
viewHolder.concernShareIv.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mConcernEntity.getImg() != null && mConcernEntity.getImg().size() > 0) {
|
||||
Intent intent = new Intent(mContext, ShareCardPicActivity.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("gameName", mConcernEntity.getGameName());
|
||||
bundle.putString("gameIconUrl", mConcernEntity.getGameIcon());
|
||||
bundle.putString("shareContent", mConcernEntity.getContent());
|
||||
bundle.putStringArrayList("shareArrImg", (ArrayList<String>) mConcernEntity.getImg());
|
||||
intent.putExtras(bundle);
|
||||
mContext.startActivity(intent);
|
||||
} else {
|
||||
Intent intent = new Intent(mContext, ShareCardActivity.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("gameName", mConcernEntity.getGameName());
|
||||
bundle.putString("gameIconUrl", mConcernEntity.getGameIcon());
|
||||
bundle.putString("shareContent", mConcernEntity.getContent());
|
||||
intent.putExtras(bundle);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Map<String, Object> kv = new HashMap<>();
|
||||
kv.put("名字", mConcernEntity.getTitle());
|
||||
// kv.put("位置", String.valueOf(viewHolder.getPosition() + 1));
|
||||
DataUtils.onEvent(mContext, "点击", "消息详情", kv);
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// map.put("location", "列表");
|
||||
map.put("page", "消息详情");
|
||||
map.put("news", mConcernEntity.getTitle());
|
||||
map.put("news_id", mConcernEntity.getId());
|
||||
DataCollectionManager.onEvent(mContext, "click-item", map);
|
||||
|
||||
//统计阅读量
|
||||
statNewsViews(mConcernEntity.getId());
|
||||
|
||||
if (mConcernEntity.getLink() != null){
|
||||
Intent intent = new Intent(mContext, WebActivity.class);
|
||||
intent.putExtra("url",
|
||||
mConcernEntity.getLink());
|
||||
intent.putExtra("gameName", mConcernEntity.getGameName());
|
||||
mContext.startActivity(intent);
|
||||
}else {
|
||||
Intent intent = new Intent(mContext, NewsDetailActivity.class);
|
||||
intent.putExtra("newsId", mConcernEntity.getId());
|
||||
intent.putExtra("entrance", "(消息详情)");
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
EventBus.getDefault().post(new EBReuse("statNewsViews"));
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initCommentViewHolder(final CommentViewHolder holder, final CommentEntity commentEntity, final int position, final boolean isHotComment) {
|
||||
holder.commentContentTv.setText(commentEntity.getContent());
|
||||
if (commentEntity.getVote() == 0) {
|
||||
holder.commentLikeCountTv.setVisibility(View.GONE);
|
||||
} else {
|
||||
for (VoteInfo voteInfo : mVoteList) {
|
||||
if (voteInfo.getCommentId().equals(commentEntity.getId())) {
|
||||
holder.commentLikeCountTv.setTextColor(mContext.getResources().getColor(R.color.theme));
|
||||
holder.commentLikeIv.setImageResource(R.drawable.comment_like_select);
|
||||
break;
|
||||
} else {
|
||||
holder.commentLikeCountTv.setTextColor(mContext.getResources().getColor(R.color.hint));
|
||||
holder.commentLikeIv.setImageResource(R.drawable.comment_like_unselect);
|
||||
}
|
||||
}
|
||||
holder.commentLikeCountTv.setVisibility(View.VISIBLE);
|
||||
holder.commentLikeCountTv.setText(commentEntity.getVote() + "");
|
||||
}
|
||||
|
||||
holder.commentUserNameTv.setText(commentEntity.getUser().getName());
|
||||
holder.commentUserIconDv.setImageURI(commentEntity.getUser().getIcon());
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd", Locale.getDefault());
|
||||
try {
|
||||
long today = format.parse(format.format(new Date())).getTime();
|
||||
long day = Long.valueOf(commentEntity.getTime() + "000");
|
||||
if (day >= today && day < today + 86400 * 1000) {
|
||||
long min = new Date().getTime()/1000 - day/1000;
|
||||
int hour = (int) (min/ (60 * 60));
|
||||
if (hour == 0) {
|
||||
if (min < 60) {
|
||||
holder.commentTimeTv.setText("刚刚");
|
||||
} else {
|
||||
holder.commentTimeTv.setText((int)(min/60) + "分钟前");
|
||||
}
|
||||
} else {
|
||||
holder.commentTimeTv.setText(hour + "小时前");
|
||||
}
|
||||
} else if (day >= today - 86400 * 1000 && day < today) {
|
||||
format.applyPattern("HH:mm");
|
||||
holder.commentTimeTv.setText("昨天 ");
|
||||
} else {
|
||||
format.applyPattern("yyyy-MM-dd");
|
||||
holder.commentTimeTv.setText(format.format(day));
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
format.applyPattern("yyyy-MM-dd");
|
||||
holder.commentTimeTv.setText(format.format(Long.valueOf(mConcernEntity.getTime() + "000")));
|
||||
}
|
||||
|
||||
holder.commentLikeIv.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (holder.commentLikeCountTv.getCurrentTextColor() == mContext.getResources().getColor(R.color.theme)) {
|
||||
Utils.toast(mContext, "已经点过赞啦!");
|
||||
return;
|
||||
}
|
||||
PostCommentUtils.addCommentVoto(commentEntity.getId(), mContext, null);
|
||||
holder.commentLikeCountTv.setTextColor(mContext.getResources().getColor(R.color.theme));
|
||||
holder.commentLikeIv.setImageResource(R.drawable.comment_like_select);
|
||||
holder.commentLikeCountTv.setText((commentEntity.getVote() +1) + "");
|
||||
holder.commentLikeCountTv.setVisibility(View.VISIBLE);
|
||||
|
||||
mVoteDao.add(new VoteInfo(commentEntity.getId()));
|
||||
|
||||
int index = (position/10) * 10;
|
||||
|
||||
String cacheUrl;
|
||||
if (isHotComment) {
|
||||
cacheUrl = Config.COMMENT_HOST + "article/" + mConcernEntity.getId() +
|
||||
"/comment?order=hot&limit=" + 10 + "&offset=" + index;
|
||||
} else {
|
||||
cacheUrl = Config.COMMENT_HOST + "article/" + mConcernEntity.getId() +
|
||||
"/comment?limit=" + 10 + "&offset=" + index;
|
||||
}
|
||||
|
||||
modifyVolleyCache(commentEntity.getId(), cacheUrl);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void statNewsViews(final String news_id) {
|
||||
String url = Config.DATA_HOST + "news/stat?news_id=" + news_id;
|
||||
JsonObjectExtendedRequest request = new JsonObjectExtendedRequest(
|
||||
Request.Method.POST, url,
|
||||
new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
try {
|
||||
if ("success".equals(response.getString("status"))) {
|
||||
|
||||
mConcernEntity.setMessageDetailViews(mConcernEntity.getMessageDetailViews() +1);
|
||||
notifyItemChanged(0);
|
||||
|
||||
//TODO 修改关注资讯volley缓存
|
||||
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}, null);
|
||||
request.setShouldCache(false);
|
||||
AppController.addToRequestQueue(request, News1Fragment.TAG);
|
||||
}
|
||||
|
||||
private static final String DEFAULT_CACHE_DIR = "volley";
|
||||
|
||||
private void modifyVolleyCache(String id, String url) {
|
||||
if (url == null) {
|
||||
return;
|
||||
}
|
||||
File cacheDir = new File(mContext.getCacheDir(), DEFAULT_CACHE_DIR);
|
||||
DiskBasedCache cache = new DiskBasedCache(cacheDir);
|
||||
byte[] data = cache.getData(url);
|
||||
if (data != null) {
|
||||
try {
|
||||
JSONArray jsonArray = new JSONArray(new String(GzipUtils.decompressBytes(data)));
|
||||
Log.e("modifyVolleyCache11111", jsonArray.toString());
|
||||
JSONObject jsonObject;
|
||||
for (int i = 0, size = jsonArray.length(); i < size; i++) {
|
||||
jsonObject = jsonArray.getJSONObject(i);
|
||||
if (jsonObject.getString("_id").equals(id)) {
|
||||
jsonObject.put("vote", jsonObject.getInt("vote") + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Utils.log(jsonArray.toString());
|
||||
Log.e("modifyVolleyCache2222", jsonArray.toString());
|
||||
cache.modify(url, GzipUtils.compressBytes(jsonArray.toString().getBytes()));
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
Utils.log("modifyVolleyCache is null");
|
||||
}
|
||||
}
|
||||
|
||||
public String getNewsId (){
|
||||
return mConcernEntity.getId();
|
||||
}
|
||||
public boolean isLoading() {
|
||||
return isLoading;
|
||||
}
|
||||
public List<CommentEntity> getNormalCommentList (){
|
||||
return mNormalCommentList;
|
||||
}
|
||||
|
||||
public int getHotCommentListSize (){
|
||||
int index = 0;
|
||||
if (mHotCommentList.size() != 0) {
|
||||
index = mHotCommentList.size() + 1;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.gh.gamecenter.adapter.viewholder;
|
||||
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.gh.gamecenter.R;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
/**
|
||||
* Created by khy on 2016/11/9.
|
||||
*/
|
||||
public class CommentHeadViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
@BindView(R.id.comment_head_line)
|
||||
public View commentHeadLine;
|
||||
@BindView(R.id.comment_head_title)
|
||||
public TextView commentHeadTitleTv;
|
||||
|
||||
public CommentHeadViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
ButterKnife.bind(this, itemView);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.gh.gamecenter.adapter.viewholder;
|
||||
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.facebook.drawee.view.SimpleDraweeView;
|
||||
import com.gh.gamecenter.R;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
/**
|
||||
* Created by khy on 2016/11/9.
|
||||
*/
|
||||
public class CommentViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
@BindView(R.id.comment_line)
|
||||
public View commentLine;
|
||||
@BindView(R.id.comment_content)
|
||||
public TextView commentContentTv;
|
||||
@BindView(R.id.comment_like)
|
||||
public ImageView commentLikeIv;
|
||||
@BindView(R.id.comment_like_count)
|
||||
public TextView commentLikeCountTv;
|
||||
@BindView(R.id.comment_time)
|
||||
public TextView commentTimeTv;
|
||||
@BindView(R.id.comment_user_icon)
|
||||
public SimpleDraweeView commentUserIconDv;
|
||||
@BindView(R.id.comment_user_name)
|
||||
public TextView commentUserNameTv;
|
||||
|
||||
public CommentViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
ButterKnife.bind(this, itemView);
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,7 @@ package com.gh.gamecenter.adapter.viewholder;
|
||||
import android.support.v4.widget.ContentLoadingProgressBar;
|
||||
import android.support.v7.widget.RecyclerView.ViewHolder;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.gh.gamecenter.R;
|
||||
@ -18,6 +19,7 @@ import com.gh.gamecenter.R;
|
||||
public class FooterViewHolder extends ViewHolder {
|
||||
|
||||
public ContentLoadingProgressBar footerview_progressbar;
|
||||
public LinearLayout footerview_item;
|
||||
public TextView footerview_tv_loading;
|
||||
public View footerview_line1;
|
||||
public View footerview_line2;
|
||||
@ -29,6 +31,7 @@ public class FooterViewHolder extends ViewHolder {
|
||||
footerview_tv_loading = (TextView) view.findViewById(R.id.footerview_tv_loading);
|
||||
footerview_line1 = view.findViewById(R.id.footerview_line1);
|
||||
footerview_line2 = view.findViewById(R.id.footerview_line2);
|
||||
footerview_item = (LinearLayout) view.findViewById(R.id.footerview_item);
|
||||
}
|
||||
|
||||
}
|
||||
@ -10,6 +10,7 @@ import com.gh.gamecenter.db.info.DataCollectionInfo;
|
||||
import com.gh.gamecenter.db.info.FilterInfo;
|
||||
import com.gh.gamecenter.db.info.GameInfo;
|
||||
import com.gh.gamecenter.db.info.SearchHistoryInfo;
|
||||
import com.gh.gamecenter.db.info.VoteInfo;
|
||||
import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
|
||||
import com.j256.ormlite.dao.Dao;
|
||||
import com.j256.ormlite.support.ConnectionSource;
|
||||
@ -20,7 +21,7 @@ import java.sql.SQLException;
|
||||
public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||
|
||||
private static final String DATABASE_NAME = "gh_assist.db";
|
||||
private static final int DATABASE_VERSION = 2;
|
||||
private static final int DATABASE_VERSION = 3;
|
||||
|
||||
private static DatabaseHelper instance;
|
||||
private ArrayMap<String, Dao> daos = new ArrayMap<String, Dao>();
|
||||
@ -58,6 +59,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||
TableUtils.createTable(connectionSource, GameInfo.class);
|
||||
TableUtils.createTable(connectionSource, FilterInfo.class);
|
||||
TableUtils.createTable(connectionSource, DataCollectionInfo.class);
|
||||
TableUtils.createTable(connectionSource, VoteInfo.class);
|
||||
} catch (SQLException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
@ -75,6 +77,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||
TableUtils.dropTable(connectionSource, GameInfo.class, true);
|
||||
TableUtils.dropTable(connectionSource, FilterInfo.class, true);
|
||||
TableUtils.dropTable(connectionSource, DataCollectionInfo.class, true);
|
||||
TableUtils.dropTable(connectionSource, VoteInfo.class, true);
|
||||
onCreate(database, connectionSource);
|
||||
} catch (SQLException e) {
|
||||
|
||||
|
||||
45
app/src/main/java/com/gh/gamecenter/db/VoteDao.java
Normal file
45
app/src/main/java/com/gh/gamecenter/db/VoteDao.java
Normal file
@ -0,0 +1,45 @@
|
||||
package com.gh.gamecenter.db;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.gh.gamecenter.db.info.VoteInfo;
|
||||
import com.j256.ormlite.dao.Dao;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by khy on 2016/11/11.
|
||||
*/
|
||||
|
||||
public class VoteDao {
|
||||
private DatabaseHelper helper;
|
||||
private Dao<VoteInfo, String> dao;
|
||||
|
||||
public VoteDao(Context context) {
|
||||
try {
|
||||
helper = DatabaseHelper.getHelper(context);
|
||||
dao = helper.getDao(VoteInfo.class);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void add(VoteInfo vote) {
|
||||
try {
|
||||
dao.create(vote);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public List<VoteInfo> getAll() {
|
||||
try {
|
||||
return dao.queryForAll();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
36
app/src/main/java/com/gh/gamecenter/db/info/VoteInfo.java
Normal file
36
app/src/main/java/com/gh/gamecenter/db/info/VoteInfo.java
Normal file
@ -0,0 +1,36 @@
|
||||
package com.gh.gamecenter.db.info;
|
||||
|
||||
import com.j256.ormlite.field.DatabaseField;
|
||||
import com.j256.ormlite.table.DatabaseTable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by khy on 2016/11/11.
|
||||
*/
|
||||
|
||||
@DatabaseTable(tableName = "tb_vote")
|
||||
public class VoteInfo implements Serializable {
|
||||
|
||||
@DatabaseField(id = true, columnName = "commentId")
|
||||
private String commentId;
|
||||
|
||||
public String getCommentId() {
|
||||
return commentId;
|
||||
}
|
||||
|
||||
public void setCommentId(String commentId) {
|
||||
this.commentId = commentId;
|
||||
}
|
||||
|
||||
public VoteInfo(String commentId) {
|
||||
this.commentId = commentId;
|
||||
}
|
||||
|
||||
public VoteInfo() {}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VoteEntity [commentId=" + commentId + "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package com.gh.gamecenter.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Created by khy on 2016/11/8.
|
||||
*/
|
||||
public class CommentEntity {
|
||||
|
||||
@SerializedName("_id")
|
||||
private String Id;
|
||||
|
||||
private UserEntity user;
|
||||
|
||||
private String content;
|
||||
|
||||
private int vote;
|
||||
|
||||
private long time;
|
||||
|
||||
public String getId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public UserEntity getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(UserEntity user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public int getVote() {
|
||||
return vote;
|
||||
}
|
||||
|
||||
public void setVote(int vote) {
|
||||
this.vote = vote;
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(long time) {
|
||||
this.time = time;
|
||||
}
|
||||
}
|
||||
@ -20,6 +20,14 @@ public class ConcernEntity {
|
||||
private List<String> img;
|
||||
private String link;
|
||||
private String brief;
|
||||
private int messageDetailViews;
|
||||
|
||||
public int getMessageDetailViews() {
|
||||
return messageDetailViews;
|
||||
}
|
||||
public void setMessageDetailViews(int messageDetailViews) {
|
||||
this.messageDetailViews = messageDetailViews;
|
||||
}
|
||||
|
||||
public String getBrief() {
|
||||
return brief;
|
||||
|
||||
37
app/src/main/java/com/gh/gamecenter/entity/UserEntity.java
Normal file
37
app/src/main/java/com/gh/gamecenter/entity/UserEntity.java
Normal file
@ -0,0 +1,37 @@
|
||||
package com.gh.gamecenter.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Created by khy on 2016/11/8.
|
||||
*/
|
||||
public class UserEntity {
|
||||
|
||||
@SerializedName("_id")
|
||||
private String Id;
|
||||
|
||||
private String icon;
|
||||
|
||||
private String name;
|
||||
|
||||
public void setId(String Id) {
|
||||
this.Id = Id;
|
||||
}
|
||||
public String getId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@ -2,13 +2,13 @@ package com.gh.gamecenter.news;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.util.ArrayMap;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.Html;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.volley.NoConnectionError;
|
||||
@ -17,23 +17,23 @@ import com.android.volley.Response;
|
||||
import com.android.volley.TimeoutError;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.DiskBasedCache;
|
||||
import com.facebook.drawee.drawable.ScalingUtils;
|
||||
import com.facebook.drawee.view.SimpleDraweeView;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.ItemViewType;
|
||||
import com.gh.common.util.ConcernContentUtils;
|
||||
import com.gh.common.util.ConcernUtils;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.GzipUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.MD5Utils;
|
||||
import com.gh.common.util.NewsUtils;
|
||||
import com.gh.common.util.TokenUtils;
|
||||
import com.gh.common.util.Utils;
|
||||
import com.gh.common.view.CardLinearLayout;
|
||||
import com.gh.gamecenter.NewsDetailActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.ViewImageActivity;
|
||||
import com.gh.gamecenter.ShareCardActivity;
|
||||
import com.gh.gamecenter.ShareCardPicActivity;
|
||||
import com.gh.gamecenter.WebActivity;
|
||||
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
|
||||
import com.gh.gamecenter.db.info.ConcernInfo;
|
||||
@ -505,8 +505,8 @@ public class News1FragmentAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||
} else {
|
||||
viewHolder.contentPicLl.setVisibility(View.VISIBLE);
|
||||
viewHolder.contentPicLl.removeAllViews();
|
||||
addContentPic(context.getResources().getDisplayMetrics().widthPixels
|
||||
- DisplayUtils.dip2px(context, 34), viewHolder.contentPicLl, concernEntity.getImg());
|
||||
ConcernContentUtils.addContentPic(context.getResources().getDisplayMetrics().widthPixels
|
||||
- DisplayUtils.dip2px(context, 34), viewHolder.contentPicLl, concernEntity.getImg(), context);
|
||||
}
|
||||
|
||||
viewHolder.concernThumb.setImageURI(concernEntity.getGameIcon());
|
||||
@ -540,6 +540,40 @@ public class News1FragmentAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||
viewHolder.concernRead.setText("阅读 " + views);
|
||||
}
|
||||
|
||||
viewHolder.concernShareIv.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (concernEntity.getImg() != null && concernEntity.getImg().size() > 0) {
|
||||
Intent intent = new Intent(context, ShareCardPicActivity.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("gameName", concernEntity.getGameName());
|
||||
bundle.putString("gameIconUrl", concernEntity.getGameIcon());
|
||||
bundle.putString("shareContent", concernEntity.getContent());
|
||||
bundle.putStringArrayList("shareArrImg", (ArrayList<String>) concernEntity.getImg());
|
||||
intent.putExtras(bundle);
|
||||
context.startActivity(intent);
|
||||
} else {
|
||||
Intent intent = new Intent(context, ShareCardActivity.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("gameName", concernEntity.getGameName());
|
||||
bundle.putString("gameIconUrl", concernEntity.getGameIcon());
|
||||
bundle.putString("shareContent", concernEntity.getContent());
|
||||
intent.putExtras(bundle);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
viewHolder.concernCommentIv.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (viewsMap.size() != 0) {
|
||||
concernEntity.setMessageDetailViews(viewsMap.get(concernEntity.getId()));
|
||||
}
|
||||
NewsUtils.startMessageActivity(context, concernEntity, "资讯-关注");
|
||||
}
|
||||
});
|
||||
|
||||
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -603,80 +637,4 @@ public class News1FragmentAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||
return isLoading;
|
||||
}
|
||||
|
||||
private void addContentPic(int width, LinearLayout linearLayout, List<String> list) {
|
||||
int count = list.size();
|
||||
LinearLayout ll;
|
||||
int index = 0;
|
||||
for (int i = 0, size = (int) Math.ceil(list.size() / 3.0f); i < size; i++) {
|
||||
switch (count % 3) {
|
||||
case 0:
|
||||
ll = new LinearLayout(context);
|
||||
ll.setOrientation(LinearLayout.HORIZONTAL);
|
||||
for (int j = 0; j < 3; j++) {
|
||||
ll.addView(getImageView(list, index, width, 0));
|
||||
index += 1;
|
||||
}
|
||||
linearLayout.addView(ll);
|
||||
count -= 3;
|
||||
break;
|
||||
case 1:
|
||||
linearLayout.addView(getImageView(list, index, width, 1));
|
||||
count -= 1;
|
||||
index += 1;
|
||||
break;
|
||||
case 2:
|
||||
ll = new LinearLayout(context);
|
||||
ll.setOrientation(LinearLayout.HORIZONTAL);
|
||||
for (int j = 0; j < 2; j++) {
|
||||
ll.addView(getImageView(list, index, width, 2));
|
||||
index += 1;
|
||||
}
|
||||
linearLayout.addView(ll);
|
||||
count -= 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleDraweeView getImageView(final List<String> list, final int position, int width, int type) {
|
||||
SimpleDraweeView imageView;
|
||||
if (type == 0) {
|
||||
imageView = new SimpleDraweeView(context);
|
||||
LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams(
|
||||
0, width / 3 - DisplayUtils.dip2px(context, 4));
|
||||
lparams.setMargins(DisplayUtils.dip2px(context, 2), 0,
|
||||
DisplayUtils.dip2px(context, 2), DisplayUtils.dip2px(context, 4));
|
||||
lparams.weight = 1;
|
||||
imageView.setLayoutParams(lparams);
|
||||
ImageUtils.getInstance(context).display(list.get(position), imageView, ScalingUtils.ScaleType.CENTER_CROP, context);
|
||||
} else if (type == 1) {
|
||||
imageView = new SimpleDraweeView(context);
|
||||
LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams(width, width / 2);
|
||||
lparams.setMargins(DisplayUtils.dip2px(context, 2), 0,
|
||||
DisplayUtils.dip2px(context, 2), DisplayUtils.dip2px(context, 4));
|
||||
imageView.setLayoutParams(lparams);
|
||||
ImageUtils.getInstance(context).display(list.get(position), imageView, ScalingUtils.ScaleType.CENTER_CROP, context);
|
||||
} else {
|
||||
imageView = new SimpleDraweeView(context);
|
||||
LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams(
|
||||
0, width / 2 - DisplayUtils.dip2px(context, 4));
|
||||
lparams.setMargins(DisplayUtils.dip2px(context, 2), 0,
|
||||
DisplayUtils.dip2px(context, 2), DisplayUtils.dip2px(context, 4));
|
||||
lparams.weight = 1;
|
||||
imageView.setLayoutParams(lparams);
|
||||
ImageUtils.getInstance(context).display(list.get(position), imageView, ScalingUtils.ScaleType.CENTER_CROP, context);
|
||||
}
|
||||
imageView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent checkIntent = new Intent(context, ViewImageActivity.class);
|
||||
checkIntent.putExtra("urls", (ArrayList<String>) list);
|
||||
checkIntent.putExtra("current", position);
|
||||
checkIntent.putExtra("ScaleType", "FIT_CENTER");
|
||||
context.startActivity(checkIntent);
|
||||
}
|
||||
});
|
||||
return imageView;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -20,6 +20,9 @@ public class NewsConcernViewHolder extends RecyclerView.ViewHolder {
|
||||
public TextView concerntTime;
|
||||
public TextView concernContent;
|
||||
public TextView concernRead;
|
||||
public TextView concernCommentCountTv;
|
||||
public ImageView concernShareIv;
|
||||
public ImageView concernCommentIv;
|
||||
public ImageView concernLinkIcon;
|
||||
|
||||
public NewsConcernViewHolder(View itemView) {
|
||||
@ -32,6 +35,9 @@ public class NewsConcernViewHolder extends RecyclerView.ViewHolder {
|
||||
concernTitle = (TextView) itemView.findViewById(R.id.concern_rv_item_title);
|
||||
contentPicLl = (LinearLayout) itemView.findViewById(R.id.concern_rv_item_iv_ll);
|
||||
concernLinkIcon = (ImageView) itemView.findViewById(R.id.conern_link_icon);
|
||||
concernCommentCountTv = (TextView) itemView.findViewById(R.id.concern_comment_count);
|
||||
concernCommentIv = (ImageView) itemView.findViewById(R.id.concern_comment_icon);
|
||||
concernShareIv = (ImageView) itemView.findViewById(R.id.concern_share_icon);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BIN
app/src/main/res/drawable-hdpi/comment_icon.png
Normal file
BIN
app/src/main/res/drawable-hdpi/comment_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
BIN
app/src/main/res/drawable-hdpi/comment_like_select.png
Normal file
BIN
app/src/main/res/drawable-hdpi/comment_like_select.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 598 B |
BIN
app/src/main/res/drawable-hdpi/comment_like_unselect.png
Normal file
BIN
app/src/main/res/drawable-hdpi/comment_like_unselect.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 598 B |
Binary file not shown.
|
Before Width: | Height: | Size: 683 B After Width: | Height: | Size: 1.6 KiB |
5
app/src/main/res/drawable/cursor_color.xml
Normal file
5
app/src/main/res/drawable/cursor_color.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<size android:width="2dp" />
|
||||
<solid android:color="@color/theme" />
|
||||
</shape>
|
||||
8
app/src/main/res/drawable/et_line.xml
Normal file
8
app/src/main/res/drawable/et_line.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle" >
|
||||
|
||||
<solid android:color="@color/theme" />
|
||||
|
||||
<size android:height="2dp" android:width="1000dp"></size>
|
||||
</shape>
|
||||
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@drawable/textview_blue_dn" android:state_pressed="true"/>
|
||||
<item android:drawable="@drawable/textview_blue_dn" android:state_focused="true"/>
|
||||
<item android:drawable="@drawable/textview_cancel_dn" android:state_enabled="false"/>
|
||||
<item android:drawable="@drawable/textview_blue_up" android:state_enabled="true"/>
|
||||
|
||||
</selector>
|
||||
108
app/src/main/res/layout/activity_message_detail.xml
Normal file
108
app/src/main/res/layout/activity_message_detail.xml
Normal file
@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:fresco="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<include
|
||||
layout="@layout/reuse_actionbar" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/message_detail_rv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@+id/message_detail_bottom"/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="7dp"
|
||||
android:background="@drawable/shadow"
|
||||
android:layout_above="@+id/message_detail_bottom"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/message_detail_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="#fff"
|
||||
android:paddingLeft="18dp"
|
||||
android:paddingRight="18dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message_detail_comment_hint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/hint"
|
||||
android:text="发表评论.."
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/message_detail_comment_rl"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone">
|
||||
<EditText
|
||||
android:id="@+id/message_detail_comment_et"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="75dp"
|
||||
android:lineSpacingExtra="5dp"
|
||||
android:textSize="15sp"
|
||||
android:textCursorDrawable="@drawable/cursor_color"
|
||||
android:drawableBottom="@drawable/et_line"/>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/message_detail_user_rl"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:paddingLeft="18dp"
|
||||
android:paddingRight="18dp"
|
||||
android:visibility="gone"
|
||||
android:layout_alignParentBottom="true">
|
||||
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
android:id="@+id/comment_user_icon"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginRight="17dp"
|
||||
fresco:roundAsCircle="true"
|
||||
android:layout_centerVertical="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_user_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_toRightOf="@+id/comment_user_icon"
|
||||
android:layout_toLeftOf="@+id/comment_send"
|
||||
android:textColor="@color/title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_send"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="28.5dp"
|
||||
android:clickable="true"
|
||||
android:background="@drawable/textview_comment_send_style"
|
||||
android:gravity="center"
|
||||
android:text="发送"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
37
app/src/main/res/layout/comment_head_item.xml
Normal file
37
app/src/main/res/layout/comment_head_item.xml
Normal file
@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.gh.common.view.CardLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/white"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
app:left="8dp"
|
||||
app:top="8dp"
|
||||
app:right="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_head_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@color/title"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/comment_head_line"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:visibility="gone"
|
||||
android:background="@color/cutting_line"/>
|
||||
|
||||
</com.gh.common.view.CardLinearLayout>
|
||||
91
app/src/main/res/layout/comment_item.xml
Normal file
91
app/src/main/res/layout/comment_item.xml
Normal file
@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.gh.common.view.CardLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:fresco="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/reuse_listview_item_style"
|
||||
app:left="8dp"
|
||||
app:right="8dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<View
|
||||
android:id="@+id/comment_line"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="#ededed"/>
|
||||
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
android:id="@+id/comment_user_icon"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="17dp"
|
||||
fresco:roundAsCircle="true"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/comment_username_and_time"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/comment_user_icon"
|
||||
android:layout_alignTop="@id/comment_user_icon"
|
||||
android:paddingRight="15dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_user_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:textColor="@color/title"
|
||||
android:layout_toLeftOf="@+id/comment_like_count"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_time"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/comment_user_name"
|
||||
android:textSize="11sp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textColor="#c7c7c7"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_like_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="11sp"
|
||||
android:layout_toLeftOf="@+id/comment_like"
|
||||
android:layout_alignBottom="@+id/comment_like"
|
||||
android:layout_marginRight="8dp"
|
||||
android:textColor="@color/hint"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/comment_like"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:src="@drawable/comment_like_unselect"
|
||||
android:layout_alignParentRight="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:textColor="@color/title"
|
||||
android:layout_below="@+id/comment_username_and_time"
|
||||
android:layout_toRightOf="@+id/comment_user_icon"
|
||||
android:layout_marginRight="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="20dp"/>
|
||||
</RelativeLayout>
|
||||
|
||||
</com.gh.common.view.CardLinearLayout>
|
||||
@ -9,7 +9,6 @@
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingTop="15dp"
|
||||
android:paddingBottom="15dp"
|
||||
app:left="8dp"
|
||||
app:bottom="8dp"
|
||||
app:right="8dp">
|
||||
@ -37,7 +36,6 @@
|
||||
android:id="@+id/concern_rv_item_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="少年三国志"
|
||||
android:textColor="@color/theme"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginBottom="5dp"/>
|
||||
@ -46,7 +44,6 @@
|
||||
android:id="@+id/concern_rv_item_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="09:56"
|
||||
android:textColor="@color/hint"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
@ -76,17 +73,44 @@
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp">
|
||||
android:gravity="center_vertical"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/concern_rv_item_read"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="阅读 1000"
|
||||
android:textColor="@color/hint"
|
||||
android:layout_centerVertical="true"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/concern_comment_icon"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:src="@drawable/comment_icon"
|
||||
android:layout_toRightOf="@+id/concern_rv_item_read"
|
||||
android:layout_marginLeft="45dp"
|
||||
android:layout_marginRight="6dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/concern_comment_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/hint"
|
||||
android:layout_toRightOf="@+id/concern_comment_icon" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/concern_share_icon"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:src="@drawable/share_icon_gray"
|
||||
android:layout_marginLeft="65dp"
|
||||
android:layout_toRightOf="@+id/concern_comment_icon"
|
||||
android:layout_marginRight="6dp"/>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/conern_link_icon"
|
||||
android:layout_width="16dp"
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/footerview_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
|
||||
Reference in New Issue
Block a user