Skip to content

Commit

Permalink
finish timber5 style
Browse files Browse the repository at this point in the history
  • Loading branch information
naman14 committed Feb 22, 2017
1 parent 7d931e6 commit 2693981
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@

import java.util.List;

public class Timber4QueueAdapter extends RecyclerView.Adapter<Timber4QueueAdapter.ItemHolder> {
public class SlidingQueueAdapter extends RecyclerView.Adapter<SlidingQueueAdapter.ItemHolder> {

public static int currentlyPlayingPosition;
private List<Song> arraylist;
private Activity mContext;
private int lastPosition = -1;

public Timber4QueueAdapter(Activity context, List<Song> arraylist) {
public SlidingQueueAdapter(Activity context, List<Song> arraylist) {
this.arraylist = arraylist;
this.mContext = context;
currentlyPlayingPosition = MusicPlayer.getQueuePosition();
}

@Override
public ItemHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_queue_timber4_bottom, null);
View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_song_sliding_queue, null);
ItemHolder ml = new ItemHolder(v);
return ml;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import com.naman14.timber.R;
import com.naman14.timber.activities.BaseActivity;
import com.naman14.timber.adapters.BaseQueueAdapter;
import com.naman14.timber.adapters.SlidingQueueAdapter;
import com.naman14.timber.dataloaders.QueueLoader;
import com.naman14.timber.listeners.MusicStateListener;
import com.naman14.timber.timely.TimelyView;
Expand Down Expand Up @@ -121,6 +122,7 @@ public void run() {

RecyclerView recyclerView;
BaseQueueAdapter mAdapter;
SlidingQueueAdapter slidingQueueAdapter;
TimelyView timelyView11, timelyView12, timelyView13, timelyView14, timelyView15;
TextView hourColon;
int[] timeArr = new int[]{0, 0, 0, 0, 0};
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/naman14/timber/nowplaying/Timber4.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import com.naman14.timber.MusicPlayer;
import com.naman14.timber.R;
import com.naman14.timber.adapters.Timber4QueueAdapter;
import com.naman14.timber.adapters.SlidingQueueAdapter;
import com.naman14.timber.dataloaders.QueueLoader;
import com.naman14.timber.utils.ImageUtils;

Expand All @@ -39,7 +39,7 @@ public class Timber4 extends BaseNowplayingFragment {

ImageView mBlurredArt;
RecyclerView horizontalRecyclerview;
Timber4QueueAdapter horizontalAdapter;
SlidingQueueAdapter horizontalAdapter;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Expand Down Expand Up @@ -112,7 +112,7 @@ public void doAlbumArtStuff(Bitmap loadedImage) {

private void setupHorizontalQueue() {
horizontalRecyclerview.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
horizontalAdapter = new Timber4QueueAdapter(getActivity(), QueueLoader.getQueueSongs(getActivity()));
horizontalAdapter = new SlidingQueueAdapter(getActivity(), QueueLoader.getQueueSongs(getActivity()));
horizontalRecyclerview.setAdapter(horizontalAdapter);
horizontalRecyclerview.scrollToPosition(MusicPlayer.getQueuePosition() - 3);
}
Expand Down
19 changes: 17 additions & 2 deletions app/src/main/java/com/naman14/timber/nowplaying/Timber5.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@
import android.graphics.drawable.TransitionDrawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.naman14.timber.MusicPlayer;
import com.naman14.timber.R;
import com.naman14.timber.adapters.SlidingQueueAdapter;
import com.naman14.timber.dataloaders.QueueLoader;
import com.naman14.timber.utils.ImageUtils;

import net.steamcrafted.materialiconlib.MaterialDrawableBuilder;
Expand All @@ -23,8 +28,9 @@

public class Timber5 extends BaseNowplayingFragment {


ImageView mBlurredArt;
RecyclerView recyclerView;
SlidingQueueAdapter adapter;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Expand All @@ -35,8 +41,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
setSongDetails(rootView);

mBlurredArt = (ImageView) rootView.findViewById(R.id.album_art_blurred);

recyclerView = (RecyclerView) rootView.findViewById(R.id.queue_recyclerview_horizontal) ;
initGestures(mBlurredArt);
setupSlidingQueue();

return rootView;
}
Expand Down Expand Up @@ -93,6 +100,14 @@ public void doAlbumArtStuff(Bitmap loadedImage) {
blurredAlbumArt.execute(loadedImage);
}

private void setupSlidingQueue() {
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
adapter = new SlidingQueueAdapter((AppCompatActivity) getActivity(), QueueLoader.getQueueSongs(getActivity()));
recyclerView.setAdapter(adapter);
recyclerView.scrollToPosition(MusicPlayer.getQueuePosition() - 3);
}


private class setBlurredAlbumArt extends AsyncTask<Bitmap, Void, Drawable> {

@Override
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_timber4.xml
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/queue_recyclerview_horizontal"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_height="75dp"
android:layout_alignParentBottom="true" />

</android.support.percent.PercentRelativeLayout>
Expand Down
70 changes: 41 additions & 29 deletions app/src/main/res/layout/fragment_timber5.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
Expand Down Expand Up @@ -42,21 +43,25 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_marginTop="10dp"
android:gravity="center_vertical|center_horizontal"
android:orientation="horizontal">

<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="@android:color/transparent"
app:layout_heightPercent="50%"
app:layout_widthPercent="50%">
app:layout_heightPercent="60%"
app:layout_widthPercent="60%"
app:cardElevation="10dp"
android:layout_marginTop="15dp">

<ImageView
android:id="@+id/album_art"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true" />
android:adjustViewBounds="true"
android:layout_margin="1dp"
android:scaleType="centerCrop"/>

</android.support.v7.widget.CardView>
</android.support.percent.PercentRelativeLayout>
Expand All @@ -77,47 +82,45 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="left"
android:layout_marginLeft="15dp"
android:layout_marginTop="@dimen/appBarTopMargin"
android:gravity="left"
android:orientation="vertical"
android:paddingTop="25dp">
android:orientation="vertical">

<TextView
android:id="@+id/song_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:ellipsize="marquee"
android:scrollHorizontally="true"
android:singleLine="true"
android:textColor="#ffffff"
android:textSize="23sp" />
android:textSize="22sp"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"/>

<TextView
android:id="@+id/song_artist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:ellipsize="end"
android:maxLines="1"
android:paddingTop="3dp"
android:textColor="#ffffff"
android:textSize="13sp" />
android:textSize="11sp"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"/>

<SeekBar
android:id="@+id/song_progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:maxHeight="2dp"
android:paddingTop="18dp"
android:progress="30"
android:tag="tint_accent_color" />
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:tag="tint_accent_color"
android:layout_marginTop="10dp"/>


<TextView
Expand All @@ -129,23 +132,23 @@

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp">

<TextView
android:id="@+id/song_elapsed_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:paddingLeft="25dp"
android:textColor="#ffffff" />

<TextView
android:id="@+id/song_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:paddingRight="25dp"
android:textColor="#ffffff" />
android:textColor="#ffffff"/>

</RelativeLayout>

Expand All @@ -154,23 +157,24 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:orientation="horizontal"
android:paddingTop="20dp">
android:paddingTop="20dp"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp">

<ImageView
android:id="@+id/shuffle"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_weight="0.7"
android:layout_weight="1"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="center" />

<net.steamcrafted.materialiconlib.MaterialIconView
android:id="@+id/previous"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_weight="0.7"
android:layout_weight="1"
android:background="?attr/selectableItemBackgroundBorderless"
android:paddingLeft="50dp"
android:scaleType="center"
app:materialIcon="skip_previous"
app:materialIconColor="#fff"
Expand Down Expand Up @@ -202,9 +206,8 @@
android:id="@+id/next"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_weight="0.7"
android:layout_weight="1"
android:background="?attr/selectableItemBackgroundBorderless"
android:paddingRight="50dp"
android:scaleType="center"
app:materialIcon="skip_next"
app:materialIconColor="#fff"
Expand All @@ -214,7 +217,7 @@
android:id="@+id/repeat"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_weight="0.7"
android:layout_weight="1"
android:background="?attr/selectableItemBackgroundBorderless"
android:paddingLeft="5dp"
android:scaleType="center" />
Expand All @@ -223,7 +226,16 @@
</LinearLayout>
</LinearLayout>

</android.support.percent.PercentRelativeLayout>
<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/queue_recyclerview_horizontal"
android:layout_width="match_parent"
android:layout_height="75dp"
android:background="@android:color/transparent"
android:layout_alignParentBottom="true"/>

</android.support.percent.PercentRelativeLayout>

</android.support.design.widget.CoordinatorLayout>



Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="80dp"
android:layout_height="match_parent"
android:layout_width="65dp"
android:layout_height="65dp"
android:layout_marginBottom="10dp"
android:background="?attr/selectableItemBackground">


<com.naman14.timber.widgets.SquareImageView
android:id="@+id/album_art"
android:layout_width="80dp"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
android:layout_width="55dp"
android:layout_height="55dp"
android:scaleType="centerCrop"
android:layout_margin="10dp"/>

<View
android:layout_width="match_parent"
Expand Down

0 comments on commit 2693981

Please sign in to comment.