调整评论,消息分享,关闭下载的游戏不要隐藏下载按钮
This commit is contained in:
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user