Android Open Source - openMusicTagger-Android Mp3 File Selection Activity






From Project

Back to project page openMusicTagger-Android.

License

The source code is released under:

GNU General Public License

If you think the Android project openMusicTagger-Android 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.amethystAnt.openmusictagger;
/*w  ww .  ja va2  s . com*/
import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;

import android.widget.ArrayAdapter;
import paul.arian.fileselector.FileSelectionActivity;

public class Mp3FileSelectionActivity extends FileSelectionActivity {
  
  @Override
  protected void loadLists() {
        FileFilter fileFilter = new FileFilter() {
            public boolean accept(File file) {
              
              if(file.getName().endsWith(".mp3"))
                return file.isFile();
              else
                return false;
              
            }
        };
        FileFilter directoryFilter = new FileFilter(){
            public boolean accept(File file){
                return file.isDirectory();
            }
        };

        //if(mainPath.exists() && mainPath.length()>0){
        //Lista de directorios
        File[] tempDirectoryList = getMainPath().listFiles(directoryFilter);

        if (tempDirectoryList != null && tempDirectoryList.length > 1) {
            Arrays.sort(tempDirectoryList, new Comparator<File>() {
                @Override
                public int compare(File object1, File object2) {
                    return object1.getName().compareTo(object2.getName());
                }
            });
        }

        setDirectoryList(new ArrayList<File>());
        setDirectoryNames(new ArrayList<String>());
        for(File file: tempDirectoryList){
            getDirectoryList().add(file);
            getDirectoryNames().add(file.getName());
        }
        @SuppressWarnings("unused")
    ArrayAdapter<String> directoryAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, getDirectoryNames());


        File[] tempFileList = getMainPath().listFiles(fileFilter);

        if (tempFileList != null && tempFileList.length > 1) {
            Arrays.sort(tempFileList, new Comparator<File>() {
                @Override
                public int compare(File object1, File object2) {
                    return object1.getName().compareTo(object2.getName());
                }
            });
        }

        setFileList(new ArrayList<File>());
        setFileNames(new ArrayList<String>());
        for(File file : tempFileList){
            getFileList().add(file);
            getFileNames().add(file.getName());
        }



        getPath().setText(getMainPath().toString());
        iconload();
        setTitle(getMainPath().getName());
        //}
    }
  
}




Java Source Code List

com.amethystAnt.openmusictagger.DialogOnClickListener.java
com.amethystAnt.openmusictagger.MainActivity.java
com.amethystAnt.openmusictagger.Mp3FileSelectionActivity.java
paul.arian.fileselector.CheckableRelativeLayout.java
paul.arian.fileselector.CustomListSingleOnly.java
paul.arian.fileselector.CustomList.java
paul.arian.fileselector.FileSelectionActivity.java
paul.arian.fileselector.FolderSelectionActivity.java