mirror of
https://github.com/zoriya/Opus.git
synced 2025-12-06 06:26:15 +00:00
Finishing the code clean up. Starting the rework of folder browse features.
This commit is contained in:
@@ -1,19 +1,24 @@
|
||||
using Android.App;
|
||||
using Android.Database;
|
||||
using Android.Graphics;
|
||||
using Android.Net;
|
||||
using Android.OS;
|
||||
using Android.Provider;
|
||||
using Android.Support.Design.Widget;
|
||||
using Android.Support.V4.Content;
|
||||
using Android.Widget;
|
||||
using Opus.Api.Services;
|
||||
using Opus.DataStructure;
|
||||
using Opus.Fragments;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TagLib;
|
||||
using ContentResolver = Android.Content.ContentResolver;
|
||||
using ContentValues = Android.Content.ContentValues;
|
||||
using Intent = Android.Content.Intent;
|
||||
using Random = System.Random;
|
||||
|
||||
namespace Opus.Api
|
||||
{
|
||||
@@ -57,6 +62,71 @@ namespace Opus.Api
|
||||
intent.SetAction("PlayLast");
|
||||
Application.Context.StartService(intent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// RandomPlay all file in the folder you selected or all file on the device if the folderPath = null.
|
||||
/// </summary>
|
||||
/// <param name="folderPath"></param>
|
||||
public async static void ShuffleAll(string folderPath = null)
|
||||
{
|
||||
List<Song> songs = new List<Song>();
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
if (Looper.MyLooper() == null)
|
||||
Looper.Prepare();
|
||||
|
||||
CursorLoader cursorLoader = new CursorLoader(Application.Context, MediaStore.Audio.Media.ExternalContentUri, null, MediaStore.Audio.Media.InterfaceConsts.Data + " LIKE '%" + folderPath + "%'", null, null);
|
||||
ICursor musicCursor = (ICursor)cursorLoader.LoadInBackground();
|
||||
if (musicCursor != null && musicCursor.MoveToFirst())
|
||||
{
|
||||
int titleID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Title);
|
||||
int artistID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Artist);
|
||||
int albumID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Album);
|
||||
int thisID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Id);
|
||||
int pathID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Data);
|
||||
do
|
||||
{
|
||||
string Artist = musicCursor.GetString(artistID);
|
||||
string Title = musicCursor.GetString(titleID);
|
||||
string Album = musicCursor.GetString(albumID);
|
||||
long AlbumArt = musicCursor.GetLong(musicCursor.GetColumnIndex(MediaStore.Audio.Albums.InterfaceConsts.AlbumId));
|
||||
long id = musicCursor.GetLong(thisID);
|
||||
string path = musicCursor.GetString(pathID);
|
||||
|
||||
if (Title == null)
|
||||
Title = "Unknown Title";
|
||||
if (Artist == null)
|
||||
Artist = "Unknow Artist";
|
||||
if (Album == null)
|
||||
Album = "Unknow Album";
|
||||
|
||||
songs.Add(new Song(Title, Artist, Album, null, AlbumArt, id, path));
|
||||
}
|
||||
while (musicCursor.MoveToNext());
|
||||
musicCursor.Close();
|
||||
}
|
||||
});
|
||||
|
||||
if (songs.Count == 0)
|
||||
{
|
||||
Snackbar snackBar = Snackbar.Make(MainActivity.instance.FindViewById<CoordinatorLayout>(Resource.Id.snackBar), Resource.String.no_song_mix, Snackbar.LengthLong);
|
||||
snackBar.View.FindViewById<TextView>(Resource.Id.snackbar_text).SetTextColor(Color.White);
|
||||
snackBar.Show();
|
||||
return;
|
||||
}
|
||||
|
||||
Random r = new Random();
|
||||
songs = songs.OrderBy(x => r.Next()).ToList();
|
||||
SongManager.Play(songs[0]);
|
||||
songs.RemoveAt(0);
|
||||
|
||||
await Task.Delay(1000);
|
||||
while (MusicPlayer.instance == null)
|
||||
await Task.Delay(10);
|
||||
|
||||
MusicPlayer.instance.AddToQueue(songs.ToArray());
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Metadata
|
||||
|
||||
@@ -24,7 +24,6 @@ using Newtonsoft.Json;
|
||||
using Opus.DataStructure;
|
||||
using Opus.Fragments;
|
||||
using Opus.Others;
|
||||
using Opus.Resources.Portable_Class;
|
||||
using Org.Json;
|
||||
using SQLite;
|
||||
using Square.Picasso;
|
||||
|
||||
@@ -5,7 +5,7 @@ using Android.Support.V4.App;
|
||||
using Opus.Api.Services;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opus.Resources.Portable_Class
|
||||
namespace Opus.Api.Services
|
||||
{
|
||||
[Service]
|
||||
public class Sleeper : Service
|
||||
@@ -3,9 +3,9 @@ using Android.Views;
|
||||
using Android.Widget;
|
||||
using System;
|
||||
|
||||
namespace Opus.Resources.values
|
||||
namespace Opus.DataStructure
|
||||
{
|
||||
[System.Serializable]
|
||||
[Serializable]
|
||||
public class ChannelHolder
|
||||
{
|
||||
public LinearLayout textLayout;
|
||||
@@ -45,4 +45,23 @@ namespace Opus.Resources.values
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class HomeChannelHolder : RecyclerView.ViewHolder
|
||||
{
|
||||
public LinearLayout textLayout;
|
||||
public TextView Title;
|
||||
public TextView Artist;
|
||||
public ImageView AlbumArt;
|
||||
|
||||
public HomeChannelHolder(View itemView, Action<int> listener, Action<int> longListener) : base(itemView)
|
||||
{
|
||||
textLayout = itemView.FindViewById<LinearLayout>(Resource.Id.textLayout);
|
||||
Title = itemView.FindViewById<TextView>(Resource.Id.title);
|
||||
Artist = itemView.FindViewById<TextView>(Resource.Id.artist);
|
||||
AlbumArt = itemView.FindViewById<ImageView>(Resource.Id.albumArt);
|
||||
|
||||
itemView.Click += (sender, e) => listener(AdapterPosition);
|
||||
itemView.LongClick += (sender, e) => longListener(AdapterPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
|
||||
namespace Opus.Resources.Portable_Class
|
||||
namespace Opus.DataStructure
|
||||
{
|
||||
public class ChannelPreviewHolder : RecyclerView.ViewHolder
|
||||
{
|
||||
@@ -1,9 +1,26 @@
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
|
||||
namespace Opus.Resources.values
|
||||
namespace Opus.DataStructure
|
||||
{
|
||||
[System.Serializable]
|
||||
public class Folder : Java.Lang.Object
|
||||
{
|
||||
public string name;
|
||||
public string uri;
|
||||
public bool asChild = false;
|
||||
public bool isExtended = false;
|
||||
public int childCount = 0;
|
||||
public int Padding = 0;
|
||||
|
||||
public Folder(string name, string uri, bool asChild)
|
||||
{
|
||||
this.name = name;
|
||||
this.uri = uri;
|
||||
this.asChild = asChild;
|
||||
}
|
||||
}
|
||||
|
||||
public class FolderHolder
|
||||
{
|
||||
public ImageView expandChild;
|
||||
@@ -3,7 +3,7 @@ using Android.Views;
|
||||
using Android.Widget;
|
||||
using System;
|
||||
|
||||
namespace Opus.Resources.Portable_Class
|
||||
namespace Opus.DataStructure
|
||||
{
|
||||
public class HomeHolder : RecyclerView.ViewHolder
|
||||
{
|
||||
@@ -25,4 +25,23 @@ namespace Opus.Resources.Portable_Class
|
||||
itemView.LongClick += (sender, e) => longListener(AdapterPosition);
|
||||
}
|
||||
}
|
||||
|
||||
public class HomeMultipleSong : RecyclerView.ViewHolder
|
||||
{
|
||||
public TextView Title;
|
||||
public TextView Artist;
|
||||
public ImageView AlbumArt;
|
||||
public ImageView more;
|
||||
|
||||
public HomeMultipleSong(View itemView, Action<int> listener, Action<int> longListener) : base(itemView)
|
||||
{
|
||||
Title = itemView.FindViewById<TextView>(Resource.Id.title);
|
||||
Artist = itemView.FindViewById<TextView>(Resource.Id.artist);
|
||||
AlbumArt = itemView.FindViewById<ImageView>(Resource.Id.albumArt);
|
||||
more = itemView.FindViewById<ImageView>(Resource.Id.moreButton);
|
||||
|
||||
itemView.Click += (sender, e) => listener(AdapterPosition);
|
||||
itemView.LongClick += (sender, e) => longListener(AdapterPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Opus.Resources.values
|
||||
namespace Opus.DataStructure
|
||||
{
|
||||
[System.Serializable]
|
||||
public class HomeItem
|
||||
@@ -1,9 +1,7 @@
|
||||
using Android.Support.V7.Widget;
|
||||
using Opus.DataStructure;
|
||||
using Opus.Resources.Portable_Class;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Opus.Resources.values
|
||||
namespace Opus.DataStructure
|
||||
{
|
||||
[System.Serializable]
|
||||
public class HomeSection
|
||||
@@ -4,7 +4,7 @@ using Android.Views;
|
||||
using Android.Widget;
|
||||
using System;
|
||||
|
||||
namespace Opus.Resources.Portable_Class
|
||||
namespace Opus.DataStructure
|
||||
{
|
||||
public class LineSongHolder : RecyclerView.ViewHolder
|
||||
{
|
||||
@@ -1,9 +1,8 @@
|
||||
using Android.Support.V7.Widget;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using System;
|
||||
|
||||
namespace Opus.Resources.Portable_Class
|
||||
namespace Opus.DataStructure
|
||||
{
|
||||
public class QueueHeader : RecyclerView.ViewHolder
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using SQLite;
|
||||
|
||||
namespace Opus.Resources.values
|
||||
namespace Opus.DataStructure
|
||||
{
|
||||
[System.Serializable]
|
||||
[Table("Suggestion")]
|
||||
@@ -3,7 +3,6 @@ using Android.App;
|
||||
using Android.Content;
|
||||
using Android.Content.PM;
|
||||
using Android.Content.Res;
|
||||
using Android.Database;
|
||||
using Android.Gms.Auth.Api;
|
||||
using Android.Gms.Auth.Api.SignIn;
|
||||
using Android.Gms.Cast.Framework;
|
||||
@@ -13,7 +12,6 @@ using Android.Gms.Common.Apis;
|
||||
using Android.Graphics;
|
||||
using Android.Net;
|
||||
using Android.OS;
|
||||
using Android.Provider;
|
||||
using Android.Runtime;
|
||||
using Android.Support.Design.Widget;
|
||||
using Android.Support.V4.App;
|
||||
@@ -32,7 +30,6 @@ using Opus.Api.Services;
|
||||
using Opus.DataStructure;
|
||||
using Opus.Fragments;
|
||||
using Opus.Others;
|
||||
using Opus.Resources.Portable_Class;
|
||||
using SQLite;
|
||||
using Square.Picasso;
|
||||
using System;
|
||||
@@ -42,7 +39,6 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using YoutubeExplode;
|
||||
using CursorLoader = Android.Support.V4.Content.CursorLoader;
|
||||
using Environment = Android.OS.Environment;
|
||||
using Fragment = Android.Support.V4.App.Fragment;
|
||||
using Playlist = Opus.Fragments.Playlist;
|
||||
@@ -781,13 +777,17 @@ namespace Opus
|
||||
return false;
|
||||
}
|
||||
|
||||
public async Task<bool> GetReadPermission()
|
||||
public async Task<bool> GetReadPermission(bool ask = true)
|
||||
{
|
||||
if (HasReadPermission())
|
||||
return true;
|
||||
PermissionGot = null;
|
||||
string[] permissions = new string[] { Manifest.Permission.ReadExternalStorage };
|
||||
RequestPermissions(permissions, RequestCode);
|
||||
|
||||
if(ask)
|
||||
{
|
||||
string[] permissions = new string[] { Manifest.Permission.ReadExternalStorage };
|
||||
RequestPermissions(permissions, RequestCode);
|
||||
}
|
||||
|
||||
while (PermissionGot == null)
|
||||
await Task.Delay(10);
|
||||
@@ -864,64 +864,6 @@ namespace Opus
|
||||
return thumbnails.Last();
|
||||
}
|
||||
|
||||
public async void ShuffleAll()
|
||||
{
|
||||
List<Song> songs = new List<Song>();
|
||||
Android.Net.Uri musicUri = MediaStore.Audio.Media.ExternalContentUri;
|
||||
|
||||
CursorLoader cursorLoader = new CursorLoader(this, musicUri, null, null, null, null);
|
||||
ICursor musicCursor = (ICursor)cursorLoader.LoadInBackground();
|
||||
if (musicCursor != null && musicCursor.MoveToFirst())
|
||||
{
|
||||
int titleID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Title);
|
||||
int artistID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Artist);
|
||||
int albumID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Album);
|
||||
int thisID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Id);
|
||||
int pathID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Data);
|
||||
do
|
||||
{
|
||||
string Artist = musicCursor.GetString(artistID);
|
||||
string Title = musicCursor.GetString(titleID);
|
||||
string Album = musicCursor.GetString(albumID);
|
||||
long AlbumArt = musicCursor.GetLong(musicCursor.GetColumnIndex(MediaStore.Audio.Albums.InterfaceConsts.AlbumId));
|
||||
long id = musicCursor.GetLong(thisID);
|
||||
string path = musicCursor.GetString(pathID);
|
||||
|
||||
if (Title == null)
|
||||
Title = "Unknown Title";
|
||||
if (Artist == null)
|
||||
Artist = "Unknow Artist";
|
||||
if (Album == null)
|
||||
Album = "Unknow Album";
|
||||
|
||||
songs.Add(new Song(Title, Artist, Album, null, AlbumArt, id, path));
|
||||
}
|
||||
while (musicCursor.MoveToNext());
|
||||
musicCursor.Close();
|
||||
}
|
||||
|
||||
if (songs.Count == 0)
|
||||
{
|
||||
Snackbar snackBar = Snackbar.Make(FindViewById<CoordinatorLayout>(Resource.Id.snackBar), Resource.String.no_song_mix, Snackbar.LengthLong);
|
||||
snackBar.View.FindViewById<TextView>(Resource.Id.snackbar_text).SetTextColor(Color.White);
|
||||
snackBar.Show();
|
||||
return;
|
||||
}
|
||||
|
||||
Intent intent = new Intent(this, typeof(MusicPlayer));
|
||||
StartService(intent);
|
||||
|
||||
while (MusicPlayer.instance == null)
|
||||
await Task.Delay(10);
|
||||
|
||||
Random r = new Random();
|
||||
songs = songs.OrderBy(x => r.Next()).ToList();
|
||||
MusicPlayer.instance.AddToQueue(songs.ToArray());
|
||||
|
||||
ShowSmallPlayer();
|
||||
ShowPlayer();
|
||||
}
|
||||
|
||||
public void YoutubeEndPointChanged()
|
||||
{
|
||||
FindViewById<ProgressBar>(Resource.Id.ytProgress).Visibility = ViewStates.Gone;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using Android.Graphics.Drawables;
|
||||
using Square.Picasso;
|
||||
|
||||
namespace Opus.Resources.Portable_Class
|
||||
namespace Opus.Others
|
||||
{
|
||||
public class AccountTarget : Java.Lang.Object, ITarget
|
||||
{
|
||||
@@ -5,7 +5,7 @@ using Android.Util;
|
||||
using Java.Lang;
|
||||
using System;
|
||||
|
||||
namespace Opus.Resources.Portable_Class
|
||||
namespace Opus.Others
|
||||
{
|
||||
public class FixedLinearLayoutManager : LinearLayoutManager
|
||||
{
|
||||
@@ -3,7 +3,7 @@ using Android.Content;
|
||||
using Android.Support.V4.Media.Session;
|
||||
using Opus.Api.Services;
|
||||
|
||||
namespace Opus.Resources.Portable_Class
|
||||
namespace Opus.Others
|
||||
{
|
||||
public class HeadphonesActions : MediaSessionCompat.Callback
|
||||
{
|
||||
@@ -5,7 +5,6 @@ using Android.Support.V7.Widget.Helper;
|
||||
using Opus.Adapter;
|
||||
using Opus.Api.Services;
|
||||
using Opus.Fragments;
|
||||
using Opus.Resources.Portable_Class;
|
||||
|
||||
namespace Opus.Others
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Org.Adw.Library.Widgets.Discreteseekbar;
|
||||
|
||||
namespace Opus.Resources.Portable_Class
|
||||
namespace Opus.Others
|
||||
{
|
||||
public class PercentTransform : DiscreteSeekBar.NumericTransformer
|
||||
{
|
||||
@@ -94,7 +94,7 @@ namespace Opus.Adapter
|
||||
|
||||
public override void HeaderClicked(int position)
|
||||
{
|
||||
MainActivity.instance.ShuffleAll();
|
||||
LocalManager.ShuffleAll();
|
||||
}
|
||||
|
||||
public override void Clicked(Song song)
|
||||
|
||||
@@ -3,8 +3,8 @@ using Android.Content.Res;
|
||||
using Android.Graphics;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using Opus.DataStructure;
|
||||
using Opus.Fragments;
|
||||
using Opus.Resources.values;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Opus.Adapter
|
||||
|
||||
@@ -6,8 +6,6 @@ using Android.Views;
|
||||
using Opus.Api.Services;
|
||||
using Opus.DataStructure;
|
||||
using Opus.Fragments;
|
||||
using Opus.Resources.Portable_Class;
|
||||
using Opus.Resources.values;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ using Android.Widget;
|
||||
using Opus.Api.Services;
|
||||
using Opus.DataStructure;
|
||||
using Opus.Others;
|
||||
using Opus.Resources.Portable_Class;
|
||||
using Square.Picasso;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
using Android.Graphics;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using Opus.DataStructure;
|
||||
using Opus.Fragments;
|
||||
using Opus.Resources.values;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Opus.Adapter
|
||||
|
||||
@@ -3,7 +3,7 @@ using Android.Support.V7.Widget;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using Opus.DataStructure;
|
||||
using Opus.Resources.Portable_Class;
|
||||
using Opus.Fragments;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -4,7 +4,7 @@ using System;
|
||||
using Java.Lang;
|
||||
using Android.Support.V4.App;
|
||||
|
||||
namespace Opus.Resources.Portable_Class
|
||||
namespace Opus.Adapter
|
||||
{
|
||||
public class ViewPagerAdapter : FragmentStatePagerAdapter
|
||||
{
|
||||
@@ -6,8 +6,6 @@ using Opus.Api;
|
||||
using Opus.DataStructure;
|
||||
using Opus.Fragments;
|
||||
using Opus.Others;
|
||||
using Opus.Resources.Portable_Class;
|
||||
using Opus.Resources.values;
|
||||
using Square.Picasso;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -11,7 +11,6 @@ using Opus.Adapter;
|
||||
using Opus.Api;
|
||||
using Opus.DataStructure;
|
||||
using Opus.Others;
|
||||
using Opus.Resources.Portable_Class;
|
||||
using Square.Picasso;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -6,7 +6,7 @@ using Android.Views;
|
||||
using Android.Widget;
|
||||
using Java.IO;
|
||||
using Opus.Adapter;
|
||||
using Opus.Resources.values;
|
||||
using Opus.DataStructure;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -7,7 +7,7 @@ using Android.Views;
|
||||
using Opus.Adapter;
|
||||
using Opus.Api.Services;
|
||||
using Opus.DataStructure;
|
||||
using Opus.Resources.Portable_Class;
|
||||
using Opus.Others;
|
||||
|
||||
namespace Opus.Fragments
|
||||
{
|
||||
|
||||
@@ -279,6 +279,11 @@ namespace Opus.Fragments
|
||||
else
|
||||
Snackbar.Make(FindViewById<View>(Resource.Id.contentView), Resource.String.no_permission, Snackbar.LengthShort).Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
hasPermission = false;
|
||||
Snackbar.Make(FindViewById<View>(Resource.Id.contentView), Resource.String.no_permission, Snackbar.LengthShort).Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using Android;
|
||||
using Android.Content;
|
||||
using Android.Content.PM;
|
||||
using Android.Content;
|
||||
using Android.Database;
|
||||
using Android.Net;
|
||||
using Android.OS;
|
||||
@@ -15,21 +13,19 @@ using Opus.Adapter;
|
||||
using Opus.Api;
|
||||
using Opus.Api.Services;
|
||||
using Opus.DataStructure;
|
||||
using Opus.Fragments;
|
||||
using Opus.Resources.values;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using CursorLoader = Android.Support.V4.Content.CursorLoader;
|
||||
|
||||
namespace Opus.Resources.Portable_Class
|
||||
namespace Opus.Fragments
|
||||
{
|
||||
public class FolderBrowse : Fragment
|
||||
{
|
||||
public static FolderBrowse instance;
|
||||
public RecyclerView ListView;
|
||||
public List<string> pathDisplay = new List<string>();
|
||||
public List<string> paths = new List<string>();
|
||||
public List<int> pathUse = new List<int>();
|
||||
public RecyclerView ListView;
|
||||
public TwoLineAdapter adapter;
|
||||
public TextView EmptyView;
|
||||
public bool IsFocused = false;
|
||||
@@ -38,7 +34,6 @@ namespace Opus.Resources.Portable_Class
|
||||
public override void OnActivityCreated(Bundle savedInstanceState)
|
||||
{
|
||||
base.OnActivityCreated(savedInstanceState);
|
||||
|
||||
MainActivity.instance.contentRefresh.Refresh += OnRefresh;
|
||||
}
|
||||
|
||||
@@ -56,10 +51,11 @@ namespace Opus.Resources.Portable_Class
|
||||
ListView = view.FindViewById<RecyclerView>(Resource.Id.recycler);
|
||||
ListView.SetLayoutManager(new LinearLayoutManager(Android.App.Application.Context));
|
||||
ListView.SetItemAnimator(new DefaultItemAnimator());
|
||||
//ListView.ScrollChange += (s, e) => { MainActivity.instance.contentRefresh.Enabled = e. == 0; };
|
||||
ListView.NestedScrollingEnabled = true;
|
||||
|
||||
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||
PopulateList();
|
||||
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||
return view;
|
||||
}
|
||||
|
||||
@@ -69,40 +65,51 @@ namespace Opus.Resources.Portable_Class
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void PopulateList()
|
||||
public async Task PopulateList()
|
||||
{
|
||||
if (Android.Support.V4.Content.ContextCompat.CheckSelfPermission(Android.App.Application.Context, Manifest.Permission.ReadExternalStorage) != (int)Permission.Granted)
|
||||
if (await MainActivity.instance.GetReadPermission(false) == false)
|
||||
{
|
||||
MainActivity.instance.FindViewById(Resource.Id.loading).Visibility = ViewStates.Gone;
|
||||
EmptyView.Visibility = ViewStates.Visible;
|
||||
EmptyView.Text = GetString(Resource.String.no_permission);
|
||||
return;
|
||||
}
|
||||
|
||||
pathDisplay.Clear();
|
||||
paths.Clear();
|
||||
pathUse.Clear();
|
||||
|
||||
Uri musicUri = MediaStore.Audio.Media.ExternalContentUri;
|
||||
CursorLoader cursorLoader = new CursorLoader(Android.App.Application.Context, musicUri, null, null, null, null);
|
||||
ICursor musicCursor = (ICursor)cursorLoader.LoadInBackground();
|
||||
|
||||
if (musicCursor != null && musicCursor.MoveToFirst())
|
||||
await Task.Run(() =>
|
||||
{
|
||||
int pathID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Data);
|
||||
do
|
||||
{
|
||||
string path = musicCursor.GetString(pathID);
|
||||
path = path.Substring(0, path.LastIndexOf("/"));
|
||||
string displayPath = path.Substring(path.LastIndexOf("/") + 1, path.Length - (path.LastIndexOf("/") + 1));
|
||||
if (Looper.MyLooper() == null)
|
||||
Looper.Prepare();
|
||||
|
||||
if (!paths.Contains(path))
|
||||
Uri musicUri = MediaStore.Audio.Media.ExternalContentUri;
|
||||
CursorLoader cursorLoader = new CursorLoader(Android.App.Application.Context, musicUri, null, null, null, null);
|
||||
ICursor musicCursor = (ICursor)cursorLoader.LoadInBackground();
|
||||
|
||||
if (musicCursor != null && musicCursor.MoveToFirst())
|
||||
{
|
||||
int pathID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Data);
|
||||
do
|
||||
{
|
||||
pathDisplay.Add(displayPath);
|
||||
paths.Add(path);
|
||||
pathUse.Add(1);
|
||||
string path = musicCursor.GetString(pathID);
|
||||
path = path.Substring(0, path.LastIndexOf("/"));
|
||||
string displayPath = path.Substring(path.LastIndexOf("/") + 1, path.Length - (path.LastIndexOf("/") + 1));
|
||||
|
||||
if (!paths.Contains(path))
|
||||
{
|
||||
pathDisplay.Add(displayPath);
|
||||
paths.Add(path);
|
||||
pathUse.Add(1);
|
||||
}
|
||||
else
|
||||
pathUse[paths.IndexOf(path)] += 1;
|
||||
}
|
||||
else
|
||||
pathUse[paths.IndexOf(path)] += 1;
|
||||
while (musicCursor.MoveToNext());
|
||||
musicCursor.Close();
|
||||
}
|
||||
while (musicCursor.MoveToNext());
|
||||
musicCursor.Close();
|
||||
}
|
||||
});
|
||||
|
||||
adapter = new TwoLineAdapter(pathDisplay, pathUse);
|
||||
adapter.ItemClick += ListView_ItemClick;
|
||||
@@ -116,17 +123,17 @@ namespace Opus.Resources.Portable_Class
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRefresh(object sender, System.EventArgs e)
|
||||
private async void OnRefresh(object sender, System.EventArgs e)
|
||||
{
|
||||
if (!IsFocused)
|
||||
return;
|
||||
Refresh();
|
||||
await Refresh();
|
||||
MainActivity.instance.contentRefresh.Refreshing = false;
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
public async Task Refresh()
|
||||
{
|
||||
PopulateList();
|
||||
await PopulateList();
|
||||
}
|
||||
|
||||
public void ListView_ItemClick(object sender, int position)
|
||||
@@ -165,7 +172,7 @@ namespace Opus.Resources.Portable_Class
|
||||
}),
|
||||
new BottomSheetAction(Resource.Drawable.Shuffle, Resources.GetString(Resource.String.random_play), (sender, eventArg) =>
|
||||
{
|
||||
RandomPlay(path);
|
||||
LocalManager.ShuffleAll(path);
|
||||
bottomSheet.Dismiss();
|
||||
}),
|
||||
new BottomSheetAction(Resource.Drawable.PlaylistAdd, Resources.GetString(Resource.String.add_to_playlist), (sender, eventArg) =>
|
||||
@@ -232,10 +239,7 @@ namespace Opus.Resources.Portable_Class
|
||||
while (MusicPlayer.instance == null)
|
||||
await Task.Delay(10);
|
||||
|
||||
foreach (Song song in songs)
|
||||
{
|
||||
MusicPlayer.instance.AddToQueue(song);
|
||||
}
|
||||
MusicPlayer.instance.AddToQueue(songs.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,38 +373,6 @@ namespace Opus.Resources.Portable_Class
|
||||
AddToPlaylist(path, "foo", playlistID);
|
||||
}
|
||||
|
||||
void RandomPlay(string folderPath)
|
||||
{
|
||||
List<string> trackPaths = new List<string>();
|
||||
Uri musicUri = MediaStore.Audio.Media.ExternalContentUri;
|
||||
|
||||
CursorLoader cursorLoader = new CursorLoader(Android.App.Application.Context, musicUri, null, null, null, null);
|
||||
ICursor musicCursor = (ICursor)cursorLoader.LoadInBackground();
|
||||
|
||||
|
||||
if (musicCursor != null && musicCursor.MoveToFirst())
|
||||
{
|
||||
int pathID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Data);
|
||||
do
|
||||
{
|
||||
string path = musicCursor.GetString(pathID);
|
||||
|
||||
if (path.Contains(folderPath))
|
||||
trackPaths.Add(path);
|
||||
}
|
||||
while (musicCursor.MoveToNext());
|
||||
musicCursor.Close();
|
||||
}
|
||||
|
||||
|
||||
Intent intent = new Intent(Android.App.Application.Context, typeof(MusicPlayer));
|
||||
intent.PutStringArrayListExtra("files", trackPaths.ToArray());
|
||||
intent.SetAction("RandomPlay");
|
||||
Activity.StartService(intent);
|
||||
MainActivity.instance.ShowSmallPlayer();
|
||||
MainActivity.instance.ShowPlayer();
|
||||
}
|
||||
|
||||
public override void OnResume()
|
||||
{
|
||||
base.OnResume();
|
||||
@@ -10,13 +10,12 @@ using Opus.Adapter;
|
||||
using Opus.Api;
|
||||
using Opus.Api.Services;
|
||||
using Opus.DataStructure;
|
||||
using Opus.Fragments;
|
||||
using Opus.Others;
|
||||
using Square.Picasso;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opus.Resources.Portable_Class
|
||||
namespace Opus.Fragments
|
||||
{
|
||||
public class FolderTracks : Fragment
|
||||
{
|
||||
@@ -5,12 +5,10 @@ using Android.Support.V4.App;
|
||||
using Android.Support.V7.Widget;
|
||||
using Android.Support.V7.Widget.Helper;
|
||||
using Android.Views;
|
||||
using Google.Apis.YouTube.v3.Data;
|
||||
using Opus.Adapter;
|
||||
using Opus.Api;
|
||||
using Opus.Api.Services;
|
||||
using Opus.DataStructure;
|
||||
using Opus.Resources.values;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -217,7 +215,7 @@ namespace Opus.Fragments
|
||||
{
|
||||
if(adapterItems[position].contentType == SectionType.Shuffle)
|
||||
{
|
||||
MainActivity.instance.ShuffleAll();
|
||||
LocalManager.ShuffleAll();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ using Android.Support.Design.Widget;
|
||||
using Android.Support.V4.App;
|
||||
using Android.Support.V4.View;
|
||||
using Android.Views;
|
||||
using Opus.Fragments;
|
||||
using Opus.Adapter;
|
||||
|
||||
namespace Opus.Resources.Portable_Class
|
||||
namespace Opus.Fragments
|
||||
{
|
||||
public class Pager : Fragment, ViewPager.IOnPageChangeListener
|
||||
{
|
||||
@@ -39,13 +39,6 @@ namespace Opus.Resources.Portable_Class
|
||||
|
||||
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
if (savedInstanceState != null)
|
||||
{
|
||||
System.Console.WriteLine("&Instance state restored");
|
||||
//type = savedInstanceState.GetInt("type");
|
||||
//pos = savedInstanceState.GetInt("pos");
|
||||
}
|
||||
|
||||
View view = inflater.Inflate(Resource.Layout.ViewPager, container, false);
|
||||
TabLayout tabs = Activity.FindViewById<TabLayout>(Resource.Id.tabs);
|
||||
ViewPager pager = view.FindViewById<ViewPager>(Resource.Id.pager);
|
||||
@@ -187,19 +180,5 @@ namespace Opus.Resources.Portable_Class
|
||||
|
||||
instance = null;
|
||||
}
|
||||
|
||||
public override void OnViewStateRestored(Bundle savedInstanceState)
|
||||
{
|
||||
base.OnViewStateRestored(savedInstanceState);
|
||||
System.Console.WriteLine("&View state restored");
|
||||
}
|
||||
|
||||
//public override void OnSaveInstanceState(Bundle outState)
|
||||
//{
|
||||
// base.OnSaveInstanceState(outState);
|
||||
// System.Console.WriteLine("&Pager insatnce state saved");
|
||||
// outState.PutInt("type", type);
|
||||
// outState.PutInt("pos", View.FindViewById<ViewPager>(Resource.Id.pager).CurrentItem);
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ using Opus.Adapter;
|
||||
using Opus.Api;
|
||||
using Opus.DataStructure;
|
||||
using Opus.Others;
|
||||
using Opus.Resources.Portable_Class;
|
||||
using Square.Picasso;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -15,7 +15,6 @@ using Android.Support.V7.Preferences;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using Opus.Api.Services;
|
||||
using Opus.Resources.Portable_Class;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using AlertDialog = Android.Support.V7.App.AlertDialog;
|
||||
|
||||
@@ -17,7 +17,6 @@ using Opus.Api;
|
||||
using Opus.Api.Services;
|
||||
using Opus.DataStructure;
|
||||
using Opus.Others;
|
||||
using Opus.Resources.Portable_Class;
|
||||
using Opus.Views;
|
||||
using Square.Picasso;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -6,8 +6,7 @@ using Android.Views;
|
||||
using Android.Widget;
|
||||
using Newtonsoft.Json;
|
||||
using Opus.Adapter;
|
||||
using Opus.Resources.Portable_Class;
|
||||
using Opus.Resources.values;
|
||||
using Opus.DataStructure;
|
||||
using SQLite;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -10,7 +10,6 @@ using Opus.Adapter;
|
||||
using Opus.Api;
|
||||
using Opus.DataStructure;
|
||||
using Opus.Others;
|
||||
using Opus.Resources.Portable_Class;
|
||||
using Square.Picasso;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -21,7 +21,6 @@ using Opus.Api;
|
||||
using Opus.Api.Services;
|
||||
using Opus.DataStructure;
|
||||
using Opus.Others;
|
||||
using Opus.Resources.Portable_Class;
|
||||
using Square.Picasso;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -5,7 +5,7 @@ using Android.Support.V7.Preferences;
|
||||
using Android.Util;
|
||||
using Opus;
|
||||
using Opus.Api.Services;
|
||||
using Opus.Resources.Portable_Class;
|
||||
using Opus.Others;
|
||||
using Org.Adw.Library.Widgets.Discreteseekbar;
|
||||
using System;
|
||||
|
||||
|
||||
@@ -330,78 +330,73 @@
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="Code\MainActivity.cs" />
|
||||
<Compile Include="Code\UI\Views\AccountPreference.cs" />
|
||||
<Compile Include="Resources\Portable Class\AccountTarget.cs" />
|
||||
<Compile Include="Code\Others\AccountTarget.cs" />
|
||||
<Compile Include="Code\UI\Adapter\BrowseAdapter.cs" />
|
||||
<Compile Include="Code\UI\Adapter\AddToPlaylistAdapter.cs" />
|
||||
<Compile Include="Code\Others\AudioStopper.cs" />
|
||||
<Compile Include="Code\UI\Adapter\BottomSheetAdapter.cs" />
|
||||
<Compile Include="Code\UI\Fragments\Browse.cs" />
|
||||
<Compile Include="Code\Others\CastCallback.cs" />
|
||||
<Compile Include="Resources\Portable Class\CastProvider.cs" />
|
||||
<Compile Include="Code\Others\CastProvider.cs" />
|
||||
<Compile Include="Code\Others\CastQueueManager.cs" />
|
||||
<Compile Include="Resources\Portable Class\ChannelPreviewHolder.cs" />
|
||||
<Compile Include="Code\DataStructure\ChannelPreviewHolder.cs" />
|
||||
<Compile Include="Code\Others\CircleTransformation.cs" />
|
||||
<Compile Include="Code\UI\Views\CollapsingToolbar.cs" />
|
||||
<Compile Include="Code\UI\Views\CurrentItemDecoration.cs" />
|
||||
<Compile Include="Code\UI\Fragments\DownloadQueue.cs" />
|
||||
<Compile Include="Code\UI\Adapter\DownloadQueueAdapter.cs" />
|
||||
<Compile Include="Resources\Portable Class\FixedLinearLayoutManager.cs" />
|
||||
<Compile Include="Resources\Portable Class\FixedNestedScrollView.cs" />
|
||||
<Compile Include="Resources\Portable Class\PlayerBehavior.cs" />
|
||||
<Compile Include="Code\Others\FixedLinearLayoutManager.cs" />
|
||||
<Compile Include="Code\UI\Views\FixedNestedScrollView.cs" />
|
||||
<Compile Include="Code\UI\Views\PlayerBehavior.cs" />
|
||||
<Compile Include="Code\UI\Adapter\PlaylistLocationAdapter.cs" />
|
||||
<Compile Include="Resources\Portable Class\PlaylistTrackAdapter.cs" />
|
||||
<Compile Include="Code\UI\Adapter\PlaylistTrackAdapter.cs" />
|
||||
<Compile Include="Code\Others\RemoveBlackBorder.cs" />
|
||||
<Compile Include="Code\UI\Fragments\SearchableActivity.cs" />
|
||||
<Compile Include="Code\Api\Services\Downloader.cs" />
|
||||
<Compile Include="Code\UI\Fragments\DownloadFragment.cs" />
|
||||
<Compile Include="Code\UI\Fragments\EditMetaData.cs" />
|
||||
<Compile Include="Code\UI\Adapter\FolderAdapter.cs" />
|
||||
<Compile Include="Resources\Portable Class\FolderBrowse.cs" />
|
||||
<Compile Include="Resources\Portable Class\FolderTracks.cs" />
|
||||
<Compile Include="Resources\Portable Class\HeadphonesActions.cs" />
|
||||
<Compile Include="Code\UI\Fragments\FolderBrowse.cs" />
|
||||
<Compile Include="Code\UI\Fragments\FolderTracks.cs" />
|
||||
<Compile Include="Code\Others\HeadphonesActions.cs" />
|
||||
<Compile Include="Code\UI\Fragments\Home.cs" />
|
||||
<Compile Include="Code\UI\Adapter\HomeAdapter.cs" />
|
||||
<Compile Include="Code\UI\Adapter\HomeListAdapter.cs" />
|
||||
<Compile Include="Resources\Portable Class\HomeHolder.cs" />
|
||||
<Compile Include="Resources\Portable Class\HomeMultipleSong.cs" />
|
||||
<Compile Include="Code\DataStructure\HomeHolder.cs" />
|
||||
<Compile Include="Code\Others\ItemTouchCallback.cs" />
|
||||
<Compile Include="Code\UI\Adapter\LineAdapter.cs" />
|
||||
<Compile Include="Resources\Portable Class\LineSongHolder.cs" />
|
||||
<Compile Include="Code\DataStructure\LineSongHolder.cs" />
|
||||
<Compile Include="Code\Api\Services\MusicPlayer.cs" />
|
||||
<Compile Include="Resources\Portable Class\PagerFragment.cs" />
|
||||
<Compile Include="Resources\Portable Class\PercentTransform.cs" />
|
||||
<Compile Include="Code\UI\Fragments\PagerFragment.cs" />
|
||||
<Compile Include="Code\Others\PercentTransform.cs" />
|
||||
<Compile Include="Code\UI\Views\Player.cs" />
|
||||
<Compile Include="Code\UI\Fragments\Playlist.cs" />
|
||||
<Compile Include="Code\UI\Adapter\PlaylistAdapter.cs" />
|
||||
<Compile Include="Code\UI\Fragments\PlaylistTracks.cs" />
|
||||
<Compile Include="Code\UI\Fragments\Preferences.cs" />
|
||||
<Compile Include="Code\UI\Fragments\Queue.cs" />
|
||||
<Compile Include="Resources\Portable Class\QueueHolder.cs" />
|
||||
<Compile Include="Code\DataStructure\QueueHolder.cs" />
|
||||
<Compile Include="Code\UI\Adapter\QueueAdapter.cs" />
|
||||
<Compile Include="Code\UI\Views\SeekbarPreference.cs" />
|
||||
<Compile Include="Resources\Portable Class\Sleeper.cs" />
|
||||
<Compile Include="Code\Api\Services\Sleeper.cs" />
|
||||
<Compile Include="Code\Others\RemoveTrackFromPlaylistCallback.cs" />
|
||||
<Compile Include="Code\UI\Adapter\SuggestionAdapter.cs" />
|
||||
<Compile Include="Code\DataStructure\PlaylistItem.cs" />
|
||||
<Compile Include="Resources\Portable Class\TwoLineAdapter.cs" />
|
||||
<Compile Include="Code\UI\Adapter\TwoLineAdapter.cs" />
|
||||
<Compile Include="Code\DataStructure\UslessHolder.cs" />
|
||||
<Compile Include="Resources\Portable Class\ViewPagerAdapter.cs" />
|
||||
<Compile Include="Code\UI\Adapter\ViewPagerAdapter.cs" />
|
||||
<Compile Include="Code\UI\Fragments\YoutubeSearch.cs" />
|
||||
<Compile Include="Code\UI\Adapter\YtAdapter.cs" />
|
||||
<Compile Include="Code\DataStructure\YtFile.cs" />
|
||||
<Compile Include="Resources\Resource.Designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Resources\Portable Class\ChannelHolder.cs" />
|
||||
<Compile Include="Code\DataStructure\ChannelHolder.cs" />
|
||||
<Compile Include="Code\DataStructure\DownloadFile.cs" />
|
||||
<Compile Include="Resources\Portable Class\Folder.cs" />
|
||||
<Compile Include="Resources\Portable Class\FolderHolder.cs" />
|
||||
<Compile Include="Resources\Portable Class\Holder.cs" />
|
||||
<Compile Include="Resources\Portable Class\HomeChannelHolder.cs" />
|
||||
<Compile Include="Resources\Portable Class\HomeItem.cs" />
|
||||
<Compile Include="Resources\Portable Class\HomeSection.cs" />
|
||||
<Compile Include="Resources\Portable Class\PaddingChange.cs" />
|
||||
<Compile Include="Code\DataStructure\Folder.cs" />
|
||||
<Compile Include="Code\DataStructure\HomeItem.cs" />
|
||||
<Compile Include="Code\DataStructure\HomeSection.cs" />
|
||||
<Compile Include="Code\DataStructure\Song.cs" />
|
||||
<Compile Include="Resources\Portable Class\Suggestion.cs" />
|
||||
<Compile Include="Code\DataStructure\Suggestion.cs" />
|
||||
<Compile Include="Code\DataStructure\TwoLineHolder.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
namespace Opus.Resources.values
|
||||
{
|
||||
[System.Serializable]
|
||||
public class Folder : Java.Lang.Object
|
||||
{
|
||||
public string name;
|
||||
public string uri;
|
||||
public bool asChild = false;
|
||||
public bool isExtended = false;
|
||||
public int childCount = 0;
|
||||
public int Padding = 0;
|
||||
|
||||
public Folder(string name, string uri, bool asChild)
|
||||
{
|
||||
this.name = name;
|
||||
this.uri = uri;
|
||||
this.asChild = asChild;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
|
||||
namespace Opus.Resources.values
|
||||
{
|
||||
[System.Serializable]
|
||||
public class Holder
|
||||
{
|
||||
public ImageView reorder;
|
||||
public LinearLayout textLayout;
|
||||
public TextView Title;
|
||||
public TextView Artist;
|
||||
public ImageView AlbumArt;
|
||||
public ImageView youtubeIcon;
|
||||
public ImageView more;
|
||||
|
||||
public Holder(View v)
|
||||
{
|
||||
reorder = v.FindViewById<ImageView>(Resource.Id.reorder);
|
||||
textLayout = v.FindViewById<LinearLayout>(Resource.Id.textLayout);
|
||||
Title = v.FindViewById<TextView>(Resource.Id.title);
|
||||
Artist = v.FindViewById<TextView>(Resource.Id.artist);
|
||||
AlbumArt = v.FindViewById<ImageView>(Resource.Id.albumArt);
|
||||
youtubeIcon = v.FindViewById<ImageView>(Resource.Id.youtubeIcon);
|
||||
more = v.FindViewById<ImageView>(Resource.Id.moreButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using Android.Support.V7.Widget;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using System;
|
||||
|
||||
namespace Opus.Resources.values
|
||||
{
|
||||
public class HomeChannelHolder : RecyclerView.ViewHolder
|
||||
{
|
||||
public LinearLayout textLayout;
|
||||
public TextView Title;
|
||||
public TextView Artist;
|
||||
public ImageView AlbumArt;
|
||||
|
||||
public HomeChannelHolder(View itemView, Action<int> listener, Action<int> longListener) : base(itemView)
|
||||
{
|
||||
textLayout = itemView.FindViewById<LinearLayout>(Resource.Id.textLayout);
|
||||
Title = itemView.FindViewById<TextView>(Resource.Id.title);
|
||||
Artist = itemView.FindViewById<TextView>(Resource.Id.artist);
|
||||
AlbumArt = itemView.FindViewById<ImageView>(Resource.Id.albumArt);
|
||||
|
||||
itemView.Click += (sender, e) => listener(AdapterPosition);
|
||||
itemView.LongClick += (sender, e) => longListener(AdapterPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using Android.Support.V7.Widget;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using System;
|
||||
|
||||
namespace Opus.Resources.Portable_Class
|
||||
{
|
||||
public class HomeMultipleSong : RecyclerView.ViewHolder
|
||||
{
|
||||
public TextView Title;
|
||||
public TextView Artist;
|
||||
public ImageView AlbumArt;
|
||||
public ImageView more;
|
||||
|
||||
public HomeMultipleSong(View itemView, Action<int> listener, Action<int> longListener) : base(itemView)
|
||||
{
|
||||
Title = itemView.FindViewById<TextView>(Resource.Id.title);
|
||||
Artist = itemView.FindViewById<TextView>(Resource.Id.artist);
|
||||
AlbumArt = itemView.FindViewById<ImageView>(Resource.Id.albumArt);
|
||||
more = itemView.FindViewById<ImageView>(Resource.Id.moreButton);
|
||||
|
||||
itemView.Click += (sender, e) => listener(AdapterPosition);
|
||||
itemView.LongClick += (sender, e) => longListener(AdapterPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Opus.Resources.values
|
||||
{
|
||||
public class PaddingChange : EventArgs
|
||||
{
|
||||
public int oldPadding;
|
||||
public int paddingChange = 0;
|
||||
|
||||
public PaddingChange(int oldPadding)
|
||||
{
|
||||
this.oldPadding = oldPadding;
|
||||
}
|
||||
|
||||
public PaddingChange(int oldPadding, int paddingChange)
|
||||
{
|
||||
this.oldPadding = oldPadding;
|
||||
this.paddingChange = paddingChange;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user