pride: creating injections

Pride Injections

In creating all injections, the package name is replaced with "BPpackage" and the parent activity name in the manifest is replaced with "BPparent". If the injection can be renamed, the relevant class name is replaced by "BoilerPlate", the file is renamed "BoilerPlate.java", and its reference in 4Parent.java is "BoilerPlate.class".

Activity Injections

Activities are injected by a single canonical script: pr_newActivity.sh. You can create new activity injections by using an existing activity injection as a template. These injection dirs have the following elements:

/4AndroidManifest.xml contains the activity's manifest elements and is injected into the main manifest of the project.

/Perms.xml contains all permissions needed by the activity and is injected into the manifest.

/Imports contains the java imports needed by /src/4Parent.java which is injected into the activity's parent activity.

/assets contents are copied into the projects assets dir which is created if necessary.

/libs contains any libs needed except for Android support libs. The Android support libs are soft-linked out to ~/.pride/plate/libs and must be supplied by the user. Other libs are included in the injection dir.

/res contains all subdirectories of res EXCEPT res/values* with all contents needed by the activity.

/src contains 4Parent.java which is injected into the parent activity's file, the activity's main java file which is BoilerPlate.java if it can be renamed, and all other java files for the activity. These can be in subpackage directories. See the existing injections for the use of BPpackage, BoilerPlate, and other changeable tokens used to create the namespace.

/values* contain the injectable portions of strings.xml, dimens.xml, etc. These files are named 4strings.xml, 4dimens.xml, etc. Currently values and values-large are handled by the canonical injection.

Finally, if your Activity should not be renamed, add its class name to the list near the top of pr_newActivity.sh

BETA NOTE: The Blank Activity does not use the canonical script. It is a beta which allows injection into package subdirectories. If it does not have a parent activity assigned, you will have to fix its entry in the AndroidManifest.xml. The parent and child both need the proper package import statements at this time. Only use this in subdirectories if you know what you are doing until it is out of beta.

App Injections

These are entire running apps injected in the top of the $PRIDE directory. To prepare an app for injection, you only need to remove any sensitive personal data, replacing it with boiler plate text. Then you need to fix the package name. If your app is org.this_voice.modabrowser.MoDaBrowser, copy the MoDaBrowser dir to /tmp and run:
pr_sr.sh tmp/MoDaBrowser org.this_voice BPpackage
Then move the dir from /tmp to [.pride dir]/plate/app.

Code Injections

Code injections have one to three pieces: code, import, and res. All three pieces must have the same name and go in the three code injection subdirs. Code injections with res bits must meet the naming convention for XML in Android. See the alert dialog injections dirs and note how they work with pr_newCode.sh for details.

Class Injections

Since these are simply Java files injected into the project, you need only replace the package name with "BPpackage" and drop the file in the plate/class dir.

Cluster Injections

Clusters are groups of activities injected as a whole. Their injection directories are prepared exactly like Activity injections. They are not renamable.

Object Injections

These are services, receivers, providers and other non-activity constructs. Each has its own pr_objObjectName.sh script for injection. At this point there are about three different kinds of object injection as you can see from examining the scripts. When there are enough more objects to see the trends more clearly, these should split out into canonical injections. But for now, each must have its own script.

Permission Injections

These are all possible perms for the AndroidManifest.xml file and will be updated as they are altered by the Android system.

XML Injections

These are broken out into EditText, Layout, View, and Widget. Each type has a subdir in the plate directory. Elements are injected at the end of the chosen layout file. The XML injections include all Android 8 compatible GUI elements from eclipse.

NOTE: Project Injection Directory

The project injection is pride's baseline injection for new projects and should not be altered as it is overwritten with each pride update's installation.