diff --git a/Android/app/src/main/java/pub/doric/demo/MainActivity.java b/Android/app/src/main/java/pub/doric/demo/MainActivity.java index 59a6ce2d..340e94ff 100644 --- a/Android/app/src/main/java/pub/doric/demo/MainActivity.java +++ b/Android/app/src/main/java/pub/doric/demo/MainActivity.java @@ -32,6 +32,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import pub.doric.DoricActivity; import pub.doric.utils.DoricUtils; public class MainActivity extends AppCompatActivity { @@ -46,6 +47,7 @@ public class MainActivity extends AppCompatActivity { try { String[] demos = getAssets().list("demo"); List ret = new ArrayList<>(); + ret.add("Navigator"); for (String str : demos) { if (str.endsWith("js")) { ret.add(str); @@ -89,6 +91,11 @@ public class MainActivity extends AppCompatActivity { tv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + if (position == 0) { + Intent intent = new Intent(tv.getContext(), DoricActivity.class); + tv.getContext().startActivity(intent); + return; + } Intent intent = new Intent(tv.getContext(), DemoActivity.class); intent.putExtra("source", data[position]); tv.getContext().startActivity(intent); diff --git a/Android/doric/src/main/AndroidManifest.xml b/Android/doric/src/main/AndroidManifest.xml index cf6aef36..ec029524 100644 --- a/Android/doric/src/main/AndroidManifest.xml +++ b/Android/doric/src/main/AndroidManifest.xml @@ -1 +1,16 @@ - \ No newline at end of file + + + + + + + + + + + + + + + diff --git a/Android/doric/src/main/java/pub/doric/DoricActivity.java b/Android/doric/src/main/java/pub/doric/DoricActivity.java new file mode 100644 index 00000000..ee23f8f3 --- /dev/null +++ b/Android/doric/src/main/java/pub/doric/DoricActivity.java @@ -0,0 +1,45 @@ +/* + * Copyright [2019] [Doric.Pub] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pub.doric; + +import android.os.Bundle; + +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.Fragment; + +/** + * @Description: pub.doric.demo + * @Author: pengfei.zhou + * @CreateDate: 2019-11-19 + */ +public class DoricActivity extends AppCompatActivity { + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.doric_activity); + if (savedInstanceState == null) { + Fragment doricFragment = getSupportFragmentManager().getFragmentFactory().instantiate( + getClassLoader(), + DoricFragment.class.getName() + ); + getSupportFragmentManager().beginTransaction() + .add(R.id.container, doricFragment) + .commit(); + } + } +} diff --git a/Android/doric/src/main/java/pub/doric/DoricFragment.java b/Android/doric/src/main/java/pub/doric/DoricFragment.java new file mode 100644 index 00000000..806c6800 --- /dev/null +++ b/Android/doric/src/main/java/pub/doric/DoricFragment.java @@ -0,0 +1,47 @@ +/* + * Copyright [2019] [Doric.Pub] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pub.doric; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.FrameLayout; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; + +/** + * @Description: pub.doric + * @Author: pengfei.zhou + * @CreateDate: 2019-11-23 + */ +public class DoricFragment extends Fragment { + private FrameLayout root; + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + root = (FrameLayout) inflater.inflate(R.layout.doric_fragment, container, false); + return root; + } +} diff --git a/Android/doric/src/main/res/layout/doric_activity.xml b/Android/doric/src/main/res/layout/doric_activity.xml new file mode 100644 index 00000000..54b71a1b --- /dev/null +++ b/Android/doric/src/main/res/layout/doric_activity.xml @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/Android/doric/src/main/res/layout/doric_fragment.xml b/Android/doric/src/main/res/layout/doric_fragment.xml new file mode 100644 index 00000000..0f36c22b --- /dev/null +++ b/Android/doric/src/main/res/layout/doric_fragment.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file