更新应用实例参数上下文
This commit is contained in:
parent
63b1d2dece
commit
f1669f9e41
@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Tue Apr 15 02:52:13 GMT 2025
|
#Tue Apr 15 07:58:36 GMT 2025
|
||||||
stageCount=1
|
stageCount=1
|
||||||
libraryProject=
|
libraryProject=
|
||||||
baseVersion=15.2
|
baseVersion=15.2
|
||||||
publishVersion=15.2.0
|
publishVersion=15.2.0
|
||||||
buildCount=12
|
buildCount=17
|
||||||
baseBetaVersion=15.2.1
|
baseBetaVersion=15.2.1
|
||||||
|
@ -11,12 +11,11 @@ import android.util.JsonWriter;
|
|||||||
import cc.winboll.studio.autoinstaller.models.AppConfigs;
|
import cc.winboll.studio.autoinstaller.models.AppConfigs;
|
||||||
import cc.winboll.studio.autoinstaller.utils.FileUtil;
|
import cc.winboll.studio.autoinstaller.utils.FileUtil;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
|
import com.hjq.toast.ToastUtils;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import android.drm.DrmConvertedStatus;
|
|
||||||
import com.hjq.toast.ToastUtils;
|
|
||||||
|
|
||||||
public class AppConfigs implements Serializable {
|
public class AppConfigs implements Serializable {
|
||||||
|
|
||||||
@ -32,12 +31,13 @@ public class AppConfigs implements Serializable {
|
|||||||
Context mContext;
|
Context mContext;
|
||||||
|
|
||||||
AppConfigs(Context context) {
|
AppConfigs(Context context) {
|
||||||
mContext = context;
|
mContext = context.getApplicationContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized AppConfigs getInstance(Context context) {
|
public static synchronized AppConfigs getInstance(Context context) {
|
||||||
if (_AppConfigs == null) {
|
if (_AppConfigs == null) {
|
||||||
_AppConfigs = new AppConfigs(context);
|
_AppConfigs = new AppConfigs(context);
|
||||||
|
_AppConfigs.loadAppConfigs(_AppConfigs.mContext);
|
||||||
}
|
}
|
||||||
return _AppConfigs;
|
return _AppConfigs;
|
||||||
}
|
}
|
||||||
@ -137,11 +137,22 @@ public class AppConfigs implements Serializable {
|
|||||||
static String getDataPath(Context context) {
|
static String getDataPath(Context context) {
|
||||||
return context.getExternalFilesDir(TAG) + "/" + TAG + ".json";
|
return context.getExternalFilesDir(TAG) + "/" + TAG + ".json";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AppConfigs loadAppConfigs() {
|
||||||
|
AppConfigs appConfigs = null;
|
||||||
|
try {
|
||||||
|
String szJson = FileUtil.readFile(getDataPath(mContext));
|
||||||
|
appConfigs = AppConfigs.getInstance(mContext).parseAppConfigs(szJson);
|
||||||
|
} catch (IOException e) {
|
||||||
|
LogUtils.d(TAG, e.getMessage(), Thread.currentThread().getStackTrace());
|
||||||
|
}
|
||||||
|
return appConfigs;
|
||||||
|
}
|
||||||
|
|
||||||
public AppConfigs loadAppConfigs(Context context) {
|
public AppConfigs loadAppConfigs(Context context) {
|
||||||
AppConfigs appConfigs = null;
|
AppConfigs appConfigs = null;
|
||||||
try {
|
try {
|
||||||
String szJson = FileUtil.readFile(getDataPath(context));
|
String szJson = FileUtil.readFile(getDataPath(context.getApplicationContext()));
|
||||||
appConfigs = AppConfigs.getInstance(mContext).parseAppConfigs(szJson);
|
appConfigs = AppConfigs.getInstance(mContext).parseAppConfigs(szJson);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LogUtils.d(TAG, e.getMessage(), Thread.currentThread().getStackTrace());
|
LogUtils.d(TAG, e.getMessage(), Thread.currentThread().getStackTrace());
|
||||||
@ -159,7 +170,7 @@ public class AppConfigs implements Serializable {
|
|||||||
LogUtils.d(TAG, e.getMessage(), Thread.currentThread().getStackTrace());
|
LogUtils.d(TAG, e.getMessage(), Thread.currentThread().getStackTrace());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveAppConfigs() {
|
public void saveAppConfigs() {
|
||||||
saveAppConfigs(mContext, this);
|
saveAppConfigs(mContext, this);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user