Java Code Examples for android.support.v7.view.ActionMode#Callback

The following examples show how to use android.support.v7.view.ActionMode#Callback . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChannelListFragment.java    From Plumble with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onChannelClick(IChannel channel) {
    if (mTargetProvider.getChatTarget() != null &&
            channel.equals(mTargetProvider.getChatTarget().getChannel()) &&
            mActionMode != null) {
        // Dismiss action mode if double pressed. FIXME: use list view selection instead?
        mActionMode.finish();
    } else {
        ActionMode.Callback cb = new ChatTargetActionModeCallback(mTargetProvider, new ChatTargetProvider.ChatTarget(channel)) {
            @Override
            public void onDestroyActionMode(ActionMode actionMode) {
                super.onDestroyActionMode(actionMode);
                mActionMode = null;
            }
        };
        mActionMode = ((ActionBarActivity)getActivity()).startSupportActionMode(cb);
    }
}
 
Example 2
Source File: ChannelListFragment.java    From Plumble with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onUserClick(IUser user) {
    if (mTargetProvider.getChatTarget() != null &&
            user.equals(mTargetProvider.getChatTarget().getUser()) &&
            mActionMode != null) {
        // Dismiss action mode if double pressed. FIXME: use list view selection instead?
        mActionMode.finish();
    } else {
        ActionMode.Callback cb = new ChatTargetActionModeCallback(mTargetProvider, new ChatTargetProvider.ChatTarget(user)) {
            @Override
            public void onDestroyActionMode(ActionMode actionMode) {
                super.onDestroyActionMode(actionMode);
                mActionMode = null;
            }
        };
        mActionMode = ((ActionBarActivity)getActivity()).startSupportActionMode(cb);
    }
}
 
Example 3
Source File: Card.java    From Pimp_my_Z1 with GNU General Public License v2.0 5 votes vote down vote up
public Card(String title, String desc, String color, String unit, String prop, int seekBarMin, int seekBarMax, int seekBarProgress, int seekBarProgress2, ActionBarActivity fa, ActionMode.Callback callback) {
    this.title = title;
    this.desc = desc;
    this.color = color;
    this.unit = unit;
    this.seekbarMin = seekBarMin;
    this.seekBarMax = seekBarMax;
    this.seekBarProgress = seekBarProgress;
    this.seekBarProgress2 = seekBarProgress2;
    this.fa = fa;
    this.prop = prop;
    this.callback = callback;
}
 
Example 4
Source File: Card.java    From Pimp_my_Z1 with GNU General Public License v2.0 5 votes vote down vote up
public Card(String title, String desc, String color, String unit, String prop, int seekBarMax, int seekBarProgress, int seekBarProgress2, ActionBarActivity fa, ActionMode.Callback callback) {
    this.title = title;
    this.desc = desc;
    this.color = color;
    this.unit = unit;
    this.seekBarMax = seekBarMax;
    this.seekBarProgress = seekBarProgress;
    this.seekBarProgress2 = seekBarProgress2;
    this.fa = fa;
    this.prop = prop;
    this.callback = callback;
}
 
Example 5
Source File: Card.java    From Pimp_my_Z1 with GNU General Public License v2.0 5 votes vote down vote up
public Card(String title, String desc, String unit, String prop, int seekBarMax, int seekBarProgress, ActionBarActivity fa, ActionMode.Callback callback) {
    this.title = title;
    this.desc = desc;
    this.unit = unit;
    this.seekBarMax = seekBarMax;
    this.seekBarProgress = seekBarProgress;
    this.fa = fa;
    this.prop = prop;
    this.callback = callback;
}
 
Example 6
Source File: ChatActivity.java    From actor-platform with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public ActionMode startSupportActionMode(@NonNull final ActionMode.Callback callback) {
    // Fix for bug https://code.google.com/p/android/issues/detail?id=159527
    final ActionMode mode = super.startSupportActionMode(callback);
    if (mode != null) {
        mode.invalidate();
    }
    return mode;
}
 
Example 7
Source File: Card.java    From Pimp_my_Z1 with GNU General Public License v2.0 5 votes vote down vote up
public Card(String title, String desc, String unit, int seekBarMax, int seekBarProgress, ActionBarActivity fa, ActionMode.Callback callback) {
    this.title = title;
    this.desc = desc;
    this.unit = unit;
    this.seekBarMax = seekBarMax;
    this.seekBarProgress = seekBarProgress;
    this.fa = fa;
    this.callback = callback;
}
 
Example 8
Source File: CardSeekBarSC.java    From Pimp_my_Z1 with GNU General Public License v2.0 4 votes vote down vote up
public CardSeekBarSC(String title, String desc, String color, String unit, String prop, int seekBarMax, int seekBarProgress, ActionBarActivity fa, ActionMode.Callback callback) {
    super(title, desc, color, unit, prop, seekBarMax, seekBarProgress, fa, callback);
}
 
Example 9
Source File: CardSeekBarReadahead.java    From Pimp_my_Z1 with GNU General Public License v2.0 4 votes vote down vote up
public CardSeekBarReadahead(String title, String desc, String color, String unit, String prop, int seekBarMin, int seekBarMax, int seekBarProgress, ActionBarActivity fa, ActionMode.Callback callback) {
    super(title, desc, color, unit, prop, seekBarMin, seekBarMax, seekBarProgress, fa, callback);
}
 
Example 10
Source File: CardSeekBar.java    From Pimp_my_Z1 with GNU General Public License v2.0 4 votes vote down vote up
public CardSeekBar(String title, String desc, String color, String unit, String prop, int seekBarMin, int seekBarMax, int seekBarProgress, ActionBarActivity fa, ActionMode.Callback callback) {
    super(title, desc, color, unit, prop, seekBarMin, seekBarMax, seekBarProgress, fa, callback);
}
 
Example 11
Source File: CardEditText.java    From Pimp_my_Z1 with GNU General Public License v2.0 4 votes vote down vote up
public CardEditText(String title, String desc, String unit, String prop, int seekBarMax, int seekBarProgress, ActionBarActivity fa, ActionMode.Callback callback) {
    super(title, desc, unit, prop, seekBarMax, seekBarProgress, fa, callback);
}
 
Example 12
Source File: CardDoubleSeekBarPA.java    From Pimp_my_Z1 with GNU General Public License v2.0 4 votes vote down vote up
public CardDoubleSeekBarPA(String title, String desc, String color, String unit, String prop, int seekBarMax, int seekBarProgress, int seekBarProgress2, ActionBarActivity fa, ActionMode.Callback callback) {
    super(title, desc, color, unit, prop, seekBarMax, seekBarProgress, seekBarProgress2, fa, callback);
    location = prop;
}
 
Example 13
Source File: MainActivity.java    From material-notes with Apache License 2.0 4 votes vote down vote up
/** Crea la llamada al modo contextual. */
private void setupActionModeCallback() {
    actionModeCallback = new ActionMode.Callback() {

        /** {@inheritDoc} */
        @Override
        public boolean onCreateActionMode(ActionMode mode, Menu menu) {
            setListOnItemClickListenersWhenActionMode();
            // inflar menu contextual
            mode.getMenuInflater().inflate(R.menu.context_note, menu);
            return true;
        }

        /** {@inheritDoc} */
        @Override
        public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
            // Nada
            return false;
        }

        /** {@inheritDoc} */
        @Override
        public boolean onActionItemClicked(final ActionMode mode, MenuItem item) {
            switch (item.getItemId()) {
                // borrar notas solo si hay notas a borrar; sino se acaba el modo contextual.
                case R.id.action_delete:
                    if (!selectedPositions.isEmpty()) {
                        new AlertDialog.Builder(MainActivity.this)
                                .setMessage(getString(R.string.delete_notes_alert, selectedPositions.size()))
                                .setNegativeButton(android.R.string.no, null)
                                .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {

                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                                        deleteNotes(selectedPositions);
                                        mode.finish();
                                    }
                                })
                                .show();
                    } else mode.finish();
                    return true;
                default:
                    return false;
            }
        }

        /** {@inheritDoc} */
        @Override
        public void onDestroyActionMode(ActionMode mode) {
            // Regresar al modo normal
            setListOnItemClickListenersWhenNoActionMode();
            resetSelectedListItems();
        }
    };
}
 
Example 14
Source File: RobotoInflater.java    From Android-RobotoTextView with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public ActionMode onWindowStartingSupportActionMode(ActionMode.Callback callback) {
    return null;
}
 
Example 15
Source File: FileListPagerFragment.java    From 920-text-editor-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public ActionMode startActionMode(ActionMode.Callback callback) {
    return ((AppCompatActivity)getActivity()).startSupportActionMode(callback);
}
 
Example 16
Source File: FolioActivity.java    From ankihelper with GNU General Public License v3.0 4 votes vote down vote up
@Nullable
@Override
public ActionMode startSupportActionMode(@NonNull ActionMode.Callback callback) {
    return super.startSupportActionMode(callback);
}
 
Example 17
Source File: FolioActivity.java    From ankihelper with GNU General Public License v3.0 4 votes vote down vote up
@Nullable
@Override
public ActionMode onWindowStartingSupportActionMode(@NonNull ActionMode.Callback callback) {
    return super.onWindowStartingSupportActionMode(callback);
}
 
Example 18
Source File: FileListPagerFragment.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
@Override
public ActionMode startActionMode(ActionMode.Callback callback) {
    return ((AppCompatActivity)getActivity()).startSupportActionMode(callback);
}
 
Example 19
Source File: AppCompatPreferenceActivity.java    From Nimingban with Apache License 2.0 2 votes vote down vote up
/**
 * Called when a support action mode is being started for this window. Gives the
 * callback an opportunity to handle the action mode in its own unique and
 * beautiful way. If this method returns null the system can choose a way
 * to present the mode or choose not to start the mode at all.
 *
 * @param callback Callback to control the lifecycle of this action mode
 * @return The ActionMode that was started, or null if the system should present it
 */
@Nullable
@Override
public ActionMode onWindowStartingSupportActionMode(ActionMode.Callback callback) {
    return null;
}
 
Example 20
Source File: FileExplorerView.java    From 920-text-editor-v2 with Apache License 2.0 votes vote down vote up
ActionMode startActionMode(ActionMode.Callback callback);