| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -15,17 +15,17 @@ import java.util.* | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * | 
					 | 
					 | 
					 | 
					 * | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * 通用的adapter 可添加header,footer,以及不同类型item | 
					 | 
					 | 
					 | 
					 * 通用的adapter 可添加header,footer,以及不同类型item | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 */ | 
					 | 
					 | 
					 | 
					 */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context): | 
					 | 
					 | 
					 | 
					abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) : | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    RecyclerView.Adapter<ItemViewHolder>() { | 
					 | 
					 | 
					 | 
					    RecyclerView.Adapter<ItemViewHolder>() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    constructor(context: Context, vararg delegates: ItemViewDelegate<ITEM>): this(context) { | 
					 | 
					 | 
					 | 
					    constructor(context: Context, vararg delegates: ItemViewDelegate<ITEM>) : this(context) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        addItemViewDelegates(*delegates) | 
					 | 
					 | 
					 | 
					        addItemViewDelegates(*delegates) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    constructor( | 
					 | 
					 | 
					 | 
					    constructor( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        context: Context, | 
					 | 
					 | 
					 | 
					        context: Context, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        vararg delegates: Pair<Int, ItemViewDelegate<ITEM>> | 
					 | 
					 | 
					 | 
					        vararg delegates: Pair<Int, ItemViewDelegate<ITEM>> | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    ): this(context) { | 
					 | 
					 | 
					 | 
					    ) : this(context) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        addItemViewDelegates(*delegates) | 
					 | 
					 | 
					 | 
					        addItemViewDelegates(*delegates) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -57,15 +57,15 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        recyclerView.adapter = this | 
					 | 
					 | 
					 | 
					        recyclerView.adapter = this | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    fun <DELEGATE: ItemViewDelegate<ITEM>> addItemViewDelegate(viewType: Int, delegate: DELEGATE) { | 
					 | 
					 | 
					 | 
					    fun <DELEGATE : ItemViewDelegate<ITEM>> addItemViewDelegate(viewType: Int, delegate: DELEGATE) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        itemDelegates[viewType] = delegate | 
					 | 
					 | 
					 | 
					        itemDelegates[viewType] = delegate | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    fun <DELEGATE: ItemViewDelegate<ITEM>> addItemViewDelegate(delegate: DELEGATE) { | 
					 | 
					 | 
					 | 
					    fun <DELEGATE : ItemViewDelegate<ITEM>> addItemViewDelegate(delegate: DELEGATE) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        itemDelegates[itemDelegates.size] = delegate | 
					 | 
					 | 
					 | 
					        itemDelegates[itemDelegates.size] = delegate | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    fun <DELEGATE: ItemViewDelegate<ITEM>> addItemViewDelegates(vararg delegates: DELEGATE) { | 
					 | 
					 | 
					 | 
					    fun <DELEGATE : ItemViewDelegate<ITEM>> addItemViewDelegates(vararg delegates: DELEGATE) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        delegates.forEach { | 
					 | 
					 | 
					 | 
					        delegates.forEach { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            addItemViewDelegate(it) | 
					 | 
					 | 
					 | 
					            addItemViewDelegate(it) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -365,7 +365,7 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        super.onAttachedToRecyclerView(recyclerView) | 
					 | 
					 | 
					 | 
					        super.onAttachedToRecyclerView(recyclerView) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        val manager = recyclerView.layoutManager | 
					 | 
					 | 
					 | 
					        val manager = recyclerView.layoutManager | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (manager is GridLayoutManager) { | 
					 | 
					 | 
					 | 
					        if (manager is GridLayoutManager) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            manager.spanSizeLookup = object: GridLayoutManager.SpanSizeLookup() { | 
					 | 
					 | 
					 | 
					            manager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                override fun getSpanSize(position: Int): Int { | 
					 | 
					 | 
					 | 
					                override fun getSpanSize(position: Int): Int { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    return getItem(position)?.let { | 
					 | 
					 | 
					 | 
					                    return getItem(position)?.let { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        if (isHeader(position) || isFooter(position)) manager.spanCount else getSpanSize( | 
					 | 
					 | 
					 | 
					                        if (isHeader(position) || isFooter(position)) manager.spanCount else getSpanSize( | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |