1、更改部分下载类,未完成

2、@#&@*#
This commit is contained in:
CsHeng
2017-06-29 11:17:01 +08:00
parent 5cbf06f6a6
commit f97ccd5c5d
126 changed files with 454 additions and 6379 deletions

View File

@ -9,6 +9,7 @@ import android.content.SharedPreferences.Editor;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
@ -21,22 +22,20 @@ import android.widget.TextView;
import com.gh.base.AppController;
import com.gh.base.BaseActivity;
import com.gh.common.constant.Config;
import com.lightgame.utils.AppManager;
import com.gh.common.util.FileUtils;
import com.gh.common.util.PackageUtils;
import com.gh.common.util.PlatformUtils;
import com.gh.common.util.TagUtils;
import com.gh.common.util.TimestampUtils;
import com.gh.common.util.TokenUtils;
import com.gh.common.util.Utils;
import com.gh.download.DownloadManager;
import com.gh.download.DownloadService;
import com.gh.gamecenter.eventbus.EBReuse;
import com.gh.gamecenter.manager.DataCollectionManager;
import com.gh.gamecenter.manager.FilterManager;
import com.gh.gamecenter.retrofit.JSONObjectResponse;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.lightgame.download.FileUtils;
import com.lightgame.utils.AppManager;
import com.lightgame.utils.Utils;
import com.readystatesoftware.systembartint.SystemBarTintManager;
import org.greenrobot.eventbus.EventBus;
@ -60,7 +59,7 @@ import static com.gh.common.util.EntranceUtils.KEY_DATA;
*/
public class SplashScreenActivity extends BaseActivity {
private SharedPreferences sp;
private SharedPreferences mSharedPreferences;
private long start;
@ -93,8 +92,8 @@ public class SplashScreenActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
sp = getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE);
isNewFirstLaunch = sp.getBoolean("isNewFirstLaunchV" + PackageUtils.getVersionName(getApplicationContext()), true);
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
isNewFirstLaunch = mSharedPreferences.getBoolean("isNewFirstLaunchV" + PackageUtils.getVersionName(getApplicationContext()), true);
super.onCreate(savedInstanceState);
@ -115,7 +114,7 @@ public class SplashScreenActivity extends BaseActivity {
isFirst = true;
if (isNewFirstLaunch || sp.getInt("actionbar_height", 0) != 0) {
if (isNewFirstLaunch || mSharedPreferences.getInt("actionbar_height", 0) != 0) {
setTheme(R.style.AppGuideTheme);
} else {
setTheme(R.style.AppFullScreenTheme);
@ -202,7 +201,7 @@ public class SplashScreenActivity extends BaseActivity {
// 第一次启动把package.txt文件内容加载进数据库
FilterManager filterManager = new FilterManager(getApplicationContext());
if (!sp.getBoolean("isLoadFilterV2d4", false)) {
if (!mSharedPreferences.getBoolean("isLoadFilterV2d4", false)) {
filterManager.loadFilter();
}
// 获取过滤包
@ -212,7 +211,7 @@ public class SplashScreenActivity extends BaseActivity {
checkOldGhFile();
// 更新过滤表获取自动刷新的cd获取版本对应表
String time = sp.getString("refresh_time", null);
String time = mSharedPreferences.getString("refresh_time", null);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
String today = format.format(new Date());
if (!today.equals(time)) {
@ -222,7 +221,7 @@ public class SplashScreenActivity extends BaseActivity {
}
// 获取下载按钮状态、开启or关闭
if (sp.getBoolean("isCheckShow", true)) {
if (mSharedPreferences.getBoolean("isCheckShow", true)) {
getDownloadStatus();
}
@ -238,16 +237,13 @@ public class SplashScreenActivity extends BaseActivity {
// 解决助手奔溃后导致的下载状态保留问题
DownloadManager.getInstance(this).checkAll();
// 开启下载服务
startService(new Intent(this, DownloadService.class));
// 不是第一次启动
if (!isNewFirstLaunch) {
int height = sp.getInt("actionbar_height", 0);
int height = mSharedPreferences.getInt("actionbar_height", 0);
if (height == 0) {
final ActionBar actionBar = getActionBar();
if (actionBar != null) {
sp.edit().putInt("actionbar_height", actionBar.getHeight()).apply();
mSharedPreferences.edit().putInt("actionbar_height", actionBar.getHeight()).apply();
}
}
long end = System.currentTimeMillis() - start;
@ -298,12 +294,12 @@ public class SplashScreenActivity extends BaseActivity {
try {
String status = response.getString("status");
if ("on".equals(status)) {
Editor editor = sp.edit();
Editor editor = mSharedPreferences.edit();
editor.putBoolean("isShow", true);
editor.putBoolean("isCheckShow", false);
editor.apply();
} else {
sp.edit().putBoolean("isShow", false).apply();
mSharedPreferences.edit().putBoolean("isShow", false).apply();
}
EventBus.getDefault().post(new EBReuse("Refresh"));
} catch (JSONException e) {
@ -324,7 +320,7 @@ public class SplashScreenActivity extends BaseActivity {
public void onResponse(JSONObject response) {
if (response.length() != 0) {
try {
Editor editor = sp.edit();
Editor editor = mSharedPreferences.edit();
editor.putInt("download_box_row",
response.getJSONObject("download_box").getInt("row"));
editor.putInt("download_box_column",