Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize README #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,25 @@

Android Dynamic Loader is a plugin system. The host application is like a browser, but instead of load web pages, it load plugins which runs natively on Android system.

This implementation is using Andoid .apk file as plugin container.

You can download the demo from <https://github.com/mmin18/AndroidDynamicLoader/raw/master/host.apk> (35k).

![HelloWorldDemo](https://raw.github.com/mmin18/AndroidDynamicLoader/master/HelloWorldDemo.png)

![BitmapFunDemo](https://raw.github.com/mmin18/AndroidDynamicLoader/master/BitmapFunDemo.png)

## Folders

`/Host` contains the host application (build as host.apk).

`/tools/update.sh` checks your environment and helps you config your plugins. You should always run it once after git clone or create a new plugin.

`/workspace/sample.helloworld` is a most simple plugin.
`/workspace/sample.helloworld/fragment.properties` defines the url mapping of your fragments.

`/site/***/site.txt` is the definition file for all the plugins files, dependency and fragments url mapping table.

## How to run the sample plugins

The sample plugins is under **workspace** folder, but do not try to run them directly, it won't start.
Expand Down Expand Up @@ -37,19 +50,6 @@ Once the plugin and its dependency is downloaded, an Activity (MainActivity.java

See the [HelloFragment.java](https://github.com/mmin18/AndroidDynamicLoader/blob/master/workspace/sample.helloworld/src/sample/helloworld/HelloFragment.java) sample.

## About URL Mapping

Since we use Fragment as UI container, each page is implemented in Fragment instead of Activity. So how do we start a new page?

We use URL, just like a browser does. For instance, in a browser, we open `http://mydomain.com/helloworld.html`. In plugins, we open `app://helloworld`.

Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("app://helloworld"));
startActivity(i);

Each host is mapped to a single fragment, you define the url mapping table in **project/fragment.properties**.

See the [helloworld fragment.properties](https://github.com/mmin18/AndroidDynamicLoader/blob/master/workspace/sample.helloworld/fragment.properties) sample.

## About Resources

In the plugins, we pack resources and codes in the same package. We use R.java as the index of resources.
Expand Down Expand Up @@ -77,14 +77,16 @@ Here is a sample in HelloFragment.java

You can use MyResources to get drawable, string, or inflate layout.

## Folders

`/Host` contains the host application (build as host.apk).
## About URL Mapping

`/tools/update.sh` checks your environment and helps you config your plugins. You should always run it once after git clone or create a new plugin.
Since we use Fragment as UI container, each page is implemented in Fragment instead of Activity. So how do we start a new page?

`/workspace/sample.helloworld` is a most simple plugin.
`/workspace/sample.helloworld/fragment.properties` defines the url mapping of your fragments.
We use URL, just like a browser does. For instance, in a browser, we open `http://mydomain.com/helloworld.html`. In plugins, we open `app://helloworld`.

`/site/***/site.txt` is the definition file for all the plugins files, dependency and fragments url mapping table.
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("app://helloworld"));
startActivity(i);

Each host is mapped to a single fragment, you define the url mapping table in **project/fragment.properties**.

See the [helloworld fragment.properties](https://github.com/mmin18/AndroidDynamicLoader/blob/master/workspace/sample.helloworld/fragment.properties) sample.