Search in sources :

Example 1 with EmojiSize

use of com.waz.zclient.ui.colorpicker.EmojiSize in project wire-android by wireapp.

the class DrawingFragment method onEmojiClick.

public void onEmojiClick() {
    final EmojiBottomSheetDialog dialog = new EmojiBottomSheetDialog(getContext(), currentEmojiSize, new EmojiBottomSheetDialog.EmojiDialogListener() {

        @Override
        public void onEmojiSelected(String emoji, EmojiSize emojiSize) {
            actionButtonEmoji.setTextColor(getControllerFactory().getAccentColorController().getColor());
            actionButtonSketch.setTextColor(defaultTextColor);
            actionButtonText.setTextColor(defaultTextColor);
            drawingCanvasView.setEmoji(emoji, emojiSize.getEmojiSize(getContext()));
            currentEmojiSize = emojiSize;
            getControllerFactory().getUserPreferencesController().addRecentEmoji(emoji);
        }
    }, getControllerFactory().getUserPreferencesController().getRecentEmojis(), getControllerFactory().getUserPreferencesController().getUnsupportedEmojis());
    dialog.show();
}
Also used : EmojiBottomSheetDialog(com.waz.zclient.ui.colorpicker.EmojiBottomSheetDialog) EmojiSize(com.waz.zclient.ui.colorpicker.EmojiSize)

Example 2 with EmojiSize

use of com.waz.zclient.ui.colorpicker.EmojiSize in project wire-android by wireapp.

the class EmojiKeyboardLayout method init.

private void init() {
    currentEmojiSize = EmojiSize.MEDIUM;
    categoryPositions = new int[CATEGORY_COUNT];
    emojiAdapter = new EmojiAdapter(getContext());
    layoutManager = new GridLayoutManager(getContext(), SPAN_COUNT, LinearLayoutManager.HORIZONTAL, false);
    layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {

        @Override
        public int getSpanSize(int position) {
            return spaces.contains(position) ? SPAN_COUNT : 1;
        }
    });
    layoutManager.setSpanCount(SPAN_COUNT);
    recyclerView.addOnScrollListener(new EmojiScrollListener());
    tapIndicatorLayout.setShowDivider(false);
    tapIndicatorLayout.setGlyphLabels(Emojis.EMOJI_KEYBOARD_TAB_LABELS);
    tapIndicatorLayout.setTextColor(ContextCompat.getColorStateList(getContext(), R.color.wire__text_color_dark_selector));
    tapIndicatorLayout.setPrimaryColor(ContextCompat.getColor(getContext(), R.color.text__primary_dark));
    tapIndicatorLayout.setLabelHeight(getContext().getResources().getDimensionPixelSize(R.dimen.sketch__emoji__keyboard__tab_label_size));
    tapIndicatorLayout.setCallback(new TabIndicatorLayout.Callback() {

        @Override
        public void onItemSelected(int pos) {
            if (ViewCompat.getLayoutDirection(EmojiKeyboardLayout.this) == ViewCompat.LAYOUT_DIRECTION_RTL) {
                // Revert tab position for RTL layout
                pos = (TAB_COUNT - 1) - pos;
            }
            if (pos == TAB_COUNT - 1) {
                Threading.Background().execute(new Runnable() {

                    @Override
                    public void run() {
                        Instrumentation inst = new Instrumentation();
                        inst.sendKeyDownUpSync(KeyEvent.KEYCODE_DEL);
                    }
                });
            } else {
                tapIndicatorLayout.setSelected(pos);
                layoutManager.scrollToPositionWithOffset(getCategoryByTabPosition(pos), 0);
            }
        }
    });
    recyclerView.setAdapter(emojiAdapter);
    recyclerView.setLayoutManager(layoutManager);
    setRecyclerViewPadding(recyclerView);
    emojiAdapter.setOnEmojiClickListener(new EmojiAdapter.OnEmojiClickListener() {

        @Override
        public void onEmojiClick(String emoji, EmojiSize emojiSize) {
            if (callback != null) {
                callback.onEmojiSelected(emoji);
            }
        }
    });
}
Also used : Instrumentation(android.app.Instrumentation) TabIndicatorLayout(com.waz.zclient.ui.views.tab.TabIndicatorLayout) EmojiSize(com.waz.zclient.ui.colorpicker.EmojiSize) GridLayoutManager(androidx.recyclerview.widget.GridLayoutManager) EmojiAdapter(com.waz.zclient.ui.colorpicker.EmojiAdapter)

Aggregations

EmojiSize (com.waz.zclient.ui.colorpicker.EmojiSize)2 Instrumentation (android.app.Instrumentation)1 GridLayoutManager (androidx.recyclerview.widget.GridLayoutManager)1 EmojiAdapter (com.waz.zclient.ui.colorpicker.EmojiAdapter)1 EmojiBottomSheetDialog (com.waz.zclient.ui.colorpicker.EmojiBottomSheetDialog)1 TabIndicatorLayout (com.waz.zclient.ui.views.tab.TabIndicatorLayout)1