Landscape artist view & new progress slider
This commit is contained in:
parent
17e78fdc5e
commit
85854939c4
23 changed files with 98 additions and 116 deletions
|
|
@ -61,4 +61,6 @@ dependencies {
|
|||
}
|
||||
compile files('../libs/jaudiotagger-2.0.4-20111207.115108-15.jar')
|
||||
compile 'asia.ivity.android:drag-sort-listview:1.0'
|
||||
|
||||
compile 'com.github.navasmdc:MaterialDesign:1.+@aar'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ public class AlbumDetailActivity extends AbsFabActivity implements OnMusicRemote
|
|||
private View albumArtOverlayView;
|
||||
private View songsBackgroundView;
|
||||
private TextView albumTitleView;
|
||||
private FloatingActionButton fab;
|
||||
private Toolbar toolbar;
|
||||
private int toolbarHeight;
|
||||
private int headerOffset;
|
||||
|
|
@ -109,8 +108,8 @@ public class AlbumDetailActivity extends AbsFabActivity implements OnMusicRemote
|
|||
ViewHelper.setTranslationY(albumTitleView, titleTranslationY);
|
||||
|
||||
// Translate FAB
|
||||
int fabTranslationY = titleTranslationY + titleViewHeight - (fab.getHeight() / 2);
|
||||
ViewHelper.setTranslationY(fab, fabTranslationY);
|
||||
int fabTranslationY = titleTranslationY + titleViewHeight - (getFab().getHeight() / 2);
|
||||
ViewHelper.setTranslationY(getFab(), fabTranslationY);
|
||||
|
||||
if (TOOLBAR_IS_STICKY) {
|
||||
// Change alpha of toolbar background
|
||||
|
|
@ -167,7 +166,6 @@ public class AlbumDetailActivity extends AbsFabActivity implements OnMusicRemote
|
|||
albumArtOverlayView = findViewById(R.id.overlay);
|
||||
absSongListView = (ObservableListView) findViewById(R.id.list);
|
||||
albumTitleView = (TextView) findViewById(R.id.album_title);
|
||||
fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
songsBackgroundView = findViewById(R.id.list_background);
|
||||
statusBar = findViewById(R.id.statusBar);
|
||||
}
|
||||
|
|
@ -303,8 +301,8 @@ public class AlbumDetailActivity extends AbsFabActivity implements OnMusicRemote
|
|||
|
||||
} else {
|
||||
setUpSongsAdapter();
|
||||
fab.setScaleX(0);
|
||||
fab.setScaleY(0);
|
||||
getFab().setScaleX(0);
|
||||
getFab().setScaleY(0);
|
||||
animateHeader(DEFAULT_DELAY_NO_TRANSITION);
|
||||
animateFab(DEFAULT_DELAY_NO_TRANSITION);
|
||||
}
|
||||
|
|
@ -346,7 +344,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements OnMusicRemote
|
|||
}
|
||||
|
||||
private void animateFab(int startDelay) {
|
||||
ViewPropertyAnimator.animate(fab)
|
||||
ViewPropertyAnimator.animate(getFab())
|
||||
.scaleX(1)
|
||||
.scaleY(1)
|
||||
.setInterpolator(new DecelerateInterpolator(4))
|
||||
|
|
@ -402,19 +400,10 @@ public class AlbumDetailActivity extends AbsFabActivity implements OnMusicRemote
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
enableViews();
|
||||
updateFabIcon();
|
||||
app.getMusicPlayerRemote().addOnMusicRemoteEventListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableViews() {
|
||||
super.enableViews();
|
||||
absSongListView.setEnabled(true);
|
||||
fab.setEnabled(true);
|
||||
toolbar.setEnabled(true);
|
||||
}
|
||||
|
||||
|
|
@ -422,45 +411,9 @@ public class AlbumDetailActivity extends AbsFabActivity implements OnMusicRemote
|
|||
public void disableViews() {
|
||||
super.disableViews();
|
||||
absSongListView.setEnabled(false);
|
||||
fab.setEnabled(false);
|
||||
toolbar.setEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
app.getMusicPlayerRemote().removeOnMusicRemoteEventListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMusicRemoteEvent(MusicRemoteEvent event) {
|
||||
switch (event.getAction()) {
|
||||
case MusicRemoteEvent.PLAY:
|
||||
fab.setImageDrawable(getResources().getDrawable(R.drawable.ic_pause_white_48dp));
|
||||
break;
|
||||
case MusicRemoteEvent.PAUSE:
|
||||
fab.setImageDrawable(getResources().getDrawable(R.drawable.ic_play_arrow_white_48dp));
|
||||
break;
|
||||
case MusicRemoteEvent.RESUME:
|
||||
fab.setImageDrawable(getResources().getDrawable(R.drawable.ic_pause_white_48dp));
|
||||
break;
|
||||
case MusicRemoteEvent.STOP:
|
||||
fab.setImageDrawable(getResources().getDrawable(R.drawable.ic_play_arrow_white_48dp));
|
||||
break;
|
||||
case MusicRemoteEvent.QUEUE_COMPLETED:
|
||||
fab.setImageResource(R.drawable.ic_play_arrow_white_48dp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateFabIcon() {
|
||||
if (app.getMusicPlayerRemote().isPlaying()) {
|
||||
fab.setImageResource(R.drawable.ic_pause_white_48dp);
|
||||
} else {
|
||||
fab.setImageResource(R.drawable.ic_play_arrow_white_48dp);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.menu_album_detail, menu);
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements OnMusicRemot
|
|||
}
|
||||
|
||||
private int getListBackgroundTranslation(int scrollY) {
|
||||
return Math.max(0, -scrollY + artistImageViewHeight);
|
||||
return Math.max(0, -scrollY + artistImageViewHeight - 200);
|
||||
}
|
||||
|
||||
private int getTitleTranslation(int scrollY) {
|
||||
|
|
@ -425,18 +425,23 @@ public class ArtistDetailActivity extends AbsFabActivity implements OnMusicRemot
|
|||
toolbar.setEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
|
||||
}
|
||||
|
||||
private static class NavigationAdapter extends FragmentPagerAdapter {
|
||||
|
||||
private String[] titles;
|
||||
|
||||
private SparseArray<Fragment> mPages;
|
||||
private static SparseArray<Fragment> pages;
|
||||
private Artist artist;
|
||||
private Context context;
|
||||
|
||||
public NavigationAdapter(Activity activity, Artist artist) {
|
||||
super(activity.getFragmentManager());
|
||||
this.artist = artist;
|
||||
mPages = new SparseArray<>();
|
||||
pages = new SparseArray<>();
|
||||
context = activity;
|
||||
titles = new String[]{
|
||||
context.getResources().getString(R.string.tab_songs),
|
||||
|
|
@ -447,39 +452,40 @@ public class ArtistDetailActivity extends AbsFabActivity implements OnMusicRemot
|
|||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
Bundle args = new Bundle();
|
||||
final Bundle args = new Bundle();
|
||||
args.putInt(ARG_ARTIST_ID, artist.id);
|
||||
args.putString(ARG_ARTIST_NAME, artist.name);
|
||||
Fragment f;
|
||||
switch (position) {
|
||||
case 1:
|
||||
f = mPages.get(position, new ViewPagerTabArtistAlbumFragment());
|
||||
break;
|
||||
case 0:
|
||||
f = mPages.get(position, new ViewPagerTabArtistSongListFragment());
|
||||
break;
|
||||
case 2:
|
||||
f = mPages.get(position, new ViewPagerTabArtistBioFragment());
|
||||
break;
|
||||
default:
|
||||
f = mPages.get(position, new MainActivity.PlaceholderFragment());
|
||||
break;
|
||||
}
|
||||
|
||||
Fragment f = getOrCreateFragmentAt(position);
|
||||
f.setArguments(args);
|
||||
mPages.put(position, f);
|
||||
|
||||
pages.put(position, f);
|
||||
return f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyItem(ViewGroup container, int position, Object object) {
|
||||
if (0 <= mPages.indexOfKey(position)) {
|
||||
mPages.remove(position);
|
||||
if (0 <= pages.indexOfKey(position)) {
|
||||
pages.remove(position);
|
||||
}
|
||||
super.destroyItem(container, position, object);
|
||||
}
|
||||
|
||||
public Fragment getItemAt(int position) {
|
||||
return mPages.get(position, null);
|
||||
return pages.get(position, null);
|
||||
}
|
||||
|
||||
private Fragment getOrCreateFragmentAt(int position) {
|
||||
switch (position) {
|
||||
case 1:
|
||||
return pages.get(position, new ViewPagerTabArtistAlbumFragment());
|
||||
case 0:
|
||||
return pages.get(position, new ViewPagerTabArtistSongListFragment());
|
||||
case 2:
|
||||
return pages.get(position, new ViewPagerTabArtistBioFragment());
|
||||
default:
|
||||
return pages.get(position, new MainActivity.PlaceholderFragment());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -70,9 +70,9 @@ public abstract class AbsFabActivity extends AbsBaseActivity implements OnMusicR
|
|||
|
||||
private void updateFabState() {
|
||||
if (getApp().getMusicPlayerRemote().isPlaying()) {
|
||||
getFab().setImageResource(R.drawable.ic_pause_white_48dp);
|
||||
getFab().setImageResource(R.drawable.ic_pause_white_24dp);
|
||||
} else {
|
||||
getFab().setImageResource(R.drawable.ic_play_arrow_white_48dp);
|
||||
getFab().setImageResource(R.drawable.ic_play_arrow_white_24dp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -149,19 +149,19 @@ public abstract class AbsFabActivity extends AbsBaseActivity implements OnMusicR
|
|||
public void onMusicRemoteEvent(MusicRemoteEvent event) {
|
||||
switch (event.getAction()) {
|
||||
case MusicRemoteEvent.PLAY:
|
||||
getFab().setImageDrawable(getResources().getDrawable(R.drawable.ic_pause_white_48dp));
|
||||
getFab().setImageDrawable(getResources().getDrawable(R.drawable.ic_pause_white_24dp));
|
||||
break;
|
||||
case MusicRemoteEvent.PAUSE:
|
||||
getFab().setImageDrawable(getResources().getDrawable(R.drawable.ic_play_arrow_white_48dp));
|
||||
getFab().setImageDrawable(getResources().getDrawable(R.drawable.ic_play_arrow_white_24dp));
|
||||
break;
|
||||
case MusicRemoteEvent.RESUME:
|
||||
getFab().setImageDrawable(getResources().getDrawable(R.drawable.ic_pause_white_48dp));
|
||||
getFab().setImageDrawable(getResources().getDrawable(R.drawable.ic_pause_white_24dp));
|
||||
break;
|
||||
case MusicRemoteEvent.STOP:
|
||||
getFab().setImageDrawable(getResources().getDrawable(R.drawable.ic_play_arrow_white_48dp));
|
||||
getFab().setImageDrawable(getResources().getDrawable(R.drawable.ic_play_arrow_white_24dp));
|
||||
break;
|
||||
case MusicRemoteEvent.QUEUE_COMPLETED:
|
||||
getFab().setImageResource(R.drawable.ic_play_arrow_white_48dp);
|
||||
getFab().setImageResource(R.drawable.ic_play_arrow_white_24dp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class ViewPagerTabArtistAlbumFragment extends AbsViewPagerTabArtistListFr
|
|||
openAlbumDetailsActivityIfPossible(album, albumArtView);
|
||||
}
|
||||
});
|
||||
setColumns(2);
|
||||
setColumns(getResources().getInteger(R.integer.grid_columns));
|
||||
return adapter;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,8 +101,8 @@ public class AlbumViewFragment extends Fragment implements KabViewsDisableAble,
|
|||
|
||||
private void fillAbsListView(List<Album> albums) {
|
||||
Collections.sort(albums, new AlbumAlphabeticComparator());
|
||||
AlbumViewGridAdapter albumTileAdapter = new AlbumViewGridAdapter(getActivity(), albums);
|
||||
absListView.setAdapter(albumTileAdapter);
|
||||
AlbumViewGridAdapter albumViewGridAdapter = new AlbumViewGridAdapter(getActivity(), albums);
|
||||
absListView.setAdapter(albumViewGridAdapter);
|
||||
absListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
|
|
|
|||
BIN
app/src/main/res/drawable-xxxhdpi/ic_pause_white_24dp.png
Executable file
BIN
app/src/main/res/drawable-xxxhdpi/ic_pause_white_24dp.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 256 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_play_arrow_white_24dp.png
Executable file
BIN
app/src/main/res/drawable-xxxhdpi/ic_play_arrow_white_24dp.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 477 B |
4
app/src/main/res/drawable/seekbar_progress.xml
Normal file
4
app/src/main/res/drawable/seekbar_progress.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#00000000"/>
|
||||
</shape>
|
||||
4
app/src/main/res/drawable/seekbar_thumb.xml
Normal file
4
app/src/main/res/drawable/seekbar_thumb.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/seekbar_thumb_pressed" android:state_pressed="false"/>
|
||||
<item android:drawable="@drawable/seekbar_thumb_normal"/>
|
||||
</selector>
|
||||
10
app/src/main/res/drawable/seekbar_thumb_normal.xml
Normal file
10
app/src/main/res/drawable/seekbar_thumb_normal.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
|
||||
<size
|
||||
android:height="10dp"
|
||||
android:width="10dp"/>
|
||||
<solid
|
||||
android:color="@color/materialmusic_accent_color"/>
|
||||
<corners
|
||||
android:radius="18dp"/>
|
||||
</shape>
|
||||
8
app/src/main/res/drawable/seekbar_thumb_pressed.xml
Normal file
8
app/src/main/res/drawable/seekbar_thumb_pressed.xml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
|
||||
<size
|
||||
android:height="18dp"
|
||||
android:width="18dp"/>
|
||||
<solid
|
||||
android:color="@color/materialmusic_accent_color"/>
|
||||
</shape>
|
||||
|
|
@ -14,9 +14,6 @@
|
|||
android:layout_height="match_parent"
|
||||
tools:context=".DrawerActivity">
|
||||
|
||||
<!-- As the main content view, the view below consumes the entire
|
||||
space available using match_parent in both dimensions. -->
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
|
|
|||
|
|
@ -159,13 +159,8 @@
|
|||
|
||||
<SeekBar
|
||||
android:id="@+id/progress_slider"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/footer"
|
||||
android:elevation="2dp"
|
||||
android:padding="0dp"
|
||||
android:progressTint="@color/materialmusic_accent_color"
|
||||
android:thumbTint="@color/materialmusic_accent_color_darker"/>
|
||||
style="@style/MusicProgressSlider"
|
||||
android:layout_above="@+id/footer"/>
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
|
|
|
|||
5
app/src/main/res/values-land/dimens.xml
Normal file
5
app/src/main/res/values-land/dimens.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<resources>
|
||||
<dimen name="title_view_height">56dp</dimen>
|
||||
|
||||
<dimen name="header_image_height">180dp</dimen>
|
||||
</resources>
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="statusMargin">25dp</dimen>
|
||||
|
||||
<dimen name="navigation_drawer_image_height">189dp</dimen>
|
||||
<dimen name="navigation_drawer_width">304dp</dimen>
|
||||
</resources>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="statusMargin">25dp</dimen>
|
||||
|
||||
<dimen name="navigation_drawer_image_height">189dp</dimen>
|
||||
<dimen name="navigation_drawer_width">304dp</dimen>
|
||||
</resources>
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="statusMargin">25dp</dimen>
|
||||
|
||||
<dimen name="navigation_drawer_image_height">189dp</dimen>
|
||||
<dimen name="navigation_drawer_width">304dp</dimen>
|
||||
</resources>
|
||||
|
|
@ -1,6 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="statusMargin">25dp</dimen>
|
||||
|
||||
<dimen name="navigation_drawer_width">304dp</dimen>
|
||||
</resources>
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="statusMargin">25dp</dimen>
|
||||
|
||||
<dimen name="navigation_drawer_image_height">165dp</dimen>
|
||||
</resources>
|
||||
|
|
@ -21,4 +21,11 @@
|
|||
<item name="android:background">@drawable/notification_selector</item>
|
||||
<item name="android:tint">@color/notification_buttons_tint</item>
|
||||
</style>
|
||||
|
||||
<style name="MusicProgressSlider" parent="MusicProgressSliderParent">
|
||||
<item name="android:elevation">2dp</item>
|
||||
<item name="android:thumbTint">@color/materialmusic_accent_color</item>
|
||||
<item name="android:progressTint">@color/materialmusic_accent_color_darker</item>
|
||||
<item name="android:padding">0dp</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -37,4 +37,10 @@
|
|||
<style name="NotificationButton" parent="NotificationButtonParent">
|
||||
<item name="android:background">?android:attr/selectableItemBackground</item>
|
||||
</style>
|
||||
|
||||
<style name="MusicProgressSlider" parent="MusicProgressSliderParent">
|
||||
<item name="android:progressDrawable">@drawable/seekbar_progress</item>
|
||||
<item name="android:thumb">@drawable/seekbar_thumb</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -49,8 +49,6 @@
|
|||
<style name="PlayPauseFabParent">
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:scaleType">fitCenter</item>
|
||||
<item name="android:padding">14dp</item>
|
||||
<item name="fab_color">@color/materialmusic_accent_color</item>
|
||||
<item name="fab_colorNormal">@color/materialmusic_accent_color</item>
|
||||
<item name="fab_colorPressed">@color/materialmusic_accent_color_darker</item>
|
||||
|
|
@ -63,4 +61,10 @@
|
|||
<item name="android:layout_gravity">center</item>
|
||||
<item name="android:layout_weight">1</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="MusicProgressSliderParent">
|
||||
<item name="android:layout_width">fill_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
</style>
|
||||
</resources>
|
||||
Loading…
Add table
Add a link
Reference in a new issue