Give search item stable ids to animate rows during search
This commit is contained in:
		
							parent
							
								
									b86723be44
								
							
						
					
					
						commit
						cd5ba9d8f2
					
				@ -6,6 +6,7 @@ import android.support.v7.widget.RecyclerView;
 | 
			
		||||
import android.view.ViewGroup;
 | 
			
		||||
import org.fdroid.fdroid.R;
 | 
			
		||||
import org.fdroid.fdroid.data.App;
 | 
			
		||||
import org.fdroid.fdroid.data.Schema;
 | 
			
		||||
 | 
			
		||||
class AppListAdapter extends RecyclerView.Adapter<StandardAppListItemController> {
 | 
			
		||||
 | 
			
		||||
@ -16,6 +17,7 @@ class AppListAdapter extends RecyclerView.Adapter<StandardAppListItemController>
 | 
			
		||||
    AppListAdapter(Activity activity) {
 | 
			
		||||
        this.activity = activity;
 | 
			
		||||
        divider = new AppListItemDivider(activity);
 | 
			
		||||
        setHasStableIds(true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setAppCursor(Cursor cursor) {
 | 
			
		||||
@ -35,6 +37,12 @@ class AppListAdapter extends RecyclerView.Adapter<StandardAppListItemController>
 | 
			
		||||
        holder.bindModel(new App(cursor));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public long getItemId(int position) {
 | 
			
		||||
        cursor.moveToPosition(position);
 | 
			
		||||
        return cursor.getLong(cursor.getColumnIndex(Schema.AppMetadataTable.Cols.ROW_ID));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public int getItemCount() {
 | 
			
		||||
        return cursor == null ? 0 : cursor.getCount();
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user