Layout improvements
Add new icon
|
@ -24,6 +24,7 @@ package de.arcus.playmusicexporter2;
|
|||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -88,13 +89,35 @@ public class TrackDetailFragment extends Fragment {
|
|||
|
||||
// Show the dummy content as text in a TextView.
|
||||
if (mMusicTrackList != null) {
|
||||
ListView listView = (ListView)rootView.findViewById(R.id.list_music_track);
|
||||
final ListView listView = (ListView)rootView.findViewById(R.id.list_music_track);
|
||||
|
||||
|
||||
MusicTrackAdapter musicTrackAdapter = new MusicTrackAdapter(getActivity());
|
||||
|
||||
musicTrackAdapter.setList(mMusicTrackList.getMusicTrackList());
|
||||
|
||||
listView.setAdapter(musicTrackAdapter);
|
||||
listView.setDrawSelectorOnTop(false);
|
||||
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
|
||||
listView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
|
||||
Log.d("onItemSelected", "pos: " + position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
Log.d("onItemClick", "pos: " + position);
|
||||
listView.setItemChecked(position, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return rootView;
|
||||
|
|
|
@ -31,6 +31,7 @@ import de.arcus.framework.logger.Logger;
|
|||
import de.arcus.framework.crashhandler.CrashHandler;
|
||||
import de.arcus.playmusiclib.PlayMusicManager;
|
||||
import de.arcus.playmusiclib.datasources.AlbumDataSource;
|
||||
import de.arcus.playmusiclib.datasources.PlaylistDataSource;
|
||||
import de.arcus.playmusiclib.enums.ID3v2Version;
|
||||
import de.arcus.playmusiclib.items.MusicTrackList;
|
||||
|
||||
|
@ -115,6 +116,9 @@ public class TrackListActivity extends ActionBarActivity
|
|||
|
||||
// Load all albums to the list
|
||||
AlbumDataSource albumDataSource = new AlbumDataSource(playMusicManager);
|
||||
//PlaylistDataSource playlistDataSource = new PlaylistDataSource(playMusicManager);
|
||||
|
||||
albumDataSource.setOfflineOnly(true);
|
||||
|
||||
((TrackListFragment) getSupportFragmentManager()
|
||||
.findFragmentById(R.id.track_list)).setMusicTrackList(albumDataSource.getAll());
|
||||
|
|
|
@ -117,6 +117,8 @@ public class TrackListFragment extends ListFragment {
|
|||
super.onCreate(savedInstanceState);
|
||||
|
||||
mMusicTrackListAdapter = new MusicTrackListAdapter(getActivity());
|
||||
|
||||
|
||||
setListAdapter(mMusicTrackListAdapter);
|
||||
}
|
||||
|
||||
|
@ -157,7 +159,7 @@ public class TrackListFragment extends ListFragment {
|
|||
|
||||
// Notify the active callbacks interface (the activity, if the
|
||||
// fragment is attached to one) that an item has been selected.
|
||||
mCallbacks.onItemSelected(mMusicTrackListAdapter.getList().get(position));
|
||||
mCallbacks.onItemSelected(mMusicTrackListAdapter.getItem(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,6 +27,7 @@ import android.database.DataSetObserver;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -38,86 +39,35 @@ import de.arcus.playmusiclib.items.MusicTrack;
|
|||
/**
|
||||
* Adapter for the music tracks
|
||||
*/
|
||||
public class MusicTrackAdapter implements ListAdapter {
|
||||
public class MusicTrackAdapter extends ArrayAdapter<MusicTrack> {
|
||||
/**
|
||||
* The context of the app
|
||||
*/
|
||||
private Context mContext;
|
||||
|
||||
/**
|
||||
* The list
|
||||
*/
|
||||
private List<MusicTrack> mList;
|
||||
|
||||
/**
|
||||
* @param list Sets a new list
|
||||
*/
|
||||
public void setList(List<MusicTrack> list) {
|
||||
mList = list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Gets the list
|
||||
*/
|
||||
public List<MusicTrack> getList() {
|
||||
return mList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new track adapter
|
||||
* @param context The app context
|
||||
*/
|
||||
public MusicTrackAdapter(Context context) {
|
||||
super(context, R.layout.adapter_music_track);
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areAllItemsEnabled() {
|
||||
return false;
|
||||
}
|
||||
public void setList(List<MusicTrack> musicTracks) {
|
||||
// Clear all items
|
||||
clear();
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(int position) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerDataSetObserver(DataSetObserver observer) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterDataSetObserver(DataSetObserver observer) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
if (mList == null) return 0;
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return mList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// We don't have ids
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasStableIds() {
|
||||
// We don't have ids
|
||||
return false;
|
||||
// Add the new items
|
||||
for(MusicTrack musicTrack : musicTracks) {
|
||||
add(musicTrack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// The track
|
||||
MusicTrack musicTrack = mList.get(position);
|
||||
MusicTrack musicTrack = getItem(position);
|
||||
|
||||
View view = convertView;
|
||||
|
||||
|
@ -131,38 +81,32 @@ public class MusicTrackAdapter implements ListAdapter {
|
|||
|
||||
// Set the track number
|
||||
textView = (TextView)view.findViewById(R.id.text_music_track_number);
|
||||
if (musicTrack.getTrackNumber() > 0)
|
||||
textView.setText("" + musicTrack.getTrackNumber());
|
||||
long trackPosition = musicTrack.getTrackNumber();
|
||||
|
||||
if (musicTrack.getContainerName() != null)
|
||||
trackPosition = musicTrack.getContainerPosition();
|
||||
|
||||
if (trackPosition > 0)
|
||||
textView.setText("" + trackPosition);
|
||||
else
|
||||
textView.setText("");
|
||||
textView.setTextColor(mContext.getResources().getColor(musicTrack.isOfflineAvailable() ? R.color.text_music_number : R.color.text_music_disable_number));
|
||||
|
||||
// Set the title
|
||||
textView = (TextView)view.findViewById(R.id.text_music_track_title);
|
||||
textView.setText(musicTrack.getTitle());
|
||||
textView.setTextColor(mContext.getResources().getColor(musicTrack.isOfflineAvailable() ? R.color.text_music_title : R.color.text_music_disable_title));
|
||||
|
||||
// Set the artist
|
||||
textView = (TextView)view.findViewById(R.id.text_music_track_artist);
|
||||
textView.setText(musicTrack.getArtist());
|
||||
textView.setTextColor(mContext.getResources().getColor(musicTrack.isOfflineAvailable() ? R.color.text_music_description : R.color.text_music_disable_description));
|
||||
|
||||
// Track is available?
|
||||
view.setEnabled(musicTrack.isOfflineAvailable());
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
// We don't have view types
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewTypeCount() {
|
||||
// We don't have view types
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return (mList == null || mList.isEmpty());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import android.database.DataSetObserver;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.TextView;
|
||||
|
@ -35,81 +36,40 @@ import java.util.List;
|
|||
|
||||
import de.arcus.playmusicexporter2.R;
|
||||
import de.arcus.playmusicexporter2.utils.ImageViewLoader;
|
||||
import de.arcus.playmusiclib.items.MusicTrack;
|
||||
import de.arcus.playmusiclib.items.MusicTrackList;
|
||||
|
||||
/**
|
||||
* Adapter for the music track lists
|
||||
*/
|
||||
public class MusicTrackListAdapter implements ListAdapter {
|
||||
public class MusicTrackListAdapter extends ArrayAdapter<MusicTrackList> {
|
||||
/**
|
||||
* The context of the app
|
||||
*/
|
||||
private Context mContext;
|
||||
|
||||
/**
|
||||
* The list
|
||||
*/
|
||||
private List<MusicTrackList> mList;
|
||||
|
||||
/**
|
||||
* @param list Sets a new list
|
||||
*/
|
||||
public void setList(List<MusicTrackList> list) {
|
||||
mList = list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Gets the list
|
||||
*/
|
||||
public List<MusicTrackList> getList() {
|
||||
return mList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new track list adapter
|
||||
* @param context The app context
|
||||
*/
|
||||
public MusicTrackListAdapter(Context context) {
|
||||
super(context, R.layout.adapter_music_track);
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerDataSetObserver(DataSetObserver observer) {
|
||||
public void setList(List<MusicTrackList> musicTrackLists) {
|
||||
// Clear all items
|
||||
clear();
|
||||
|
||||
// Add the new items
|
||||
for(MusicTrackList musicTrackList : musicTrackLists) {
|
||||
add(musicTrackList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterDataSetObserver(DataSetObserver observer) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
if (mList == null) return 0;
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return mList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// We don't have ids
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasStableIds() {
|
||||
// We don't have ids
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// The track list
|
||||
MusicTrackList musicTrackList = mList.get(position);
|
||||
MusicTrackList musicTrackList = getItem(position);
|
||||
|
||||
View view = convertView;
|
||||
|
||||
|
@ -147,31 +107,4 @@ public class MusicTrackListAdapter implements ListAdapter {
|
|||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
// We don't have view types
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewTypeCount() {
|
||||
// We don't have view types
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return (mList == null || mList.isEmpty());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areAllItemsEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(int position) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
BIN
playmusicexporter/src/main/res/drawable-hdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 4.2 KiB |
BIN
playmusicexporter/src/main/res/drawable-mdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 3.1 KiB |
BIN
playmusicexporter/src/main/res/drawable-xhdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 11 KiB |
|
@ -22,7 +22,8 @@
|
|||
-->
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp">
|
||||
|
@ -34,7 +35,9 @@
|
|||
android:text="1"
|
||||
android:id="@+id/text_music_track_number"
|
||||
android:gravity="center"
|
||||
android:layout_centerVertical="true" />
|
||||
android:layout_centerVertical="true"
|
||||
android:textSize="20dp"
|
||||
android:textColor="@color/text_music_number" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -51,7 +54,10 @@
|
|||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:text="Large Text"
|
||||
android:id="@+id/text_music_track_title"
|
||||
android:layout_alignParentTop="true" />
|
||||
android:layout_alignParentTop="true"
|
||||
android:maxLines="2"
|
||||
android:textSize="16dp"
|
||||
android:textColor="@color/text_music_title" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -59,7 +65,9 @@
|
|||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="Small Text"
|
||||
android:id="@+id/text_music_track_artist"
|
||||
android:layout_below="@+id/text_music_track_title" />
|
||||
android:layout_below="@+id/text_music_track_title"
|
||||
android:maxLines="2"
|
||||
android:textColor="@color/text_music_description" />
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
|
@ -22,12 +22,13 @@
|
|||
-->
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="96dp"
|
||||
android:layout_width="@dimen/music_track_list_artwork_size"
|
||||
android:layout_height="@dimen/music_track_list_artwork_size"
|
||||
android:id="@+id/image_music_track_artwork"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
|
@ -36,7 +37,7 @@
|
|||
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="96dp"
|
||||
android:layout_height="@dimen/music_track_list_artwork_size"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toRightOf="@+id/image_music_track_artwork"
|
||||
android:layout_toEndOf="@+id/image_music_track_artwork"
|
||||
|
@ -66,7 +67,8 @@
|
|||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:maxLines="2"
|
||||
android:textSize="16dp" />
|
||||
android:textSize="16dp"
|
||||
android:textColor="@color/text_music_title" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -79,7 +81,8 @@
|
|||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:maxLines="2" />
|
||||
android:maxLines="2"
|
||||
android:textColor="@color/text_music_description" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
|
@ -21,7 +21,6 @@
|
|||
-->
|
||||
|
||||
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools" android:id="@+id/list_music_track"
|
||||
android:id="@+id/list_music_track"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".TrackDetailFragment" />
|
||||
android:layout_height="match_parent" />
|
||||
|
|
|
@ -22,6 +22,14 @@
|
|||
-->
|
||||
|
||||
<resources>
|
||||
<color name="applicationMainColor">#ef6c00</color>
|
||||
<color name="applicationMainColorDark">#e65100</color>
|
||||
<color name="application_main">#ef6c00</color>
|
||||
<color name="application_main_dark">#e65100</color>
|
||||
|
||||
<color name="text_music_number">#ff000000</color>
|
||||
<color name="text_music_title">#ff000000</color>
|
||||
<color name="text_music_description">#88000000</color>
|
||||
|
||||
<color name="text_music_disable_number">#44000000</color>
|
||||
<color name="text_music_disable_title">#44000000</color>
|
||||
<color name="text_music_disable_description">#22000000</color>
|
||||
</resources>
|
26
playmusicexporter/src/main/res/values/dimens.xml
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2015 David Schulte
|
||||
~
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<dimen name="music_track_list_artwork_size">86dp</dimen>
|
||||
</resources>
|
|
@ -25,9 +25,7 @@
|
|||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/applicationMainColor</item>
|
||||
<item name="colorPrimaryDark">@color/applicationMainColorDark</item>
|
||||
<item name="colorPrimary">@color/application_main</item>
|
||||
<item name="colorPrimaryDark">@color/application_main_dark</item>
|
||||
</style>
|
||||
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -148,6 +148,6 @@ public class PlaylistDataSource extends DataSource<Playlist> {
|
|||
* @return Returns all playlists
|
||||
*/
|
||||
public List<Playlist> getAll() {
|
||||
return getItems(TABLE_LIST, COLUMNS_ALL, prepareWhere(COLUMN_LIST_TYPE + " != " + Playlist.TYPE_QUEUE), COLUMN_NAME);
|
||||
return getItems(TABLE_LIST, COLUMNS_ALL, prepareWhere(COLUMN_LIST_TYPE + " != " + Playlist.TYPE_QUEUE), COLUMN_LIST_TYPE + ", " + COLUMN_NAME);
|
||||
}
|
||||
}
|
||||
|
|