kandi background
Explore Kits

folding-cell-android | material design expanding content cell inspired | User Interface library

 by   Ramotion Java Version: Current License: MIT

 by   Ramotion Java Version: Current License: MIT

Download this library from

kandi X-RAY | folding-cell-android Summary

folding-cell-android is a Java library typically used in User Interface applications. folding-cell-android has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. However folding-cell-android has 2 bugs. You can download it from GitHub, Maven.
:octocat: 📃 FoldingCell is a material design expanding content cell inspired by folding paper material made by @Ramotion
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • folding-cell-android has a medium active ecosystem.
  • It has 4822 star(s) with 849 fork(s). There are 159 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 7 open issues and 64 have been closed. On average issues are closed in 232 days. There are no pull requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of folding-cell-android is current.
folding-cell-android Support
Best in #User Interface
Average in #User Interface
folding-cell-android Support
Best in #User Interface
Average in #User Interface

quality kandi Quality

  • folding-cell-android has 2 bugs (0 blocker, 0 critical, 0 major, 2 minor) and 21 code smells.
folding-cell-android Quality
Best in #User Interface
Average in #User Interface
folding-cell-android Quality
Best in #User Interface
Average in #User Interface

securitySecurity

  • folding-cell-android has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • folding-cell-android code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
folding-cell-android Security
Best in #User Interface
Average in #User Interface
folding-cell-android Security
Best in #User Interface
Average in #User Interface

license License

  • folding-cell-android is licensed under the MIT License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
folding-cell-android License
Best in #User Interface
Average in #User Interface
folding-cell-android License
Best in #User Interface
Average in #User Interface

buildReuse

  • folding-cell-android releases are not available. You will need to build from source code and install.
  • Deployable package is available in Maven.
  • Build file is available. You can build the component from source.
  • Installation instructions, examples and code snippets are available.
  • folding-cell-android saves you 706 person hours of effort in developing the same functionality from scratch.
  • It has 1632 lines of code, 78 functions and 28 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
folding-cell-android Reuse
Best in #User Interface
Average in #User Interface
folding-cell-android Reuse
Best in #User Interface
Average in #User Interface
Top functions reviewed by kandi - BETA

kandi has reviewed folding-cell-android and discovered the below as its top functions. This is intended to give you an instant insight into folding-cell-android implemented functionality, and help decide if they suit your requirements.

  • Get view .
  • Fold this cell .
  • Unfolding content .
  • Override this to create the list view .
  • Returns true if the item are equal
  • Set back view .
  • Apply a transformation .
  • Returns a hash code for the purchase .
  • Add a view to the FoldingCellView .
  • String representation of this animation .

folding-cell-android Key Features

:octocat: 📃 FoldingCell is a material design expanding content cell inspired by folding paper material made by @Ramotion

Installation

copy iconCopydownload iconDownload
'com.ramotion.foldingcell:folding-cell:1.2.3'

Basic usage

copy iconCopydownload iconDownload
<com.ramotion.foldingcell.FoldingCell
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/folding_cell"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
​
</com.ramotion.foldingcell.FoldingCell>

Expanding / Collapsing Cards in Recycler View sometimes result in whitespaces and drawing bugs

copy iconCopydownload iconDownload
if(foldingCellPosition != -1) {
     currentFoldingCell.fold(false);
}
  public void checkForHide(int first, int last){
        if(foldingCellPosition != -1){
            if(foldingCellPosition < first || foldingCellPosition > last){
                foldingCellPosition = -1;
            }
        }
    }
  mBinding.movieDetailReviewListRvReviews.addOnScrollListener(new RecyclerView.OnScrollListener() {
            @Override
            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
                super.onScrolled(recyclerView, dx, dy);
                // Load more data if reached the end of the list
                adapter.checkForHide(layoutManager.findFirstVisibleItemPosition(), layoutManager.findLastVisibleItemPosition());

                if (layoutManager.findLastVisibleItemPosition() == adapter.reviewList.size() - 1 && !isLoadingLocked && !isLoading) {
                    if (pageToDownload < totalPages) {
                        mBinding.layoutContent.pbLoadingMore.setVisibility(View.VISIBLE);
                        downloadMovieReviews();
                    }
                }
            }
        });
-----------------------
if(foldingCellPosition != -1) {
     currentFoldingCell.fold(false);
}
  public void checkForHide(int first, int last){
        if(foldingCellPosition != -1){
            if(foldingCellPosition < first || foldingCellPosition > last){
                foldingCellPosition = -1;
            }
        }
    }
  mBinding.movieDetailReviewListRvReviews.addOnScrollListener(new RecyclerView.OnScrollListener() {
            @Override
            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
                super.onScrolled(recyclerView, dx, dy);
                // Load more data if reached the end of the list
                adapter.checkForHide(layoutManager.findFirstVisibleItemPosition(), layoutManager.findLastVisibleItemPosition());

                if (layoutManager.findLastVisibleItemPosition() == adapter.reviewList.size() - 1 && !isLoadingLocked && !isLoading) {
                    if (pageToDownload < totalPages) {
                        mBinding.layoutContent.pbLoadingMore.setVisibility(View.VISIBLE);
                        downloadMovieReviews();
                    }
                }
            }
        });
-----------------------
if(foldingCellPosition != -1) {
     currentFoldingCell.fold(false);
}
  public void checkForHide(int first, int last){
        if(foldingCellPosition != -1){
            if(foldingCellPosition < first || foldingCellPosition > last){
                foldingCellPosition = -1;
            }
        }
    }
  mBinding.movieDetailReviewListRvReviews.addOnScrollListener(new RecyclerView.OnScrollListener() {
            @Override
            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
                super.onScrolled(recyclerView, dx, dy);
                // Load more data if reached the end of the list
                adapter.checkForHide(layoutManager.findFirstVisibleItemPosition(), layoutManager.findLastVisibleItemPosition());

                if (layoutManager.findLastVisibleItemPosition() == adapter.reviewList.size() - 1 && !isLoadingLocked && !isLoading) {
                    if (pageToDownload < totalPages) {
                        mBinding.layoutContent.pbLoadingMore.setVisibility(View.VISIBLE);
                        downloadMovieReviews();
                    }
                }
            }
        });

Community Discussions

Trending Discussions on folding-cell-android
  • Expanding / Collapsing Cards in Recycler View sometimes result in whitespaces and drawing bugs
Trending Discussions on folding-cell-android

QUESTION

Expanding / Collapsing Cards in Recycler View sometimes result in whitespaces and drawing bugs

Asked 2017-Jul-03 at 23:33

The Problem


I have a recycler view with card items. These card items contain only text and are expandable.It looks like this Collapsed Expanded

Now I expand and collapse one of them sometimes and scroll around and somehow there appears now more whitespace between the cards: Whitespace between cards

Moreover, for cards with long text when I click to collapse them, this appears: Big Cards

The Code


xml:

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <com.ramotion.foldingcell.FoldingCell
        android:id="@+id/folding_cell"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clickable="true"
        app:backSideColor="#F5F5F5">

        <FrameLayout
            android:id="@+id/cell_content_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:minHeight="300dp"
            android:visibility="gone">

            <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:cardview="http://schemas.android.com/apk/res-auto"
                xmlns:custom="http://schemas.android.com/apk/res-auto"
                xmlns:tools="http://schemas.android.com/tools"
                android:id="@+id/movie_card2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:clickable="true"
                android:foreground="?attr/selectableItemBackground"
                android:minHeight="300dp"
                cardview:cardBackgroundColor="@color/card_background"
                cardview:cardCornerRadius="1dp"
                cardview:cardElevation="4dp"
                cardview:cardUseCompatPadding="true">

                <RelativeLayout
                    android:id="@+id/review_item2"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:clickable="true"
                    android:orientation="vertical">

                    <View
                        android:id="@+id/review_detail_header"
                        android:layout_width="match_parent"
                        android:layout_height="50dp"
                        android:background="@color/material_red_400" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignBottom="@id/review_detail_header"
                        android:layout_alignTop="@id/review_detail_header"
                        android:layout_centerHorizontal="true"
                        android:gravity="center"
                        android:text="Review Details"
                        android:textColor="@color/text_secondary" />

                    <ImageView
                        android:id="@+id/ic"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/review_detail_header"
                        android:layout_marginTop="@dimen/material_layout_keylines_horizontal_margin"
                        android:adjustViewBounds="true"
                        android:paddingLeft="@dimen/material_layout_keylines_horizontal_margin"
                        android:paddingRight="@dimen/material_layout_keylines_horizontal_margin"
                        android:src="@drawable/ic_account_circle_white_24dp"
                        android:tint="@color/accent"
                        tools:ignore="ContentDescription" />

                    <com.mt.moviesiwanttowatch.ui.widget.TextViewRoboto
                        android:id="@+id/review_author2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/review_detail_header"
                        android:layout_gravity="center_vertical"
                        android:layout_marginTop="@dimen/material_layout_keylines_horizontal_margin"
                        android:layout_toRightOf="@id/ic"
                        android:textSize="14sp"
                        custom:robotoType="bold"
                        tools:text="User Name" />

                    <com.mt.moviesiwanttowatch.ui.widget.TextViewRoboto
                        android:id="@+id/review_body2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/review_author2"
                        android:layout_marginBottom="@dimen/material_layout_keylines_horizontal_margin"
                        android:layout_marginLeft="56dp"
                        android:layout_marginRight="24dp"
                        android:layout_marginTop="@dimen/material_layout_vertical_spacing_between_content_areas"
                        android:layout_weight="1"
                        android:ellipsize="none"
                        android:maxLines="100"
                        android:scrollHorizontally="false"
                        android:textSize="14sp"
                        custom:robotoType="regular"
                        tools:text="The movie's review goes here..." />

                    <com.mt.moviesiwanttowatch.ui.widget.TextViewRoboto
                        android:id="@+id/review_spoiler2"
                        style="@style/ReviewBodyStyle"
                        android:text="@string/reviews_alert"
                        android:textColor="@color/primary"
                        android:visibility="gone"
                        custom:robotoType="bold" />


                    <com.mt.moviesiwanttowatch.ui.widget.TextViewRoboto
                        android:id="@+id/review_time2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentEnd="true"
                        android:layout_alignParentRight="true"
                        android:layout_below="@+id/review_body2"
                        android:layout_margin="@dimen/material_layout_keylines_horizontal_margin"
                        android:textSize="@dimen/material_layout_keylines_horizontal_margin"
                        android:visibility="gone"
                        custom:robotoType="regular"
                        tools:text="01 Jan 2016" />

                </RelativeLayout>

            </android.support.v7.widget.CardView>

        </FrameLayout>
        ​

        <FrameLayout
            android:id="@+id/cell_title_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:cardview="http://schemas.android.com/apk/res-auto"
                xmlns:custom="http://schemas.android.com/apk/res-auto"
                xmlns:tools="http://schemas.android.com/tools"
                android:id="@+id/movie_card"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:clickable="true"
                android:foreground="?attr/selectableItemBackground"
                cardview:cardBackgroundColor="@color/card_background"
                cardview:cardCornerRadius="1dp"
                cardview:cardElevation="4dp"
                cardview:cardUseCompatPadding="true">

                <RelativeLayout
                    android:id="@+id/review_item"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="?attr/selectableItemBackground"
                    android:clickable="true"
                    android:orientation="vertical"
                    android:padding="@dimen/material_layout_keylines_horizontal_margin">


                    <ImageView
                        android:id="@+id/ic2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentLeft="true"
                        android:layout_alignParentStart="true"
                        android:adjustViewBounds="true"
                        android:src="@drawable/ic_account_circle_white_24dp"
                        android:tint="@color/accent"
                        tools:ignore="ContentDescription" />

                    <com.mt.moviesiwanttowatch.ui.widget.TextViewRoboto
                        android:id="@+id/review_author"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="@dimen/material_layout_keylines_horizontal_margin"
                        android:layout_toRightOf="@+id/ic2"
                        custom:robotoType="bold"
                        android:textSize="14sp"
                        tools:text="User Name" />

                    <!-- Review open icon -->
                    <ImageView
                        android:id="@+id/review_open"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentEnd="true"
                        android:layout_alignParentRight="true"
                        android:adjustViewBounds="true"
                        android:src="@drawable/ic_open_in_new_white_24dp"
                        android:tint="@color/accent"
                        tools:ignore="contentDescription" />

                    <!-- Review Body -->

                    <com.mt.moviesiwanttowatch.ui.widget.TextViewRoboto
                        android:id="@+id/review_body"
                        style="@style/ReviewBodyStyle"
                        android:layout_marginLeft="40dp"
                        android:layout_marginRight="8dp"
                        android:layout_below="@+id/review_spoiler"
                        custom:robotoType="regular"
                        tools:text="The movie's review goes here..." />

                    <com.mt.moviesiwanttowatch.ui.widget.TextViewRoboto
                        android:id="@+id/review_spoiler"
                        style="@style/ReviewBodyStyle"
                        android:layout_below="@id/review_open"
                        android:text="@string/reviews_alert"
                        android:textColor="@color/primary"
                        android:layout_marginLeft="40dp"
                        android:layout_marginRight="8dp"
                        android:visibility="gone"
                        custom:robotoType="bold" />


                    <com.mt.moviesiwanttowatch.ui.widget.TextViewRoboto
                        android:id="@+id/review_time"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentEnd="true"
                        android:layout_alignParentRight="true"
                        android:layout_below="@+id/review_body"
                        android:layout_margin="@dimen/material_layout_keylines_horizontal_margin"
                        android:textSize="@dimen/material_layout_keylines_horizontal_margin"
                        android:visibility="gone"
                        custom:robotoType="regular"
                        tools:text="01 Jan 2016" />

                </RelativeLayout>

            </android.support.v7.widget.CardView>

        </FrameLayout>
    </com.ramotion.foldingcell.FoldingCell>
</layout>

The adapter:

public class ReviewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

    public ArrayList<Review> reviewList;
    public int foldingCellPosition = -1;
    public FoldingCell currentFoldingCell;
    // Constructor
    public ReviewAdapter(ArrayList<Review> reviewList) {
        this.reviewList = reviewList;
    }

    // RecyclerView methods
    @Override
    public int getItemCount() {
        return reviewList.size();
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        ViewGroup v = (ViewGroup) LayoutInflater.from(parent.getContext()).inflate(R.layout.item_list_review, parent, false);
        return new ReviewViewHolder(v);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
        Review review = reviewList.get(position);
        ReviewViewHolder holder = (ReviewViewHolder) viewHolder;
        if (position == foldingCellPosition) {
            holder.binding.foldingCell.unfold(true);
            holder.binding.reviewBody2.setText(review.getComment());
            holder.binding.reviewAuthor2.setText(review.getUsername());
            return;
        }


        holder.binding.foldingCell.fold(true);
        holder.binding.reviewAuthor.setText(review.getUsername());
        if (review.isHasSpoiler()) {
            holder.binding.reviewBody.setVisibility(View.GONE);
            holder.binding.reviewSpoiler.setVisibility(View.VISIBLE);
        } else {
            holder.binding.reviewBody.setText(review.getComment());
            holder.binding.reviewBody.setVisibility(View.VISIBLE);
            holder.binding.reviewSpoiler.setVisibility(View.GONE);
        }
        holder.binding.reviewTime.setText(review.getCreatedAt());
    }

    // ViewHolder
    public class ReviewViewHolder extends RecyclerView.ViewHolder {
        ItemListReviewBinding binding;

        public ReviewViewHolder(final ViewGroup itemView) {
            super(itemView);
            binding = DataBindingUtil.bind(itemView);

            binding.reviewItem.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    //       onReviewClickListener.onReviewClicked(getAdapterPosition());
                    Log.e("TEST", "CLIKC");

                    if (foldingCellPosition != -1) {
                        currentFoldingCell.fold(false);
                    }
                    currentFoldingCell = binding.foldingCell;
                    binding.reviewBody2.setText(reviewList.get(getAdapterPosition()).getComment());
                    binding.reviewAuthor2.setText(reviewList.get(getAdapterPosition()).getUsername());
                    binding.foldingCell.toggle(false);
                    foldingCellPosition = getAdapterPosition();

                }
            });

            binding.reviewItem2.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    binding.reviewItem2.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            foldingCellPosition = -1;
                            binding.foldingCell.fold(false);
                        }
                    });
                }
            });


        }
    }
}

How the recycler view is created:

  layoutManager = new LinearLayoutManager(getContext());
     mBinding.movieDetailReviewListRvReviews.setHasFixedSize(true);
     mBinding.movieDetailReviewListRvReviews.setLayoutManager(layoutManager);
     mBinding.movieDetailReviewListRvReviews.setAdapter(adapter); 

What I tried so far


I really dont have any idea why this happens. However I tried notifyDataSetChanged() after each collapse/expand as well as invalidate().

Edit


For the collapsing / expanding effect I use this library:https://github.com/Juriv/folding-cell-android

ANSWER

Answered 2017-Apr-07 at 07:03

Try leaving cardview:cardUseCompatPadding false, which is the default.

From https://developer.android.com/reference/android/support/v7/widget/CardView.html#setUseCompatPadding(boolean)

setUseCompatPadding

added in version 24.2.0 void setUseCompatPadding (boolean useCompatPadding) CardView adds additional padding to draw shadows on platforms before Lollipop.

This may cause Cards to have different sizes between Lollipop and before Lollipop. If you need to align CardView with other Views, you may need api version specific dimension resources to account for the changes. As an alternative, you can set this flag to true and CardView will add the same padding values on platforms Lollipop and after.

Since setting this flag to true adds unnecessary gaps in the UI, default value is false.

This implies that the CardView may be adding padding when you collapse/expand cards.

Source https://stackoverflow.com/questions/43271192

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install folding-cell-android

​ Just download the package from here and add it to your project classpath, or just use the maven repo:.

Support

For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Explore Related Topics

Share this Page

share link
Compare User Interface Libraries with Highest Quality
Compare User Interface Libraries with Highest Security
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.
  • © 2022 Open Weaver Inc.