feat:update template
This commit is contained in:
parent
403e7c3a02
commit
458638bd42
@ -31,4 +31,13 @@ android {
|
|||||||
implementation "pub.doric:core:0.1.0"
|
implementation "pub.doric:core:0.1.0"
|
||||||
debugImplementation "pub.doric:core:0.1.0"
|
debugImplementation "pub.doric:core:0.1.0"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
buildJSBundle.exec()
|
||||||
|
}
|
||||||
|
|
||||||
|
task buildJSBundle(type: Exec) {
|
||||||
|
workingDir project.rootDir.getParent() + "/js"
|
||||||
|
commandLine 'doric', 'build'
|
||||||
}
|
}
|
@ -5,17 +5,29 @@ import android.os.Bundle;
|
|||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import pub.doric.DoricPanel;
|
import pub.doric.DoricFragment;
|
||||||
import pub.doric.utils.DoricUtils;
|
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
private final String BUNDLE_NAME = "__$__";
|
private final String BUNDLE_NAME = "__$__";
|
||||||
|
private DoricFragment doricFragment;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
DoricPanel doricPanel = findViewById(R.id.doric_panel);
|
if (savedInstanceState == null) {
|
||||||
doricPanel.config(DoricUtils.readAssetFile(BUNDLE_NAME + ".js"), BUNDLE_NAME);
|
String scheme = "assets://" + BUNDLE_NAME + ".js";
|
||||||
|
this.doricFragment = DoricFragment.newInstance(scheme, BUNDLE_NAME);
|
||||||
|
this.getSupportFragmentManager().beginTransaction().add(R.id.root, this.doricFragment).commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
if (this.doricFragment.canPop()) {
|
||||||
|
this.doricFragment.pop();
|
||||||
|
} else {
|
||||||
|
super.onBackPressed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<pub.doric.DoricPanel xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/doric_panel"
|
android:id="@+id/root"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
@ -1,7 +1,7 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
import { Panel, Group, vlayout, layoutConfig, Gravity, IVLayout, text, Text, Color } from "doric";
|
import { Panel, Group, vlayout, layoutConfig, Gravity, IVLayout, text, Text, Color, navbar } from "doric";
|
||||||
|
|
||||||
@Entry
|
@Entry
|
||||||
class __$__ extends Panel {
|
class __$__ extends Panel {
|
||||||
|
onShow() {
|
||||||
|
navbar(context).setTitle("__$__")
|
||||||
|
}
|
||||||
build(rootView: Group): void {
|
build(rootView: Group): void {
|
||||||
let number: Text
|
let number: Text
|
||||||
let count = 0
|
let count = 0
|
||||||
|
Reference in New Issue
Block a user