Moving options menu from java to xml
authorDoug Turner <dougt@dougt.org>
Tue, 11 Oct 2011 20:32:23 -0700
changeset 83146 2f3d39316c54192d37b29c2070904b0abe666aff
parent 83145 a7a700a9069916e61bd1efce7d30bf6d46854839
child 83147 b7228098923508d64f62d69a8377b11d2f358035
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone10.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Moving options menu from java to xml
embedding/android/GeckoApp.java
embedding/android/Makefile.in
embedding/android/locales/en-US/android_strings.dtd
embedding/android/resources/drawable/quit.png
embedding/android/resources/layout/gecko_menu.xml
embedding/android/strings.xml.in
--- a/embedding/android/GeckoApp.java
+++ b/embedding/android/GeckoApp.java
@@ -363,27 +363,32 @@ abstract public class GeckoApp
         return true;
     }
 
     @Override
     public boolean onCreateOptionsMenu(Menu menu)
     {
         final Activity self = this;
 
-        MenuItem quitItem = menu.add("Quit");
-        quitItem.setIcon(android.R.drawable.ic_menu_close_clear_cancel);
-        quitItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
-                public boolean onMenuItemClick(MenuItem item) {
-                    quit();
-                    return true;
-                }
-            });
+        MenuInflater inflater = getMenuInflater();
+        inflater.inflate(R.layout.gecko_menu, menu);
         return true;
     }
 
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+           case R.id.quit:
+               quit();
+               return true;
+           default:
+               return super.onOptionsItemSelected(item);
+        }
+    }
+
     private void quit() {
         Log.i(LOG_FILE_NAME, "pleaseKillMe");
         if (surfaceView != null)
             surfaceView.saveLast();
         System.exit(0);
     }
 
     /** Called when the activity is first created. */
--- a/embedding/android/Makefile.in
+++ b/embedding/android/Makefile.in
@@ -144,19 +144,26 @@ LOCALIZED_BRANDPATH = $(DEPTH)/dist/bin/
 LOCALIZED_STRINGSPATH = $(DEPTH)/dist/bin/chrome/android-res/res/values-$(AB_CD)/android_strings.dtd
 
 ifdef MOZ_CRASHREPORTER
 PROCESSEDJAVAFILES += CrashReporter.java
 MOZ_ANDROID_DRAWABLES += embedding/android/resources/drawable/crash_reporter.png
 RES_LAYOUT += res/layout/crash_reporter.xml
 endif
 
-MOZ_ANDROID_DRAWABLES += embedding/android/resources/drawable/desktop_notification.png embedding/android/resources/drawable/favicon.png embedding/android/resources/drawable/reload.png
-MOZ_ANDROID_DRAWABLES += embedding/android/resources/drawable/address_bar_button_left.9.png embedding/android/resources/drawable/address_bar_button_right.9.png
-MOZ_ANDROID_DRAWABLES += embedding/android/resources/drawable/address_bar_button_middle.9.png embedding/android/resources/drawable/address_bar_bg.9.png
+MOZ_ANDROID_DRAWABLES += embedding/android/resources/drawable/desktop_notification.png        \
+	                     embedding/android/resources/drawable/favicon.png                     \
+                         embedding/android/resources/drawable/reload.png                      \
+                         embedding/android/resources/drawable/quit.png                        \
+                         embedding/android/resources/drawable/address_bar_button_left.9.png   \
+                         embedding/android/resources/drawable/address_bar_button_right.9.png  \
+                         embedding/android/resources/drawable/address_bar_button_middle.9.png \
+                         embedding/android/resources/drawable/address_bar_bg.9.png            \
+                         $(NULL)
+
 
 MOZ_ANDROID_DRAWABLES += $(shell if test -e $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/android-resources.mn; then cat $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/android-resources.mn | tr '\n' ' ';  fi)
 
 include $(topsrcdir)/config/rules.mk
 
 ifneq ($(AB_CD),en-US)
 LOCALIZED_STRINGS_XML = res/values-$(AB_rCD)/strings.xml
 endif
--- a/embedding/android/locales/en-US/android_strings.dtd
+++ b/embedding/android/locales/en-US/android_strings.dtd
@@ -14,8 +14,10 @@
 <!ENTITY  sending_crash_report "Sending crash report\u2026">
 <!ENTITY  exit_label "Exit">
 <!ENTITY  continue_label "Continue">
 
 <!ENTITY  launcher_shortcuts_title "&brandShortName; Web Apps">
 <!ENTITY  launcher_shortcuts_empty "No web apps were found">
 
 <!ENTITY choose_file "Choose File">
+
+<!ENTITY quit "Quit">
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..78222ea8eb2fcfedbc27b892156b1efab00534e9
GIT binary patch
literal 5306
zc$@*c6h-TaP)<h;3K|Lk000e1NJLTq001xm001xu1^@s6R|5Hm00009a7bBm000XU
z000XU0RWnu7ytkYPiaF#P*7-ZbZ>KLZ*U+<Lqi~Na&Km7Y-Iodc-oy)XH-+^7Crag
z^g>IBfRsybQWXdwQbLP>6p<z>Aqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uh<iVD~V
z<RPMtgQJLw%KPDaqifc@_vX$1wbwr9tn;0-&j-K=43<bUQ8j=JsX`tR;Dg7+#^K~H
zK!FM*Z~zbpvt%K2{UZSY_<lS*D<Z%Lz5oGu(+dayz)hRLFdT>f59&ghTmgWD0l;*T
zI7<kC6aYYajzXpYKt=(8otP$50H6c_V9R4-;{Z@C0AMG7=F<Rxo%or10RUT+Ar%3j
zkpLhQWr#!oXgdI`&sK^>09Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p
z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-<?i
z0%4j!F2Z@488U%158(66005wo6%pWr^Zj_v4zAA5HjcIqUoGmt2LB>rV&neh&#Q1i
z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_<lS*MWK+n+1cgf
z<k(8YLR(?VSAG6x!e78w{cQPuJpA|d;J)G{fihizM+Erb!p!tcr5w+a34~(Y=8s4G
zw+sLL9n&JjNn*KJDiq^U5^;`1nvC-@r6P$!k}1U{(*I=Q-z@tBKHoI}uxdU5dyy@u
zU1J0GOD7Ombim^G008p4Z^6_k2m^p<gW=D2|L;HjN1!DDfM!X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l(GanbK1=`682dGXGdUESQUH?FSM7e%*h(|9RJQ{~9HhTwDkNd)9_Z>d0IF
zdh4)kJi<ZMLTrGA*uX0h8-yjF?t1!|>$)A8%^8qRA?E{15NbxF@uz*y>^m;i?!sE@
zzzqQW;`1+_B2euq$YeH~Ob8Yodw#oTq&!^SBBgU(Z0$shD#L<A<>B&{J;gmEuIqMK
zDGSh++Dag(*sSp6zGwEGij7(Byrry+R34qaG+hP&haISpqY_zo?8`P>&#js%bFi?p
zFjVX;uGmtRhsx>7*-Gc!S95!bC}}pDAU$BL(EH(pBl}>snBSTIK`muXQ(t<!bjWqx
z!(hM>4%CDSu^@t1IdyZcIYGltm@zf;JO~~D2o@T9yxsNOW>N@xqYgt~nrcLY0ab;r
z=`eKT*uH1>-Ib=kW~@>=QR;Wu?O-n$6-LLNkUnC-WfzX?fW0LugaYWA4pmd5wv?1W
z;DzU`DuMB&(a3>k58Sn}$}NMf(%Ypz_PE3KTnHg<{k4x8Efk+PgvvI2A7?evC^Y`A
z54LU@EtZGMFFCGr*md1#a2rVnrB*(~XQMR|LkWn0h(J2Q)XihX&f<?UT3m6sJO1f-
z?xKD12z%Vh9)qhKjS6qkLd*ZIBB<Cp!O)CJ%d&cM?YSRyxcj~1^~y-4%k|vdf<-Gc
z2eHo_F;p~yNvJ`Xgo#V)q^{}j7di?**?9f74>+d&J(ZrjGPjGF+ZenNK9;wKGo;W}
zBAPHanP;+Fvp>rNj{mzyOm%nZN&V0Ekgx9Ee>J!V;2wZq_VwQZ05_G%zpY$r>Hq)$
M07*qoM6N<$f<UJq1ONa4
new file mode 100644
--- /dev/null
+++ b/embedding/android/resources/layout/gecko_menu.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@+id/quit"
+          android:icon="@drawable/quit"
+          android:title="@string/quit" />
+</menu>
--- a/embedding/android/strings.xml.in
+++ b/embedding/android/strings.xml.in
@@ -19,9 +19,11 @@
   <string name="sending_crash_report">&sending_crash_report;</string>
   <string name="exit_label">&exit_label;</string>
   <string name="continue_label">&continue_label;</string>
 
   <string name="launcher_shortcuts_title">&launcher_shortcuts_title;</string>
   <string name="launcher_shortcuts_empty">&launcher_shortcuts_empty;</string>
   
   <string name="choose_file">&choose_file;</string>
+
+  <string name="quit">&quit;</string>
 </resources>