のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

Default BrowserのMenu

BrowserのMenuを押すと

    144     @Override
    145     public boolean onMenuOpened(int featureId, Menu menu) {
    146         if (Window.FEATURE_OPTIONS_PANEL == featureId) {
    147             mController.onMenuOpened(featureId, menu); 
    148         }
    149         return true;

コントローラの関数へ飛ぶ

   1860     @Override
   1861     public boolean onMenuOpened(int featureId, Menu menu) {
   1862         if (mOptionsMenuOpen) {
   1863             if (mConfigChanged) {
   1864                 // We do not need to make any changes to the state of the
   1865                 // title bar, since the only thing that happened was a
   1866                 // change in orientation
   1867                 mConfigChanged = false;
   1868             } else {
   1869                 if (!mExtendedMenuOpen) {
   1870                     mExtendedMenuOpen = true;
   1871                     mUi.onExtendedMenuOpened();
   1872                 } else {
   1873                     // Switching the menu back to icon view, so show the
   1874                     // title bar once again.
   1875                     mExtendedMenuOpen = false;
   1876                     mUi.onExtendedMenuClosed(isInLoad());
   1877                 }
   1878             }
   1879         } else { <= こっちを通る
   1880             // The options menu is closed, so open it, and show the title
   1881             mOptionsMenuOpen = true;
   1882             mConfigChanged = false;
   1883             mExtendedMenuOpen = false;
   1884             mUi.onOptionsMenuOpened(); <=ここを通る
   1885         }
   1886         return true;
   1887     }
    512     private void openPanel(PanelFeatureState st, KeyEvent event) {
    513         // System.out.println(&quot;Open panel: isOpen=&quot; + st.isOpen);
    514 
    515         // Already open, return
    516         if (st.isOpen || isDestroyed()) {
    517             return;
    518         }
    519 
    520         // Don&#39;t open an options panel for honeycomb apps on xlarge devices.
    521         // (The app should be using an action bar for menu items.)
    522         if (st.featureId == FEATURE_OPTIONS_PANEL) {
    523             Context context = getContext();
    524             Configuration config = context.getResources().getConfiguration();
    525             boolean isXLarge = (config.screenLayout &amp; Configuration.SCREENLAYOUT_SIZE_MASK) ==
    526                     Configuration.SCREENLAYOUT_SIZE_XLARGE;
    527             boolean isHoneycombApp = context.getApplicationInfo().targetSdkVersion &gt;=
    528                     android.os.Build.VERSION_CODES.HONEYCOMB;
    529 
    530             if (isXLarge &amp;&amp; isHoneycombApp) {
    531                 return;
    532             }
    533         }
    534 
    535         Callback cb = getCallback();
    536         if ((cb != null) &amp;&amp; (!cb.onMenuOpened(st.featureId, st.menu))) { <=ここにでてきた
    537             // Callback doesn&#39;t want the menu to open, reset any state
    538             closePanel(st, true);
    539             return;
    540         }
    541 
    542         final WindowManager wm = getWindowManager();
    543         if (wm == null) {
    544             return;
    545         }

MenuのPreferenceを押すとBrowserPreferencesPageに飛ぶ。

     35     @Override
     36     public void onCreate(Bundle icicle) {
     37         super.onCreate(icicle);
     38 
     39         ActionBar actionBar = getActionBar();
     40         if (actionBar != null) {
     41             actionBar.setDisplayOptions(
     42                     ActionBar.DISPLAY_HOME_AS_UP, ActionBar.DISPLAY_HOME_AS_UP);
     43         }
     44     }