示例#1
0
  void updateBottomBarWidgetState() {
    LogUtils.d(TAG, "updateBottomBarWidgetState(), editing=" + mTodosListAdapter.isEditing());
    if (mTodosListAdapter.isEditing()) {
      int selectedNumber = 0;
      int dataSourceNumber = 0;
      if (mTodosListAdapter.getEditType() == TodosListAdapter.EDIT_TODOS) {
        selectedNumber = mTodosListAdapter.getSeletedTodosNumber();
        dataSourceNumber = mTodosListAdapter.getTodosDataSource().size();
      } else if (mTodosListAdapter.getEditType() == TodosListAdapter.EDIT_DONES) {
        selectedNumber = mTodosListAdapter.getSeletedDonesNumber();
        dataSourceNumber = mTodosListAdapter.getDonesDataSource().size();
      }

      LogUtils.d(
          TAG, "selectedNumber=" + selectedNumber + ", dataSourceNumber=" + dataSourceNumber);
      if (dataSourceNumber == 0) {
        updateToEditNull();
      } else {
        /// M: add to avoid this case: no item has been selected but the button
        // can be pressed {@
        if (selectedNumber > 0) {
          mBtnDelete.setEnabled(true);
          mBtnChangeState.setEnabled(true);
        } else {
          mBtnDelete.setEnabled(false);
          mBtnChangeState.setEnabled(false);
        }
        /// @}
        mTodosActionCallBack.updateActionMode();
      }
    }
  }
示例#2
0
 @Override
 public boolean onMenuOpened(int featureId, Menu menu) {
   if (menu != null) {
     MenuItem miSwitch = menu.findItem(SWITCH_MODE_INDEX);
     if (firstTime) {
       miSwitch.setEnabled(false);
     } else {
       miSwitch.setEnabled(true);
     }
     MenuItem miMute = menu.findItem(MUTE_INDEX);
     if (viewMode == VIEW_KEYPAD) {
       miMute.setVisible(true);
       if (mute) {
         miMute.setTitle(R.string.sounds);
         miMute.setIcon(android.R.drawable.ic_lock_silent_mode_off);
       } else {
         miMute.setTitle(R.string.mute);
         miMute.setIcon(android.R.drawable.ic_lock_silent_mode);
       }
     } else {
       miMute.setVisible(false);
     }
   }
   return super.onMenuOpened(featureId, menu);
 }
示例#3
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case R.id.menu_clear:
       this.mAdapter.clear();
       mDmesgViewerHandler
           .obtainMessage(DmesgLogHelpers.MSG_LISTVIEW_ADAPTER_REFRESH)
           .sendToTarget();
       fixUpTitle(this.mDmesgLogHandler.getIsPaused());
       return true;
     case R.id.menu_pause:
       handlePauseResume(item);
       return true;
     case R.id.menu_preferences:
       Intent intentLaunchPrefs = new Intent(this, t0mm13b.dmesglog.prefs.DMesgPrefs.class);
       intentLaunchPrefs.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
       startActivity(intentLaunchPrefs);
       return true;
     case R.id.menu_share:
       handlePause(item);
       new asyncSaveDmesg(this, this.mAdapter.getEntries(), item, true).execute();
       item.setEnabled(false); // Prevent multiple spawning of async tasks!
       break;
     case R.id.menu_save:
       handlePause(item);
       new asyncSaveDmesg(this, this.mAdapter.getEntries(), item, false).execute();
       item.setEnabled(false);
       break;
   }
   return super.onOptionsItemSelected(item);
 }
  @Override
  public void onPrepareOptionsMenu(Menu menu) {
    currentMenu = menu;

    for (int index = 0; index < menu.size(); index++) {
      menu.getItem(index).setVisible(false);
    }

    MenuItem undo = menu.findItem(R.id.menu_undo);
    if (formulaEditorEditText == null || !formulaEditorEditText.getHistory().undoIsPossible()) {
      undo.setIcon(R.drawable.icon_undo_disabled);
      undo.setEnabled(false);
    } else {
      undo.setIcon(R.drawable.icon_undo);
      undo.setEnabled(true);
    }

    MenuItem redo = menu.findItem(R.id.menu_redo);
    if (formulaEditorEditText == null || !formulaEditorEditText.getHistory().redoIsPossible()) {
      redo.setIcon(R.drawable.icon_redo_disabled);
      redo.setEnabled(false);
    } else {
      redo.setIcon(R.drawable.icon_redo);
      redo.setEnabled(true);
    }

    menu.findItem(R.id.menu_undo).setVisible(true);
    menu.findItem(R.id.menu_redo).setVisible(true);
    getActivity().getActionBar().setDisplayShowTitleEnabled(true);
    getActivity().getActionBar().setTitle(getString(R.string.formula_editor_title));

    super.onPrepareOptionsMenu(menu);
  }
示例#5
0
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   MenuInflater inflater = mCoolReader.getMenuInflater();
   menu.clear();
   inflater.inflate(
       mList.isShortcutMode()
           ? R.menu.cr3_bookmark_shortcut_context_menu
           : R.menu.cr3_bookmark_context_menu,
       menu);
   AdapterContextMenuInfo mi = (AdapterContextMenuInfo) menuInfo;
   if (mi != null) selectedItem = mi.position;
   Bookmark bm = mList.getSelectedBookmark();
   menu.setHeaderTitle(getContext().getString(R.string.context_menu_title_bookmark));
   for (int i = 0; i < menu.size(); i++) {
     MenuItem menuItem = menu.getItem(i);
     if (menuItem.getItemId() == R.id.bookmark_shortcut_goto
         || menuItem.getItemId() == R.id.bookmark_edit
         || menuItem.getItemId() == R.id.bookmark_delete) menuItem.setEnabled(bm != null);
     if (menuItem.getItemId() == R.id.bookmark_edit)
       menuItem.setEnabled(
           bm != null
               && (bm.getType() == Bookmark.TYPE_COMMENT
                   || bm.getType() == Bookmark.TYPE_CORRECTION));
     menuItem.setOnMenuItemClickListener(
         new OnMenuItemClickListener() {
           public boolean onMenuItemClick(MenuItem item) {
             onContextItemSelected(item);
             return true;
           }
         });
   }
 }
  @Override
  public boolean onPrepareOptionsMenu(Menu menu) {
    boolean bSortingEnabled = true;

    MenuItem sortCount = menu.findItem(R.id.by_count_desc);
    MenuItem sortTime = menu.findItem(R.id.by_time_desc);

    if (m_iSorting == 0) {
      // sorting is by time
      sortTime.setEnabled(false);
      sortCount.setEnabled(true);
    } else {
      // sorting is by count
      sortTime.setEnabled(true);
      sortCount.setEnabled(false);
    }

    if (m_iStat == 2) // @see arrays.xml, dependency to string-array name="stats"
    {
      // disable menu group
      bSortingEnabled = true;
    } else {
      // enable menu group
      bSortingEnabled = true;
    }
    menu.setGroupEnabled(R.id.sorting_group, bSortingEnabled);

    return true;
  }
示例#7
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    MenuItem item = menu.add(0, SWITCH_MODE_INDEX, 0, R.string.switch_mode);
    // icon set below in onPrepareOptionsMenu()
    if (CheckWrappers.mActionBarAvailable) {
      WrapActionBar.showIfRoom(item);
    }
    if (firstTime) {
      item.setEnabled(false);
    } else {
      item.setEnabled(true);
    }

    MenuItem miMute;
    if (mute) {
      miMute =
          menu.add(0, MUTE_INDEX, 0, R.string.sounds)
              .setIcon(android.R.drawable.ic_lock_silent_mode_off);
    } else {
      miMute =
          menu.add(0, MUTE_INDEX, 0, R.string.mute).setIcon(android.R.drawable.ic_lock_silent_mode);
    }
    miMute.setVisible(viewMode == VIEW_KEYPAD);

    // Add distribution menu items last.
    mDistribution.onCreateOptionsMenu(menu);

    return true;
  }
示例#8
0
 @Override
 public boolean onPrepareOptionsMenu(Menu menu) {
   super.onPrepareOptionsMenu(menu);
   hackForSubmenus = menu;
   if (progress != null && (actionBarCompat == null || actionBarCompat.hasMenuButton()))
     return false; // not safe/useful until game is loaded
   MenuItem item;
   item = menu.findItem(R.id.solve);
   item.setEnabled(solveEnabled);
   if (actionBarCompat != null) item.setVisible(solveEnabled);
   MenuItem undoItem = menu.findItem(R.id.undo), redoItem = menu.findItem(R.id.redo);
   undoItem.setEnabled(undoEnabled);
   redoItem.setEnabled(redoEnabled);
   undoItem.setIcon(
       undoEnabled ? R.drawable.sym_keyboard_undo : R.drawable.sym_keyboard_undo_disabled);
   redoItem.setIcon(
       redoEnabled ? R.drawable.sym_keyboard_redo : R.drawable.sym_keyboard_redo_disabled);
   item = menu.findItem(R.id.type);
   item.setEnabled(!gameTypes.isEmpty() || customVisible);
   if (actionBarCompat != null) item.setVisible(item.isEnabled());
   typeMenu = item.getSubMenu();
   for (Integer i : gameTypes.keySet()) {
     if (menu.findItem(i) == null) typeMenu.add(R.id.typeGroup, i, Menu.NONE, gameTypes.get(i));
   }
   MenuItem customItem = menu.findItem(R.id.custom);
   customItem.setVisible(customVisible);
   typeMenu.setGroupCheckable(R.id.typeGroup, true, true);
   if (currentType < 0) customItem.setChecked(true);
   else if (currentType < gameTypes.size())
     menu.findItem((Integer) gameTypes.keySet().toArray()[currentType]).setChecked(true);
   menu.findItem(R.id.thisgame)
       .setTitle(
           MessageFormat.format(getString(R.string.help_on_game), new Object[] {this.getTitle()}));
   return true;
 }
 private void updateDoneMenuItem(String string) {
   if (string.length() > 0) {
     mDoneMenuItem.setEnabled(true);
     mDoneMenuItem.getIcon().setAlpha(255);
   } else {
     mDoneMenuItem.setEnabled(false);
     mDoneMenuItem.getIcon().setAlpha(127);
   }
 }
示例#10
0
 private void updateSendMenu() {
   if (mEtInput.getText().length() == 0) {
     mMenuSend.setEnabled(false);
     mMenuSend.setIcon(R.drawable.actionbar_unsend_icon);
   } else {
     mMenuSend.setEnabled(true);
     mMenuSend.setIcon(R.drawable.actionbar_send_icon);
   }
 }
示例#11
0
  @Override
  public boolean onMenuOpened(int featureId, Menu menu) {
    MenuItem item = menu.findItem(R.id.log_out);
    if (item != null) {
      // Is the user logged in?
      if (LoginDbAdapter.getCurrentUser() == null) item.setEnabled(false);
      else item.setEnabled(true);
    }

    return true;
  }
示例#12
0
 @Override
 public void onPrepareOptionsMenu(Menu menu) {
   super.onPrepareOptionsMenu(menu);
   if (headerMenu != null) {
     MenuItem backItem = headerMenu.findItem(R.id.action_back);
     MenuItem forwardItem = headerMenu.findItem(R.id.action_forward);
     backItem.setEnabled(mainWebView.canGoBack());
     forwardItem.setEnabled(mainWebView.canGoForward());
   }
   if (menu == null) {
     return;
   }
   // MenuItem reloadItem = menu.findItem(R.id.action_reload);
   // reloadItem.setVisible(true);
   MenuItem saveItem = menu.findItem(R.id.action_add_favorite);
   MenuItem deleteItem = menu.findItem(R.id.action_remove_favorite);
   switch (urlType) {
     case FEED:
       if (DDGControlVar.currentFeedObject != null) {
         if (DDGControlVar.currentFeedObject.isSaved()) {
           saveItem.setVisible(false);
           deleteItem.setVisible(true);
         } else {
           saveItem.setVisible(true);
           deleteItem.setVisible(false);
         }
       } else {
         saveItem.setVisible(false);
         deleteItem.setVisible(false);
       }
       break;
     case SERP:
       String webViewUrl = mainWebView.getUrl();
       if (webViewUrl == null) {
         webViewUrl = "";
       }
       String query = DDGUtils.getQueryIfSerp(webViewUrl);
       if (DDGApplication.getDB().isSavedSearch(query)) {
         saveItem.setVisible(false);
         deleteItem.setVisible(true);
       } else {
         saveItem.setVisible(true);
         deleteItem.setVisible(false);
       }
       break;
     case WEBPAGE:
     default:
       saveItem.setVisible(false);
       deleteItem.setVisible(false);
       break;
   }
   webMenu = menu;
 }
示例#13
0
 /** Callback method to prepare customized menu options. */
 public void onPrepareOptionsMenu(Menu menu) {
   MenuItem item = menu.findItem(mMenuSimSms);
   if (!Op02MmsUtils.isSmsEnabled(this)
       || !Op02MmsUtils.isSimInserted(this)
       || Op02MmsUtils.isAirplaneOn(this)
       || !Op02MmsUtils.isSmsReady(this)) {
     item.setEnabled(false);
     Log.d(TAG, "Menu sim sms entry is disabled");
   } else {
     item.setEnabled(true);
     Log.d(TAG, "Menu sim sms entry is enabled");
   }
 }
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   inflater.inflate(R.menu.details_menu, menu);
   if (!this.getArguments().getBoolean(ARG_KEY_ACTION_EDIT_ENABLED, true)) {
     MenuItem actionEdit = menu.findItem(R.id.action_edit);
     actionEdit.setVisible(false);
     actionEdit.setEnabled(false);
   }
   if (!this.getArguments().getBoolean(ARG_KEY_ACTION_DELETE_ENABLED, true)) {
     MenuItem actionDelete = menu.findItem(R.id.action_delete);
     actionDelete.setVisible(false);
     actionDelete.setEnabled(false);
   }
   super.onCreateOptionsMenu(menu, inflater);
 }
  /**
   * Callback method from {@link ProjectListFragment.Callbacks} indicating that the item with the
   * given ID was selected.
   */
  public void onItemSelected(Project p) {
    MenuItem charts = this.actionBarmenu.findItem(R.id.action_charts);
    charts.setEnabled(true);
    charts.setVisible(true);
    MenuItem item = this.actionBarmenu.findItem(R.id.action_all_tasks);
    item.setVisible(false);

    this.selectedProject = p;
    Bundle arguments = new Bundle();
    ProjectDetailFragment fragment = new ProjectDetailFragment();
    arguments.putBoolean("TwoPane", mGlobalVariables.ismTwoPane());
    fragment.setArguments(arguments);
    // currFragment=fragment;
    getFragmentManager()
        .beginTransaction()
        .replace(
            mGlobalVariables.ismTwoPane()
                ? R.id.twopane_detail_container
                : R.id.main_fragment_container,
            fragment)
        .commit();
    // If in two pane mode, we cannot go up.

    if (!mGlobalVariables.ismTwoPane()) {
      this.fragmentStack.push(fragment);
    }
    getActionBar().setDisplayHomeAsUpEnabled(!mGlobalVariables.ismTwoPane());
  }
 @Override
 public void onPrepareOptionsMenu(Menu menu) {
   boolean ok = false;
   ok = editAccountName.getText().length() > 0;
   MenuItem item = menu.findItem(R.id.add_account);
   item.setEnabled(ok);
 }
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    MenuItem item = menu.findItem(menu.add(0, v.getId(), 0, "Copy").getItemId());

    if (this.characterListAdapter.getCount() < MAX_CHARACTERS) {
      item.setEnabled(true);

    } else {
      // disabled
      item.setEnabled(false);
      item.setTitle("Copy (Too many characters)");
    }

    menu.add(0, v.getId(), 1, "Delete");
  }
 public static void enableShareMenuItem(Menu menu, boolean enabled) {
   MenuItem item = menu.findItem(MENU_IMAGE_SHARE);
   if (item != null) {
     item.setVisible(enabled);
     item.setEnabled(enabled);
   }
 }
示例#19
0
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    getMenuInflater().inflate(R.menu.context_bookmark, menu);

    android.view.MenuItem menuRenameLabel = menu.findItem(R.id.menuRenameLabel);
    android.view.MenuItem menuDeleteLabel = menu.findItem(R.id.menuDeleteLabel);

    AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    if (info.position < 4) {
      menuRenameLabel.setEnabled(false);
      menuDeleteLabel.setEnabled(false);
    } else {
      menuRenameLabel.setEnabled(true);
      menuDeleteLabel.setEnabled(true);
    }
  }
示例#20
0
 // Override al onPrepare para poder instanciar el icono
 @Override
 public boolean onPrepareOptionsMenu(Menu menu) {
   mSearchItem = menu.findItem(R.id.clear);
   mSearchItem.setVisible(false);
   mSearchItem.setEnabled(false);
   return super.onPrepareOptionsMenu(menu);
 }
示例#21
0
  @Override
  public void onUpdate(User user) {
    if (mUserMenuItem != null) {
      mUserMenuItem.setEnabled(true);
    }

    if (mContext == null || mName == null || mBackpack == null || mAvatar == null) {
      return;
    }

    // Set the name
    mName.setText(user.getName());

    // Set the backpack value
    double bpValue = user.getBackpackValue();
    if (bpValue >= 0) {
      mBackpack.setText(
          String.format(
              "Backpack: %s",
              mContext.getString(R.string.currency_metal, String.valueOf(Math.round(bpValue)))));
    } else {
      mBackpack.setText("Private backpack");
    }

    // Download the avatar (if needed) and set it
    Glide.with(mContext)
        .load(user.getAvatarUrl())
        .diskCacheStrategy(DiskCacheStrategy.ALL)
        .transform(new CircleTransform(mContext))
        .into(mAvatar);
  }
示例#22
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_main, menu);
    // make non-clickable
    tts = menu.findItem(R.id.menu_speech_to_text);
    tts.setVisible(false);
    tts.setEnabled(false);

    // NOTE: only works on API 11
    final MenuItem menuSearch = menu.findItem(R.id.menu_search);

    mSearchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
    mSearchView.setQueryHint("Search for a Product.");
    mSearchView.setOnQueryTextListener(
        new OnQueryTextListener() {

          @Override
          public boolean onQueryTextSubmit(String query) {
            search(query);
            return true;
          }

          @Override
          public boolean onQueryTextChange(String newText) {
            return false;
          }
        });
    return true;
  }
  @SuppressWarnings("deprecation")
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    activity = this;
    setContentView(R.layout.activity_camera);
    mSurfaceView = (SurfaceView) findViewById(R.id.previewSurface);
    CompoundTouchListener compoundTouch = new CompoundTouchListener();
    compoundTouch.addTouchListener(
        new TouchZoomControl(
            this, ScreenDimension.getScreenWidth(this), ScreenDimension.getScreenHeight(this)));
    mSurfaceView.setOnTouchListener(compoundTouch);
    mHolder = mSurfaceView.getHolder();
    mHolder.addCallback(mCallback);
    mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    zoomText = (TextView) findViewById(R.id.zoomtext);
    // RotateAnimation rotate=
    // (RotateAnimation)AnimationUtils.loadAnimation(this,R.anim.rotate_textview);
    zoomText.setText("100%");
    // zoomText.setAnimation(rotate);
    takePhoto = (ImageButton) findViewById(R.id.takePhotoButton);
    switchMode = (ImageButton) findViewById(R.id.switchCameraMode);
    zoomIn = (ImageButton) findViewById(R.id.zoomInButton);
    zoomOut = (ImageButton) findViewById(R.id.zoomOutButton);

    mSerialService = new BluetoothSerialService(this, mHandlerBT /*, mEmulatorView*/);

    bluetoothNameLabel = (TextView) findViewById(R.id.bluetoothtext);

    mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    // BluetoothAdapter myBluetoothAdapter = null; //This was to test to see what the
    // noBluetoothAdapter() method did
    if (mBluetoothAdapter == null) {
      mMenuItemConnect.setEnabled(false);
    }
  }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.first_launch, menu);
    mJobPicker = (MenuItem) menu.findItem(R.id.action_pick_job);
    mLinePicker = (MenuItem) menu.findItem(R.id.action_pick_line);
    mJobPicker.setEnabled(false);
    if (!ViewConfiguration.get(this).hasPermanentMenuKey()) {
      mJobPicker.setShowAsAction(
          MenuItem.SHOW_AS_ACTION_NEVER); // just a hack to make the arrow line up
    }

    // populate the line picker with line numbers from the database
    List<Integer> lineNumberList = new ArrayList<Integer>();
    lineNumberList = mModel.getLineNumbers();

    Menu pickLineSubMenu = mLinePicker.getSubMenu();
    pickLineSubMenu.clear();

    for (int i = 0; i < lineNumberList.size(); i++) {
      // don't have access to View.generateViewId(), so fake a random ID
      pickLineSubMenu.add(
          LINE_LIST_MENU_GROUP,
          (Menu.FIRST + lineNumberList.get(i)),
          Menu.FLAG_APPEND_TO_GROUP,
          "Line  " + String.valueOf(lineNumberList.get(i)));
    }

    return super.onCreateOptionsMenu(menu);
  }
 /** Change the scaling mode sub-menu to reflect available scaling modes. */
 void updateScalingMenu() {
   try {
     for (MenuItem item : scalingModeMenuItems) {
       // If the entire framebuffer is NOT contained in the bitmap, fit-to-screen is meaningless.
       if (item.getItemId() == R.id.itemFitToScreen) {
         if (canvas != null
             && canvas.bitmapData != null
             && (canvas.bitmapData.bitmapheight != canvas.bitmapData.framebufferheight
                 || canvas.bitmapData.bitmapwidth != canvas.bitmapData.framebufferwidth))
           item.setEnabled(false);
         else item.setEnabled(true);
       } else item.setEnabled(true);
     }
   } catch (NullPointerException e) {
   }
 }
示例#26
0
 @Override
 public void setGroupEnabled(int group, boolean enabled) {
   for (final MenuItem item : mMenuItems) {
     if (item.getGroupId() == group) {
       item.setEnabled(enabled);
     }
   }
 }
 @Override
 public boolean onPrepareOptionsMenu(Menu aMenu) {
   super.onPrepareOptionsMenu(aMenu);
   final MenuItem theMenuItem = aMenu.findItem(R.id.menu_agency_site);
   theMenuItem.setEnabled(false);
   theMenuItem.setVisible(false);
   return true;
 }
 @Override
 public boolean onPrepareOptionsMenu(Menu menu) {
   viewTipsMenuItem = menu.getItem(0);
   try {
     Boolean aBoolean = new RowExist().execute((Object[]) null).get();
     if (aBoolean) {
       viewTipsMenuItem.setEnabled(true);
     } else {
       viewTipsMenuItem.setEnabled(false);
     }
   } catch (InterruptedException e) {
     e.printStackTrace();
   } catch (ExecutionException e) {
     e.printStackTrace();
   }
   return super.onPrepareOptionsMenu(menu);
 }
  @Override
  public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {

    AdapterView.AdapterContextMenuInfo info;
    try {
      info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    } catch (ClassCastException e) {
      LOG.error("Could not cast [{}] to [{}].", menuInfo, AdapterView.AdapterContextMenuInfo.class);
      return;
    }

    Cursor cursor = (Cursor) getListAdapter().getItem(info.position);
    if (cursor == null) {
      LOG.error("The cursor is not available from the list adapter.");
      return;
    }

    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.split_marker_set_list_item_menu, menu);

    String splitMarkerSetName =
        cursor.getString(cursor.getColumnIndex(TrackLoggerData.SplitMarkerSet.COLUMN_NAME_NAME));

    menu.setHeaderTitle(splitMarkerSetName);

    for (int i = 0; i < menu.size(); i++) {
      MenuItem menuItem = menu.getItem(i);
      switch (menuItem.getItemId()) {
        case R.id.split_marker_set_list_item_menu_delete:
          try {
            info = (AdapterView.AdapterContextMenuInfo) menuItem.getMenuInfo();

            if (isInUse((int) info.id)) {
              menuItem.setEnabled(false);
            }
          } catch (ClassCastException e) {
            LOG.error(
                "Could not cast [{}] to [{}].",
                menuItem.getMenuInfo(),
                AdapterView.AdapterContextMenuInfo.class);
            menuItem.setEnabled(false);
          }
      }
    }
  }
 /** Creates the menu for the project */
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   // Inflate the menu; this adds items to the action bar if it is present.
   getMenuInflater().inflate(R.menu.main, menu);
   this.actionBarmenu = menu;
   MenuItem allTasks = menu.findItem(R.id.action_all_tasks);
   allTasks.setVisible(false);
   allTasks.setEnabled(false);
   MenuItem search = menu.findItem(R.id.action_search);
   search.setEnabled(false);
   search.setVisible(false);
   MenuItem sorting = menu.findItem(R.id.action_sorting);
   MenuItem charts = menu.findItem(R.id.action_charts);
   charts.setEnabled(false);
   charts.setVisible(false);
   sorting.setEnabled(true);
   sorting.setVisible(true);
   MenuItem createMilestone = menu.findItem(R.id.action_milestone);
   createMilestone.setVisible(false);
   createMilestone.setEnabled(false);
   MenuItem createTask = menu.findItem(R.id.action_task);
   createTask.setVisible(false);
   createTask.setEnabled(false);
   MenuItem createbounty = menu.findItem(R.id.action_bounty);
   createbounty.setVisible(false);
   createbounty.setEnabled(false);
   return true;
 }