Exemplo n.º 1
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   FileHolder f;
   if (convertView == null) {
     f = new FileHolder();
     LayoutInflater inflater =
         (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
     convertView = inflater.inflate(R.layout.row_list_1, parent, false);
     f.FileIcon = (ImageView) convertView.findViewById(R.id.fileIcon);
     f.FileName = (TextView) convertView.findViewById(R.id.fileName);
     f.l = (LinearLayout) convertView.findViewById(R.id.row1BtnLayout);
     f.box = (CheckBox) convertView.findViewById(R.id.checkbox);
     convertView.setTag(f);
   } else f = (FileHolder) convertView.getTag();
   f.box.setVisibility(View.GONE);
   f.l.setVisibility(View.GONE);
   if (position == 0) {
     f.FileIcon.setBackgroundResource(R.drawable.ic_launcher_music);
     f.FileName.setText(list[position]);
   } else if (position == 1) {
     f.FileIcon.setBackgroundResource(R.drawable.ic_launcher_apk);
     f.FileName.setText(list[position]);
   } else if (position == 2) {
     f.FileIcon.setBackgroundResource(R.drawable.ic_launcher_ppt);
     f.FileName.setText(list[position]);
   } else if (position == 3) {
     f.FileIcon.setBackgroundResource(R.drawable.ic_launcher_images);
     f.FileName.setText(list[position]);
   } else if (position == 4) {
     f.FileIcon.setBackgroundResource(R.drawable.ic_launcher_video);
     f.FileName.setText(list[position]);
   } else if (position == 5) {
     f.FileIcon.setBackgroundResource(R.drawable.ic_launcher_zip_it);
     f.FileName.setText(list[position]);
   } else if (position == 6) {
     f.FileIcon.setBackgroundResource(R.drawable.ic_launcher_other_compressed);
     f.FileName.setText(list[position]);
   } else if (position == 7) {
     f.FileIcon.setBackgroundResource(R.drawable.ic_launcher_sdcard);
     f.FileName.setText(list[position]);
   }
   return convertView;
 }
Exemplo n.º 2
0
	@Override
	public View getView( final int position , View convertView, ViewGroup container){
		info = nList.get(position);
		if( convertView == null){
			convertView = inflater.inflate(R.layout.row_list_1, container , false);
			nHolder = new FileHolder();
			nHolder.FileIcon = (ImageView)convertView.findViewById(R.id.fileIcon);
			nHolder.FileName = (TextView)convertView.findViewById(R.id.fileName);
			nHolder.FileSize = (TextView)convertView.findViewById(R.id.fileSize);
			nHolder.FileType = (TextView)convertView.findViewById(R.id.fileType);
			nHolder.box = (CheckBox)convertView.findViewById(R.id.checkbox);
			convertView.setTag(nHolder); 
		}else
			nHolder = (FileHolder)convertView.getTag(); 
		
		MULTI_APPS.add(null);
		if(MULTI_SELECT){
			nHolder.box.setVisibility(View.VISIBLE);
			nHolder.box.setId(position);
			nHolder.box.setOnClickListener(new View.OnClickListener() {
				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					CheckBox ch = (CheckBox) v;
					int id = ch.getId();
					if(thumbSelection[id]){
						ch.setChecked(false);
						thumbSelection[id] = false;
						MULTI_APPS.remove(id);
						MULTI_APPS.add(id,null);
						C--;
					}else{
						C++;
						MULTI_APPS.remove(id);
						MULTI_APPS.add(id,nList.get(id));
						ch.setChecked(true);
						thumbSelection[id] = true;
					}
				}
			});
			nHolder.box.setChecked(thumbSelection[position]);
		}else
			nHolder.box.setVisibility(View.GONE);
		/*
		final Handler handle = new Handler(){
			@Override
			public void handleMessage(Message msg) {
				// TODO Auto-generated method stub
				super.handleMessage(msg);
				switch(msg.what){
					case 1:
						Drawable im = (Drawable) msg.obj;
						nHolder.FileIcon.setBackgroundDrawable(im);
						break;	
					case 2:
						nHolder.FileName.setText((CharSequence) msg.obj);
						break;
					case 3:
						nHolder.FileSize.setText((CharSequence) msg.obj);
						break;
					case 4:
						
						break;
				}
			}			
		};
		Thread thread = new Thread(new Runnable() {
			@Override
			public void run() {
				// TODO Auto-generated method stub
				msg = new Message();
				msg.what = 1;
				msg.obj = nPManager.getApplicationIcon(info);
				handle.sendMessage(msg);
				
				msg = new Message();
				msg.what = 2;
				msg.obj = nPManager.getApplicationLabel(info).toString();
				handle.sendMessage(msg);
				
				msg = new Message();
				msg.what = 3;
				msg.obj = size(new File(info.sourceDir));
				handle.sendMessage(msg);
				
				msg = new Message();
				msg.what = 4;
				long date = backupExists(info);
				if(date == 0)
					msg.obj = "No Backup";
				else
					msg.obj = new Date(date);
				handle.sendMessage(msg);
				
			}
		});
		thread.run();*/
		new AppLoader(nHolder.FileIcon , nHolder.FileName , nHolder.FileSize , nHolder.FileType).execute(info);
		return convertView;
	}
Exemplo n.º 3
0
 @Override
 protected int comp(FileHolder f1, FileHolder f2) {
   return ((Long) f1.getFile().lastModified()).compareTo(f2.getFile().lastModified());
 }
Exemplo n.º 4
0
 @Override
 protected int comp(FileHolder f1, FileHolder f2) {
   return f1.getExtension().compareTo(f2.getExtension());
 }
Exemplo n.º 5
0
 @Override
 protected int comp(FileHolder f1, FileHolder f2) {
   return f1.getName().toLowerCase().compareTo(f2.getName().toLowerCase());
 }