Android Open Source - file-browser File Info Adapter






From Project

Back to project page file-browser.

License

The source code is released under:

Copyright (c) 2014, Hyusein Gyulyustan All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are m...

If you think the Android project file-browser listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.hglstn.filebrowser;
//  ww  w  .  j  a v  a  2 s.  c  o m
import java.util.List;

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

public class FileInfoAdapter extends ArrayAdapter<FileInfo> {

  private Context context;

  public FileInfoAdapter(Context context, int resource, List<FileInfo> objects) {
    super(context, resource, objects);
    this.context = context;

  }

  public View getView(int position, View convertView, ViewGroup parent) {
    View view = convertView;
    if (view == null) {
      LayoutInflater inflater = (LayoutInflater) context
          .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      view = inflater.inflate(R.layout.file_info_item, null);
    }

    FileInfo file = getItem(position);
    if (file != null) {

      TextView fileNameView = (TextView) view
          .findViewById(R.id.file_info_name);
      if (fileNameView != null) {
        fileNameView.setText(file.getDisplayName());
      }

      TextView childItemsView = (TextView) view
          .findViewById(R.id.file_info_size);
      if (childItemsView != null) {
        childItemsView.setText(file.getSizeInfo());
      }

      TextView accessInfoView = (TextView) view
          .findViewById(R.id.file_info_access);
      if (accessInfoView != null) {
        accessInfoView.setText(file.getModificationTime() + " | "
            + file.getPermissions());
      }

      ImageView fileIconView = (ImageView) view
          .findViewById(R.id.file_info_icon);
      if (fileIconView != null) {
        fileIconView.setImageResource(file.getIconResource());
      }
    }

    return view;
  }
}




Java Source Code List

com.hglstn.filebrowser.FileBrowserFragment.java
com.hglstn.filebrowser.FileInfoAdapter.java
com.hglstn.filebrowser.FileInfo.java
com.hglstn.filebrowser.FileSystem.java
com.hglstn.filebrowser.LocalFileSystem.java
com.hglstn.filebrowser.MainActivity.java