From f3ee2d2cf00c9506fd3815b468418d1ad1eb0c4e Mon Sep 17 00:00:00 2001 From: huangzhuanghua <401742778@qq.com> Date: Tue, 25 Oct 2016 09:32:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0downloadOffText=EF=BC=8C?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E4=B8=8B=E8=BD=BD=E4=B8=8A=E4=BC=A0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=98=AF=E5=90=A6=E5=AE=8C=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 1 - .../main/java/com/gh/base/DetailActivity.java | 7 +- .../java/com/gh/common/util/DialogUtils.java | 4 +- .../java/com/gh/common/util/FileUtils.java | 9 +- .../com/gh/common/util/PlatformUtils.java | 4 +- .../java/com/gh/download/DownloadThread.java | 89 ++++++++----------- .../com/gh/gamecenter/CropImageActivity.java | 6 +- .../com/gh/gamecenter/GameDetailActivity.java | 1 + .../java/com/gh/gamecenter/MainActivity.java | 8 +- .../com/gh/gamecenter/NewsDetailActivity.java | 1 + .../com/gh/gamecenter/ViewImageActivity.java | 1 - .../adapter/ConcernRecommendAdapter.java | 4 +- .../gamecenter/adapter/ImagePagerAdapter.java | 4 +- .../gh/gamecenter/adapter/SubjectAdapter.java | 10 +-- .../download/GameUpdateAdapter.java | 2 +- .../gamecenter/entity/GameDetailEntity.java | 10 +++ .../com/gh/gamecenter/entity/GameEntity.java | 39 ++++++-- .../gamecenter/game/Game2FragmentAdapter.java | 8 +- .../com/gh/gamecenter/news/News4Fragment.java | 2 +- .../gamecenter/news/News4FragmentAdapter.java | 4 +- .../gamecenter/personal/PersonalFragment.java | 4 +- .../volley/extended/ExtendedRequest.java | 7 +- .../main/res/layout/viewimage_gif_item.xml | 20 ----- 23 files changed, 125 insertions(+), 120 deletions(-) delete mode 100644 app/src/main/res/layout/viewimage_gif_item.xml diff --git a/app/build.gradle b/app/build.gradle index 99f1da1327..1796971109 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -118,7 +118,6 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' - compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.16' compile 'com.android.support:cardview-v7:21.0.0' compile ('com.facebook.fresco:fresco:0.12.0') { diff --git a/app/src/main/java/com/gh/base/DetailActivity.java b/app/src/main/java/com/gh/base/DetailActivity.java index e199e5680a..6171178436 100644 --- a/app/src/main/java/com/gh/base/DetailActivity.java +++ b/app/src/main/java/com/gh/base/DetailActivity.java @@ -60,6 +60,7 @@ public abstract class DetailActivity extends BaseActivity implements View.OnClic protected String name; protected String title; protected String downloadAddWord; + protected String downloadOffText; protected Handler handler = new Handler(); @@ -166,7 +167,11 @@ public abstract class DetailActivity extends BaseActivity implements View.OnClic detail_tv_download.setVisibility(View.VISIBLE); detail_pb_progressbar.setVisibility(View.GONE); detail_tv_per.setVisibility(View.GONE); - detail_tv_download.setText("暂无下载"); + if (TextUtils.isEmpty(downloadOffText)) { + detail_tv_download.setText("暂无下载"); + } else { + detail_tv_download.setText(downloadOffText); + } detail_tv_download.setBackgroundResource(R.drawable.game_item_btn_pause_style); detail_tv_download.setTextColor(0xFF999999); detail_tv_download.setClickable(false); diff --git a/app/src/main/java/com/gh/common/util/DialogUtils.java b/app/src/main/java/com/gh/common/util/DialogUtils.java index c5f29f2576..ba1967b681 100644 --- a/app/src/main/java/com/gh/common/util/DialogUtils.java +++ b/app/src/main/java/com/gh/common/util/DialogUtils.java @@ -101,8 +101,8 @@ public class DialogUtils { } // 打开QQ客户端,创建临时会话 - public static void showQqSessionDialog(final Context context, String qq){ - if (qq == null){ + public static void showQqSessionDialog(final Context context, String qq) { + if (qq == null) { qq = "2586716223"; } final String finalQq = qq; diff --git a/app/src/main/java/com/gh/common/util/FileUtils.java b/app/src/main/java/com/gh/common/util/FileUtils.java index 2fba49aa9b..59096ae2d3 100644 --- a/app/src/main/java/com/gh/common/util/FileUtils.java +++ b/app/src/main/java/com/gh/common/util/FileUtils.java @@ -5,7 +5,6 @@ import android.os.Environment; import android.os.StatFs; import android.os.StrictMode; -import org.apache.http.HttpStatus; import org.json.JSONObject; import java.io.DataInputStream; @@ -271,14 +270,14 @@ public class FileUtils { int statusCode = connection.getResponseCode(); Utils.log("statusCode = " + statusCode); - if (statusCode == HttpStatus.SC_OK) { + if (statusCode == HttpURLConnection.HTTP_OK) { // {"icon":"http:\/\/gh-test-1.oss-cn-qingdao.aliyuncs.com\/pic\/57e4f4d58a3200042d29492f.jpg"} JSONObject response = new JSONObject(b.toString().trim()); - response.put("statusCode", HttpStatus.SC_OK); + response.put("statusCode", HttpURLConnection.HTTP_OK); return response; - } else if (statusCode == HttpStatus.SC_FORBIDDEN) { + } else if (statusCode == HttpURLConnection.HTTP_FORBIDDEN) { JSONObject response = new JSONObject(b.toString().trim()); - response.put("statusCode", HttpStatus.SC_FORBIDDEN); + response.put("statusCode", HttpURLConnection.HTTP_FORBIDDEN); return response; } } catch (Exception e) { diff --git a/app/src/main/java/com/gh/common/util/PlatformUtils.java b/app/src/main/java/com/gh/common/util/PlatformUtils.java index 7359311748..494f7cff63 100644 --- a/app/src/main/java/com/gh/common/util/PlatformUtils.java +++ b/app/src/main/java/com/gh/common/util/PlatformUtils.java @@ -15,13 +15,13 @@ import com.gh.gamecenter.R; import com.gh.gamecenter.eventbus.EBReuse; import com.gh.gamecenter.volley.extended.JsonArrayExtendedRequest; -import org.apache.http.HttpStatus; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.File; import java.io.IOException; +import java.net.HttpURLConnection; import java.util.ArrayList; import java.util.HashSet; import java.util.Properties; @@ -175,7 +175,7 @@ public class PlatformUtils { + url.substring(url.lastIndexOf("/") + 1); try { int code = FileUtils.downloadFile(url, savePath); - if (code == HttpStatus.SC_OK) { + if (code == HttpURLConnection.HTTP_OK) { success++; } } catch (IOException e) { diff --git a/app/src/main/java/com/gh/download/DownloadThread.java b/app/src/main/java/com/gh/download/DownloadThread.java index 27ec069a5f..f4f012908a 100644 --- a/app/src/main/java/com/gh/download/DownloadThread.java +++ b/app/src/main/java/com/gh/download/DownloadThread.java @@ -7,8 +7,6 @@ import android.util.Log; import com.gh.common.util.HttpsUtils; import com.gh.common.util.Utils; -import org.apache.http.HttpStatus; - import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; @@ -52,66 +50,34 @@ public class DownloadThread extends Thread { if (TextUtils.isEmpty(entry.getUrl())) { listener.onStatusChanged(DownloadStatus.notfound); - Utils.log(DownloadThread.class.getSimpleName(), - "error-->url is empty"); + Utils.log(DownloadThread.class.getSimpleName(), "error-->url is empty"); return; } - URL url = new URL(entry.getUrl()); + Utils.log("url = " + entry.getUrl()); - HttpURLConnection connection; - if ("https".equals(url.getProtocol())) { - connection = HttpsUtils.getHttpsURLConnection(url); - } else { - connection = (HttpURLConnection) url.openConnection(); - } + HttpURLConnection connection = openConnection(new URL(entry.getUrl()), targetFile.length()); - connection.setRequestMethod("GET"); - connection.setConnectTimeout(CONNECT_TIME); - connection.setReadTimeout(READ_TIME); - connection.setRequestProperty("RANGE", - "bytes=" + targetFile.length() + "-"); - Utils.log(DownloadThread.class.getSimpleName(), - "startPosition-->" + targetFile.length()); - //设置自动重定向 - connection.setInstanceFollowRedirects(true); + Utils.log(DownloadThread.class.getSimpleName(), "startPosition-->" + targetFile.length()); int code = connection.getResponseCode(); Utils.log("code = " +code); - if (code == HttpStatus.SC_MOVED_PERMANENTLY - || code == HttpStatus.SC_MOVED_TEMPORARILY) { + if (code == HttpURLConnection.HTTP_MOVED_PERM + || code == HttpURLConnection.HTTP_MOVED_TEMP) { //未自动重定向 String location = connection.getHeaderField("Location"); Utils.log("location = " + location); - url = new URL(location); - connection = (HttpURLConnection) url.openConnection(); - connection.setRequestMethod("GET"); - connection.setConnectTimeout(CONNECT_TIME); - connection.setReadTimeout(READ_TIME); - connection.setRequestProperty("RANGE", - "bytes=" + targetFile.length() + "-"); - Utils.log(DownloadThread.class.getSimpleName(), - "startPosition-->" + targetFile.length()); - //设置自动重定向 - connection.setInstanceFollowRedirects(true); + connection = openConnection(new URL(location), targetFile.length()); code = connection.getResponseCode(); } - if (code == HttpStatus.SC_NOT_FOUND) { + if (code == HttpURLConnection.HTTP_NOT_FOUND) { // 404 Not Found listener.onStatusChanged(DownloadStatus.notfound); - Utils.log(DownloadThread.class.getSimpleName(), - "error-->404 Not Found"); + Utils.log(DownloadThread.class.getSimpleName(), "error-->404 Not Found"); return; } - bis = new BufferedInputStream(connection.getInputStream()); - if (targetFile.length() > 0) { - bos = new BufferedOutputStream(new FileOutputStream(entry.getPath(), true)); - } else { - bos = new BufferedOutputStream(new FileOutputStream(entry.getPath())); - } - String eTag = connection.getHeaderField("ETag"); if (!TextUtils.isEmpty(eTag) && eTag.startsWith("\"") && eTag.endsWith("\"")) { eTag = eTag.substring(1, eTag.length() - 1); @@ -122,8 +88,7 @@ public class DownloadThread extends Thread { Utils.log("eTag = " + eTag); Utils.log("eTag2 = " + eTag2); listener.onStatusChanged(DownloadStatus.hijack); - Utils.log(DownloadThread.class.getSimpleName(), - "error-->链接被劫持"); + Utils.log(DownloadThread.class.getSimpleName(), "error-->链接被劫持"); return; } @@ -132,14 +97,20 @@ public class DownloadThread extends Thread { if (entry.getSize() == 0) { entry.setSize(conentLength); DownloadDao.getInstance(context).newOrUpdate(entry); - Utils.log(DownloadThread.class.getSimpleName(), - "记录第一次长度"); + Utils.log(DownloadThread.class.getSimpleName(), "记录第一次长度"); } Utils.log(DownloadThread.class.getSimpleName(), "progress:" + entry.getProgress() + "/curfilesize:" + targetFile.length() + "=====contentLength:" + conentLength + "/ totalSize:" + entry.getSize()); + bis = new BufferedInputStream(connection.getInputStream()); + if (targetFile.length() > 0) { + bos = new BufferedOutputStream(new FileOutputStream(entry.getPath(), true)); + } else { + bos = new BufferedOutputStream(new FileOutputStream(entry.getPath())); + } + byte[] buffer = new byte[2048]; int len; while ((len = bis.read(buffer)) != -1) { @@ -160,16 +131,15 @@ public class DownloadThread extends Thread { listener.onStatusChanged(DownloadStatus.done); } } catch (Exception e) { - String errorMsg = Log.getStackTraceString(e); + // TODO 默认第一次错误自动恢复一次下载 - //e.getMessage() will null error + String errorMsg = Log.getStackTraceString(e); if (!TextUtils.isEmpty(e.getMessage()) && e.getMessage().contains("connection timeout")) { listener.onStatusChanged(DownloadStatus.timeout, errorMsg); } else { listener.onStatusChanged(DownloadStatus.neterror, errorMsg); } - Utils.log(DownloadThread.class.getSimpleName(), - "exception-->" + e.toString()); + Utils.log(DownloadThread.class.getSimpleName(), "exception-->" + e.toString()); } finally { if (bis != null) { try { @@ -188,6 +158,23 @@ public class DownloadThread extends Thread { } } + private HttpURLConnection openConnection(URL url, long range) throws Exception { + HttpURLConnection connection; + if ("https".equals(url.getProtocol())) { + connection = HttpsUtils.getHttpsURLConnection(url); + } else { + connection = (HttpURLConnection) url.openConnection(); + } + connection.setRequestMethod("GET"); + connection.setConnectTimeout(CONNECT_TIME); + connection.setReadTimeout(READ_TIME); + connection.setDoInput(true); + connection.setRequestProperty("RANGE", "bytes=" + range + "-"); + //设置自动重定向 + connection.setInstanceFollowRedirects(true); + return connection; + } + public void setStatus(DownloadStatus status) { this.status = status; } diff --git a/app/src/main/java/com/gh/gamecenter/CropImageActivity.java b/app/src/main/java/com/gh/gamecenter/CropImageActivity.java index 7f64a83829..681c8c2125 100644 --- a/app/src/main/java/com/gh/gamecenter/CropImageActivity.java +++ b/app/src/main/java/com/gh/gamecenter/CropImageActivity.java @@ -22,12 +22,12 @@ import com.gh.common.util.FileUtils; import com.gh.common.util.TokenUtils; import com.gh.common.view.CropImageCustom; -import org.apache.http.HttpStatus; import org.json.JSONException; import org.json.JSONObject; import java.io.File; import java.lang.ref.SoftReference; +import java.net.HttpURLConnection; public class CropImageActivity extends BaseActivity { @@ -82,13 +82,13 @@ public class CropImageActivity extends BaseActivity { if (result != null) { try { int statusCode = result.getInt("statusCode"); - if (statusCode == HttpStatus.SC_OK) { + if (statusCode == HttpURLConnection.HTTP_OK) { Intent data = new Intent(); data.putExtra("url", result.getString("icon")); setResult(RESULT_OK, data); finish(); handler.sendEmptyMessage(0); - } else if (statusCode == HttpStatus.SC_FORBIDDEN + } else if (statusCode == HttpURLConnection.HTTP_FORBIDDEN && "too frequent".equals(result.getString("detail"))) { handler.sendEmptyMessage(2); } diff --git a/app/src/main/java/com/gh/gamecenter/GameDetailActivity.java b/app/src/main/java/com/gh/gamecenter/GameDetailActivity.java index eed81bd549..9ffcac43f7 100644 --- a/app/src/main/java/com/gh/gamecenter/GameDetailActivity.java +++ b/app/src/main/java/com/gh/gamecenter/GameDetailActivity.java @@ -91,6 +91,7 @@ public class GameDetailActivity extends DetailActivity implements View.OnClickLi iv_share.setVisibility(View.VISIBLE); } downloadAddWord = adapter.getGameDetailEntity().getDownloadAddWord(); + downloadOffText = gameEntity.getDownloadOffText(); initDownload(true); } diff --git a/app/src/main/java/com/gh/gamecenter/MainActivity.java b/app/src/main/java/com/gh/gamecenter/MainActivity.java index 471a5141c4..9bfed1c9ce 100644 --- a/app/src/main/java/com/gh/gamecenter/MainActivity.java +++ b/app/src/main/java/com/gh/gamecenter/MainActivity.java @@ -962,7 +962,7 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene Intent toIntent = new Intent(MainActivity.this, clazz); if ("NewsActivity".equals(to) || "NewsDetailActivity".equals(to)) { toIntent.putExtra("newsId", getIntent().getExtras().getString("newsId")); - toIntent.putExtra("entrance", getIntent().getExtras().getString("entrance")); + toIntent.putExtra("entrance", "(插件跳转)"); } else if("DownloadManagerActivity".equals(to)) { String packageName = getIntent().getExtras().getString("packageName"); if (packageName != null) { @@ -971,7 +971,7 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene } } else if ("GameDetailsActivity".equals(to) || "GameDetailActivity".equals(to)) { toIntent.putExtra("gameId", getIntent().getExtras().getString("gameId")); - toIntent.putExtra("entrance", getIntent().getExtras().getString("entrance")); + toIntent.putExtra("entrance", "(插件跳转)"); } else if ("SubjectActivity".equals(to)) { toIntent.putExtra("id", getIntent().getExtras().getString("id")); toIntent.putExtra("name", getIntent().getExtras().getString("name")); @@ -993,12 +993,12 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene startActivity(intent); } else if (from.equals("mipush_news")) { Intent intent = new Intent(MainActivity.this, NewsDetailActivity.class); - intent.putExtra("entrance", "小米推送"); + intent.putExtra("entrance", "(小米推送)"); intent.putExtra("newsId", getIntent().getStringExtra("newsId")); startActivity(intent); } else if (from.equals("mipush_new_game")) { Intent intent = new Intent(MainActivity.this, GameDetailActivity.class); - intent.putExtra("entrance", "小米推送"); + intent.putExtra("entrance", "(小米推送)"); startActivity(intent); } else if (from.equals("mipush_plugin")) { Intent intent = new Intent(MainActivity.this, DownloadManagerActivity.class); diff --git a/app/src/main/java/com/gh/gamecenter/NewsDetailActivity.java b/app/src/main/java/com/gh/gamecenter/NewsDetailActivity.java index 7a684cced9..ed2cb4307e 100644 --- a/app/src/main/java/com/gh/gamecenter/NewsDetailActivity.java +++ b/app/src/main/java/com/gh/gamecenter/NewsDetailActivity.java @@ -339,6 +339,7 @@ public class NewsDetailActivity extends DetailActivity implements OnClickListene adapter.setGameEntity(gameEntity); adapter.notifyItemInserted(1); downloadAddWord = gameEntity.getDownloadAddWord(); + downloadOffText = gameEntity.getDownloadOffText(); initDownload(true); } } diff --git a/app/src/main/java/com/gh/gamecenter/ViewImageActivity.java b/app/src/main/java/com/gh/gamecenter/ViewImageActivity.java index d7e0721e9d..c8ed9f24cc 100644 --- a/app/src/main/java/com/gh/gamecenter/ViewImageActivity.java +++ b/app/src/main/java/com/gh/gamecenter/ViewImageActivity.java @@ -26,7 +26,6 @@ import com.gc.materialdesign.views.ProgressBarCircularIndeterminate; import com.gh.base.BaseActivity; import com.gh.common.util.DisplayUtils; import com.gh.common.util.ImageUtils; -import com.gh.common.util.Utils; import com.gh.common.view.Gh_RelativeLayout; import com.gh.common.view.Gh_RelativeLayout.OnSingleTapListener; diff --git a/app/src/main/java/com/gh/gamecenter/adapter/ConcernRecommendAdapter.java b/app/src/main/java/com/gh/gamecenter/adapter/ConcernRecommendAdapter.java index 727454a137..e4aba641a5 100644 --- a/app/src/main/java/com/gh/gamecenter/adapter/ConcernRecommendAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/adapter/ConcernRecommendAdapter.java @@ -80,7 +80,9 @@ public class ConcernRecommendAdapter extends RecyclerView.Adapter articleTypes; @SerializedName("share_code") private String shareCode; + @SerializedName("download_off_text") + private String downloadOffText; + + public void setDownloadOffText(String downloadOffText) { + this.downloadOffText = downloadOffText; + } + + public String getDownloadOffText() { + return downloadOffText; + } public ArrayList getArticleTypes() { return articleTypes; diff --git a/app/src/main/java/com/gh/gamecenter/entity/GameEntity.java b/app/src/main/java/com/gh/gamecenter/entity/GameEntity.java index eb65261ee7..d69cbb21fc 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/GameEntity.java +++ b/app/src/main/java/com/gh/gamecenter/entity/GameEntity.java @@ -42,14 +42,25 @@ public class GameEntity { private String link; @SerializedName("concern_article_exists") - private boolean exists = true; + private boolean newsExists = true; - public boolean isExists() { - return exists; + @SerializedName("download_off_text") + private String downloadOffText; + + public void setDownloadOffText(String downloadOffText) { + this.downloadOffText = downloadOffText; } - public void setExists(boolean exists) { - this.exists = exists; + public String getDownloadOffText() { + return downloadOffText; + } + + public boolean isNewsExists() { + return newsExists; + } + + public void setNewsExists(boolean newsExists) { + this.newsExists = newsExists; } public String getLink() { @@ -181,15 +192,27 @@ public class GameEntity { gameEntity.setIcon(icon); gameEntity.setName(name); gameEntity.setBrief(brief); - gameEntity.setTag(new ArrayList<>(tag)); - gameEntity.setApk(new ArrayList<>(apk)); + if (tag != null) { + gameEntity.setTag(new ArrayList<>(tag)); + } + if (apk != null) { + gameEntity.setApk(new ArrayList<>(apk)); + } + if (collection != null) { + gameEntity.setCollection(new ArrayList<>(collection)); + } gameEntity.setSlide(slide); gameEntity.setTest(test); gameEntity.setDownloadAddWord(downloadAddWord); - gameEntity.setEntryMap(new ArrayMap(entryMap)); + if (entryMap != null) { + gameEntity.setEntryMap(new ArrayMap(entryMap)); + } gameEntity.setImage(image); gameEntity.setType(type); gameEntity.setPluggable(isPluggable); + gameEntity.setLink(link); + gameEntity.setNewsExists(newsExists); + gameEntity.setDownloadOffText(downloadOffText); return gameEntity; } diff --git a/app/src/main/java/com/gh/gamecenter/game/Game2FragmentAdapter.java b/app/src/main/java/com/gh/gamecenter/game/Game2FragmentAdapter.java index 996c1c32f8..583ef67d8f 100644 --- a/app/src/main/java/com/gh/gamecenter/game/Game2FragmentAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/game/Game2FragmentAdapter.java @@ -211,17 +211,17 @@ public class Game2FragmentAdapter extends RecyclerView.Adapter= offset && position <= subjectList.get(i).getData().size() + offset) { - int index = position -offset-1; + int index = position - offset - 1; if (index < 0) { index = 0; } gameEntity = subjectList.get(i).getData().get(index); - if (position == offset && !TextUtils.isEmpty(gameEntity.getImage())){ + if (position == offset && !TextUtils.isEmpty(gameEntity.getImage())) { return ItemViewType.GAME_IMAGE; - }else if (position == offset){ + } else if (position == offset) { return ItemViewType.COLUMN_HEADER; } - if (position == offset+1 && !TextUtils.isEmpty(subjectList.get(i).getData().get(0).getImage())) { + if (position == offset + 1 && !TextUtils.isEmpty(subjectList.get(i).getData().get(0).getImage())) { return ItemViewType.COLUMN_HEADER; } if (gameEntity.getTest() != null) { diff --git a/app/src/main/java/com/gh/gamecenter/news/News4Fragment.java b/app/src/main/java/com/gh/gamecenter/news/News4Fragment.java index 470218b399..c0e1d1fa3a 100644 --- a/app/src/main/java/com/gh/gamecenter/news/News4Fragment.java +++ b/app/src/main/java/com/gh/gamecenter/news/News4Fragment.java @@ -328,7 +328,7 @@ public class News4Fragment extends BaseFragment implements SwipeRefreshLayout.On if (finalI == size - 1) { recommendGameList.add(gameEntity); - } else if (gameEntity.isExists()) { + } else if (gameEntity.isNewsExists()) { installGameList.add(gameEntity); } } diff --git a/app/src/main/java/com/gh/gamecenter/news/News4FragmentAdapter.java b/app/src/main/java/com/gh/gamecenter/news/News4FragmentAdapter.java index 1105719ca1..67eb2544b8 100644 --- a/app/src/main/java/com/gh/gamecenter/news/News4FragmentAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/news/News4FragmentAdapter.java @@ -46,13 +46,13 @@ import com.gh.gamecenter.volley.extended.JsonObjectExtendedRequest; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; -import org.apache.http.HttpStatus; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.File; import java.lang.reflect.Type; +import java.net.HttpURLConnection; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -186,7 +186,7 @@ public class News4FragmentAdapter extends RecyclerView.Adapter extends Request { String responseString = null; String charset = HttpHeaderParser.parseCharset(response.headers); - if (HttpStatus.SC_NOT_MODIFIED == response.statusCode + if (HttpURLConnection.HTTP_NOT_MODIFIED == response.statusCode || (mGzipEnabled && isGzipped(response.headers)) - || HttpStatus.SC_OK == response.statusCode) { + || HttpURLConnection.HTTP_OK == response.statusCode) { try { byte[] data = GzipUtils.decompressBytes(response.data); responseString = new String(data, charset); diff --git a/app/src/main/res/layout/viewimage_gif_item.xml b/app/src/main/res/layout/viewimage_gif_item.xml deleted file mode 100644 index 10eac33703..0000000000 --- a/app/src/main/res/layout/viewimage_gif_item.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - \ No newline at end of file