Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

collapse recycler view on new item click

holder.itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            final boolean visibility = holder.details.getVisibility()==View.VISIBLE;

            if (!visibility)
            {
                holder.itemView.setActivated(true);
                holder.details.setVisibility(View.VISIBLE);
                if (prev_expanded!=-1 && prev_expanded!=position)
                {
                    recycler.findViewHolderForLayoutPosition(prev_expanded).itemView.setActivated(false);
                    recycler.findViewHolderForLayoutPosition(prev_expanded).itemView.findViewById(R.id.cpl_details).setVisibility(View.GONE);
                }
                prev_expanded = position;
            }
            else
            {
                holder.itemView.setActivated(false);
                holder.details.setVisibility(View.GONE);
            }
            TransitionManager.beginDelayedTransition(recycler);              
        }
});
Comment

PREVIOUS NEXT
Code Example
Java :: build cmake gradle 
Java :: instance field java 
Java :: @android:color/system_neutral1_1000 
Java :: ant bild skip java doc 
Java :: java.lang.NullPointerException at org.openqa.selenium.support.pagefactory.findElement(DefaultElementLocator.java:69) 
Java :: if(ResultSet.next()) 
Java :: synchronized method in java 
Java :: Java Copying Arrays Using Assignment Operator 
Java :: Java TestNG Data provider Provider with multiple variables 
Java :: Append Line Separator In StringBuilder 
Java :: Java’s generic programming does not apply to the primitive types. True or False? 
Java :: error attribute fabattached not found 
Java :: Fast Search in java 
Java :: single line comment in java 
Java :: print different variable datatype 
Java :: Java Numbers and Strings 
Java :: What is sleep() method 
Java :: replace range from array java 
Java :: how to validate information against the database in java 
Java :: java :: operator 
Java :: throw keyword in java 
Java :: java use of super keyword 
Java :: how to access methods from another class in java 
Java :: java @override 
Java :: number of digits program in java 
Java :: use of getclass()in string 
Java :: why is java so verbose 
Java :: devoluciones redsys api 
Sql :: count of tables in database mysql 
Sql :: oracle all tables in schema 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =