Small fixes, also added empty text to playlist fragment and detail viewer.

This commit is contained in:
Aidan Follestad 2015-04-16 19:47:32 -05:00
commit 7055b443fb
14 changed files with 52 additions and 20 deletions

View file

@ -8,6 +8,7 @@ import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View;
import com.kabouzeid.gramophone.R; import com.kabouzeid.gramophone.R;
import com.kabouzeid.gramophone.adapter.songadapter.PlaylistSongAdapter; import com.kabouzeid.gramophone.adapter.songadapter.PlaylistSongAdapter;
@ -44,6 +45,10 @@ public class PlaylistDetailActivity extends AbsFabActivity {
recyclerView.setLayoutManager(new GridLayoutManager(this, 1)); recyclerView.setLayoutManager(new GridLayoutManager(this, 1));
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
findViewById(android.R.id.empty).setVisibility(
songs.size() == 0 ? View.VISIBLE : View.GONE
);
DragSortRecycler dragSortRecycler = new DragSortRecycler(); DragSortRecycler dragSortRecycler = new DragSortRecycler();
dragSortRecycler.setViewHandleId(R.id.album_art); dragSortRecycler.setViewHandleId(R.id.album_art);

View file

@ -60,8 +60,4 @@ public abstract class AbsMainActivityFragment extends Fragment implements KabVie
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
setHasOptionsMenu(true); setHasOptionsMenu(true);
} }
protected MainActivity getMainActivity() {
return (MainActivity) getActivity();
}
} }

View file

@ -4,6 +4,7 @@ package com.kabouzeid.gramophone.ui.fragments.mainactivityfragments;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.kabouzeid.gramophone.R; import com.kabouzeid.gramophone.R;
import com.kabouzeid.gramophone.adapter.PlaylistAdapter; import com.kabouzeid.gramophone.adapter.PlaylistAdapter;
@ -24,6 +25,12 @@ public class PlaylistViewFragment extends AbsMainActivityRecyclerViewFragment {
@Override @Override
protected RecyclerView.Adapter createAdapter() { protected RecyclerView.Adapter createAdapter() {
return new PlaylistAdapter((ActionBarActivity) getActivity()); PlaylistAdapter adapter = new PlaylistAdapter((ActionBarActivity) getActivity());
View v = getView();
if (v != null) {
v.findViewById(android.R.id.empty).setVisibility(
adapter.getItemCount() == 0 ? View.VISIBLE : View.GONE);
}
return adapter;
} }
} }

View file

@ -1,7 +1,7 @@
package com.kabouzeid.gramophone.views; package com.kabouzeid.gramophone.views;
import android.content.Context; import android.content.Context;
import android.support.v7.internal.widget.TintCheckBox; import android.support.v7.internal.widget.TintEditText;
import android.util.AttributeSet; import android.util.AttributeSet;
import com.afollestad.materialdialogs.ThemeSingleton; import com.afollestad.materialdialogs.ThemeSingleton;
@ -10,7 +10,7 @@ import com.afollestad.materialdialogs.internal.MDTintHelper;
/** /**
* @author Aidan Follestad (afollestad) * @author Aidan Follestad (afollestad)
*/ */
public class DynamicEditText extends TintCheckBox { public class DynamicEditText extends TintEditText {
public DynamicEditText(Context context) { public DynamicEditText(Context context) {
super(context); super(context);

View file

@ -1,4 +1,4 @@
<selector android:exitFadeDuration="@android:integer/config_mediumAnimTime" xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/list_activated" android:state_activated="true" /> <item android:drawable="@drawable/list_activated" android:state_activated="true" />
<item android:drawable="@drawable/rect_selected" android:state_pressed="true" /> <item android:drawable="@drawable/rect_selected" android:state_pressed="true" />
<item android:drawable="@drawable/transparent" /> <item android:drawable="@drawable/transparent" />

View file

@ -1,4 +1,4 @@
<selector android:exitFadeDuration="@android:integer/config_mediumAnimTime" xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/list_activated_dark" android:state_activated="true" /> <item android:drawable="@drawable/list_activated_dark" android:state_activated="true" />
<item android:drawable="@drawable/rect_selected_dark" android:state_pressed="true" /> <item android:drawable="@drawable/rect_selected_dark" android:state_pressed="true" />
<item android:drawable="@drawable/transparent" /> <item android:drawable="@drawable/transparent" />

View file

@ -1,4 +1,4 @@
<selector android:exitFadeDuration="@android:integer/config_shortAnimTime" xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/round_selected" /> <item android:state_pressed="true" android:drawable="@drawable/round_selected" />
<item android:drawable="@android:color/transparent" /> <item android:drawable="@android:color/transparent" />
</selector> </selector>

View file

@ -1,4 +1,4 @@
<selector android:exitFadeDuration="@android:integer/config_shortAnimTime" xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/round_selected_dark" /> <item android:state_pressed="true" android:drawable="@drawable/round_selected_dark" />
<item android:drawable="@android:color/transparent" /> <item android:drawable="@android:color/transparent" />
</selector> </selector>

View file

@ -1,4 +1,4 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -80,4 +80,4 @@
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
tools:ignore="RtlHardcoded" /> tools:ignore="RtlHardcoded" />
</merge> </FrameLayout>

View file

@ -1,4 +1,4 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -82,4 +82,4 @@
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
tools:ignore="RtlHardcoded" /> tools:ignore="RtlHardcoded" />
</merge> </FrameLayout>

View file

@ -1,4 +1,4 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -21,8 +21,19 @@
android:divider="@null" android:divider="@null"
android:dividerHeight="0px" android:dividerHeight="0px"
android:scrollbars="vertical" /> android:scrollbars="vertical" />
</LinearLayout> </LinearLayout>
<TextView
android:id="@android:id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/empty_text_size"
android:textColor="?android:textColorSecondary"
android:fontFamily="sans-serif-light"
android:text="@string/playlist_empty_text"
android:layout_gravity="center" />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -37,4 +48,4 @@
</LinearLayout> </LinearLayout>
</merge> </FrameLayout>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <FrameLayout
android:id="@+id/fragment_song_view" android:id="@+id/fragment_song_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"
@ -14,4 +14,14 @@
android:divider="@null" android:divider="@null"
android:scrollbars="vertical" /> android:scrollbars="vertical" />
</LinearLayout> <TextView
android:id="@android:id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/empty_text_size"
android:textColor="?android:textColorSecondary"
android:fontFamily="sans-serif-light"
android:text="@string/no_playlists"
android:layout_gravity="center" />
</FrameLayout>

View file

@ -40,5 +40,6 @@ http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout
<!-- Color Chooser Dialog --> <!-- Color Chooser Dialog -->
<dimen name="circle_view_border">1dp</dimen> <dimen name="circle_view_border">1dp</dimen>
<dimen name="circle_view_check">24dp</dimen> <dimen name="circle_view_check">24dp</dimen>
<dimen name="empty_text_size">20sp</dimen>
</resources> </resources>

View file

@ -98,6 +98,8 @@
<string name="primary_color_desc">The primary theme color, defaults to indigo.</string> <string name="primary_color_desc">The primary theme color, defaults to indigo.</string>
<string name="accent_color_desc">The accent theme color, defaults to pink.</string> <string name="accent_color_desc">The accent theme color, defaults to pink.</string>
<string name="update_image">Update Image</string> <string name="update_image">Update Image</string>
<string name="playlist_empty_text">This playlist is empty</string>
<string name="no_playlists">No playlists</string>
<string-array name="update_albumcover_options"> <string-array name="update_albumcover_options">
<item>Download from LastFM</item> <item>Download from LastFM</item>