消息webView下载跳转自带浏览器,分享卡片修复图片混乱
This commit is contained in:
@ -50,7 +50,7 @@ public class PostCommentUtils {
|
||||
}).start();
|
||||
}
|
||||
|
||||
public static void addCommentVoto(final String newsId, final Context context, final PostCommentListener listener) {
|
||||
public static void addCommentVote(final String newsId, final Context context, final PostCommentListener listener) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -69,7 +69,7 @@ public class PostCommentUtils {
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
if (error.networkResponse != null && error.networkResponse.statusCode == 401) {
|
||||
TokenUtils.getToken(context, false);
|
||||
addCommentVoto(newsId, context, listener);
|
||||
addCommentVote(newsId, context, listener);
|
||||
return;
|
||||
}
|
||||
if (listener != null){
|
||||
|
||||
@ -27,8 +27,8 @@ 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 java.util.Vector;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
@ -51,16 +51,16 @@ public class ShareCardPicActivity extends BaseActivity {
|
||||
@BindView(R.id.sharecard_chang_img_icon) ImageView mShareChangImageIcon;
|
||||
@BindView(R.id.sharecard_chang_img_tv) TextView mShareChangImageTv;
|
||||
|
||||
String gameName;
|
||||
String gameIconUrl;
|
||||
String shareContent;
|
||||
String picName;
|
||||
private String gameName;
|
||||
private String gameIconUrl;
|
||||
private String shareContent;
|
||||
private String picName;
|
||||
|
||||
int currentImgPosition;
|
||||
|
||||
ArrayList<String> shareArrImg;
|
||||
private List<String> shareArrImg;
|
||||
|
||||
Bitmap shareBm;
|
||||
private Bitmap shareBm;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -79,7 +79,8 @@ public class ShareCardPicActivity extends BaseActivity {
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
||||
shareArrImg = new ArrayList<>();
|
||||
shareArrImg = new Vector<>();;
|
||||
shareArrImg.addAll(arrImg);
|
||||
|
||||
mActionbar.setBackgroundColor(getResources().getColor(R.color.back));
|
||||
SystemBarTintManager tintManager = getTintManager();
|
||||
@ -87,8 +88,8 @@ public class ShareCardPicActivity extends BaseActivity {
|
||||
tintManager.setStatusBarTintResource(R.color.back);
|
||||
}
|
||||
|
||||
for (int i = 0; i < arrImg.size(); i++) {
|
||||
checkUrl(arrImg.get(i), arrImg.size());
|
||||
for (int i = 0; i < shareArrImg.size(); i++) {
|
||||
checkUrl(shareArrImg.get(i), shareArrImg.size(), i);
|
||||
}
|
||||
|
||||
mShareGameNameTv.setText(gameName);
|
||||
@ -96,7 +97,7 @@ public class ShareCardPicActivity extends BaseActivity {
|
||||
mShareGameIconDv.setImageURI(gameIconUrl);
|
||||
mShareQrCodeDv.setImageURI("res:///" + R.drawable.test_qrcode);
|
||||
|
||||
if (arrImg.size() > 1) {
|
||||
if (shareArrImg.size() > 1) {
|
||||
mShareChangImageIcon.setImageResource(R.drawable.sharecard_chang_img);
|
||||
mShareChangImageTv.setTextColor(Color.WHITE);
|
||||
} else {
|
||||
@ -179,7 +180,7 @@ public class ShareCardPicActivity extends BaseActivity {
|
||||
currentImgPosition ++;
|
||||
}
|
||||
|
||||
private void checkUrl(final String url, final int size) {
|
||||
private void checkUrl(final String url,final int size, final int position) {
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -193,7 +194,8 @@ public class ShareCardPicActivity extends BaseActivity {
|
||||
int code = connection.getResponseCode();
|
||||
if (code == 200) {
|
||||
addCount();
|
||||
shareArrImg.add(newUrl);
|
||||
shareArrImg.remove(position);
|
||||
shareArrImg.add(position, newUrl);
|
||||
if (count == size) {
|
||||
ShareCardPicActivity.this.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
@ -205,7 +207,6 @@ public class ShareCardPicActivity extends BaseActivity {
|
||||
}
|
||||
} else {
|
||||
addCount();
|
||||
shareArrImg.add(url);
|
||||
if (count == size) {
|
||||
ShareCardPicActivity.this.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
package com.gh.gamecenter;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.webkit.DownloadListener;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
@ -33,6 +36,8 @@ public class WebActivity extends BaseActivity {
|
||||
|
||||
WebSettings settings = news_webview.getSettings();
|
||||
settings.setJavaScriptEnabled(true);
|
||||
settings.setSupportZoom(true);
|
||||
settings.setBuiltInZoomControls(true);
|
||||
|
||||
//用webview打开url
|
||||
news_webview.setWebViewClient(new WebViewClient(){
|
||||
@ -41,6 +46,25 @@ public class WebActivity extends BaseActivity {
|
||||
view.loadUrl(url);
|
||||
return true;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
|
||||
// 广告拦截操作
|
||||
// if (!url.contains(xxxx)) {
|
||||
// return new WebResourceResponse(null, null, null);
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
});
|
||||
|
||||
// 页面里的下载跳转到自带浏览器
|
||||
news_webview.setDownloadListener(new DownloadListener() {
|
||||
@Override
|
||||
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
|
||||
Uri uri = Uri.parse(url);
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
//设置加载进度条
|
||||
|
||||
@ -480,7 +480,7 @@ public class MessageDetailAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||
return;
|
||||
}
|
||||
finalCommentEntity.setVote(finalCommentEntity.getVote() + 1);
|
||||
PostCommentUtils.addCommentVoto(finalCommentEntity.getId(), mContext, null);
|
||||
PostCommentUtils.addCommentVote(finalCommentEntity.getId(), mContext, null);
|
||||
holder.commentLikeCountTv.setTextColor(mContext.getResources().getColor(R.color.theme));
|
||||
holder.commentLikeIv.setImageResource(R.drawable.comment_like_select);
|
||||
holder.commentLikeCountTv.setText(String.valueOf(finalCommentEntity.getVote()));
|
||||
|
||||
Reference in New Issue
Block a user