OSDN Git Service

Enable an initial command string to be passed as part of the intent.
authorJack Palevich <jackpal@google.com>
Sat, 25 Jun 2011 11:45:32 +0000 (19:45 +0800)
committerJack Palevich <jackpal@google.com>
Sat, 25 Jun 2011 11:45:32 +0000 (19:45 +0800)
Thanks to Christoph Schmidt-Hieber, M.D., c.schmidt-hieber@ucl.ac.uk
for the idea and the patch.

src/jackpal/androidterm/Term.java

index d0b2f8a..1f577f2 100644 (file)
@@ -313,6 +313,18 @@ public class Term extends Activity {
 
         mEmulatorView.initialize(mTermFd, mTermOut);
 
+        /* Check whether we've received an initial command from the
+         * launching application
+         */
+        String iInitialCommand = getIntent().getStringExtra("jackpal.androidterm.iInitialCommand");
+        if (iInitialCommand != null) {
+            if (mInitialCommand != null) {
+                mInitialCommand += "\r" + iInitialCommand;
+            } else {
+                mInitialCommand = iInitialCommand;
+            }
+        }
+
         sendInitialCommand();
     }