diff --git a/MusicApp/MusicApp.csproj b/MusicApp/MusicApp.csproj
index 13a06b6..473a3a3 100644
--- a/MusicApp/MusicApp.csproj
+++ b/MusicApp/MusicApp.csproj
@@ -301,6 +301,7 @@
+
diff --git a/MusicApp/Resources/Portable Class/Home.cs b/MusicApp/Resources/Portable Class/Home.cs
index 4a6faa5..9d813d0 100644
--- a/MusicApp/Resources/Portable Class/Home.cs
+++ b/MusicApp/Resources/Portable Class/Home.cs
@@ -145,7 +145,7 @@ namespace MusicApp.Resources.Portable_Class
ChannelListResponse response = await request.ExecuteAsync();
- foreach(var ytItem in response.Items)
+ foreach (var ytItem in response.Items)
{
Song channel = new Song(ytItem.Snippet.Title, "", ytItem.Snippet.Thumbnails.Default__.Url, ytItem.Id, -1, -1, null, true);
contentValue.Add(channel);
@@ -154,23 +154,24 @@ namespace MusicApp.Resources.Portable_Class
return;
}
- HomeSection section = new HomeSection(item.SectionTitle, item.contentType, contentValue);
+ }
- if (adapter == null)
- {
- adapterItems.Add(section);
- adapter = new HomeAdapter(adapterItems);
- ListView.SetAdapter(adapter);
- adapter.ItemClick += ListView_ItemClick;
- adapter.ItemLongClick += ListView_ItemLongCLick;
- ListView.SetItemAnimator(new DefaultItemAnimator());
- ListView.ScrollChange += MainActivity.instance.Scroll;
- }
- else
- {
- adapterItems.Add(section);
- adapter.AddToList(new List() { section });
- }
+ HomeSection section = new HomeSection(item.SectionTitle, item.contentType, contentValue);
+
+ if (adapter == null)
+ {
+ adapterItems.Add(section);
+ adapter = new HomeAdapter(adapterItems);
+ ListView.SetAdapter(adapter);
+ adapter.ItemClick += ListView_ItemClick;
+ adapter.ItemLongClick += ListView_ItemLongCLick;
+ ListView.SetItemAnimator(new DefaultItemAnimator());
+ ListView.ScrollChange += MainActivity.instance.Scroll;
+ }
+ else
+ {
+ adapterItems.Add(section);
+ adapter.AddToList(new List() { section });
}
}
break;
diff --git a/MusicApp/Resources/Portable Class/HomeAdapter.cs b/MusicApp/Resources/Portable Class/HomeAdapter.cs
index 160e91b..038c1ea 100644
--- a/MusicApp/Resources/Portable Class/HomeAdapter.cs
+++ b/MusicApp/Resources/Portable Class/HomeAdapter.cs
@@ -71,6 +71,11 @@ namespace MusicApp.Resources.Portable_Class
View itemView = LayoutInflater.From(parent.Context).Inflate(Android.Resource.Layout.PreferenceCategory, parent, false);
return new HeaderHolder(itemView, OnClick, OnLongClick);
}
+ if(viewType == (int)HomeRow.ChannelHolder)
+ {
+ View itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.ChannelList, parent, false);
+ return new HomeChannelHolder(itemView, OnClick, OnLongClick);
+ }
if (viewType == (int)HomeRow.SongHolder)
{
View itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.SongList, parent, false);
@@ -106,6 +111,23 @@ namespace MusicApp.Resources.Portable_Class
HeaderHolder holder = (HeaderHolder)viewHolder;
holder.headerText.Text = items[containerID].SectionTitle;
}
+ else if(items[containerID].contentType == SectionType.ChannelList)
+ {
+ HomeChannelHolder holder = (HomeChannelHolder)viewHolder;
+
+ holder.Title.Text = items[containerID].contentValue[position].GetName();
+ holder.Artist.Text = items[containerID].contentValue[position].GetArtist();
+ holder.CheckBox.Visibility = ViewStates.Gone;
+
+ Picasso.With(Application.Context).Load(items[containerID].contentValue[position].GetAlbum()).Placeholder(Resource.Drawable.MusicIcon).Transform(new CircleTransformation()).Into(holder.AlbumArt);
+
+ if (MainActivity.Theme == 1)
+ {
+ holder.Title.SetTextColor(Color.White);
+ holder.Artist.SetTextColor(Color.White);
+ holder.Artist.Alpha = 0.7f;
+ }
+ }
else if(items[containerID].contentType == SectionType.SinglePlaylist)
{
HomeMultipleSong holder = (HomeMultipleSong)viewHolder;
diff --git a/MusicApp/Resources/Portable Class/HomeHolder.cs b/MusicApp/Resources/Portable Class/HomeHolder.cs
index 4db18a3..abe12a3 100644
--- a/MusicApp/Resources/Portable Class/HomeHolder.cs
+++ b/MusicApp/Resources/Portable Class/HomeHolder.cs
@@ -9,7 +9,7 @@ namespace MusicApp.Resources.Portable_Class
{
public TextView headerText;
- public HeaderHolder(View itemView, Action itemClick, Action listener, Action longListener) : base(itemView)
+ public HeaderHolder(View itemView, Action listener, Action longListener) : base(itemView)
{
headerText = itemView.FindViewById(Android.Resource.Id.Title);
itemView.Click += (sender, e) => listener(AdapterPosition);
diff --git a/MusicApp/Resources/values/HomeChannelHolder.cs b/MusicApp/Resources/values/HomeChannelHolder.cs
new file mode 100644
index 0000000..6419d5d
--- /dev/null
+++ b/MusicApp/Resources/values/HomeChannelHolder.cs
@@ -0,0 +1,28 @@
+using Android.Support.V7.Widget;
+using Android.Views;
+using Android.Widget;
+using System;
+
+namespace MusicApp.Resources.values
+{
+ public class HomeChannelHolder : RecyclerView.ViewHolder
+ {
+ public LinearLayout textLayout;
+ public TextView Title;
+ public TextView Artist;
+ public ImageView AlbumArt;
+ public CheckBox CheckBox;
+
+ public HomeChannelHolder(View itemView, Action listener, Action longListener) : base(itemView)
+ {
+ textLayout = itemView.FindViewById(Resource.Id.textLayout);
+ Title = itemView.FindViewById(Resource.Id.title);
+ Artist = itemView.FindViewById(Resource.Id.artist);
+ AlbumArt = itemView.FindViewById(Resource.Id.albumArt);
+ CheckBox = itemView.FindViewById(Resource.Id.checkBox);
+
+ itemView.Click += (sender, e) => listener(AdapterPosition);
+ itemView.LongClick += (sender, e) => longListener(AdapterPosition);
+ }
+ }
+}
\ No newline at end of file