diff options
author | Joey Hess <joey@kitenet.net> | 2013-05-28 18:25:27 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-05-28 18:25:27 -0400 |
commit | f9aef09f97a864a9bc2663af80736df1a3f0a816 (patch) | |
tree | eb946f52a22763feb0caf4705ac623fefd8b5d5b /standalone/android | |
parent | b6eb8760322b3615a05ebc440598379c137c397d (diff) |
Android: Added an "Open WebApp" item to the terminal's menu. Should work for Android devices that cannot auto-open the webapp on start.
Diffstat (limited to 'standalone/android')
-rw-r--r-- | standalone/android/term.patch | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/standalone/android/term.patch b/standalone/android/term.patch index e7e2983c8..da5989328 100644 --- a/standalone/android/term.patch +++ b/standalone/android/term.patch @@ -23,6 +23,28 @@ index f6952f0..1a8df8f 100644 execBuild.redirectErrorStream(true); Process exec = null; try { +diff --git a/res/menu/main.xml b/res/menu/main.xml +index 064f833..fe5f3a3 100644 +--- a/res/menu/main.xml ++++ b/res/menu/main.xml +@@ -16,6 +16,8 @@ + --> + + <menu xmlns:android="http://schemas.android.com/apk/res/android"> ++ <item android:id="@+id/menu_send_email" ++ android:title="@string/send_email" /> + <item android:id="@+id/menu_new_window" + android:title="@string/new_window" + android:icon="@drawable/ic_menu_add" /> +@@ -34,8 +36,6 @@ + android:icon="@drawable/ic_menu_preferences" /> + <item android:id="@+id/menu_reset" + android:title="@string/reset" /> +- <item android:id="@+id/menu_send_email" +- android:title="@string/send_email" /> + <item android:id="@+id/menu_toggle_wakelock" + android:title="@string/enable_wakelock" /> + <item android:id="@+id/menu_toggle_wifilock" diff --git a/res/values/defaults.xml b/res/values/defaults.xml index 67287b2..9b7cfcd 100644 --- a/res/values/defaults.xml @@ -41,6 +63,83 @@ index 67287b2..9b7cfcd 100644 <bool name="pref_verify_path_default">true</bool> <bool name="pref_do_path_extensions_default">true</bool> <bool name="pref_allow_prepend_path_default">true</bool> +diff --git a/res/values/strings.xml b/res/values/strings.xml +index f1464e9..b06ec9a 100644 +--- a/res/values/strings.xml ++++ b/res/values/strings.xml +@@ -23,7 +23,7 @@ + <string name="prev_window">Prev window</string> + <string name="next_window">Next window</string> + <string name="reset">Reset term</string> +- <string name="send_email">Email to</string> ++ <string name="send_email">Open WebApp</string> + <string name="special_keys">Special keys</string> + <string name="toggle_soft_keyboard">Toggle soft keyboard</string> + +diff --git a/src/jackpal/androidterm/Term.java b/src/jackpal/androidterm/Term.java +index 8a3a4ac..af8d1ad 100644 +--- a/src/jackpal/androidterm/Term.java ++++ b/src/jackpal/androidterm/Term.java +@@ -21,6 +21,9 @@ import java.text.Collator; + import java.util.Arrays; + import java.util.Locale; + ++import java.io.FileReader; ++import java.io.BufferedReader; ++ + import android.app.Activity; + import android.app.AlertDialog; + import android.content.ActivityNotFoundException; +@@ -59,6 +62,11 @@ import android.view.inputmethod.InputMethodManager; + import android.widget.TextView; + import android.widget.Toast; + ++import android.content.Intent; ++import android.net.Uri; ++import android.app.Activity; ++import android.content.Context; ++ + import jackpal.androidterm.emulatorview.ColorScheme; + import jackpal.androidterm.emulatorview.EmulatorView; + import jackpal.androidterm.emulatorview.TermSession; +@@ -911,31 +919,15 @@ public class Term extends Activity implements UpdateCallback { + } + + private void doEmailTranscript() { ++ // Hack: repurposed to open the git-annex webapp + TermSession session = getCurrentTermSession(); + if (session != null) { +- // Don't really want to supply an address, but +- // currently it's required, otherwise nobody +- // wants to handle the intent. +- String addr = "user@example.com"; +- Intent intent = +- new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" +- + addr)); +- +- String subject = getString(R.string.email_transcript_subject); +- String title = session.getTitle(); +- if (title != null) { +- subject = subject + " - " + title; +- } +- intent.putExtra(Intent.EXTRA_SUBJECT, subject); +- intent.putExtra(Intent.EXTRA_TEXT, +- session.getTranscriptText().trim()); + try { +- startActivity(Intent.createChooser(intent, +- getString(R.string.email_transcript_chooser_title))); +- } catch (ActivityNotFoundException e) { +- Toast.makeText(this, +- R.string.email_transcript_no_email_activity_found, +- Toast.LENGTH_LONG).show(); ++ BufferedReader buf = new BufferedReader(new FileReader("/sdcard/git-annex.home/.git-annex-url")); ++ String s = buf.readLine(); ++ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(s)); ++ startActivity(intent); ++ } catch (Exception e) { + } + } + } diff --git a/tools/build-debug b/tools/build-debug index 1f15cd2..e611956 100755 --- a/tools/build-debug |