add: build apk from js file

This commit is contained in:
hyb1996
2017-10-24 15:49:45 +08:00
parent 448d39b7e8
commit 9077e4928d
9 changed files with 275 additions and 16 deletions

View File

@@ -2,6 +2,7 @@ package com.stardust.autojs.runtime.api.ui;
import android.content.Context;
import android.text.InputType;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
@@ -11,10 +12,19 @@ import com.stardust.autojs.runtime.api.ui.widget.JsFrameLayout;
import com.stardust.autojs.runtime.api.ui.xml.XmlConverter;
import com.stardust.util.MapEntries;
import org.xml.sax.SAXException;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
import java.io.IOException;
import java.io.StringReader;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import javax.xml.parsers.ParserConfigurationException;
/**
* Created by Stardust on 2017/5/14.
*/
@@ -33,10 +43,10 @@ public class ConvertLayoutInflater implements JsLayoutInflater {
.entry("password", InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_CLASS_TEXT)
.entry("email", InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS | InputType.TYPE_CLASS_TEXT)
.entry("date", InputType.TYPE_DATETIME_VARIATION_DATE | InputType.TYPE_CLASS_DATETIME)
.entry("time", InputType.TYPE_DATETIME_VARIATION_TIME| InputType.TYPE_CLASS_DATETIME)
.entry("time", InputType.TYPE_DATETIME_VARIATION_TIME | InputType.TYPE_CLASS_DATETIME)
.map();
@Override
@Override
public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) {
if (!(view instanceof TextView))
return;
@@ -56,6 +66,7 @@ public class ConvertLayoutInflater implements JsLayoutInflater {
@Override
public View inflate(Context context, String xml) {
try {
String androidLayoutXml = XmlConverter.convertToAndroidLayout(xml);
JsFrameLayout root = new JsFrameLayout(context);