Search in sources :

Example 1 with TextStreamListAdapter

use of com.genonbeta.TrebleShot.adapter.TextStreamListAdapter in project TrebleShot by genonbeta.

the class TextStreamListFragment method onAdapter.

@Override
public TextStreamListAdapter onAdapter() {
    return new TextStreamListAdapter(getActivity()) {

        @Override
        public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {
            super.onBindViewHolder(holder, position);
            holder.getView().setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    if (!holder.isRepresentative() && !setItemSelected(holder)) {
                        TextStreamObject textStreamObject = getAdapter().getItem(holder);
                        startActivity(new Intent(getContext(), TextEditorActivity.class).setAction(TextEditorActivity.ACTION_EDIT_TEXT).putExtra(TextEditorActivity.EXTRA_CLIPBOARD_ID, textStreamObject.id).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
                    }
                }
            });
        }
    };
}
Also used : TextStreamObject(com.genonbeta.TrebleShot.object.TextStreamObject) TextEditorActivity(com.genonbeta.TrebleShot.activity.TextEditorActivity) NonNull(android.support.annotation.NonNull) TextStreamListAdapter(com.genonbeta.TrebleShot.adapter.TextStreamListAdapter) Intent(android.content.Intent) View(android.view.View)

Aggregations

Intent (android.content.Intent)1 NonNull (android.support.annotation.NonNull)1 View (android.view.View)1 TextEditorActivity (com.genonbeta.TrebleShot.activity.TextEditorActivity)1 TextStreamListAdapter (com.genonbeta.TrebleShot.adapter.TextStreamListAdapter)1 TextStreamObject (com.genonbeta.TrebleShot.object.TextStreamObject)1