Posted 17 February 2017 - 07:51 PM
craftAndroid - The OS for Adv. Pocket Computers
Information:
Spoiler
- This OS uses cLinux as it's "kernel", tho has its own "core" ontop of it, which manages all of the tasks in the taskmanager, installing packages and making notifications
- The core has 3 built-in buttons: back, home and the tasklist-button (which currently only shuts the system down)
- The home button automatically minimizes your current application, kills the old launcher-task and makes a new one (this is to refresh the applist for example)
- The back button queues an event, instead of really doing anything. This is useful for apps, as they have the ability to use that button for their own purpose (it queues "craftAndroid_back")
- The tasklist button currently only shuts the system down. (I plan on letting it start up a default taskmanager)
- You can make your own "app-launcher" / home-menu and make it the default one ("launcher" is the stock one and cannot be removed)
- There are 3 extra built-in apps that cannot be removed: settings, pastebin downloader (single file only) and notifier
- Settings currently allows you to customize the "launcher" app (background color and text color), to enable or disable the rednet API (but doesn't open the modem) and to remove user-made apps (system apps are not displayed)
- The pastebin downloader downloads a single file and installs it as an app
- The notifier lets you see notifications that are made by other apps (and app_crash) (NOTE: they aren't saved after a reboot)
- There is also a testingapp that makes a notification on startup (don't get scared when starting it, it's supposed to be a black screen, just press the homebutton)
The APIs available for apps:
lib.craftAndroid:
Spoiler
- lib.craftAndroid.goHome() Is the same as pressing the homebutton, the current app gets minimized, not killed
- lib.craftAndroid.taskmanager.runApp([string appName], [bool visible]) Tries to run an app. Displays the errorwindow if it failes (and it makes a notification)
- lib.craftAndroid.displayCrash([string appName]) Displays the errorwindow (It says: [appName] crashed.)
- lib.craftAndroid.udBackBtn(, ) Changes the colors of the back button
- lib.craftAndroid.udHomeBtn(, ) Changes the colors of the home button
- lib.craftAndroid.udTlBtn(, ) Changes the colors of the tasklist button
lib.candroid:
Spoiler
- lib.candroid.package.install([string encryptedPackage]) Installs a package
- lib.candroid.package.remove([string name]) Removes a package, if it's not a system-app
- lib.candroid.package.list() Returns a table of all installed packages (the keys are the names of the packages, the value is a table containing the type of the package and the size) Example:
local t = lib.candroid.package.list()
--Table of all packages
--The package "launcher" looks like this:
--t.launcher = {
-- type = "system",
-- size = 0,
--}
Information on packages:
Packages are simply SERIALIZED tables containing minimal metadata for the package and every file/folder it includes. They are also encrypted using the password "cAndroid". (Here is the encryption API)
Example package:
{
files = {
"startup",
},
folders = {
},
fileData = {
"print('hello')", --The fileData table is sorted for the order of the files, meaning that the first entry belongs to the first file in the files table
},
name = "myApp",
type = "user",
size = 0,
}
Now you only need to serialize and encrypt this table using the given APINOTE: If you want to use a custom icon for the app, make a file called "img" (should be inside the "root" of the package) (should be made with paint)
Credits:
PixelToast - The encryption API
Screenshots:
Here's a gallery.
Download / Code:
NOTE: There is currently no pastebin downloader, as it's still WIP and I didn't have the time for it. To download, download the ZIP from GitHub and put it into your folder of your Adv. Pocket Computer
GitHub