Android Open Source - FileRenamer Android File Browser File






From Project

Back to project page FileRenamer.

License

The source code is released under:

License text from http://www.opensource.org/licenses/GPL-3.0 Copyright (c) 2012 Thomas Schmid, Froburgstrasse 25, 4052 Basel, Schweiz Permission is hereby granted, free of charge, to any person obta...

If you think the Android project FileRenamer 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

/*
 * Copyright (C) 2012 Thomas Schmid <tschmid35@gmail.com>
 */*from  www .  j  a v  a 2  s .  co m*/
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package com.scto.filerenamer;

import android.graphics.drawable.Drawable;
import java.util.Comparator;

public class AndroidFileBrowserFile implements Comparable< AndroidFileBrowserFile >
{
  private boolean mIsFolder = false;
     private String mText = "";
  private Drawable mIcon;
  private boolean mSelectable = true;
     private String mPerms = "";
     private String mSize = "";

  public AndroidFileBrowserFile( String text, Drawable bullet, boolean isFolder, String permissions, String fileSize )
  {
    mIsFolder = isFolder;
    mIcon = bullet;
    mText = text;
    mPerms = permissions;
    mSize = fileSize;
  }

  public boolean isFolder()
  {
    return mIsFolder;
  }

  public void setFolder( boolean isFolder )
  {
    mIsFolder = isFolder;
  }
  
  public boolean isSelectable()
  {
    return mSelectable;
  }
  
  public void setSelectable( boolean selectable )
  {
    mSelectable = selectable;
  }
    
  public void setIcon( Drawable icon )
  {
    mIcon = icon;
  }
  
  public Drawable getIcon()
  {
    return mIcon;
  }
  
  public void setText( String text )
  {
    mText = text;
  }
  
  public String getText()
  {
    return mText;
  }

  public void setPerms( String perms )
  {
    mPerms = perms;
  }
  
  public String getPerms()
  {
    return mPerms;
  }

  public void setSize( String size )
  {
    mSize = size;
  }

  public String getSize()
  {
    return mSize;
  }
  
  @Override
  public int compareTo( AndroidFileBrowserFile other )
  {
    if( this.mText != null )
      return this.mText.compareTo( other.getText() ); 
    else 
      throw new IllegalArgumentException();
  }
  
  public static Comparator< AndroidFileBrowserFile > mAndroidFileBrowserFileComparator = new Comparator< AndroidFileBrowserFile >()
  {
      public int compare( AndroidFileBrowserFile androidFileBrowserFile1, AndroidFileBrowserFile androidFileBrowserFile2 )
    {
      boolean androidFileBrowserFileName1 = androidFileBrowserFile1.isFolder();
      boolean androidFileBrowserFileName2 = androidFileBrowserFile2.isFolder();
      if( androidFileBrowserFileName2 == androidFileBrowserFileName1 )
      {
        return androidFileBrowserFile1.getText().compareToIgnoreCase( androidFileBrowserFile2.getText() );  
      }
      else if( androidFileBrowserFileName2 )
      {
        return 1;
      }
      return -1;
      }
  };
}




Java Source Code List

com.scto.filerenamer.AddCharsFragment.java
com.scto.filerenamer.AddCustomFragment.java
com.scto.filerenamer.AddDateFragment.java
com.scto.filerenamer.AddNumbersFragment.java
com.scto.filerenamer.AndroidFileBrowserFile.java
com.scto.filerenamer.AndroidFileBrowserListAdapter.java
com.scto.filerenamer.AndroidFileBrowser.java
com.scto.filerenamer.Eula.java
com.scto.filerenamer.ExecuteAsRootBase.java
com.scto.filerenamer.ExitDialog.java
com.scto.filerenamer.FileRenamerActivity.java
com.scto.filerenamer.HelpDialog.java
com.scto.filerenamer.ListPreferenceSummary.java
com.scto.filerenamer.MainActivity.java
com.scto.filerenamer.MimeTypes.java
com.scto.filerenamer.PreferencesActivity.java
com.scto.filerenamer.Prefs.java
com.scto.filerenamer.RemoveCharsFragment.java
com.scto.filerenamer.SeekBarPreference.java
com.scto.filerenamer.ShellCommand.java
com.scto.filerenamer.SplashActivity.java
com.scto.filerenamer.Tools.java
com.scto.filerenamer.WhatsNewDialog.java