启动界面修改
This commit is contained in:
@ -23,6 +23,7 @@ import com.gh.base.BaseActivity;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.FileUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.PackageUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.common.util.TrafficUtils;
|
||||
@ -73,7 +74,6 @@ import java.util.Set;
|
||||
public class SplashScreenActivity extends BaseActivity {
|
||||
|
||||
private ConcernManager concernManager;
|
||||
private PackageManager manager;
|
||||
private SharedPreferences sp;
|
||||
private boolean isFirst;
|
||||
|
||||
@ -81,11 +81,16 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
|
||||
private String from;
|
||||
|
||||
private long start = 0L;
|
||||
private long end = 0L;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
start = System.currentTimeMillis();
|
||||
|
||||
isFirst = true;
|
||||
|
||||
sp = getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE);
|
||||
@ -127,15 +132,14 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
|
||||
return pics.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object instantiateItem(ViewGroup container, int position) {
|
||||
|
||||
ImageView iv = new ImageView(SplashScreenActivity.this);
|
||||
iv.setBackgroundResource(pics[position]);
|
||||
// iv.setBackgroundResource(pics[position]);
|
||||
ImageUtils.getInstance(SplashScreenActivity.this).display("drawable://" + pics[position], iv, -1);
|
||||
if (position == pics.length - 1) {
|
||||
iv.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@ -153,13 +157,11 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
public boolean isViewFromObject(View view, Object object) {
|
||||
|
||||
return view == object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyItem(ViewGroup container, int position, Object object) {
|
||||
|
||||
container.removeView((View) object);
|
||||
object = null;
|
||||
}
|
||||
@ -168,7 +170,6 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
|
||||
if (sp.getBoolean("isFirstLaunch", true)) {
|
||||
Intent intent = new Intent(SplashScreenActivity.this,
|
||||
@ -184,7 +185,6 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
if (hasFocus && isFirst) {
|
||||
|
||||
@ -241,7 +241,7 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
/*
|
||||
* 初始化已安装软件map,获取游戏更新列表和已安装列表
|
||||
*/
|
||||
manager = new PackageManager(getApplicationContext());
|
||||
PackageManager manager = new PackageManager(getApplicationContext());
|
||||
manager.getInstalledMapFromLocal();
|
||||
|
||||
getInstalledListFromServer();
|
||||
@ -320,7 +320,7 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
/*
|
||||
* 检查下载文件夹下是否有旧版本的光环助手的包,有这删除
|
||||
* 检查下载文件夹下是否有旧版本的光环助手的包,有则删除
|
||||
*/
|
||||
private void checkUpdateFile() {
|
||||
File file = new File(FileUtils.getDownloadDir(this) + File.separator);
|
||||
@ -384,7 +384,7 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
private int iCount;
|
||||
|
||||
private void getInstalledListFromServer() {
|
||||
List<String> list = manager.getLocalPackageName();
|
||||
List<String> list = PackageManager.getLocalPackageName(getApplicationContext());
|
||||
final int count = list.size();
|
||||
final List<JSONObject> data = new ArrayList<JSONObject>();
|
||||
final List<String> useParams = new ArrayList<String>();
|
||||
@ -392,8 +392,7 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
for (int i = 0, size = list.size(); i < size; i++) {
|
||||
final String packageName = list.get(i);
|
||||
JsonObjectExtendedRequest request = new JsonObjectExtendedRequest(
|
||||
Config.HOST + "v1d45/support/package/" + list.get(i)
|
||||
+ "/game/digest",
|
||||
Config.HOST + "v1d45/support/package/" + list.get(i) + "/game/digest",
|
||||
new Response.Listener<JSONObject>() {
|
||||
|
||||
@Override
|
||||
@ -454,7 +453,7 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
|
||||
char[] clhs = lhs.toCharArray();
|
||||
char[] crhs = rhs.toCharArray();
|
||||
int length = 0;
|
||||
int length;
|
||||
if (clhs.length < crhs.length) {
|
||||
length = clhs.length;
|
||||
} else if (clhs.length > crhs.length) {
|
||||
@ -668,8 +667,7 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
if (height == 0) {
|
||||
final ActionBar actionBar = getActionBar();
|
||||
if (actionBar != null) {
|
||||
sp.edit().putInt("actionbar_height", actionBar.getHeight())
|
||||
.apply();
|
||||
sp.edit().putInt("actionbar_height", actionBar.getHeight()).apply();
|
||||
}
|
||||
}
|
||||
|
||||
@ -688,6 +686,10 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
intent.putExtra("path", getIntent().getStringExtra("path"));
|
||||
}
|
||||
|
||||
end = System.currentTimeMillis();
|
||||
|
||||
Utils.log("time = " + (end - start));
|
||||
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user