mirror of
https://github.com/zoriya/Opus.git
synced 2025-12-06 06:26:15 +00:00
Making channel header height precalculated, adding select feedback and adding header click to go to the channel tab.
This commit is contained in:
@@ -261,7 +261,7 @@ namespace Opus.Api
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method will remove playback calls and get requests from the
|
||||
/// This method will remove playback calls
|
||||
/// </summary>
|
||||
private void Cancel()
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Android.Graphics;
|
||||
using Android.Support.V7.Widget;
|
||||
using Android.Util;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using Opus.Api;
|
||||
@@ -15,7 +16,7 @@ namespace Opus.Adapter
|
||||
public class YtAdapter : RecyclerView.Adapter
|
||||
{
|
||||
public int listPadding;
|
||||
private List<YtFile> items;
|
||||
private readonly List<YtFile> items;
|
||||
public event EventHandler<int> ItemClick;
|
||||
public event EventHandler<int> ItemLongCLick;
|
||||
|
||||
@@ -116,16 +117,35 @@ namespace Opus.Adapter
|
||||
holder.Name.Text = channel.Name;
|
||||
Picasso.With(Android.App.Application.Context).Load(channel.ImageURL).Placeholder(Resource.Color.placeholder).Transform(new CircleTransformation(true)).Into(holder.Logo);
|
||||
|
||||
List<YtFile> files = items.FindAll(x => x.Kind == YtKind.Video && x.song.Artist == channel.Name);
|
||||
if(files.Count > 0)
|
||||
Picasso.With(Android.App.Application.Context).Load(files[0].song.Album).Transform(new RemoveBlackBorder()).Into(holder.MixOne);
|
||||
if (files.Count > 1)
|
||||
Picasso.With(Android.App.Application.Context).Load(files[1].song.Album).Transform(new RemoveBlackBorder()).Into(holder.MixTwo);
|
||||
|
||||
holder.MixOne.ViewTreeObserver.Draw += (sender, e) =>
|
||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
MainActivity.instance.WindowManager.DefaultDisplay.GetMetrics(displayMetrics);
|
||||
int wholeWidth = (displayMetrics.WidthPixels - MainActivity.instance.DpToPx(15)) / 2;
|
||||
int mixHeight = (int)(wholeWidth * 0.5625); /// width / 16 */ 9
|
||||
holder.MixOne.LayoutParameters.Height = mixHeight;
|
||||
holder.MixOne.RequestLayout();
|
||||
holder.MixTwo.LayoutParameters.Height = mixHeight;
|
||||
holder.ChannelLogo.LayoutParameters.Height = mixHeight * 2;
|
||||
|
||||
Picasso.With(Android.App.Application.Context).Load(channel.ImageURL).Placeholder(Resource.Color.placeholder).Fit().CenterCrop().Into(holder.ChannelLogo);
|
||||
|
||||
List<YtFile> files = items.FindAll(x => x.Kind == YtKind.Video && x.song.Artist == channel.Name);
|
||||
if (files.Count > 0)
|
||||
Picasso.With(Android.App.Application.Context).Load(files[0].song.Album).Placeholder(Resource.Color.placeholder).Transform(new RemoveBlackBorder()).Into(holder.MixOne);
|
||||
if (files.Count > 1)
|
||||
Picasso.With(Android.App.Application.Context).Load(files[1].song.Album).Placeholder(Resource.Color.placeholder).Transform(new RemoveBlackBorder()).Into(holder.MixTwo);
|
||||
|
||||
if (!holder.ChannelHolder.HasOnClickListeners)
|
||||
{
|
||||
Picasso.With(Android.App.Application.Context).Load(channel.ImageURL).Placeholder(Resource.Color.placeholder).Fit().CenterCrop().Into(holder.ChannelLogo);
|
||||
};
|
||||
holder.ChannelHolder.Click += (sender, e) =>
|
||||
{
|
||||
MainActivity.instance.menu.FindItem(Resource.Id.search).ActionView.Focusable = false;
|
||||
MainActivity.instance.menu.FindItem(Resource.Id.search).CollapseActionView();
|
||||
MainActivity.instance.menu.FindItem(Resource.Id.search).ActionView.Focusable = true;
|
||||
MainActivity.instance.FindViewById(Resource.Id.tabs).Visibility = ViewStates.Gone;
|
||||
MainActivity.instance.SupportFragmentManager.BeginTransaction().Replace(Resource.Id.contentView, ChannelDetails.NewInstance(channel)).AddToBackStack("Channel Details").Commit();
|
||||
};
|
||||
}
|
||||
|
||||
if (!holder.MixHolder.HasOnClickListeners)
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
android:background="#141414"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:id="@+id/channelHolder" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
@@ -37,11 +38,13 @@
|
||||
android:orientation="horizontal"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:id="@+id/mixHolder" >
|
||||
<ImageView
|
||||
android:layout_width="0px"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@color/placeholder"
|
||||
android:id="@+id/channelLogo" />
|
||||
<LinearLayout
|
||||
android:layout_width="0px"
|
||||
@@ -52,12 +55,14 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="1"
|
||||
android:src="@color/placeholder"
|
||||
android:adjustViewBounds="true"
|
||||
android:id="@+id/mixOne" />
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="1"
|
||||
android:src="@color/placeholder"
|
||||
android:adjustViewBounds="true"
|
||||
android:id="@+id/mixTwo" />
|
||||
</LinearLayout>
|
||||
|
||||
Reference in New Issue
Block a user