调整评论,消息分享,关闭下载的游戏不要隐藏下载按钮

This commit is contained in:
khy
2016-11-16 12:08:26 +08:00
parent f28a54506e
commit 04cfbcb7e4
11 changed files with 119 additions and 43 deletions

View File

@ -357,7 +357,8 @@ public class DownloadItemUtils {
textView.setVisibility(View.VISIBLE);
game_progressbar.setVisibility(View.GONE);
game_ll_info.setVisibility(View.GONE);
downloadBtn.setVisibility(View.GONE);
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_pause_style);
downloadBtn.setText("暂无");
} else if (entity.getApk().size() == 1) {
updateNormalItem(context, textView, game_progressbar, game_ll_info, download_speed,
download_percentage, downloadBtn, entity, isShowPlatform);

View File

@ -1,7 +1,6 @@
package com.gh.common.util;
import android.content.Context;
import android.util.Log;
import com.android.volley.Request;
import com.android.volley.Response;
@ -18,7 +17,7 @@ public class PostCommentUtils {
new Thread(new Runnable() {
@Override
public void run() {
Utils.log("url::" + url, "/ content::" + content);
Utils.log("addCommentData--url::" + url, "/ content::" + content);
StringExtendedRequest request = new StringExtendedRequest(
Request.Method.POST, url, content,
new Response.Listener<String>() {
@ -55,7 +54,6 @@ public class PostCommentUtils {
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.e("======onResponse", "onResponse");
if (listener != null){
listener.postSucced(response.toString());
}
@ -64,7 +62,6 @@ public class PostCommentUtils {
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("======onErrorResponse", new String(error.networkResponse.data));
if (listener != null){
listener.postFailed(error);
}

View File

@ -225,6 +225,8 @@ public class MessageDetailActivity extends BaseActivity{
}
modifyNewsCommentVolleyCache(0, cacheObject, newsId);
mMessageDetailAdapter.notifyItemInserted(mMessageDetailAdapter.getHotCommentListSize() + 2);
//TODO 完成评论操作
}
@Override

View File

@ -24,7 +24,11 @@ import com.gh.common.util.MessageShareUtils;
import com.gh.gamecenter.manager.SystemBarTintManager;
import java.io.File;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
@ -65,7 +69,7 @@ public class ShareCardPicActivity extends BaseActivity {
gameName = extras.getString("gameName");
gameIconUrl = extras.getString("gameIconUrl");
shareContent = extras.getString("shareContent");
shareArrImg = extras.getStringArrayList("shareArrImg");
List<String> arrImg = extras.getStringArrayList("shareArrImg");
picName = "shareImgPic.jpg";
currentImgPosition = 0;
@ -75,18 +79,24 @@ public class ShareCardPicActivity extends BaseActivity {
ButterKnife.bind(this);
shareArrImg = new ArrayList<>();
mActionbar.setBackgroundColor(getResources().getColor(R.color.back));
SystemBarTintManager tintManager = getTintManager();
if (tintManager != null) {
tintManager.setStatusBarTintResource(R.color.back);
}
for (int i = 0; i < arrImg.size(); i++) {
checkUrl(arrImg.get(i), arrImg.size());
}
mShareGameNameTv.setText(gameName);
mShareContentTv.setText(Html.fromHtml(shareContent));
mShareGameIconDv.setImageURI(gameIconUrl);
mShareQrCodeDv.setImageURI("res:///" + R.drawable.test_qrcode);
if (shareArrImg.size() > 1) {
if (arrImg.size() > 1) {
mShareChangImageIcon.setImageResource(R.drawable.sharecard_chang_img);
mShareChangImageTv.setTextColor(Color.WHITE);
} else {
@ -94,8 +104,6 @@ public class ShareCardPicActivity extends BaseActivity {
mShareChangImageTv.setTextColor(getResources().getColor(R.color.hint));
}
setContentImage(shareArrImg.get(currentImgPosition));
currentImgPosition++;
}
private void setContentImage(String url){
@ -171,6 +179,58 @@ public class ShareCardPicActivity extends BaseActivity {
currentImgPosition ++;
}
private void checkUrl(final String url, final int size) {
new Thread() {
@Override
public void run() {
try {
String newUrl = "http://image.ghzhushou.com/pic/hq" + url.substring(url.lastIndexOf("/"));
HttpURLConnection connection = (HttpURLConnection) new URL(newUrl).openConnection();
connection.setRequestMethod("GET");
connection.setConnectTimeout(5 * 1000);
connection.setReadTimeout(5 * 1000);
connection.connect();
int code = connection.getResponseCode();
if (code == 200) {
addCount();
shareArrImg.add(newUrl);
if (count == size) {
ShareCardPicActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
setContentImage(shareArrImg.get(currentImgPosition));
currentImgPosition++;
}
});
}
} else {
addCount();
shareArrImg.add(url);
if (count == size) {
ShareCardPicActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
setContentImage(shareArrImg.get(currentImgPosition));
currentImgPosition++;
}
});
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}.start();
}
private int count;
private void addCount() {
synchronized (ShareCardPicActivity.class) {
count++;
}
}
public static Bitmap getBitmapByView(ScrollView scrollView) {
int h = 0;
Bitmap bitmap = null;

View File

@ -430,7 +430,7 @@ public class MessageDetailAdapter extends RecyclerView.Adapter<RecyclerView.View
if (commentEntity.getVote() == 0) {
holder.commentLikeCountTv.setVisibility(View.GONE);
} else { // 检查是否已点赞
if (mVoteDao.find(commentEntity.getId())) {
if (mVoteDao.find(commentEntity.getId()) && commentEntity.getVote() >= 1) {
holder.commentLikeCountTv.setTextColor(mContext.getResources().getColor(R.color.theme));
holder.commentLikeIv.setImageResource(R.drawable.comment_like_select);
} else {
@ -483,6 +483,7 @@ public class MessageDetailAdapter extends RecyclerView.Adapter<RecyclerView.View
Utils.toast(mContext, "已经点过赞啦!");
return;
}
PostCommentUtils.addCommentVoto(finalCommentEntity.getId(), mContext, null);
holder.commentLikeCountTv.setTextColor(mContext.getResources().getColor(R.color.theme));
holder.commentLikeIv.setImageResource(R.drawable.comment_like_select);

View File

@ -24,7 +24,7 @@ public class NewsDigestViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.news_digest_content) public TextView content;
@BindView(R.id.news_digest_ll_img) public LinearLayout imgLayout;
@BindView(R.id.news_digest_read) public TextView read;
@BindView(R.id.news_digest_comment) public ImageView comment;
@BindView(R.id.concern_comment_ll) public LinearLayout comment;
@BindView(R.id.news_digest_commentnum) public TextView commentnum;
@BindView(R.id.news_digest_share) public ImageView share;
@BindView(R.id.news_digest_link) public ImageView link;

View File

@ -177,7 +177,10 @@ public class SearchGameDetailFragmentAdapter extends RecyclerView.Adapter<GameNo
});
if (gameEntity.getApk() == null || gameEntity.getApk().isEmpty()
|| !Config.isShow(context) || "光环助手".equals(gameEntity.getName())) {
|| !Config.isShow(context)) {
viewHolder.downloadBtn.setBackgroundResource(R.drawable.game_item_btn_pause_style);
viewHolder.downloadBtn.setText("暂无");
} else if ("光环助手".equals(gameEntity.getName())) {
viewHolder.downloadBtn.setVisibility(View.GONE);
} else {
viewHolder.downloadBtn.setVisibility(View.VISIBLE);

View File

@ -169,7 +169,10 @@ public class SearchGameListFragmentAdapter extends RecyclerView.Adapter<Recycler
});
if (gameEntity.getApk() == null || gameEntity.getApk().isEmpty()
|| !Config.isShow(context) || "光环助手".equals(gameEntity.getName())) {
|| !Config.isShow(context) ) {
viewHolder.downloadBtn.setBackgroundResource(R.drawable.game_item_btn_pause_style);
viewHolder.downloadBtn.setText("暂无");
} else if ("光环助手".equals(gameEntity.getName())) {
viewHolder.downloadBtn.setVisibility(View.GONE);
} else {
viewHolder.downloadBtn.setVisibility(View.VISIBLE);