游戏详情接入游戏推荐(大家都在玩),优化代码

This commit is contained in:
khy
2017-04-26 15:34:58 +08:00
parent 5798ba9e89
commit a0cae1b7b8
39 changed files with 601 additions and 1099 deletions

View File

@ -1,40 +1,97 @@
package com.gh.gamecenter;
import android.content.*;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.graphics.Color;
import android.net.Uri;
import android.os.*;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
import android.provider.Settings;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.util.ArrayMap;
import android.text.*;
import android.text.Html;
import android.text.Spanned;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.*;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.gh.base.BaseFragmentActivity;
import com.gh.common.constant.Config;
import com.gh.common.util.*;
import com.gh.download.*;
import com.gh.common.util.ClassUtils;
import com.gh.common.util.DataCollectionUtils;
import com.gh.common.util.DataLogUtils;
import com.gh.common.util.DataUtils;
import com.gh.common.util.DialogUtils;
import com.gh.common.util.FileUtils;
import com.gh.common.util.GameUtils;
import com.gh.common.util.LibaoUtils;
import com.gh.common.util.PackageUtils;
import com.gh.common.util.PlatformUtils;
import com.gh.common.util.TokenUtils;
import com.gh.common.util.TrafficUtils;
import com.gh.common.util.Utils;
import com.gh.download.DataWatcher;
import com.gh.download.DownloadEntity;
import com.gh.download.DownloadManager;
import com.gh.download.DownloadStatus;
import com.gh.gamecenter.db.MessageMarkReadDao;
import com.gh.gamecenter.db.info.*;
import com.gh.gamecenter.entity.*;
import com.gh.gamecenter.eventbus.*;
import com.gh.gamecenter.db.info.ConcernInfo;
import com.gh.gamecenter.db.info.GameInfo;
import com.gh.gamecenter.db.info.MessageMarkReadInfo;
import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.GameDigestEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.GameUpdateEntity;
import com.gh.gamecenter.entity.SuggestionTypeEntity;
import com.gh.gamecenter.eventbus.EBDownloadStatus;
import com.gh.gamecenter.eventbus.EBPackage;
import com.gh.gamecenter.eventbus.EBShowDialog;
import com.gh.gamecenter.eventbus.EBSkip;
import com.gh.gamecenter.eventbus.EBUISwitch;
import com.gh.gamecenter.game.GameFragment;
import com.gh.gamecenter.manager.*;
import com.gh.gamecenter.manager.ConcernManager;
import com.gh.gamecenter.manager.DataCollectionManager;
import com.gh.gamecenter.manager.FilterManager;
import com.gh.gamecenter.manager.GameManager;
import com.gh.gamecenter.manager.PackageManager;
import com.gh.gamecenter.manager.UpdateManager;
import com.gh.gamecenter.message.MessageFragment;
import com.gh.gamecenter.news.NewsFragment;
import com.gh.gamecenter.personal.PersonalFragment;
import com.gh.gamecenter.retrofit.*;
import com.gh.gamecenter.retrofit.JSONObjectResponse;
import com.gh.gamecenter.retrofit.ObservableUtil;
import com.gh.gamecenter.retrofit.Response;
import de.greenrobot.event.EventBus;
import okhttp3.*;
import com.gh.gamecenter.retrofit.RetrofitManager;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import de.greenrobot.event.EventBus;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.adapter.rxjava.HttpException;
import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
@ -42,12 +99,6 @@ import rx.functions.Action1;
import rx.functions.Func1;
import rx.schedulers.Schedulers;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
/**
* 项目的主Activity3个Fragment都嵌入在这里。
*/
@ -414,11 +465,11 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
public void onResponse(ResponseBody response) {
super.onResponse(response);
Utils.log("=========postMarkRead::" + type);
// if ("kefu".equals(type)) {
// readDao.cleanKeFu();
// } else {
// readDao.cleanNotice();
// }
if ("kefu".equals(type)) {
readDao.cleanKeFu();
} else {
readDao.cleanNotice();
}
}
@ -632,17 +683,6 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
// 获取已安装游戏
private void getInstalledListFromServer() {
ArrayList<String> list = PackageUtils.getAllPackageName(getApplicationContext());
// if (list.isEmpty()) {
// if (isNewFirstLaunch) { // 延迟0.3s,防止页面未注册eventbus接收消息失败
// handler.postDelayed(new Runnable() {
// @Override
// public void run() {
// EventBus.getDefault().post(new EBUISwitch("NewsFragment", -1)); //通知更新推荐关注小版块
// }
// }, 300);
// }
// return;
// }
PackageManager.init(list);
@ -735,9 +775,6 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
* 更新关注列表数据
*/
private void update() {
// if (isNewFirstLaunch) {
// EventBus.getDefault().post(new EBUISwitch("NewsFragment", -1)); //通知更新推荐关注小版块
// }
new Thread(){
@Override
public void run() {