package com.wing;
import com.wing.poem.vo.Level;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
public class Application extends android.app.Application {
private static final String ERROR_CANT_LOAD_PACKAGE_INFO = "Can't load package info";
private static final String DEFAULT_APPLICATION_VERSION = "1.0";
private static final String DEBUG_METADATA_KEY = "debug";
private static final int DEFAULT_APPLICATION_VERSION_CODE = 1;
public static final int SWIPE_MIN_DISTANCE = 120;
public static final int SWIPE_THRESHOLD_VELOCITY = 200;
public static String APPLICATION_VERSION = DEFAULT_APPLICATION_VERSION;
public static int APPLICATION_VERSION_CODE = DEFAULT_APPLICATION_VERSION_CODE;
public final static String QUIT = "com.wing.app.money.quit";
private static Context applicationContext;
public static LayoutInflater inflater;
public static boolean IS_DEBUG;
@Override
public void onCreate() {
super.onCreate();
try {
inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
applicationContext = getApplicationContext();
PackageInfo packageInfo = applicationContext.getPackageManager()
.getPackageInfo(applicationContext.getPackageName(), 0);
ApplicationInfo applicationInfo =
getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA);
Bundle applicationMetaData = applicationInfo.metaData;
APPLICATION_VERSION = packageInfo.versionName;
APPLICATION_VERSION_CODE = packageInfo.versionCode;
// DBAdapter.copyDB();
// DBAdapter.getInstance();
SharedPreferences sp = Application.getContext().getSharedPreferences(Level.NEW.toString(), Context.MODE_PRIVATE);
Editor edit = sp.edit();
edit.putBoolean(String.valueOf(0), false);
edit.commit();
} catch (NameNotFoundException e) {
Log.e(getClass().getName(), ERROR_CANT_LOAD_PACKAGE_INFO, e);
}
}
public static Context getContext() {
return applicationContext;
}
public static boolean UIThreadStillActive() {
return applicationContext != null
&& applicationContext.getApplicationContext() != null;
}
}
最近下载更多
最近浏览更多
anjuw521 LV1
2024年7月10日
AIWU1234 LV2
2024年6月9日
求学的熊猫 LV11
2024年6月3日
yhwyhw1 LV2
2023年12月19日
lmroman LV8
2023年4月27日
sunny1314
2023年3月30日
暂无贡献等级
yzhszz LV3
2022年12月27日
不正经的90后程序猿 LV1
2022年9月12日
17366635519 LV1
2022年8月30日
1532593037 LV8
2022年6月3日

