mirror of
https://github.com/zoriya/Opus.git
synced 2026-06-03 06:25:31 +00:00
changing some things with swipe in the queue
This commit is contained in:
@@ -236,6 +236,11 @@ namespace MusicApp
|
||||
{
|
||||
if(!Queue.instance.adapter.RefreshDisabled())
|
||||
contentRefresh.SetEnabled(((LinearLayoutManager)Queue.instance.ListView.GetLayoutManager()).FindFirstVisibleItemPosition() == 0);
|
||||
|
||||
if(((LinearLayoutManager)Queue.instance.ListView.GetLayoutManager()).FindLastCompletelyVisibleItemPosition() == Queue.instance.adapter.songList.Count)
|
||||
{
|
||||
Queue.instance.LoadMore();
|
||||
}
|
||||
}
|
||||
|
||||
private async void ActionPlayer()
|
||||
|
||||
@@ -26,6 +26,10 @@ namespace MusicApp.Resources.Portable_Class
|
||||
{
|
||||
int dragFlag = ItemTouchHelper.Up | ItemTouchHelper.Down;
|
||||
int swipeFlag = ItemTouchHelper.Left | ItemTouchHelper.Right;
|
||||
|
||||
if (MusicPlayer.queue[MusicPlayer.CurrentID()].GetName() == viewHolder.ItemView.FindViewById<TextView>(Resource.Id.title).Text)
|
||||
return MakeMovementFlags(dragFlag, 0);
|
||||
|
||||
return MakeMovementFlags(dragFlag, swipeFlag);
|
||||
}
|
||||
|
||||
@@ -47,7 +51,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
|
||||
public override void OnChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, bool isCurrentlyActive)
|
||||
{
|
||||
if (actionState == ItemTouchHelper.ActionStateSwipe && MusicPlayer.queue[MusicPlayer.CurrentID()].GetName() != viewHolder.ItemView.FindViewById<TextView>(Resource.Id.title).Text)
|
||||
if (actionState == ItemTouchHelper.ActionStateSwipe)
|
||||
{
|
||||
viewHolder.ItemView.Alpha = 1 - Math.Abs(dX) / viewHolder.ItemView.Width;
|
||||
viewHolder.ItemView.TranslationX = dX;
|
||||
|
||||
@@ -6,6 +6,7 @@ using Android.Views;
|
||||
using Android.Widget;
|
||||
using MusicApp.Resources.values;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MusicApp.Resources.Portable_Class
|
||||
@@ -114,6 +115,11 @@ namespace MusicApp.Resources.Portable_Class
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadMore()
|
||||
{
|
||||
List<Song> songList = MusicPlayer.queue.Except(adapter.songList).ToList();
|
||||
}
|
||||
|
||||
private async void ListView_ItemClick(object sender, int Position)
|
||||
{
|
||||
Song item = MusicPlayer.queue[Position];
|
||||
@@ -155,6 +161,12 @@ namespace MusicApp.Resources.Portable_Class
|
||||
|
||||
public void RemoveFromQueue(Song item)
|
||||
{
|
||||
if(item == MusicPlayer.queue[MusicPlayer.CurrentID()])
|
||||
{
|
||||
//Make snackbar
|
||||
return;
|
||||
}
|
||||
|
||||
foreach(Song song in MusicPlayer.queue)
|
||||
{
|
||||
if (song.queueSlot > item.queueSlot)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.Graphics;
|
||||
using Android.Support.V7.Widget;
|
||||
using Android.Views;
|
||||
using MusicApp.Resources.values;
|
||||
@@ -11,7 +12,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
{
|
||||
public class RecyclerAdapter : RecyclerView.Adapter, IItemTouchAdapter
|
||||
{
|
||||
private List<Song> songList;
|
||||
public List<Song> songList;
|
||||
private bool refreshDisabled = false;
|
||||
public event EventHandler<int> ItemClick;
|
||||
public event EventHandler<int> ItemLongCLick;
|
||||
@@ -27,6 +28,13 @@ namespace MusicApp.Resources.Portable_Class
|
||||
NotifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void AddToList(List<Song> songList)
|
||||
{
|
||||
int positionStart = this.songList.Count;
|
||||
this.songList.AddRange(songList);
|
||||
NotifyItemRangeInserted(positionStart, songList.Count);
|
||||
}
|
||||
|
||||
public override int ItemCount => songList.Count;
|
||||
|
||||
public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
|
||||
@@ -98,6 +106,11 @@ namespace MusicApp.Resources.Portable_Class
|
||||
{
|
||||
holder.youtubeIcon.Visibility = ViewStates.Gone;
|
||||
}
|
||||
|
||||
if (position == MusicPlayer.CurrentID())
|
||||
holder.ItemView.SetBackgroundColor(Color.DimGray);
|
||||
else
|
||||
holder.ItemView.SetBackgroundColor(Color.White);
|
||||
}
|
||||
|
||||
public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
|
||||
|
||||
@@ -18,7 +18,6 @@ namespace MusicApp.Resources.Portable_Class
|
||||
|
||||
public RecyclerHolder(View itemView, Action<int> listener, Action<int> longListener) : base(itemView)
|
||||
{
|
||||
itemView.SetBackgroundColor(Color.White);
|
||||
reorder = itemView.FindViewById<ImageView>(Resource.Id.reorder);
|
||||
textLayout = itemView.FindViewById<LinearLayout>(Resource.Id.textLayout);
|
||||
Title = itemView.FindViewById<TextView>(Resource.Id.title);
|
||||
|
||||
Reference in New Issue
Block a user