Optimized layouts and bugfix
Optimized song and artist list item layouts Hopefully fixed a NPE when deleting a track
This commit is contained in:
parent
7c206f5423
commit
31f794336a
8 changed files with 28 additions and 39 deletions
|
|
@ -61,6 +61,7 @@ dependencies {
|
||||||
compile 'com.squareup.okhttp:okhttp:2.2.0'
|
compile 'com.squareup.okhttp:okhttp:2.2.0'
|
||||||
compile files('../libs/jaudiotagger-2.0.4-20111207.115108-15.jar')
|
compile files('../libs/jaudiotagger-2.0.4-20111207.115108-15.jar')
|
||||||
compile 'asia.ivity.android:drag-sort-listview:1.0'
|
compile 'asia.ivity.android:drag-sort-listview:1.0'
|
||||||
|
compile 'de.hdodenhof:circleimageview:1.2.2'
|
||||||
compile('com.crashlytics.sdk.android:crashlytics:2.2.1@aar') {
|
compile('com.crashlytics.sdk.android:crashlytics:2.2.1@aar') {
|
||||||
transitive = true;
|
transitive = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ public class ArtistAdapter extends RecyclerView.Adapter<ArtistAdapter.ViewHolder
|
||||||
public void onArtistThumbnailUrlLoaded(String url) {
|
public void onArtistThumbnailUrlLoaded(String url) {
|
||||||
Picasso.with(activity)
|
Picasso.with(activity)
|
||||||
.load(url)
|
.load(url)
|
||||||
|
.noFade()
|
||||||
.placeholder(R.drawable.default_artist_image)
|
.placeholder(R.drawable.default_artist_image)
|
||||||
.into(holder.artistImage);
|
.into(holder.artistImage);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,10 @@ package com.kabouzeid.gramophone.ui.fragments.mainactivityfragments;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.widget.GridLayoutManager;
|
import android.support.v7.widget.GridLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
import com.kabouzeid.gramophone.adapter.AlbumAdapter;
|
import com.kabouzeid.gramophone.adapter.AlbumAdapter;
|
||||||
|
|
@ -20,14 +20,10 @@ public class AlbumViewFragment extends AbsMainActivityFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
return inflater.inflate(R.layout.fragment_album_view, container, false);
|
View view = inflater.inflate(R.layout.fragment_album_view, container, false);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
|
||||||
super.onViewCreated(view, savedInstanceState);
|
|
||||||
recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
|
recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
|
||||||
setUpRecyclerView();
|
setUpRecyclerView();
|
||||||
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpRecyclerView() {
|
private void setUpRecyclerView() {
|
||||||
|
|
|
||||||
|
|
@ -131,8 +131,8 @@ public class MusicUtil {
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
while (!cursor.isAfterLast()) {
|
while (!cursor.isAfterLast()) {
|
||||||
final String name = cursor.getString(1);
|
final String name = cursor.getString(1);
|
||||||
final File f = new File(name);
|
|
||||||
try { // File.delete can throw a security exception
|
try { // File.delete can throw a security exception
|
||||||
|
final File f = new File(name);
|
||||||
if (!f.delete()) {
|
if (!f.delete()) {
|
||||||
// I'm not sure if we'd ever get here (deletion would
|
// I'm not sure if we'd ever get here (deletion would
|
||||||
// have to fail, but no exception thrown)
|
// have to fail, but no exception thrown)
|
||||||
|
|
@ -141,6 +141,8 @@ public class MusicUtil {
|
||||||
cursor.moveToNext();
|
cursor.moveToNext();
|
||||||
} catch (final SecurityException ex) {
|
} catch (final SecurityException ex) {
|
||||||
cursor.moveToNext();
|
cursor.moveToNext();
|
||||||
|
} catch (NullPointerException e){
|
||||||
|
Log.e("MusicUtils", "Failed to find file " + name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cursor.close();
|
cursor.close();
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,12 @@
|
||||||
android:id="@+id/fragment_album_view"
|
android:id="@+id/fragment_album_view"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:padding="2dp">
|
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/recycler_view"
|
android:id="@+id/recycler_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:padding="2dp"
|
|
||||||
android:scrollbars="vertical"/>
|
android:scrollbars="vertical"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
||||||
|
|
@ -2,25 +2,26 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="64dp"
|
android:layout_height="72dp"
|
||||||
android:background="?rect_selector"
|
android:background="?rect_selector"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
android:paddingRight="16dp">
|
android:paddingRight="16dp">
|
||||||
|
|
||||||
<com.kabouzeid.gramophone.view.SquareImageView
|
<de.hdodenhof.circleimageview.CircleImageView
|
||||||
android:id="@+id/artist_image"
|
android:id="@+id/artist_image"
|
||||||
android:layout_width="60dp"
|
android:layout_width="56dp"
|
||||||
android:layout_height="60dp"
|
android:layout_height="56dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"/>
|
||||||
/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:layout_marginRight="16dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|
@ -28,8 +29,6 @@
|
||||||
android:id="@+id/artist_name"
|
android:id="@+id/artist_name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="16dp"
|
|
||||||
android:layout_marginRight="16dp"
|
|
||||||
android:fontFamily="sans-serif"
|
android:fontFamily="sans-serif"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2"/>
|
android:textAppearance="@style/TextAppearance.AppCompat.Body2"/>
|
||||||
|
|
@ -38,8 +37,6 @@
|
||||||
android:id="@+id/artist_info"
|
android:id="@+id/artist_info"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="16dp"
|
|
||||||
android:layout_marginRight="16dp"
|
|
||||||
android:fontFamily="sans-serif"
|
android:fontFamily="sans-serif"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Caption"/>
|
android:textAppearance="@style/TextAppearance.AppCompat.Caption"/>
|
||||||
|
|
|
||||||
|
|
@ -2,21 +2,22 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="64dp"
|
android:layout_height="72dp"
|
||||||
android:descendantFocusability="blocksDescendants"
|
android:descendantFocusability="blocksDescendants"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingLeft="16dp">
|
android:paddingLeft="16dp">
|
||||||
|
|
||||||
<com.kabouzeid.gramophone.view.SquareImageView
|
<com.kabouzeid.gramophone.view.SquareImageView
|
||||||
android:id="@+id/album_art"
|
android:id="@+id/album_art"
|
||||||
android:layout_width="60dp"
|
android:layout_width="56dp"
|
||||||
android:layout_height="60dp"
|
android:layout_height="56dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"/>
|
||||||
/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:layout_marginRight="16dp"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
|
@ -27,8 +28,6 @@
|
||||||
android:id="@+id/song_title"
|
android:id="@+id/song_title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="16dp"
|
|
||||||
android:layout_marginRight="16dp"
|
|
||||||
android:fontFamily="sans-serif"
|
android:fontFamily="sans-serif"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2"/>
|
android:textAppearance="@style/TextAppearance.AppCompat.Body2"/>
|
||||||
|
|
@ -37,8 +36,6 @@
|
||||||
android:id="@+id/song_info"
|
android:id="@+id/song_info"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="16dp"
|
|
||||||
android:layout_marginRight="16dp"
|
|
||||||
android:fontFamily="sans-serif"
|
android:fontFamily="sans-serif"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Caption"/>
|
android:textAppearance="@style/TextAppearance.AppCompat.Caption"/>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="64dp"
|
android:layout_height="72dp"
|
||||||
android:background="?rect_selector"
|
android:background="?rect_selector"
|
||||||
android:descendantFocusability="blocksDescendants"
|
android:descendantFocusability="blocksDescendants"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
|
|
@ -10,17 +10,18 @@
|
||||||
|
|
||||||
<com.kabouzeid.gramophone.view.SquareImageView
|
<com.kabouzeid.gramophone.view.SquareImageView
|
||||||
android:id="@+id/album_art"
|
android:id="@+id/album_art"
|
||||||
android:layout_width="60dp"
|
android:layout_width="56dp"
|
||||||
android:layout_height="60dp"
|
android:layout_height="56dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"/>
|
||||||
/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:layout_marginRight="16dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|
@ -28,8 +29,6 @@
|
||||||
android:id="@+id/song_title"
|
android:id="@+id/song_title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="16dp"
|
|
||||||
android:layout_marginRight="16dp"
|
|
||||||
android:fontFamily="sans-serif"
|
android:fontFamily="sans-serif"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2"/>
|
android:textAppearance="@style/TextAppearance.AppCompat.Body2"/>
|
||||||
|
|
@ -38,8 +37,6 @@
|
||||||
android:id="@+id/song_info"
|
android:id="@+id/song_info"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="16dp"
|
|
||||||
android:layout_marginRight="16dp"
|
|
||||||
android:fontFamily="sans-serif"
|
android:fontFamily="sans-serif"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Caption"/>
|
android:textAppearance="@style/TextAppearance.AppCompat.Caption"/>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue