This commit is contained in:
Gangphon 2024-03-05 16:50:07 +08:00
parent d100a67bf7
commit 05ff5a7488
4 changed files with 20 additions and 9 deletions

View File

@ -8,10 +8,10 @@ android {
defaultConfig {
applicationId "com.xixun.xixunplayer"
minSdk 24
minSdk 21
targetSdk 34
versionCode 1
versionName "1.0.23-sche"
versionName "1.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@ -13,6 +13,7 @@
<application
android:allowBackup="true"
android:usesCleartextTraffic="true"
android:launchMode="singleTop"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"

View File

@ -309,7 +309,7 @@ public class MainActivity extends ComponentActivity implements Choreographer.Fra
}
} catch (FileNotFoundException e) {
state = 3;
Util.printStackTrace(e);
Util.println(""+e);
} catch (Throwable e) {
state = 7;
Util.makeText(this, Util.toStr(e)).show();
@ -319,13 +319,17 @@ public class MainActivity extends ComponentActivity implements Choreographer.Fra
public void initProg(byte[] json) {
try {
Util.println("\nParse Prog Json");
var task = JSMap.from(json).jsmap("task");
var root = JSMap.from(json);
var task = root.jsmap("task");
if(task==null) {
if(! root.containsKey("layers")) {
state = 7;
Util.println(" Error: task==null\n");
Util.println(new String(json, Chsets.UTF8));
return;
}
task = new JSMap("items", new JSList<>(new JSMap("repeatTimes", 1, "_program", root)));
}
var view = new Prog(task, this);
if(view.getChildCount()==0) {
state = 7;

View File

@ -233,7 +233,13 @@ public class Server extends Service {
} else if(_type.equals("SetPlayerBackground")) {
var url = json.str("url");
if(url==null) new File(Util.backImgFile).delete();
else IOs.writeClose(new FileOutputStream(Util.backImgFile), new URLConn(url).in());
else {
var fout = new FileOutputStream(Util.backImgFile);
IOs.write(fout, new URLConn(url).in());
fout.flush();
fout.getFD().sync();
fout.close();
}
MainActivity.ins.runOnUiThread(() -> {
MainActivity.ins.backView.cosImg = url==null ? null : BitmapFactory.decodeFile(Util.backImgFile);
MainActivity.ins.backView.invalidate();