Explorar el Código

android progress & some more compat fixxxes

LH hace 10 años
padre
commit
dec437bd87
Se han modificado 56 ficheros con 906 adiciones y 103 borrados
  1. 4 1
      IZPL-A/IZPL/app/build.gradle
  2. 5 1
      IZPL-A/IZPL/app/src/main/AndroidManifest.xml
  3. BIN
      IZPL-A/IZPL/app/src/main/ic_launcher-web.png
  4. 77 0
      IZPL-A/IZPL/app/src/main/java/de/nplusc/izc/izpl/Enqueue.java
  5. 102 0
      IZPL-A/IZPL/app/src/main/java/de/nplusc/izc/izpl/MainMenu.java
  6. 0 39
      IZPL-A/IZPL/app/src/main/java/de/nplusc/izc/izpl/Menu.java
  7. 50 0
      IZPL-A/IZPL/app/src/main/java/de/nplusc/izc/izpl/PlayListAdapter.java
  8. 83 0
      IZPL-A/IZPL/app/src/main/java/de/nplusc/izc/izpl/PlayListItemWrapper.java
  9. 81 0
      IZPL-A/IZPL/app/src/main/java/de/nplusc/izc/izpl/PlaybackCore.java
  10. BIN
      IZPL-A/IZPL/app/src/main/res/drawable-hdpi/ic_launcher.png
  11. BIN
      IZPL-A/IZPL/app/src/main/res/drawable-mdpi/back.png
  12. BIN
      IZPL-A/IZPL/app/src/main/res/drawable-mdpi/ic_launcher.png
  13. BIN
      IZPL-A/IZPL/app/src/main/res/drawable-mdpi/list.png
  14. BIN
      IZPL-A/IZPL/app/src/main/res/drawable-mdpi/pause.png
  15. BIN
      IZPL-A/IZPL/app/src/main/res/drawable-mdpi/play.png
  16. BIN
      IZPL-A/IZPL/app/src/main/res/drawable-mdpi/skipenqueue.png
  17. BIN
      IZPL-A/IZPL/app/src/main/res/drawable-xhdpi/ic_launcher.png
  18. BIN
      IZPL-A/IZPL/app/src/main/res/drawable-xxhdpi/ic_launcher.png
  19. 16 0
      IZPL-A/IZPL/app/src/main/res/layout/activity_enqueue.xml
  20. 38 5
      IZPL-A/IZPL/app/src/main/res/layout/activity_menu.xml
  21. 21 0
      IZPL-A/IZPL/app/src/main/res/layout/playlistitemview.xml
  22. 6 0
      IZPL-A/IZPL/app/src/main/res/menu/menu_enqueue.xml
  23. 1 0
      IZPL-A/IZPL/app/src/main/res/values/strings.xml
  24. 1 0
      IZPL-A/IZPL/filechooser/.gitignore
  25. 30 0
      IZPL-A/IZPL/filechooser/build.gradle
  26. 17 0
      IZPL-A/IZPL/filechooser/proguard-rules.pro
  27. 13 0
      IZPL-A/IZPL/filechooser/src/androidTest/java/de/nplusc/izc/filechooser/ApplicationTest.java
  28. 20 0
      IZPL-A/IZPL/filechooser/src/main/AndroidManifest.xml
  29. 9 0
      IZPL-A/IZPL/filechooser/src/main/AndroidManifest.xml.bak
  30. 88 0
      IZPL-A/IZPL/filechooser/src/main/java/br/com/thinkti/android/filechooser/FileArrayAdapter.java
  31. 122 0
      IZPL-A/IZPL/filechooser/src/main/java/br/com/thinkti/android/filechooser/FileChooser.java
  32. 43 0
      IZPL-A/IZPL/filechooser/src/main/java/br/com/thinkti/android/filechooser/Option.java
  33. BIN
      IZPL-A/IZPL/filechooser/src/main/res/drawable/android32.png
  34. BIN
      IZPL-A/IZPL/filechooser/src/main/res/drawable/back32.png
  35. BIN
      IZPL-A/IZPL/filechooser/src/main/res/drawable/doc.png
  36. BIN
      IZPL-A/IZPL/filechooser/src/main/res/drawable/folder.png
  37. BIN
      IZPL-A/IZPL/filechooser/src/main/res/drawable/folder_icon.png
  38. BIN
      IZPL-A/IZPL/filechooser/src/main/res/drawable/gif32.png
  39. BIN
      IZPL-A/IZPL/filechooser/src/main/res/drawable/jpg32.png
  40. BIN
      IZPL-A/IZPL/filechooser/src/main/res/drawable/pdf.png
  41. BIN
      IZPL-A/IZPL/filechooser/src/main/res/drawable/png32.png
  42. BIN
      IZPL-A/IZPL/filechooser/src/main/res/drawable/ppt.png
  43. BIN
      IZPL-A/IZPL/filechooser/src/main/res/drawable/rtf32.png
  44. BIN
      IZPL-A/IZPL/filechooser/src/main/res/drawable/txt32.png
  45. BIN
      IZPL-A/IZPL/filechooser/src/main/res/drawable/whitepage32.png
  46. BIN
      IZPL-A/IZPL/filechooser/src/main/res/drawable/xls.png
  47. BIN
      IZPL-A/IZPL/filechooser/src/main/res/drawable/zip32.png
  48. 46 0
      IZPL-A/IZPL/filechooser/src/main/res/layout/file_view.xml
  49. 9 0
      IZPL-A/IZPL/filechooser/src/main/res/values/stringsFileChooser.xml
  50. 1 1
      IZPL-A/IZPL/settings.gradle
  51. 0 48
      IZPL-A/build.gradle
  52. 7 1
      Readme.txt
  53. BIN
      iZpl/src/main/resources/rsrc/andro.xcf
  54. 2 1
      izpl-shared/build.gradle
  55. 0 1
      izpl-shared/src/main/java/de/nplusc/izc/iZpl/API/shared/PlayListFile.java
  56. 14 5
      izpl-shared/src/main/java/de/nplusc/izc/iZpl/Utils/shared/PLFileIO.java

+ 4 - 1
IZPL-A/IZPL/app/build.gradle

@@ -25,6 +25,9 @@ android {
 }
 
 dependencies {
-    compile fileTree(dir: 'libs', include: ['*.jar'])
+    compile fileTree(dir: 'libs', include: '*.jar')
+    compile files('libs/izpl-shared.jar')
     compile 'com.android.support:appcompat-v7:22.1.1'
+    compile project(':filechooser')
+    compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.1'
 }

+ 5 - 1
IZPL-A/IZPL/app/src/main/AndroidManifest.xml

@@ -8,7 +8,7 @@
         android:label="@string/app_name"
         android:theme="@style/AppTheme" >
         <activity
-            android:name="de.nplusc.izc.izpl.Menu"
+            android:name=".MainMenu"
             android:label="@string/app_name" >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -16,6 +16,10 @@
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
+        <activity
+            android:name="de.nplusc.izc.izpl.Enqueue"
+            android:label="@string/title_activity_enqueue" >
+        </activity>
     </application>
 
 </manifest>

BIN
IZPL-A/IZPL/app/src/main/ic_launcher-web.png


+ 77 - 0
IZPL-A/IZPL/app/src/main/java/de/nplusc/izc/izpl/Enqueue.java

@@ -0,0 +1,77 @@
+package de.nplusc.izc.izpl;
+
+import android.app.ActionBar;
+import android.support.v7.app.ActionBarActivity;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import android.widget.Toast;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import de.nplusc.izc.iZpl.API.shared.PlayListItem;
+
+
+public class Enqueue extends ActionBarActivity {
+
+    PlaybackCore c=null;
+    PlayListAdapter adp;
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_enqueue);
+        ActionBar ab = getActionBar();
+        if(ab !=null)ab.hide();
+        ListView poolList = (ListView) findViewById(R.id.lstTracks);
+        c = PlaybackCore.openSession();
+        List<PlayListItemWrapper> datat = new ArrayList<>();
+
+        List<PlayListItem> data = c.getPool();
+        for (int i = 0; i < data.size(); i++) {
+            datat.add(new PlayListItemWrapper(data.get(i),i));
+        }
+        Collections.sort(datat,datat.get(0));
+        adp=new PlayListAdapter(this,R.layout.playlistitemview,datat);
+        adp.notifyDataSetChanged();
+        poolList.setAdapter(adp);
+        adp.notifyDataSetChanged();
+        poolList.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
+            @Override
+            public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
+                c.forcePlay(((PlayListItemWrapper)parent.getAdapter().getItem(position)).getRawIDX());
+                return true;
+            }
+        });
+
+    }
+
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        // Inflate the menu; this adds items to the action bar if it is present.
+        getMenuInflater().inflate(R.menu.menu_enqueue, menu);
+        return true;
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        // Handle action bar item clicks here. The action bar will
+        // automatically handle clicks on the Home/Up button, so long
+        // as you specify a parent activity in AndroidManifest.xml.
+        int id = item.getItemId();
+
+        //noinspection SimplifiableIfStatement
+        if (id == R.id.action_settings) {
+            return true;
+        }
+
+        return super.onOptionsItemSelected(item);
+    }
+}

+ 102 - 0
IZPL-A/IZPL/app/src/main/java/de/nplusc/izc/izpl/MainMenu.java

@@ -0,0 +1,102 @@
+package de.nplusc.izc.izpl;
+
+import android.app.ActionBar;
+import android.app.Activity;
+import android.content.Intent;
+import android.net.Uri;
+import android.support.v7.app.ActionBarActivity;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+
+import java.util.ArrayList;
+
+import br.com.thinkti.android.filechooser.FileChooser;
+
+
+public class MainMenu extends ActionBarActivity {
+
+
+
+    PlaybackCore c;
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_menu);
+        ActionBar ab = getActionBar();
+        if(ab !=null)ab.hide();
+        c=PlaybackCore.openSession();
+        if(!c.isLoaded())
+        {
+            performFileSearch();
+        }
+        findViewById(R.id.btnList).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                Intent myIntent = new Intent(MainMenu.this, Enqueue.class);
+                MainMenu.this.startActivity(myIntent);
+            }
+        });
+    }
+
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        // Inflate the menu; this adds items to the action bar if it is present.
+        getMenuInflater().inflate(R.menu.menu_menu, menu);
+        return true;
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        // Handle action bar item clicks here. The action bar will
+        // automatically handle clicks on the Home/Up button, so long
+        // as you specify a parent activity in AndroidManifest.xml.
+        int id = item.getItemId();
+
+        //noinspection SimplifiableIfStatement
+        if (id == R.id.action_settings) {
+            return true;
+        }
+
+        return super.onOptionsItemSelected(item);
+    }
+
+    private static final int READ_REQUEST_CODE = 9263;
+    public void performFileSearch() {
+
+        Intent intent = new Intent(this, FileChooser.class);
+        ArrayList<String> extensions = new ArrayList<String>();
+        extensions.add(".izpl");
+        intent.putStringArrayListExtra("filterFileExtension", extensions);
+        startActivityForResult(intent, READ_REQUEST_CODE);
+    }
+
+    @Override
+    public void onActivityResult(int requestCode, int resultCode,
+                                 Intent resultData) {
+
+        // The ACTION_OPEN_DOCUMENT intent was sent with the request code
+        // READ_REQUEST_CODE. If the request code seen here doesn't match, it's the
+        // response to some other intent, and the code below shouldn't run at all.
+
+        if (requestCode == READ_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
+            // The document selected by the user won't be returned in the intent.
+            // Instead, a URI to that document will be contained in the return intent
+            // provided to this method as a parameter.
+            // Pull that URI using resultData.getData().
+            String res = "";
+            if (resultData != null) {
+                res= resultData.getStringExtra("fileSelected");
+                Log.i("IZPL", "FILE: " + res);
+                c.loadPlaylistFile(res);
+            }
+        }
+    }
+
+
+
+
+}

+ 0 - 39
IZPL-A/IZPL/app/src/main/java/de/nplusc/izc/izpl/Menu.java

@@ -1,39 +0,0 @@
-package de.nplusc.izc.izpl;
-
-import android.support.v7.app.ActionBarActivity;
-import android.os.Bundle;
-import android.view.Menu;
-import android.view.MenuItem;
-
-
-public class Menu extends ActionBarActivity {
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_menu);
-    }
-
-
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        // Inflate the menu; this adds items to the action bar if it is present.
-        getMenuInflater().inflate(R.menu.menu_menu, menu);
-        return true;
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        // Handle action bar item clicks here. The action bar will
-        // automatically handle clicks on the Home/Up button, so long
-        // as you specify a parent activity in AndroidManifest.xml.
-        int id = item.getItemId();
-
-        //noinspection SimplifiableIfStatement
-        if (id == R.id.action_settings) {
-            return true;
-        }
-
-        return super.onOptionsItemSelected(item);
-    }
-}

+ 50 - 0
IZPL-A/IZPL/app/src/main/java/de/nplusc/izc/izpl/PlayListAdapter.java

@@ -0,0 +1,50 @@
+package de.nplusc.izc.izpl;
+
+import android.content.Context;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.TextView;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by LH on 03.05.2015.
+ */
+public class PlayListAdapter extends ArrayAdapter<PlayListItemWrapper> {
+
+    private int vid;
+    Context c;
+    public PlayListAdapter(Context context, int resource,List<PlayListItemWrapper> l) {
+        super(context, resource,l);
+        vid=resource;
+        c=context;
+    }
+
+    @Override
+    public View getView(int position, View convertView, ViewGroup parent) {
+        Log.i("IZPL", "getView()");
+        if(convertView==null)
+        {
+            LayoutInflater vi = (LayoutInflater) c
+                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+            convertView = vi.inflate(vid, null);
+        }
+        Log.i("IZPL", "P="+position);
+        PlayListItemWrapper itm = getItem(position);
+        if(itm!=null)
+        {
+            TextView titleView = (TextView) convertView.findViewById(R.id.titleView);
+            TextView detailsView = (TextView) convertView.findViewById(R.id.dataView);
+            titleView.setText(itm.toString());
+            detailsView.setText(itm.getDetails());
+        }
+
+
+        return convertView;
+    }
+
+}

+ 83 - 0
IZPL-A/IZPL/app/src/main/java/de/nplusc/izc/izpl/PlayListItemWrapper.java

@@ -0,0 +1,83 @@
+package de.nplusc.izc.izpl;
+
+import java.util.Comparator;
+
+import de.nplusc.izc.iZpl.API.shared.MultiPlayListItem;
+import de.nplusc.izc.iZpl.API.shared.PlayListItem;
+import de.nplusc.izc.iZpl.API.shared.SinglePlayListItem;
+
+/**
+ * Created by LH on 03.05.2015.
+ */
+public class PlayListItemWrapper implements Comparator<PlayListItemWrapper>{
+
+
+    private PlayListItem itm;
+    private int rawIDX;
+
+    public PlayListItemWrapper(PlayListItem cnt,int idx)
+    {
+        itm=cnt;
+        rawIDX=idx;
+    }
+
+
+    public String toString()
+    {
+        if(itm instanceof SinglePlayListItem)
+        {
+            return ((SinglePlayListItem)itm).getTitle().split(",")[1];
+        }
+        else
+        {
+            if(itm instanceof MultiPlayListItem)
+            {
+                return ((MultiPlayListItem)itm).getSrc();
+            }
+            else
+            {
+                return "INVALID";
+            }
+        }
+    }
+
+    public String getDetails()
+    {
+
+        return itm.getCountPlayed()+"/"+itm.getTargetPlaycount();
+    }
+
+
+    public int getRawIDX()
+    {
+        return rawIDX;
+    }
+
+    @Override
+    public int compare(PlayListItemWrapper lhs, PlayListItemWrapper rhs) {
+        PlayListItem o1=lhs.itm;
+        PlayListItem o2=rhs.itm;
+        if(o1 instanceof MultiPlayListItem&&!(o2 instanceof MultiPlayListItem))
+        {
+            return 1;
+        }
+        else if(o2 instanceof MultiPlayListItem&&!(o1 instanceof MultiPlayListItem))
+        {
+            return -1;
+        }
+        else if(o1 instanceof MultiPlayListItem&&(o2 instanceof MultiPlayListItem))
+        {
+            int r=o1.getM3UElement().trim().compareToIgnoreCase(o2.getM3UElement().trim());
+            r=r>0?1:r<0?-1:0;//Fuckyou string.compare
+            return r;
+        }
+        else
+        {                                                   //denk an die API oder es hagelt mysteryerrors
+            String t1=((SinglePlayListItem)o1).getTitle().split(",")[1].trim();
+            String t2=((SinglePlayListItem)o2).getTitle().split(",")[1].trim();
+            int r=t1.compareToIgnoreCase(t2);
+            r=r>0?1:r<0?-1:0;
+            return r;
+        }
+    }
+}

+ 81 - 0
IZPL-A/IZPL/app/src/main/java/de/nplusc/izc/izpl/PlaybackCore.java

@@ -0,0 +1,81 @@
+package de.nplusc.izc.izpl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import de.nplusc.izc.iZpl.API.shared.InvalidPlayListFileException;
+import de.nplusc.izc.iZpl.API.shared.PlayListItem;
+import de.nplusc.izc.iZpl.Utils.shared.PLFileIO;
+
+/**
+ * Created by LH on 02.05.2015.
+ */
+public class PlaybackCore
+{
+    private List<PlayListItem> currentPool;
+    private static PlaybackCore session = null;
+    private List<PlayListItem> cache = new ArrayList<>();
+    private List<PlayListItem> forceQueue=new ArrayList<>();
+    private boolean loaded=false;
+    public static synchronized PlaybackCore openSession()
+    {
+        if(session==null)
+        {
+            session=new PlaybackCore();
+        }
+        return session;
+    }
+
+    public void revalidatePool()
+    {
+        cache.clear();
+        for (PlayListItem itm:currentPool)
+        {
+            for(int i=0;i<itm.getTargetPlaycount()-itm.getCountPlayed();i++)
+            {
+                cache.add(itm);
+            }
+        }
+    }
+
+
+    public void loadPlaylistFile(String path)
+    {
+        loaded=true;
+        try {
+            currentPool = PLFileIO.parseFullList(path);
+        } catch (InvalidPlayListFileException e) {
+            //TODO Error popup
+        }
+    }
+
+    public void forcePlay(int idx)
+    {
+        forceQueue.add(currentPool.get(idx));
+    }
+
+    public PlayListItem getNextItem()
+    {
+        if(forceQueue.isEmpty())
+        {
+            return cache.get((int)(Math.random()*((float)cache.size())));
+        }
+        else
+        {
+            return forceQueue.remove(0);
+        }
+    }
+    public List<PlayListItem> getPool()
+    {
+        return currentPool;
+
+    }
+    public boolean isLoaded()
+    {
+        return loaded;
+    }
+
+
+}

BIN
IZPL-A/IZPL/app/src/main/res/drawable-hdpi/ic_launcher.png


BIN
IZPL-A/IZPL/app/src/main/res/drawable-mdpi/back.png


BIN
IZPL-A/IZPL/app/src/main/res/drawable-mdpi/ic_launcher.png


BIN
IZPL-A/IZPL/app/src/main/res/drawable-mdpi/list.png


BIN
IZPL-A/IZPL/app/src/main/res/drawable-mdpi/pause.png


BIN
IZPL-A/IZPL/app/src/main/res/drawable-mdpi/play.png


BIN
IZPL-A/IZPL/app/src/main/res/drawable-mdpi/skipenqueue.png


BIN
IZPL-A/IZPL/app/src/main/res/drawable-xhdpi/ic_launcher.png


BIN
IZPL-A/IZPL/app/src/main/res/drawable-xxhdpi/ic_launcher.png


+ 16 - 0
IZPL-A/IZPL/app/src/main/res/layout/activity_enqueue.xml

@@ -0,0 +1,16 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
+    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
+    android:paddingRight="@dimen/activity_horizontal_margin"
+    android:paddingTop="@dimen/activity_vertical_margin"
+    android:paddingBottom="@dimen/activity_vertical_margin"
+    tools:context="de.nplusc.izc.izpl.Enqueue">
+
+    <ListView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:id="@+id/lstTracks"
+        android:layout_alignParentTop="true"
+        android:layout_alignParentStart="true"
+        android:layout_alignParentBottom="true" />
+</RelativeLayout>

+ 38 - 5
IZPL-A/IZPL/app/src/main/res/layout/activity_menu.xml

@@ -9,15 +9,48 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:id="@+id/seekBar"
+        android:layout_above="@+id/btnPlay"
+        android:layout_alignParentEnd="true"
+        android:layout_alignParentStart="true" />
+
+    <ImageButton
+        android:layout_width="120dp"
+        android:layout_height="80dp"
+        android:id="@+id/btnPlay"
+        android:src="@drawable/play"
+        android:scaleType="fitCenter"
         android:layout_alignParentBottom="true"
         android:layout_alignParentStart="true"
-        android:layout_marginBottom="61dp"
-        android:layout_alignParentEnd="true" />
+        android:clickable="true" />
+
+    <ImageButton
+        android:layout_width="80dp"
+        android:layout_height="80dp"
+        android:id="@+id/btnSkip"
+        android:layout_alignBottom="@+id/btnPlay"
+        android:layout_below="@+id/seekBar"
+        android:layout_toEndOf="@+id/btnPlay"
+        android:scaleType="fitCenter"
+        android:src="@drawable/skipenqueue"
+        android:clickable="true" />
+
+    <ImageButton
+        android:layout_width="120dp"
+        android:layout_height="80dp"
+        android:id="@+id/btnList"
+        android:layout_alignBottom="@+id/btnSkip"
+        android:layout_toEndOf="@+id/btnSkip"
+        android:scaleType="fitCenter"
+        android:src="@drawable/list"
+        android:clickable="true" />
 
     <ImageView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:id="@+id/imageView"
-        android:layout_alignParentBottom="true"
-        android:layout_alignParentStart="true" />
+        android:id="@+id/vieweAlbumArt"
+        android:layout_above="@+id/seekBar"
+        android:layout_alignParentTop="true"
+        android:layout_alignParentStart="true"
+        android:layout_alignParentEnd="true" />
+
 </RelativeLayout>

+ 21 - 0
IZPL-A/IZPL/app/src/main/res/layout/playlistitemview.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical" android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:weightSum="1">
+
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="28dp"
+        android:text="Titel"
+        android:id="@+id/titleView"
+        android:textSize="15dp"
+        android:textStyle="bold" />
+
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:text="XX/XX"
+        android:id="@+id/dataView"
+        android:textSize="12dp" />
+</LinearLayout>

+ 6 - 0
IZPL-A/IZPL/app/src/main/res/menu/menu_enqueue.xml

@@ -0,0 +1,6 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools" tools:context="de.nplusc.izc.izpl.Enqueue">
+    <item android:id="@+id/action_settings" android:title="@string/action_settings"
+        android:orderInCategory="100" app:showAsAction="never" />
+</menu>

+ 1 - 0
IZPL-A/IZPL/app/src/main/res/values/strings.xml

@@ -4,5 +4,6 @@
     <string name="app_name">iZpl</string>
     <string name="hello_world">Hello world!</string>
     <string name="action_settings">Settings</string>
+    <string name="title_activity_enqueue">Enqueue</string>
 
 </resources>

+ 1 - 0
IZPL-A/IZPL/filechooser/.gitignore

@@ -0,0 +1 @@
+/build

+ 30 - 0
IZPL-A/IZPL/filechooser/build.gradle

@@ -0,0 +1,30 @@
+apply plugin: 'com.android.library'
+
+
+android {
+    compileSdkVersion 21
+    buildToolsVersion "21.0.2"
+
+    defaultConfig {
+        minSdkVersion 19
+        targetSdkVersion 21
+        versionCode 1
+        versionName "1.0"
+    }
+
+    compileOptions {
+        sourceCompatibility JavaVersion.VERSION_1_7
+        targetCompatibility JavaVersion.VERSION_1_7
+    }
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+        }
+    }
+}
+
+dependencies {
+    compile fileTree(dir: 'libs', include: ['*.jar'])
+    compile 'com.android.support:appcompat-v7:22.1.1'
+}

+ 17 - 0
IZPL-A/IZPL/filechooser/proguard-rules.pro

@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in D:/src/android_sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}

+ 13 - 0
IZPL-A/IZPL/filechooser/src/androidTest/java/de/nplusc/izc/filechooser/ApplicationTest.java

@@ -0,0 +1,13 @@
+package de.nplusc.izc.filechooser;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
+ */
+public class ApplicationTest extends ApplicationTestCase<Application> {
+    public ApplicationTest() {
+        super(Application.class);
+    }
+}

+ 20 - 0
IZPL-A/IZPL/filechooser/src/main/AndroidManifest.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+      package="br.com.thinkti.android.filechooser"
+      android:versionCode="1"
+      android:versionName="1.0">
+    <!--android:icon="@drawable/android32"-->
+    <application  android:label="@string/app_name">
+        <activity android:name="br.com.thinkti.android.filechooser.FileChooser"
+                  android:label="@string/app_name">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+
+    </application>
+    <uses-sdk android:minSdkVersion="4" />
+
+<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
+</manifest> 

+ 9 - 0
IZPL-A/IZPL/filechooser/src/main/AndroidManifest.xml.bak

@@ -0,0 +1,9 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="de.nplusc.izc.filechooser">
+
+    <application android:allowBackup="true" android:label="@string/app_name"
+        android:icon="@drawable/ic_launcher">
+
+    </application>
+
+</manifest>

+ 88 - 0
IZPL-A/IZPL/filechooser/src/main/java/br/com/thinkti/android/filechooser/FileArrayAdapter.java

@@ -0,0 +1,88 @@
+package br.com.thinkti.android.filechooser;
+
+import java.util.List;
+
+import br.com.thinkti.android.filechooser.R;
+
+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 FileArrayAdapter extends ArrayAdapter<Option> {
+
+	private Context c;
+	private int id;
+	private List<Option> items;
+
+	public FileArrayAdapter(Context context, int textViewResourceId,
+			List<Option> objects) {
+		super(context, textViewResourceId, objects);
+		c = context;
+		id = textViewResourceId;
+		items = objects;
+	}
+
+	public Option getItem(int i) {
+		return items.get(i);
+	}
+
+	@Override
+	public View getView(int position, View convertView, ViewGroup parent) {
+		View v = convertView;
+		if (v == null) {
+			LayoutInflater vi = (LayoutInflater) c
+					.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+			v = vi.inflate(id, null);
+		}
+		final Option o = items.get(position);
+		if (o != null) {
+			ImageView im = (ImageView) v.findViewById(R.id.img1);
+			TextView t1 = (TextView) v.findViewById(R.id.TextView01);
+			TextView t2 = (TextView) v.findViewById(R.id.TextView02);
+			
+			if(o.getData().equalsIgnoreCase("folder")){
+				im.setImageResource(R.drawable.folder);
+			} else if (o.getData().equalsIgnoreCase("parent directory")) {
+				im.setImageResource(R.drawable.back32);
+			} else {
+				String name = o.getName().toLowerCase();
+				if (name.endsWith(".xls") ||  name.endsWith(".xlsx"))
+					im.setImageResource(R.drawable.xls);
+				else if (name.endsWith(".doc") ||  name.endsWith(".docx"))
+					im.setImageResource(R.drawable.doc);
+				else if (name.endsWith(".ppt") ||  o.getName().endsWith(".pptx"))
+					im.setImageResource(R.drawable.ppt);
+				else if (name.endsWith(".pdf"))
+					im.setImageResource(R.drawable.pdf);
+				else if (name.endsWith(".apk"))
+					im.setImageResource(R.drawable.android32);
+				else if (name.endsWith(".txt"))
+					im.setImageResource(R.drawable.txt32);
+				else if (name.endsWith(".jpg") || name.endsWith(".jpeg"))
+					im.setImageResource(R.drawable.jpg32);
+				else if (name.endsWith(".png"))
+					im.setImageResource(R.drawable.png32);
+				else if (name.endsWith(".zip"))
+					im.setImageResource(R.drawable.zip32);
+				else if (name.endsWith(".rtf"))
+					im.setImageResource(R.drawable.rtf32);
+				else if (name.endsWith(".gif"))
+					im.setImageResource(R.drawable.gif32);
+				else
+					im.setImageResource(R.drawable.whitepage32);					
+			}
+
+			if (t1 != null)
+				t1.setText(o.getName());
+			if (t2 != null)
+				t2.setText(o.getData());				
+
+		}
+		return v;
+	}
+
+}

+ 122 - 0
IZPL-A/IZPL/filechooser/src/main/java/br/com/thinkti/android/filechooser/FileChooser.java

@@ -0,0 +1,122 @@
+package br.com.thinkti.android.filechooser;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import br.com.thinkti.android.filechooser.R;
+
+import android.app.Activity;
+import android.app.ListActivity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.View;
+import android.widget.ListView;
+import android.widget.Toast;
+
+public class FileChooser extends ListActivity {
+	private File currentDir;
+	private FileArrayAdapter adapter;
+	private FileFilter fileFilter;
+	private File fileSelected;
+	private ArrayList<String> extensions;
+	
+	@Override
+	public void onCreate(Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		Bundle extras = getIntent().getExtras();
+		if (extras != null) {
+			if (extras.getStringArrayList("filterFileExtension") != null) {
+				extensions = extras.getStringArrayList("filterFileExtension");
+				Log.i("AAA", extensions.size()+ "");
+				fileFilter = new FileFilter() {
+					@Override
+					public boolean accept(File pathname) {
+						Log.i("AAA", pathname.getName()+ "");
+						Log.i("AAA", pathname.getName()+ "");
+						return (pathname.getName().contains(".")?extensions.contains(pathname.getName().substring(pathname.getName().lastIndexOf("."))):true);
+					}
+				};
+			}
+		}
+		
+		currentDir = new File("/sdcard/");
+		fill(currentDir);		
+	}
+	
+	public boolean onKeyDown(int keyCode, KeyEvent event) {
+        if (keyCode == KeyEvent.KEYCODE_BACK) {
+        	if ((!currentDir.getName().equals("sdcard")) && (currentDir.getParentFile() != null)) {
+	        	currentDir = currentDir.getParentFile();
+	        	fill(currentDir);
+        	} else {
+        		finish();
+        	}
+            return false;
+        }
+        return super.onKeyDown(keyCode, event);
+	}
+
+	private void fill(File f) {
+		File[] dirs = null;
+		if (fileFilter != null)
+			dirs = f.listFiles(fileFilter);
+		else 
+			dirs = f.listFiles();
+			
+		this.setTitle(getString(R.string.currentDir) + ": " + f.getName());
+		List<Option> dir = new ArrayList<Option>();
+		List<Option> fls = new ArrayList<Option>();
+		try {
+			for (File ff : dirs) {
+				if (ff.isDirectory() && !ff.isHidden())
+					dir.add(new Option(ff.getName(), getString(R.string.folder), ff
+							.getAbsolutePath(), true, false));
+				else {
+					if (!ff.isHidden())
+						fls.add(new Option(ff.getName(), getString(R.string.fileSize) + ": "
+								+ ff.length(), ff.getAbsolutePath(), false, false));
+				}
+			}
+		} catch (Exception e) {
+
+		}
+		Collections.sort(dir);
+		Collections.sort(fls);
+		dir.addAll(fls);
+		if (!f.getName().equalsIgnoreCase("sdcard")) {
+			if (f.getParentFile() != null) dir.add(0, new Option("..", getString(R.string.parentDirectory), f.getParent(), false, true));
+		}
+		adapter = new FileArrayAdapter(FileChooser.this, R.layout.file_view,
+				dir);
+		this.setListAdapter(adapter);
+	}
+
+	@Override
+	protected void onListItemClick(ListView l, View v, int position, long id) {
+		// TODO Auto-generated method stub
+		super.onListItemClick(l, v, position, id);
+		Option o = adapter.getItem(position);
+		if (o.isFolder() || o.isParent()) {			
+			currentDir = new File(o.getPath());
+			fill(currentDir);
+		} else {
+			//onFileClick(o);
+			fileSelected = new File(o.getPath());
+			Intent intent = new Intent();
+			intent.putExtra("fileSelected", fileSelected.getAbsolutePath());
+			setResult(Activity.RESULT_OK, intent);
+			finish();
+		}		
+	}
+
+	private void onFileClick(Option o) {
+		Toast.makeText(this, "File Clicked: " + o.getName(), Toast.LENGTH_SHORT)
+				.show();
+	}
+		
+}

+ 43 - 0
IZPL-A/IZPL/filechooser/src/main/java/br/com/thinkti/android/filechooser/Option.java

@@ -0,0 +1,43 @@
+package br.com.thinkti.android.filechooser;
+
+public class Option implements Comparable<Option>{
+	private String name;
+	private String data;
+	private String path;
+	private boolean folder;
+	private boolean parent;
+	
+	public Option(String n,String d,String p, boolean folder, boolean parent)
+	{
+		name = n;
+		data = d;
+		path = p;
+		this.folder = folder;
+		this.parent = parent;
+	}
+	public String getName()
+	{
+		return name;
+	}
+	public String getData()
+	{
+		return data;
+	}
+	public String getPath()
+	{
+		return path;
+	}
+	@Override
+	public int compareTo(Option o) {
+		if(this.name != null)
+			return this.name.toLowerCase().compareTo(o.getName().toLowerCase()); 
+		else 
+			throw new IllegalArgumentException();
+	}
+	public boolean isFolder() {
+		return folder;
+	}
+	public boolean isParent() {
+		return parent;
+	}
+}

BIN
IZPL-A/IZPL/filechooser/src/main/res/drawable/android32.png


BIN
IZPL-A/IZPL/filechooser/src/main/res/drawable/back32.png


BIN
IZPL-A/IZPL/filechooser/src/main/res/drawable/doc.png


BIN
IZPL-A/IZPL/filechooser/src/main/res/drawable/folder.png


BIN
IZPL-A/IZPL/filechooser/src/main/res/drawable/folder_icon.png


BIN
IZPL-A/IZPL/filechooser/src/main/res/drawable/gif32.png


BIN
IZPL-A/IZPL/filechooser/src/main/res/drawable/jpg32.png


BIN
IZPL-A/IZPL/filechooser/src/main/res/drawable/pdf.png


BIN
IZPL-A/IZPL/filechooser/src/main/res/drawable/png32.png


BIN
IZPL-A/IZPL/filechooser/src/main/res/drawable/ppt.png


BIN
IZPL-A/IZPL/filechooser/src/main/res/drawable/rtf32.png


BIN
IZPL-A/IZPL/filechooser/src/main/res/drawable/txt32.png


BIN
IZPL-A/IZPL/filechooser/src/main/res/drawable/whitepage32.png


BIN
IZPL-A/IZPL/filechooser/src/main/res/drawable/xls.png


BIN
IZPL-A/IZPL/filechooser/src/main/res/drawable/zip32.png


+ 46 - 0
IZPL-A/IZPL/filechooser/src/main/res/layout/file_view.xml

@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:layout_height="wrap_content" 
+  android:orientation="vertical" 
+  android:layout_width="fill_parent">
+  	
+  	<LinearLayout 
+  		android:layout_height="wrap_content" 
+  		android:orientation="horizontal" 
+  		android:layout_width="fill_parent"
+  		>  
+  		<ImageView
+			android:id="@+id/img1" 
+			android:layout_width="wrap_content" 
+			android:layout_height="wrap_content" 
+			android:singleLine="true"
+			android:layout_marginTop="5dip" 
+			android:layout_marginLeft="5dip"			
+  		/>
+  		<LinearLayout 
+  			android:layout_height="wrap_content" 
+  			android:orientation="vertical" 
+  			android:layout_width="fill_parent"
+  			>	
+			<TextView 
+				android:text="@+id/TextView01" 
+				android:id="@+id/TextView01" 
+				android:layout_width="wrap_content" 
+				android:layout_height="wrap_content" 
+				android:singleLine="true" 
+				android:textStyle="bold" 
+				android:layout_marginTop="5dip" 
+				android:layout_marginLeft="5dip">
+			</TextView>
+			<TextView 
+				android:text="@+id/TextView02" 
+				android:id="@+id/TextView02" 
+				android:layout_width="wrap_content" 
+				android:layout_height="wrap_content" 
+				android:layout_marginLeft="5dip">
+			</TextView>
+		</LinearLayout>
+	</LinearLayout>
+	
+</LinearLayout>

+ 9 - 0
IZPL-A/IZPL/filechooser/src/main/res/values/stringsFileChooser.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="hello">Hello World, FileChooser!</string>
+    <string name="app_name">File Chooser</string>
+    <string name="folder">Folder</string>
+    <string name="parentDirectory">Parent Directory</string>
+    <string name="fileSize">File Size</string>
+    <string name="currentDir">Current Dir</string>
+</resources>

+ 1 - 1
IZPL-A/IZPL/settings.gradle

@@ -1 +1 @@
-include ':app'
+include ':app', ':filechooser'

+ 0 - 48
IZPL-A/build.gradle

@@ -1,51 +1,3 @@
-defaultTasks 'distZip'
 
-apply plugin: 'java'
-apply plugin: 'application'
 
 
-sourceCompatibility = 1.8
-version = 'SNAPSHOT'
-mainClassName = 'de.nplusc.izc.iZpl.Builder'
-
-
-jar{
-	manifest{
-		attributes 'Implementation-Title': 'iZToolKit',
-					'Implementation-Version': 'SNAPSHOT',
-					'Main-Class': 'de.nplusc.izc.iZpl.Builder'
-					
-	}
-}
-
-repositories{
-	jcenter()
-}
-
-compileJava {
-options.compilerArgs << '-Xlint:none'
-
-options.compilerArgs << '-Xlint:-deprecation'
-
-options.compilerArgs << '-XDignore.symbol.file'
-}
-
-dependencies{
-	compile fileTree(dir: 'lib', include: '*.jar')
-	compile "commons-io:commons-io:2.+"
-	compile 'org.apache.commons:commons-exec:1.3'
-	compile "org.yaml:snakeyaml:1.14"
-	compile "commons-net:commons-net:3.3"
-	compile 'org.ini4j:ini4j:0.5.2'
-	compile 'org.im4java:im4java:1.4.0'
-    compile 'net.java.dev.jna:jna:3.5.2'
-	compile 'uk.co.caprica:vlcj:3.0.1' //HACK! bezüglich JNA
-    compile	'org.xerial:sqlite-jdbc:3.8.7'
-	compile 'mysql:mysql-connector-java:5.1.6'
-	compile(project(':ToolKit')) {
-        transitive = false
-    }
-
-
-	
-}

+ 7 - 1
Readme.txt

@@ -5,6 +5,12 @@ Currently Supported OSes: Windows
 
 Contained programs:
 
+iZpl-Android
+    Status: Pre-Alpha
+    Folder IZPL-A
+    Description:Android port of iZplaylist
+    Note: code in the filechooser subfolder is from : https://code.google.com/p/android-file-chooser/
+
 iZplaylist:
     Status: Alpha
     Folder: iZpl
@@ -88,4 +94,4 @@ WallpaperCacheManager
     Status: alpha
     Folder: WPCMGr
     Description: tool for managing wallpapers in larger collection. Requires installed ImageMagick
-    OSes: windows
+    OSes: windows

BIN
iZpl/src/main/resources/rsrc/andro.xcf


+ 2 - 1
izpl-shared/build.gradle

@@ -1,6 +1,7 @@
 apply plugin: 'java'
 
-
+sourceCompatibility = 1.7
+targetCompatibility = 1.7
 dependencies{
     compile fileTree(dir: 'lib', include: '*.jar')
     compile "org.yaml:snakeyaml:1.14"

+ 0 - 1
izpl-shared/src/main/java/de/nplusc/izc/iZpl/API/shared/PlayListFile.java

@@ -17,7 +17,6 @@
 
 package de.nplusc.izc.iZpl.API.shared;
 
-import de.nplusc.izc.iZpl.API.shared.SinglePlayListItem;
 import java.util.List;
 import java.util.Objects;
 

+ 14 - 5
izpl-shared/src/main/java/de/nplusc/izc/iZpl/Utils/shared/PLFileIO.java

@@ -30,13 +30,11 @@ import java.io.IOException;
 import java.io.RandomAccessFile;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
-import org.yaml.snakeyaml.Yaml;
 
 /**
  *
@@ -59,7 +57,7 @@ public class PLFileIO
     */
     
     
-    private static Yaml y = new Yaml();
+    //private static Yaml y = new Yaml();
     private static final Logger l = LogManager.getLogger();
     public static List<SinglePlayListItem> readSingleList(String path) throws InvalidPlayListFileException
     {
@@ -234,7 +232,15 @@ public class PLFileIO
     List<PlayListItem> result = new ArrayList<>();
 
         List<SinglePlayListItem> rootList = readSingleList(path);
-        l.trace(y.dump(rootList));
+        try{
+            Class yaml = Class.forName("org.yaml.snakeyaml.Yaml");
+            Object y = yaml.getConstructor().newInstance();
+            l.trace(yaml.getMethod("dump", Object.class).invoke(y, rootList));
+        }
+        catch(Exception e)
+        {
+        
+        }
         for (SinglePlayListItem re : rootList)
         {
             if(re.isIncludeElement())
@@ -251,7 +257,10 @@ public class PLFileIO
                 else
                 {
                     List<PlayListItem> temp = parseFullList(re.getPath(),rd-1);
-                    temp.forEach((ple)->ple.setTargetPlaycount(ple.getTargetPlaycount()*re.getTargetPlaycount()));
+                    for (PlayListItem ple : temp)
+                    {
+                        ple.setTargetPlaycount(ple.getTargetPlaycount()*re.getTargetPlaycount());
+                    }
                     result.addAll(temp);
                 }
             }