Poor Richard's Independent anDroid Environment

May 20, 2013 - what it does, all in a zip or tarfile and email it to the Contact email address below. Fixes, .... List Activity: evsiz + stub and import in Parent.java.
339KB taille 3 téléchargements 290 vues
pride: Poor Richard's Independent anDroid Environment

1 of 7

Afficher cette page en : français

http://this-voice.org/alchemy/pride.html

Traduire

Désactiver pour : anglais

Options ▼

Sélectionner une langue ▼

alchemy

eBooks pride

Poor Richard's Independent anDroid Environment

Current Version: 0.5.9 Download latest version

Changes to project plate res/values/themes.xml added drawables launcher icon

This page is the only INSTALL file and man page for pride Pride combines medit, bash scripts, zenity, and the android tools to create a light and coherent environment for Android development. It uses only devices (no glacially slow AVDs) and includes only buildable and runnable injections of code. All the pieces come ready to run and gun. Pride is for hands-on GNUheads who are comfortable with bash scripts and the command-line. For changes, updates, bug reports and suggestions, see pride's blog. You can get update notifications by following the project on freshmeat, er, freecode...

05/20/2013 11:45 PM

pride: Poor Richard's Independent anDroid Environment

2 of 7

http://this-voice.org/alchemy/pride.html

Pride is not a movement back into emacs, screen and ansi C style work. We are moving beyond eclipse here, not back from it. You can already create a new project, inject my plate, inject code , edit its trigger, build, run, and Bob's your uncle. Here is how you add to it. Create a new project. Make the pride boilerplate injection work for you. Then take your own whatsit. Put it in the right .pride/plate directory and create pr_xxxWhatsit.sh if you need to in the scripts directory. Then import the whole thing into eclipse (instructions below). Now let the millions of dollars Google is spending on eclipse, android, and their own eventual destruction help you make your whatsit work. To import a pride project into eclipse: 1. 2. 3. 4. 5. 6. 7.

Create new eclipse project with duplicate names for project and main activity. Open both project directories and view hidden files in both. Merge the AndroidManifest.xmls by hand, keeping the eclipse header intact. For the remainder, if it is in both, delete the eclipse version. If it is only in eclipse, KEEP IT. You need it. Copy all pride files, except .name, .package and build log, into eclipse. Refresh the eclipse project.

When it builds and runs, merge it back into your boilerplate and shell script. Then you can create a project, inject the plate, inject your own whatsit, edit its trigger, build, run, and Robert will be your father's brother. And as soon as you see how things work in pride, you will only need eclipse if you are integrating something difficult.

the boilerplate The files in .pride/plate/project make it possible for pride to work with everyone's projects and for everyone to have their own plate in that directory. Pride assumes injection of .pride/plate/project. The option for not injecting this plate is necessary for working with pride. But Pride::Injection only works if the new project script injects the plate. You will want your own script that creates your own plate from the install plate. Any changes to the project plate baseline will be announced at the top of the page.

your contribs YOU SHOULD CONTRIBUTE YOUR INJECTIONS. Because we are GNUed here, you can contribute your whatsit to pride. Merge your contribution COMPLETELY with the download of pride_install. Make it buildable and runnable, even with the PRA style. This is important. We need a baseline that allows us to create these individual conversion scripts that move the baseline to what works for each of us. Useful contributions that do not duplicate other contributions and conform COMPLETELY with the baseline pride_install will be included in pride. Improvements to existing contributions will replace existing ones. To contribute your injections to the project, include the buildable and runnable injection alone in a copy of its .pride/plate/* directory, its pr_xxxWhatsit.sh and a README about what it does, all in a zip or tarfile and email it to the Contact email address below. Fixes, 05/20/2013 11:45 PM

pride: Poor Richard's Independent anDroid Environment

3 of 7

http://this-voice.org/alchemy/pride.html

tell me what to expect. I'll inject your contrib into a fresh new baseline project, build, and run. If it runs, I'll add it to pride. If it doesn't show up in the install, it didn't run. All code tested on Android 2.3.6 and 4.1.1.

the assumptions 1. 2. 3. 4. 5. 6.

Projects are in $PRIDE Project Name is in $PRIDE/Name Project Name has a main launcher activity Name in Name.java All elements work in all android versions without version-forks New projects inject the project plate Activities have parent activities

the dependencies You will need the Android SDK that you have been using. And eclipse will remain helpful, mostly for building complex UI bits. Beyond the SDK binaries required for making apps, pride uses the following:

medit

Medit allows you to integrate bash, lua or python scripts into its menu. It has multiple tabs and an optional split-document interface. The Pride tool system will go into the medit Tools menu. You can use pride without medit by running its scripts in a terminal. You will have to use "export DATA_DIR=$HOME" if you do this.

zenity

Zenity is a graphical dialog system for shell scripts. It is the glue that holds Pride together. Make sure that zenity is actually running by using one of the man-page examples before installing pride. Zenity's dependencies are not well-documented. Also, zenity is a piece of dog poopoo. It generates an unbelievable amount of data in ~/.xsession-errors. (Really. You wouldn't believe me.) You will want to remove .xsession-errors regularly from .xinitrc or .profile.

bash

05/20/2013 11:45 PM

pride: Poor Richard's Independent anDroid Environment

4 of 7

http://this-voice.org/alchemy/pride.html

must have /bin/bash to use pride. Yeah, yeah, I hear you. But there are people who actually don't have bash and are scary with C. Maybe they want to play too.

using pride without medit Pride is just a hierarchy of bash scripts called from medit and glued together with zenity. You can run the scripts from the command line or from another editor. You will still need zenity. Here's the top of the script chain: Pride::Project - pr_project.sh Pride::Snapshot - pr_snapshot.sh Pride::Injection - pr_injection.sh Pride::Imports - pr_imports.sh Pride::Build - rxvt -geometry 132x40 -e pr_build.sh Pride::Lint - pr_lint.sh Pride::Run - pr_run.sh Pride:Clean - pr_clean.sh Pride::Uninstall - pr_uninstall.sh Pride::Release - rxvt -e pr_release.sh

the installation All files unzip to ./pride_install. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.

cp ./pride_install/pride to ~/.pride cp ./pride_install/scripts/* to ~/.local/share/medit-1/scripts/ chmod 700 .local/share/medit-1/scripts/* set all vars in ~/.pride/pride.rc (do not use ~/, only $HOME) link ~/.local/share/medit-1/scripts/pride to desktop set its icon to ~/.pride/pride.png alter ~/.pride/plate/project to suit (See "the boilerplate" above.) merge pride's menu.xml with the one in ~/.local/share/medit-1 set your terminal app in menu.xml in those pride tools that use one enable ctags in medit plugins (ctags stuff is coming...)

the tools Pride is as simple as possible. All scripts reside in ~/.local/share/medit-1/scripts. The rc file, ~/.pride/pride.rc is sourced to allow the scripts to run in a spawned, environmentless bash shell.

Pride::Help Displays project information and points you to this page.

Pride::Project 05/20/2013 11:45 PM

pride: Poor Richard's Independent anDroid Environment

5 of 7

http://this-voice.org/alchemy/pride.html

Select

Sets the current project for the pride system. Changed here or by creating a new project. Backup

Uses zenity to select a project "Name" then calls "backupProject.sh Name". You must create your own backupProject.sh script. New

Creates a project with `android` and injects your personal boiler-plate from ~/.pride/plate /project. Sets current project. Leaving the domain field blank makes pride.rc's DOMAIN the domain. All new elements come buildable and runnable with pride's baseline plate injection. Import

Imports a project from $IMPORTS (usually ~/workspace). This will duplicate the eclipse-based project in $PRIDE. Your main launcher activity must be com.example.name.Name.java to work with pride. You need to make any namespace changes to your app correctly or you will break it in Android - Google Play namespace.

Pride::Snapshot Backs up and restores a project to directory $SNAPSHOT defined by you in pride.rc

Pride::Injection Used to inject new elements into projects. You must inject the new project plate for these to build and run. Activity

Activity injections from eclipse and contribs. Leaving the parent field in the Activity form blank makes the main activity the parent. Blank Activity: eclipse + stub and import in Parent.java FileChooserDialog Activity: ScR4tCh + stub and imports in Parent.java Flashcard Activity: evsiz + stub and import in Parent.java FullScreen Activity: eclipse + stub and import in Parent.java List Activity: evsiz + stub and import in Parent.java Login Activity: eclipse + stub and import in Parent.java MessengerService Activity: brazil + stub and import in Parent.java ReaderView Activity: evsiz + stub and import in Parent.java Settings Activity: eclipse + stub and import in Parent.java 05/20/2013 11:45 PM

pride: Poor Richard's Independent anDroid Environment

6 of 7

http://this-voice.org/alchemy/pride.html

Object

Object injections from eclipse and contribs. BatteryService: evsiz with settings activity BroadcastReceiver: eclipse + PHONE_STATE buildable example ContentProvider: eclipse NetworkService: evsiz with settings activity Notification: eclipse Service: eclipse Code

Injects contents of .pride/plate/code/code|imports/fname into $parent. Allows multiple injections. Current list: AlertDialog_TextEditCancel AlertDialog_TextEditClearCancel AlertDialog_YesNo emailDeveloper findViews onActivityResult onBackPressed (hit twice to exit with Toast) onDestroy onPause onRestart onResume onStart onStop toaster webHelp Important

With injections which are not yet used in my own projects, I am not removing the "if HONEYCOMB" and related bits. If you like these bits, you MUST keep your own working copies. Anything I use will be altered to my one-version-runs-everywhere in the code, styles, etc, and those iffy bits will be removed from the pride installation.

Pride::Imports Place a "#" in front of any number of Java objects like "#Button" or "#AlertDialog.Builder". You can have more than one on a line. Hit Pride::Imports. Hit F5 to refresh the file. Imports are inserted just before the main class declaration after existing imports. And thanks to Zabri who made the import list when I asked on stackoverflow where I could find one.

05/20/2013 11:45 PM

pride: Poor Richard's Independent anDroid Environment

7 of 7

http://this-voice.org/alchemy/pride.html

Runs `ant debug` in a spawned shell and leaves "pr_build.log" in the current project root.

Pride::Lint Runs `lint -Wall` to generate an HTML report and loads that report into $BROWSER.

Pride::Run Loads the current project onto the connected device with adb without removing the data, and starts its main activity. It does NOT rebuild the debug apk. Uses `rxvt`. Change to suit yourself. Set your logcat watch flags in the script. See the docs.

Pride::Clean Runs `ant clean`. No other command includes "clean"

Pride::Uninstall Removes current project from the device but leaves its cache and data in place.

Pride::Release Uses $RELEASE_KEY* in pride.rc to create a signed, ready for upload-to-market APK.

support this project If you want to support pride with loot instead of code, go get yourself one of my apps on Google Play. Or one of my books for Kindle. Think of it as a free whatsit with every little donation.

contact Email pride.

1 You are alone with your own being and the reality of things. - Mary Baker Eddy Noir:QRdvark

05/20/2013 11:45 PM