update cli template

This commit is contained in:
pengfei.zhou 2020-03-14 17:47:38 +08:00 committed by osborn
parent 80b9565f96
commit bcd1dd8844
2 changed files with 18 additions and 14 deletions

View File

@ -1,24 +1,17 @@
package pub.doric.example; package pub.doric.example;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity; import pub.doric.DoricActivity;
import pub.doric.DoricFragment;
public class MainActivity extends AppCompatActivity { public class MainActivity extends AppCompatActivity {
private final String BUNDLE_NAME = "__$__"; private final String BUNDLE_NAME = "__$__";
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
String source = "assets://src/" + BUNDLE_NAME + ".js"; String source = "assets://src/" + BUNDLE_NAME + ".js";
getIntent().putExtra("source", source); getIntent().putExtra("source", source);
getIntent().putExtra("alias", BUNDLE_NAME); getIntent().putExtra("alias", BUNDLE_NAME);
this.getSupportFragmentManager().beginTransaction().add(R.id.root, new DoricFragment()).commit(); super.onCreate(savedInstanceState);
}
} }
} }

View File

@ -1,5 +1,16 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root" android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<pub.doric.navbar.BaseDoricNavBar
android:id="@+id/doric_nav_bar"
android:layout_width="match_parent"
android:layout_height="44dp" />
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
</LinearLayout>