<commit_before>package org.openintents.filemanager;

import java.util.List;

import org.openintents.filemanager.files.FileHolder;
import org.openintents.filemanager.view.ViewHolder;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class FileHolderListAdapter extends BaseAdapter {
	private List<FileHolder> mItems;
	private LayoutInflater mInflater;
	private Context mContext;
	
	// Thumbnail specific
    private ThumbnailLoader mThumbnailLoader;
    private boolean scrolling = false;
	
	public FileHolderListAdapter(List<FileHolder> files, Context c){
		mItems = files;
		mInflater = (LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		mContext = c;
		
		mThumbnailLoader = new ThumbnailLoader(c);
	}
	
	@Override
	public boolean hasStableIds() {
		return true;
	}
	
	@Override
	public int getCount() {
		return mItems.size();
	}

	@Override
	public Object getItem(int position) {
		return mItems.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}
	
	/**
	 * Creates a new list item view, along with it's ViewHolder set as a tag.
	 * @return The new view.
	 */
	private View newView(){
		View view = mInflater.inflate(R.layout.filelist_item, null);
		
		ViewHolder holder = new ViewHolder();
		holder.icon = (ImageView) view.findViewById(R.id.icon);
		holder.primaryInfo = (TextView) view.findViewById(R.id.primary_info);
		holder.secondaryInfo = (TextView) view.findViewById(R.id.secondary_info);
		holder.tertiaryInfo = (TextView) view.findViewById(R.id.tertiary_info);
		
		view.setTag(holder);
		return view;
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		FileHolder item = mItems.get(position);
		
		if(convertView == null)
			convertView = newView();
		
		ViewHolder holder = (ViewHolder) convertView.getTag();
		
		holder.icon.setImageDrawable(item.getIcon());
		holder.primaryInfo.setText(item.getName());
		holder.secondaryInfo.setText(item.getFormattedModificationDate());
		holder.tertiaryInfo.setText(item.getFormattedSize(mContext));
        
        if(!scrolling && item.getFile().isFile() && !item.getMimeType().equals("video/mpeg")){
      	  if(mThumbnailLoader != null) {
      		  mThumbnailLoader.loadImage(item.getFile().getParent(), item, holder.icon);
      	  }
        }<commit_msg>Removed folder size indicator from lists.<commit_after>package org.openintents.filemanager;

import java.util.List;

import org.openintents.filemanager.files.FileHolder;
import org.openintents.filemanager.view.ViewHolder;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class FileHolderListAdapter extends BaseAdapter {
	private List<FileHolder> mItems;
	private LayoutInflater mInflater;
	private Context mContext;
	
	// Thumbnail specific
    private ThumbnailLoader mThumbnailLoader;
    private boolean scrolling = false;
	
	public FileHolderListAdapter(List<FileHolder> files, Context c){
		mItems = files;
		mInflater = (LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		mContext = c;
		
		mThumbnailLoader = new ThumbnailLoader(c);
	}
	
	@Override
	public boolean hasStableIds() {
		return true;
	}
	
	@Override
	public int getCount() {
		return mItems.size();
	}

	@Override
	public Object getItem(int position) {
		return mItems.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}
	
	/**
	 * Creates a new list item view, along with it's ViewHolder set as a tag.
	 * @return The new view.
	 */
	private View newView(){
		View view = mInflater.inflate(R.layout.filelist_item, null);
		
		ViewHolder holder = new ViewHolder();
		holder.icon = (ImageView) view.findViewById(R.id.icon);
		holder.primaryInfo = (TextView) view.findViewById(R.id.primary_info);
		holder.secondaryInfo = (TextView) view.findViewById(R.id.secondary_info);
		holder.tertiaryInfo = (TextView) view.findViewById(R.id.tertiary_info);
		
		view.setTag(holder);
		return view;
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		FileHolder item = mItems.get(position);
		
		if(convertView == null)
			convertView = newView();
		
		ViewHolder holder = (ViewHolder) convertView.getTag();
		
		holder.icon.setImageDrawable(item.getIcon());
		holder.primaryInfo.setText(item.getName());
		holder.secondaryInfo.setText(item.getFormattedModificationDate());
		// Hide directories' size as it's irrelevant if we can't recursively find it.
		holder.tertiaryInfo.setText(item.getFile().isDirectory()? "" : item.getFormattedSize(mContext));
        
        if(!scrolling && item.getFile().isFile() && !item.getMimeType().equals("video/mpeg")){
      	  if(mThumbnailLoader != null) {
      		  mThumbnailLoader.loadImage(item.getFile().getParent(), item, holder.icon);
      	  }
        }
{'fraction_non_alphanumeric': 0.11180244993194634, 'fraction_numerical': 0.0, 'mean_word_length': 4.495726495726496, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5528519', 'n_tokens_mistral': 1723, 'n_tokens_neox': 1556, 'n_words': 342}