当前位置: 首页>>代码示例>>Java>>正文


Java ActionMode类代码示例

本文整理汇总了Java中android.support.v7.view.ActionMode的典型用法代码示例。如果您正苦于以下问题:Java ActionMode类的具体用法?Java ActionMode怎么用?Java ActionMode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ActionMode类属于android.support.v7.view包,在下文中一共展示了ActionMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onActionItemClicked

import android.support.v7.view.ActionMode; //导入依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_send:
            List<Item> toTransfer = new ArrayList<>();
            for (ItemBagView instance : bagViewMap.values()) {
                for (Integer itemPosition : instance.getSelectedItems()) {
                    toTransfer.add(instance.getItem(itemPosition));
                }
            }

            new AlertDialog.Builder(getActivity())
                    .setTitle("Transfer to:")
                    .setAdapter(new ItemBagDestinationAdapter(getContext(), R.layout.view_itembagdestination_row, destinations), (dialog, which) -> {
                        presenter.sendItems(toTransfer, destinations.get(which).itemBagId);
                        mode.finish();
                    })
                    .show();
    }
    return true;
}
 
开发者ID:jam01,项目名称:LittleLight,代码行数:22,代码来源:InventoryFragment.java

示例2: initForMode

import android.support.v7.view.ActionMode; //导入依赖的package包/类
public void initForMode(final ActionMode mode) {
    if (this.mClose == null) {
        this.mClose = LayoutInflater.from(getContext()).inflate(this.mCloseItemLayout, this, false);
        addView(this.mClose);
    } else if (this.mClose.getParent() == null) {
        addView(this.mClose);
    }
    this.mClose.findViewById(R.id.action_mode_close_button).setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            mode.finish();
        }
    });
    MenuBuilder menu = (MenuBuilder) mode.getMenu();
    if (this.mActionMenuPresenter != null) {
        this.mActionMenuPresenter.dismissPopupMenus();
    }
    this.mActionMenuPresenter = new ActionMenuPresenter(getContext());
    this.mActionMenuPresenter.setReserveOverflow(true);
    LayoutParams layoutParams = new LayoutParams(-2, -1);
    menu.addMenuPresenter(this.mActionMenuPresenter, this.mPopupContext);
    this.mMenuView = (ActionMenuView) this.mActionMenuPresenter.getMenuView(this);
    this.mMenuView.setBackgroundDrawable(null);
    addView(this.mMenuView, layoutParams);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:25,代码来源:ActionBarContextView.java

示例3: startActionMode

import android.support.v7.view.ActionMode; //导入依赖的package包/类
public ActionMode startActionMode(Callback callback) {
    if (this.mActionMode != null) {
        this.mActionMode.finish();
    }
    this.mOverlayLayout.setHideOnContentScrollEnabled(false);
    this.mContextView.killMode();
    ActionModeImpl mode = new ActionModeImpl(this.mContextView.getContext(), callback);
    if (!mode.dispatchOnCreate()) {
        return null;
    }
    mode.invalidate();
    this.mContextView.initForMode(mode);
    animateToMode(true);
    this.mContextView.sendAccessibilityEvent(32);
    this.mActionMode = mode;
    return mode;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:WindowDecorActionBar.java

示例4: onCreateActionMode

import android.support.v7.view.ActionMode; //导入依赖的package包/类
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
  MenuInflater inflater = getActivity().getMenuInflater();

  if (archive) inflater.inflate(R.menu.conversation_list_batch_unarchive, menu);
  else         inflater.inflate(R.menu.conversation_list_batch_archive, menu);

  inflater.inflate(R.menu.conversation_list_batch, menu);

  mode.setTitle(R.string.conversation_fragment_cab__batch_selection_mode);
  mode.setSubtitle(getString(R.string.conversation_fragment_cab__batch_selection_amount, 1));

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.action_mode_status_bar));
  }

  return true;
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:19,代码来源:ConversationListFragment.java

示例5: onActionItemClicked

import android.support.v7.view.ActionMode; //导入依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
    boolean consumed = false;
    if (mCallback != null) {
        consumed = mCallback.onActionItemClicked(mode, item);
    }

    if (!consumed) {
        if (mSupportSubItems) {
            SubItemUtil.deleteSelected(mFastAdapter, true, false);
        }
        else {
            mFastAdapter.deleteAllSelectedItems();
        }
        //finish the actionMode
        mode.finish();
    }
    return consumed;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:ActionModeHelper.java

示例6: onPrepareActionMode

import android.support.v7.view.ActionMode; //导入依赖的package包/类
@Override
public boolean onPrepareActionMode(final ActionMode mode, final Menu menu) {
    final int checkedCount = mChoiceMode.getCheckedItemCount();

    // Show / hide menu items or menu groups based on number of checked items
    final MenuItem item = menu.findItem(R.id.action_delete);
    item.setVisible(checkedCount > 0);

    // Update action mode title
    if (checkedCount > 0) {
        final Resources resources = getResources();
        mode.setTitle(resources.getQuantityString(R.plurals.action_mode_x_items_selected,
                checkedCount, checkedCount));
    } else {
        mode.setTitle(R.string.action_mode_no_items_selected);
    }

    return true;
}
 
开发者ID:GlobusLTD,项目名称:recyclerview-android,代码行数:20,代码来源:MultipleModalChoiceModeExampleActivity.java

示例7: onDestroyActionMode

import android.support.v7.view.ActionMode; //导入依赖的package包/类
@Override
public void onDestroyActionMode(ActionMode actionMode) {
    mListener.onDestroyActionMode(actionMode);
    // Clear all the checked items
    SparseBooleanArray checkedPositions = mListView.getCheckedItemPositions();
    if (checkedPositions != null) {
        for (int i = 0; i < checkedPositions.size(); i++) {
            mListView.setItemChecked(checkedPositions.keyAt(i), false);
        }
    }
    // Restore the original onItemClickListener
    mListView.setOnItemClickListener(mOldItemClickListener);
    // Clear the Action Mode
    mActionMode = null;
    // Reset the ListView's Choice Mode
    mListView.post(mSetChoiceModeNoneRunnable);
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:18,代码来源:MultiSelectionUtil.java

示例8: onActionItemClicked

import android.support.v7.view.ActionMode; //导入依赖的package包/类
@Override
public boolean onActionItemClicked(final ActionMode mode, final MenuItem item) {
    switch (item.getItemId()) {
        case R.id.action_delete:
            final LongArrayList checkedItems = mChoiceMode.getCheckedItems();
            final int size = checkedItems.size();
            for (int index = 0; index < size; index++) {
                final long itemId = checkedItems.get(index);
                mViewModel.deleteById(itemId);
            }
            mChoiceMode.finish();
            return true;

        default:
            return false;
    }
}
 
开发者ID:GlobusLTD,项目名称:recyclerview-android,代码行数:18,代码来源:MultipleModalChoiceModeExampleActivity.java

示例9: onDestroyActionMode

import android.support.v7.view.ActionMode; //导入依赖的package包/类
@Override
public void onDestroyActionMode(ActionMode actionMode) {
    mSelection.clearSelection();

    /* List adapter could be null, as we could be destroying the action mode of a fragment
     * which is in back stack. That fragment had its onDestroyView called, where list
     * adapter is set to null.
     */
    if (getListAdapter() != null) {
        getListAdapter().notifyDataSetChanged();
    }

    if (mActionModeListener != null) {
        mActionModeListener.actionModeDestroyed();
    }

    announceChangesToActivity();
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:19,代码来源:BookFragment.java

示例10: updateActionModeForSelection

import android.support.v7.view.ActionMode; //导入依赖的package包/类
@Override
public void updateActionModeForSelection(int selectedCount, ActionMode.Callback actionMode) {
    if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG, selectedCount, actionMode);

    if (mActionMode != null) { /* Action menu is already activated. */
        /* Finish action mode if there are no more selected items. */
        if (selectedCount == 0) {
            mActionMode.finish();
        } else {
            mActionMode.invalidate();
        }

    } else { /* No action menu activated - started it. */
        if (selectedCount > 0) {
            /* Start new action mode. */
            mActionMode = startSupportActionMode(actionMode);
        }
    }
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:20,代码来源:MainActivity.java

示例11: onActionItemClicked

import android.support.v7.view.ActionMode; //导入依赖的package包/类
@Override
public boolean onActionItemClicked(final ActionMode mode,
                                   MenuItem item) {
    if (isAdded() && getView() != null) {
        if (item.getTitle().toString().equals(mContext.getString(R.string.favorite))) {

        } else {
            mode.finish();
        }
    }
    return true;
}
 
开发者ID:SalmanTKhan,项目名称:MyAnimeViewer,代码行数:13,代码来源:HistoryMaterialFragment.java

示例12: onDestroyActionMode

import android.support.v7.view.ActionMode; //导入依赖的package包/类
@Override
public void onDestroyActionMode(ActionMode actionMode) {
    // On configuration change, API level 8 does not handle setting single choice in the middle of process.
    if (!multiSelectionFinishedByOnDestroyView) {
        setListSingleChoiceMode();
    }
    isMultiSelectionActive = false;
}
 
开发者ID:ChessCom,项目名称:android-chessclock,代码行数:9,代码来源:SettingsFragment.java

示例13: onDestroyActionMode

import android.support.v7.view.ActionMode; //导入依赖的package包/类
@Override
public void onDestroyActionMode(ActionMode mode) {
    try {
        usersAdapter.clearSelection();
    } catch (Exception e) {
        Log.e("onDestroyActionMode", e.getMessage(), e);
    }
    actionMode = null;
    toolbar.setVisibility(View.VISIBLE);
}
 
开发者ID:Zeyad-37,项目名称:RxRedux,代码行数:11,代码来源:UserListActivity.java

示例14: onDestroyActionMode

import android.support.v7.view.ActionMode; //导入依赖的package包/类
@Override
public void onDestroyActionMode(ActionMode mode) {
    if (getView() != null) {
        mActionMode = null;
        mAdapter.setMode(MODE_SINGLE);
        mAdapter.clearSelection();
    }
}
 
开发者ID:SalmanTKhan,项目名称:MyAnimeViewer,代码行数:9,代码来源:AnimeCardGridFragment.java

示例15: onActionItemClicked

import android.support.v7.view.ActionMode; //导入依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
    mUndoHelper.remove(findViewById(android.R.id.content), "Item removed", "Undo", Snackbar.LENGTH_LONG, mFastAdapter.getSelections());
    //as we no longer have a selection so the actionMode can be finished
    mode.finish();
    //we consume the event
    return true;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:MultiselectSampleActivity.java


注:本文中的android.support.v7.view.ActionMode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。