Search in sources :

Example 71 with GridLayoutManager

use of androidx.recyclerview.widget.GridLayoutManager in project AntennaPod by AntennaPod.

the class VariableSpeedDialog method onCreateView.

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View root = View.inflate(getContext(), R.layout.speed_select_dialog, null);
    speedSeekBar = root.findViewById(R.id.speed_seek_bar);
    speedSeekBar.setProgressChangedListener(multiplier -> {
        if (controller != null) {
            controller.setPlaybackSpeed(multiplier);
        }
    });
    RecyclerView selectedSpeedsGrid = root.findViewById(R.id.selected_speeds_grid);
    selectedSpeedsGrid.setLayoutManager(new GridLayoutManager(getContext(), 3));
    selectedSpeedsGrid.addItemDecoration(new ItemOffsetDecoration(getContext(), 4));
    adapter = new SpeedSelectionAdapter();
    adapter.setHasStableIds(true);
    selectedSpeedsGrid.setAdapter(adapter);
    addCurrentSpeedChip = root.findViewById(R.id.add_current_speed_chip);
    addCurrentSpeedChip.setCloseIconVisible(true);
    addCurrentSpeedChip.setCloseIconResource(R.drawable.ic_add);
    addCurrentSpeedChip.setOnCloseIconClickListener(v -> addCurrentSpeed());
    addCurrentSpeedChip.setOnClickListener(v -> addCurrentSpeed());
    return root;
}
Also used : GridLayoutManager(androidx.recyclerview.widget.GridLayoutManager) RecyclerView(androidx.recyclerview.widget.RecyclerView) ItemOffsetDecoration(de.danoeh.antennapod.view.ItemOffsetDecoration) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) Nullable(androidx.annotation.Nullable)

Example 72 with GridLayoutManager

use of androidx.recyclerview.widget.GridLayoutManager in project MyJapanese by 54wall.

the class GojuonMemoryFragment method setRecyclerView.

@Override
public void setRecyclerView(int type) {
    switch(type) {
        case Constants.GOJUON_CHENGYU:
            RecyclerView.LayoutManager layoutManager2 = new GridLayoutManager(getContext(), Constants.COLUMN_CHENGYU);
            mRecyclerView.setLayoutManager(layoutManager2);
            break;
        case Constants.GOJUON_MEMORY:
            LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
            linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
            mRecyclerView.setLayoutManager(linearLayoutManager);
            break;
        default:
            break;
    }
}
Also used : GridLayoutManager(androidx.recyclerview.widget.GridLayoutManager) RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Example 73 with GridLayoutManager

use of androidx.recyclerview.widget.GridLayoutManager 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)

Example 74 with GridLayoutManager

use of androidx.recyclerview.widget.GridLayoutManager in project wire-android by wireapp.

the class CursorImagesLayout method onFinishInflate.

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    recyclerView = ViewUtils.getView(this, R.id.rv__cursor_images);
    recyclerView.setHasFixedSize(true);
    recyclerView.setDrawingCacheEnabled(true);
    recyclerView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
    GridLayoutManager layout = new GridLayoutManager(getContext(), IMAGE_ROWS, GridLayoutManager.HORIZONTAL, false);
    layout.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {

        @Override
        public int getSpanSize(int position) {
            return (cursorImagesAdapter.getItemViewType(position) == CursorImagesAdapter.VIEW_TYPE_CAMERA) ? IMAGE_ROWS : 1;
        }
    });
    recyclerView.setLayoutManager(layout);
    int dividerSpacing = getContext().getResources().getDimensionPixelSize(R.dimen.extended_container__camera__gallery_grid__divider__spacing);
    recyclerView.addItemDecoration(new CursorImagesItemDecoration(dividerSpacing));
    buttonNavToCamera = ViewUtils.getView(this, R.id.gtv__cursor_image__nav_camera_back);
    buttonOpenGallery = ViewUtils.getView(this, R.id.gtv__cursor_image__nav_open_gallery);
    buttonNavToCamera.setVisibility(View.GONE);
    buttonNavToCamera.setOnClickListener(this);
    buttonOpenGallery.setOnClickListener(this);
}
Also used : GridLayoutManager(androidx.recyclerview.widget.GridLayoutManager) Quint(com.waz.zclient.ui.animation.interpolators.penner.Quint)

Example 75 with GridLayoutManager

use of androidx.recyclerview.widget.GridLayoutManager in project FlexibleAdapter by davideas.

the class FragmentExpandableMultiLevel method createNewGridLayoutManager.

@Override
protected GridLayoutManager createNewGridLayoutManager() {
    GridLayoutManager gridLayoutManager = new SmoothScrollGridLayoutManager(getActivity(), mColumnCount);
    gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {

        @Override
        public int getSpanSize(int position) {
            // here, you should use them and not Layout integers
            switch(mAdapter.getItemViewType(position)) {
                case R.layout.recycler_scrollable_layout_item:
                case R.layout.recycler_scrollable_uls_item:
                case R.layout.recycler_header_item:
                case R.layout.recycler_expandable_header_item:
                case R.layout.recycler_expandable_item:
                    return mColumnCount;
                default:
                    return 1;
            }
        }
    });
    return gridLayoutManager;
}
Also used : GridLayoutManager(androidx.recyclerview.widget.GridLayoutManager) SmoothScrollGridLayoutManager(eu.davidea.flexibleadapter.common.SmoothScrollGridLayoutManager) SmoothScrollGridLayoutManager(eu.davidea.flexibleadapter.common.SmoothScrollGridLayoutManager)

Aggregations

GridLayoutManager (androidx.recyclerview.widget.GridLayoutManager)122 RecyclerView (androidx.recyclerview.widget.RecyclerView)63 View (android.view.View)45 TextView (android.widget.TextView)19 StaggeredGridLayoutManager (androidx.recyclerview.widget.StaggeredGridLayoutManager)16 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)13 ImageView (android.widget.ImageView)12 Nullable (androidx.annotation.Nullable)11 Toolbar (androidx.appcompat.widget.Toolbar)10 ViewGroup (android.view.ViewGroup)7 SmoothScrollGridLayoutManager (eu.davidea.flexibleadapter.common.SmoothScrollGridLayoutManager)7 SuppressLint (android.annotation.SuppressLint)6 Context (android.content.Context)6 ArrayList (java.util.ArrayList)6 NonNull (androidx.annotation.NonNull)5 SwipeRefreshLayout (androidx.swiperefreshlayout.widget.SwipeRefreshLayout)5 List (java.util.List)5 RefreshingListenerAdapter (me.dkzwm.widget.srl.RefreshingListenerAdapter)5 Drawable (android.graphics.drawable.Drawable)4 Handler (android.os.Handler)3