public MainMenuScreen(DoodleTactics dt) {
    super(dt);

    this.setBackground(java.awt.Color.GRAY);
    BufferedImage titleD = dt.importImage("src/graphics/menu/title.png");
    BufferedImage newGameD = dt.importImage("src/graphics/menu/new_game.png");
    BufferedImage newGameH = dt.importImage("src/graphics/menu/new_game_hovered.png");
    BufferedImage continueD = dt.importImage("src/graphics/menu/continue.png");
    BufferedImage continueH = dt.importImage("src/graphics/menu/continue_hovered.png");
    BufferedImage quitD = dt.importImage("src/graphics/menu/quit.png");
    BufferedImage quitH = dt.importImage("src/graphics/menu/quit_hovered.png");

    _title = new MenuItem(this, titleD, titleD, dt);
    _newGame = new ScreenChangeMenuItem(this, newGameD, newGameH, dt, dt.getGameScreen());

    _continue = new LoadGameMenuItem(this, continueD, continueH, dt);
    _quit = new QuitMenuButton(this, quitD, quitH, dt);
    _title.setLocation(
        ((DoodleTactics.TILE_COLS * map.Tile.TILE_SIZE) - _title.getImage().getWidth()) / 2, 50);
    int offset =
        ((DoodleTactics.TILE_COLS * map.Tile.TILE_SIZE) - _newGame.getImage().getWidth()) / 2;

    _newGame.setLocation(offset, 250);
    _continue.setLocation(offset, 400);
    _quit.setLocation(offset, 550);
    _title.setVisible(true);
    _newGame.setVisible(true);
    _continue.setVisible(true);
    _quit.setVisible(true);
  }
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   if (!Utils.isTablet(getActivity())) {
     getActivity().getMenuInflater().inflate(R.menu.udobra_list, menu);
     MenuItem item = menu.findItem(R.id.action_fix_udobra);
     item.setVisible(false);
     UdobraList_fragment.item = item;
   }
   super.onCreateOptionsMenu(menu, inflater);
 }
Exemple #3
0
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   inflater.inflate(R.menu.main, menu);
   MenuItem deselectItem = menu.findItem(R.id.menu_main_deselect);
   MenuItem stateItem = menu.findItem(R.id.menu_main_state);
   if (((AppsAdapter) lvApps.getAdapter()).hasSelectedItem()) {
     if (fragmentMode == Statics.FRAGMENT_ENABLED) {
       stateItem.setTitle(getResources().getString(R.string.disable_app));
       stateItem.setTitleCondensed(getResources().getString(R.string.disable));
       stateItem.setIcon(getResources().getDrawable(R.drawable.ic_disable, null));
     } else {
       stateItem.setTitle(getResources().getString(R.string.enable_app));
       stateItem.setTitleCondensed(getResources().getString(R.string.enable));
       stateItem.setIcon(getResources().getDrawable(R.drawable.ic_enable, null));
     }
     deselectItem.setVisible(true);
     stateItem.setVisible(true);
   } else {
     deselectItem.setVisible(false);
     stateItem.setVisible(false);
   }
   super.onCreateOptionsMenu(menu, inflater);
 }
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   MenuItem newItem = menu.findItem(R.id.new_item);
   newItem.setVisible(true);
   newItem.setOnMenuItemClickListener(
       new MenuItem.OnMenuItemClickListener() {
         @Override
         public boolean onMenuItemClick(MenuItem item) {
           Fragment fragment = new WaveItemsListFragment();
           FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
           fragmentManager
               .beginTransaction()
               .add(R.id.content_frame, fragment)
               .addToBackStack(null)
               .commit();
           return true;
         }
       });
   super.onCreateOptionsMenu(menu, inflater);
 }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    isGreenStyle = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("style", true);
    getMenuInflater().inflate(isGreenStyle ? R.menu.menu_new : R.menu.ivt_menu_new, menu);

    if (!Globals.isPlaying) {
      MenuItem item = menu.findItem(R.id.action_current_play);
      item.setVisible(false);
      // MenuItem item_divider = menu.findItem(R.id.action_divider);
      // item_divider.setVisible(false);
      this.invalidateOptionsMenu();
    }

    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setOnSearchClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            SharedPreferences prefs =
                PreferenceManager.getDefaultSharedPreferences(mContext.getApplicationContext());
            Boolean isImmer =
                prefs.getBoolean(mContext.getString(R.string.searchview_checkbox_key), true);
            if (!isImmer) {
              // Toast.makeText(mContext, "not isImmer",
              // Toast.LENGTH_LONG).show();
            } else {
              SearchViewDialog dialog = new SearchViewDialog(mContext);
              dialog.show();
              // Toast.makeText(mContext, "isImmer",
              // Toast.LENGTH_LONG).show();
            }
          }
        });
    return true;
  }
Exemple #6
0
 /** {@inheritDoc} */
 @Override
 public boolean onPrepareOptionsMenu(Menu menu) {
   mWordWrapAction.setChecked(this.mWordWrap);
   mSaveAction.setVisible(this.mDirty);
   return super.onPrepareOptionsMenu(menu);
 }