player
This commit is contained in:
parent
9691b7b907
commit
586583ddfd
|
@ -17,7 +17,7 @@ public class BackView extends View {
|
|||
public BackView(Context context, int width, int height) {
|
||||
super(context);
|
||||
img = BitmapFactory.decodeResource(context.getResources(), R.drawable.back, Util.noScaled);
|
||||
cosImg = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory() + "/XixunPlayer/background", Util.noScaled);
|
||||
cosImg = BitmapFactory.decodeFile(Util.backImgFile, Util.noScaled);
|
||||
rect.right = width;
|
||||
rect.bottom = height;
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ public class MainActivity extends Activity implements Choreographer.FrameCallbac
|
|||
if(requestCode==999 && grantResults.length > 0 && grantResults[0]==PackageManager.PERMISSION_GRANTED && backView==null) init();
|
||||
}
|
||||
|
||||
ConnService connService;
|
||||
ConnService serviXy;
|
||||
|
||||
@SuppressLint("UnspecifiedRegisterReceiverFlag")
|
||||
public void init() {
|
||||
|
@ -156,12 +156,12 @@ public class MainActivity extends Activity implements Choreographer.FrameCallbac
|
|||
|
||||
var cardConn = new ServiceConnection() {
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
Util.println("Disconnected cardsystem aidl service");
|
||||
Util.println("<-<- AIDL Service cardsystem Disconnected");
|
||||
}
|
||||
|
||||
public void onServiceConnected(ComponentName name, IBinder iBinder) {
|
||||
unbindService(this);
|
||||
Util.println("Bind cardsystem aidl service success");
|
||||
Util.println("->-> AIDL Service cardsystem aidl service Connected");
|
||||
var service = CardService.Stub.asInterface(iBinder);
|
||||
try {
|
||||
Util.isScreenOn = service.isScreenOpen();
|
||||
|
@ -182,17 +182,17 @@ public class MainActivity extends Activity implements Choreographer.FrameCallbac
|
|||
intent.setPackage("com.xixun.joey.cardsystem");
|
||||
bindService(intent, cardConn, Context.BIND_AUTO_CREATE);
|
||||
|
||||
var connConn = new ServiceConnection() {
|
||||
var connXy = new ServiceConnection() {
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
Util.println("Disconnected xy.conn aidl service");
|
||||
connService = null;
|
||||
Util.println("<-<- AIDL Service xy.conn Disconnected");
|
||||
serviXy = null;
|
||||
}
|
||||
public void onServiceConnected(ComponentName name, IBinder iBinder) {
|
||||
unbindService(this);
|
||||
Util.println("Bind xy.conn aidl service success");
|
||||
connService = ConnService.Stub.asInterface(iBinder);
|
||||
Util.println("->-> AIDL Service xy.conn Connected");
|
||||
serviXy = ConnService.Stub.asInterface(iBinder);
|
||||
try {
|
||||
Util.serverURL = connService.getServerURL();
|
||||
Util.serverURL = serviXy.getServerURL();
|
||||
Util.println(" ServerURL: "+Util.serverURL);
|
||||
if(Util.serverURL==null || Util.serverURL.isEmpty()) Util.serverURL = "https://m2mled.net/";
|
||||
else {
|
||||
|
@ -205,9 +205,9 @@ public class MainActivity extends Activity implements Choreographer.FrameCallbac
|
|||
}
|
||||
}
|
||||
};
|
||||
intent = new Intent("xixun.intent.action.CONNECTION_INFO");
|
||||
intent.setPackage("com.xixun.xy.conn");
|
||||
bindService(intent, connConn, Context.BIND_AUTO_CREATE);
|
||||
var intenXy = new Intent("xixun.intent.action.CONNECTION_INFO");
|
||||
intenXy.setPackage("com.xixun.xy.conn");
|
||||
bindService(intenXy, connXy, Context.BIND_AUTO_CREATE);
|
||||
|
||||
reces.clear();
|
||||
BroadcastReceiver rece;
|
||||
|
@ -238,19 +238,22 @@ public class MainActivity extends Activity implements Choreographer.FrameCallbac
|
|||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Util.println("Receive CHANGE_COMPANYID");
|
||||
if(connService!=null) {
|
||||
try {
|
||||
Util.serverURL = connService.getServerURL();
|
||||
try {
|
||||
if(serviXy!=null && serviXy.asBinder().isBinderAlive()) {
|
||||
Util.serverURL = serviXy.getServerURL();
|
||||
Util.println(" ServerURL: "+Util.serverURL);
|
||||
if(Util.serverURL==null || Util.serverURL.isEmpty()) Util.serverURL = "https://m2mled.net/";
|
||||
else {
|
||||
if(! Util.serverURL.startsWith("http")) Util.serverURL = "http://"+Util.serverURL;
|
||||
if(! Util.serverURL.endsWith("/")) Util.serverURL += "/";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Util.makeText(MainActivity.this, Util.toStr(e)).show();
|
||||
Util.printStackTrace(e);
|
||||
} else {
|
||||
Util.println(" bindService");
|
||||
bindService(intenXy, connXy, Context.BIND_AUTO_CREATE);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Util.makeText(MainActivity.this, Util.toStr(e)).show();
|
||||
Util.printStackTrace(e);
|
||||
}
|
||||
}
|
||||
}, new IntentFilter("com.xixun.joey.CHANGE_COMPANYID"));
|
||||
|
|
|
@ -179,6 +179,15 @@ public class Prog extends AbsLayout {
|
|||
}
|
||||
if(src.exitDur!=0) src.exitStart = dur*60/1000 - src.exitDur;
|
||||
|
||||
src.alpha = (float) source.dbl("opacity", 1);
|
||||
var breathe = source.dbl("breathe");
|
||||
if(breathe > 0) src.breathe = (int) Math.round(60 / breathe);
|
||||
var blink = source.dbl("blink");
|
||||
if(blink > 0) src.blinkHalf = (int) Math.round(30 / blink);
|
||||
src.rotate = (float) source.dbl("rotate");
|
||||
src.scaleX = (float) source.dbl("scaleX", 1);
|
||||
src.scaleY = (float) source.dbl("scaleY", 1);
|
||||
|
||||
var id = source.str("id");
|
||||
var fileExt = source.stnn("fileExt");
|
||||
if(id!=null && fileExt.startsWith(".") && new File(Util.programDir + "/" + id + fileExt).exists()) id += fileExt;
|
||||
|
@ -266,6 +275,12 @@ public class Prog extends AbsLayout {
|
|||
src.exitStart = ele0.exitStart;
|
||||
src.isEntryRand = ele0.isEntryRand;
|
||||
src.isExitRand = ele0.isExitRand;
|
||||
src.alpha = ele0.alpha;
|
||||
src.breathe = ele0.breathe;
|
||||
src.blinkHalf = ele0.blinkHalf;
|
||||
src.rotate = ele0.rotate;
|
||||
src.scaleX = ele0.scaleX;
|
||||
src.scaleY = ele0.scaleY;
|
||||
}
|
||||
src.endTime = src.startTime + picDur;
|
||||
if(hasTTS) {
|
||||
|
@ -352,14 +367,6 @@ public class Prog extends AbsLayout {
|
|||
if(src.view==null) continue;
|
||||
src.view.setVisibility(GONE);
|
||||
src.view.setLayoutParams(geo);
|
||||
src.alpha = (float) source.dbl("opacity", 1);
|
||||
var breathe = source.dbl("breathe");
|
||||
if(breathe > 0) src.breathe = (int) Math.round(60 / breathe);
|
||||
var blink = source.dbl("blink");
|
||||
if(blink > 0) src.blinkHalf = (int) Math.round(30 / blink);
|
||||
src.rotate = (float) source.dbl("rotate");
|
||||
src.scaleX = (float) source.dbl("scaleX", 1);
|
||||
src.scaleY = (float) source.dbl("scaleY", 1);
|
||||
box.addView(src.view);
|
||||
layer.srcs.add(src);
|
||||
src = new Source();
|
||||
|
|
|
@ -19,7 +19,7 @@ public class SrcSensor extends WebView implements IntentReceiver, Choreographer.
|
|||
static String directs[] = {"NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW", "N"};
|
||||
MainActivity act;
|
||||
ArrayList<String> htmls;
|
||||
String prefix, suffix, url, text;
|
||||
String prefix, url, text;
|
||||
int interval, pageDur, cur;
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
|
@ -34,7 +34,6 @@ public class SrcSensor extends WebView implements IntentReceiver, Choreographer.
|
|||
|
||||
var html = json.stnn("html").replace("%Co2", "%CO2").trim();
|
||||
htmls = Txts.split(html, "</p>", 1);
|
||||
for(int i=0; i<htmls.size(); i++) htmls.set(i, htmls.get(i)+"</p>");
|
||||
pageDur = json.intg("speed")*1000;
|
||||
if(pageDur==0) pageDur = json.intg("timeSpan")*1000 / htmls.size();
|
||||
url = json.str("sUrl");
|
||||
|
@ -49,14 +48,11 @@ public class SrcSensor extends WebView implements IntentReceiver, Choreographer.
|
|||
Util.printStackTrace(e);
|
||||
}
|
||||
}
|
||||
prefix = "<body style=\"color:#fff;margin:0;padding:0;";
|
||||
prefix = "<body style=\"color:#fff; margin:0;padding:0;";
|
||||
var lineHeight = json.str("lineHeight");
|
||||
if(lineHeight!=null) prefix += "line-height:"+lineHeight+";";
|
||||
prefix += "width:"+width+"; height:"+height+"; position:relative;\"><div id=\"ppp\" style=\"position:absolute;\">";
|
||||
suffix = "</div></body>";
|
||||
if(json.bool("center")) suffix += "<script>window.onload = function() { var ppp = document.getElementById(\"ppp\");\n" +
|
||||
" ppp.style.top = ("+height+"-ppp.offsetHeight)/2+'px';\n" +
|
||||
"};</script>";
|
||||
if(json.bool("center")) prefix += "display:flex; align-items:center;";
|
||||
prefix += "\">";
|
||||
prog.calls.add(this);
|
||||
}
|
||||
|
||||
|
@ -116,7 +112,7 @@ public class SrcSensor extends WebView implements IntentReceiver, Choreographer.
|
|||
.replace("%radiation", (radiation == -1 ? "--" : String.valueOf(radiation))+"W/m²")
|
||||
.replace("%bm", (beam == -1 ? "--" : String.valueOf(beam))+"lux");
|
||||
|
||||
loadDataWithBaseURL(null, prefix+htm+suffix, "text/html", "UTF-8", null);
|
||||
loadDataWithBaseURL(null, prefix+htm+"</p></body>", "text/html", "UTF-8", null);
|
||||
} catch (Exception e) {
|
||||
Util.printStackTrace(e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user