From 93a19b8622909d43f70a5adc34138ce8bf1c6689 Mon Sep 17 00:00:00 2001
From: Tristan Roux
Date: Sun, 21 Apr 2019 21:32:26 +0200
Subject: [PATCH] Finishing the code clean up. Starting the rework of folder
browse features.
---
Opus/Code/Api/LocalManager.cs | 70 +++++++++++
Opus/Code/Api/Services/MusicPlayer.cs | 1 -
.../Api/Services}/Sleeper.cs | 2 +-
.../DataStructure}/ChannelHolder.cs | 23 +++-
.../DataStructure}/ChannelPreviewHolder.cs | 2 +-
.../DataStructure/Folder.cs} | 19 ++-
.../DataStructure}/HomeHolder.cs | 21 +++-
.../DataStructure}/HomeItem.cs | 2 +-
.../DataStructure}/HomeSection.cs | 4 +-
.../DataStructure}/LineSongHolder.cs | 2 +-
.../DataStructure}/QueueHolder.cs | 3 +-
.../DataStructure}/Suggestion.cs | 2 +-
Opus/Code/MainActivity.cs | 72 ++---------
.../Others}/AccountTarget.cs | 2 +-
.../Others}/CastProvider.cs | 0
.../Others}/FixedLinearLayoutManager.cs | 2 +-
.../Others}/HeadphonesActions.cs | 2 +-
Opus/Code/Others/ItemTouchCallback.cs | 1 -
.../Others}/PercentTransform.cs | 2 +-
Opus/Code/UI/Adapter/BrowseAdapter.cs | 2 +-
Opus/Code/UI/Adapter/FolderAdapter.cs | 2 +-
Opus/Code/UI/Adapter/HomeAdapter.cs | 2 -
.../UI/Adapter}/PlaylistTrackAdapter.cs | 0
Opus/Code/UI/Adapter/QueueAdapter.cs | 1 -
Opus/Code/UI/Adapter/SuggestionAdapter.cs | 2 +-
.../UI/Adapter}/TwoLineAdapter.cs | 2 +-
.../UI/Adapter}/ViewPagerAdapter.cs | 2 +-
Opus/Code/UI/Adapter/YtAdapter.cs | 2 -
Opus/Code/UI/Fragments/Browse.cs | 1 -
Opus/Code/UI/Fragments/DownloadFragment.cs | 2 +-
Opus/Code/UI/Fragments/DownloadQueue.cs | 2 +-
Opus/Code/UI/Fragments/EditMetaData.cs | 5 +
.../UI/Fragments}/FolderBrowse.cs | 116 +++++++-----------
.../UI/Fragments}/FolderTracks.cs | 3 +-
Opus/Code/UI/Fragments/Home.cs | 4 +-
.../UI/Fragments}/PagerFragment.cs | 25 +---
Opus/Code/UI/Fragments/PlaylistTracks.cs | 1 -
Opus/Code/UI/Fragments/Preferences.cs | 1 -
Opus/Code/UI/Fragments/Queue.cs | 1 -
Opus/Code/UI/Fragments/SearchableActivity.cs | 3 +-
Opus/Code/UI/Fragments/YoutubeSearch.cs | 1 -
.../UI/Views}/FixedNestedScrollView.cs | 0
Opus/Code/UI/Views/Player.cs | 1 -
.../UI/Views}/PlayerBehavior.cs | 0
Opus/Code/UI/Views/SeekbarPreference.cs | 2 +-
Opus/Opus.csproj | 51 ++++----
Opus/Resources/Portable Class/Folder.cs | 20 ---
Opus/Resources/Portable Class/Holder.cs | 28 -----
.../Portable Class/HomeChannelHolder.cs | 26 ----
.../Portable Class/HomeMultipleSong.cs | 26 ----
.../Resources/Portable Class/PaddingChange.cs | 21 ----
51 files changed, 232 insertions(+), 355 deletions(-)
rename Opus/{Resources/Portable Class => Code/Api/Services}/Sleeper.cs (98%)
rename Opus/{Resources/Portable Class => Code/DataStructure}/ChannelHolder.cs (65%)
rename Opus/{Resources/Portable Class => Code/DataStructure}/ChannelPreviewHolder.cs (96%)
rename Opus/{Resources/Portable Class/FolderHolder.cs => Code/DataStructure/Folder.cs} (51%)
rename Opus/{Resources/Portable Class => Code/DataStructure}/HomeHolder.cs (54%)
rename Opus/{Resources/Portable Class => Code/DataStructure}/HomeItem.cs (96%)
rename Opus/{Resources/Portable Class => Code/DataStructure}/HomeSection.cs (92%)
rename Opus/{Resources/Portable Class => Code/DataStructure}/LineSongHolder.cs (95%)
rename Opus/{Resources/Portable Class => Code/DataStructure}/QueueHolder.cs (96%)
rename Opus/{Resources/Portable Class => Code/DataStructure}/Suggestion.cs (92%)
rename Opus/{Resources/Portable Class => Code/Others}/AccountTarget.cs (94%)
rename Opus/{Resources/Portable Class => Code/Others}/CastProvider.cs (100%)
rename Opus/{Resources/Portable Class => Code/Others}/FixedLinearLayoutManager.cs (96%)
rename Opus/{Resources/Portable Class => Code/Others}/HeadphonesActions.cs (97%)
rename Opus/{Resources/Portable Class => Code/Others}/PercentTransform.cs (91%)
rename Opus/{Resources/Portable Class => Code/UI/Adapter}/PlaylistTrackAdapter.cs (100%)
rename Opus/{Resources/Portable Class => Code/UI/Adapter}/TwoLineAdapter.cs (98%)
rename Opus/{Resources/Portable Class => Code/UI/Adapter}/ViewPagerAdapter.cs (97%)
rename Opus/{Resources/Portable Class => Code/UI/Fragments}/FolderBrowse.cs (81%)
rename Opus/{Resources/Portable Class => Code/UI/Fragments}/FolderTracks.cs (99%)
rename Opus/{Resources/Portable Class => Code/UI/Fragments}/PagerFragment.cs (89%)
rename Opus/{Resources/Portable Class => Code/UI/Views}/FixedNestedScrollView.cs (100%)
rename Opus/{Resources/Portable Class => Code/UI/Views}/PlayerBehavior.cs (100%)
delete mode 100644 Opus/Resources/Portable Class/Folder.cs
delete mode 100644 Opus/Resources/Portable Class/Holder.cs
delete mode 100644 Opus/Resources/Portable Class/HomeChannelHolder.cs
delete mode 100644 Opus/Resources/Portable Class/HomeMultipleSong.cs
delete mode 100644 Opus/Resources/Portable Class/PaddingChange.cs
diff --git a/Opus/Code/Api/LocalManager.cs b/Opus/Code/Api/LocalManager.cs
index da47b7c..b2ffb32 100644
--- a/Opus/Code/Api/LocalManager.cs
+++ b/Opus/Code/Api/LocalManager.cs
@@ -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);
}
+
+ ///
+ /// RandomPlay all file in the folder you selected or all file on the device if the folderPath = null.
+ ///
+ ///
+ public async static void ShuffleAll(string folderPath = null)
+ {
+ List songs = new List();
+
+ 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(Resource.Id.snackBar), Resource.String.no_song_mix, Snackbar.LengthLong);
+ snackBar.View.FindViewById(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
diff --git a/Opus/Code/Api/Services/MusicPlayer.cs b/Opus/Code/Api/Services/MusicPlayer.cs
index 2dd038f..dc8202e 100644
--- a/Opus/Code/Api/Services/MusicPlayer.cs
+++ b/Opus/Code/Api/Services/MusicPlayer.cs
@@ -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;
diff --git a/Opus/Resources/Portable Class/Sleeper.cs b/Opus/Code/Api/Services/Sleeper.cs
similarity index 98%
rename from Opus/Resources/Portable Class/Sleeper.cs
rename to Opus/Code/Api/Services/Sleeper.cs
index bcdc7b9..69df675 100644
--- a/Opus/Resources/Portable Class/Sleeper.cs
+++ b/Opus/Code/Api/Services/Sleeper.cs
@@ -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
diff --git a/Opus/Resources/Portable Class/ChannelHolder.cs b/Opus/Code/DataStructure/ChannelHolder.cs
similarity index 65%
rename from Opus/Resources/Portable Class/ChannelHolder.cs
rename to Opus/Code/DataStructure/ChannelHolder.cs
index 966536c..34668bb 100644
--- a/Opus/Resources/Portable Class/ChannelHolder.cs
+++ b/Opus/Code/DataStructure/ChannelHolder.cs
@@ -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 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);
+
+ itemView.Click += (sender, e) => listener(AdapterPosition);
+ itemView.LongClick += (sender, e) => longListener(AdapterPosition);
+ }
+ }
}
\ No newline at end of file
diff --git a/Opus/Resources/Portable Class/ChannelPreviewHolder.cs b/Opus/Code/DataStructure/ChannelPreviewHolder.cs
similarity index 96%
rename from Opus/Resources/Portable Class/ChannelPreviewHolder.cs
rename to Opus/Code/DataStructure/ChannelPreviewHolder.cs
index 25a9621..f5d29c0 100644
--- a/Opus/Resources/Portable Class/ChannelPreviewHolder.cs
+++ b/Opus/Code/DataStructure/ChannelPreviewHolder.cs
@@ -2,7 +2,7 @@
using Android.Views;
using Android.Widget;
-namespace Opus.Resources.Portable_Class
+namespace Opus.DataStructure
{
public class ChannelPreviewHolder : RecyclerView.ViewHolder
{
diff --git a/Opus/Resources/Portable Class/FolderHolder.cs b/Opus/Code/DataStructure/Folder.cs
similarity index 51%
rename from Opus/Resources/Portable Class/FolderHolder.cs
rename to Opus/Code/DataStructure/Folder.cs
index a8cddb9..64c5b5e 100644
--- a/Opus/Resources/Portable Class/FolderHolder.cs
+++ b/Opus/Code/DataStructure/Folder.cs
@@ -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;
diff --git a/Opus/Resources/Portable Class/HomeHolder.cs b/Opus/Code/DataStructure/HomeHolder.cs
similarity index 54%
rename from Opus/Resources/Portable Class/HomeHolder.cs
rename to Opus/Code/DataStructure/HomeHolder.cs
index ace6437..84c7d9e 100644
--- a/Opus/Resources/Portable Class/HomeHolder.cs
+++ b/Opus/Code/DataStructure/HomeHolder.cs
@@ -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 listener, Action longListener) : base(itemView)
+ {
+ Title = itemView.FindViewById(Resource.Id.title);
+ Artist = itemView.FindViewById(Resource.Id.artist);
+ AlbumArt = itemView.FindViewById(Resource.Id.albumArt);
+ more = itemView.FindViewById(Resource.Id.moreButton);
+
+ itemView.Click += (sender, e) => listener(AdapterPosition);
+ itemView.LongClick += (sender, e) => longListener(AdapterPosition);
+ }
+ }
}
\ No newline at end of file
diff --git a/Opus/Resources/Portable Class/HomeItem.cs b/Opus/Code/DataStructure/HomeItem.cs
similarity index 96%
rename from Opus/Resources/Portable Class/HomeItem.cs
rename to Opus/Code/DataStructure/HomeItem.cs
index 8b785d1..05eaaff 100644
--- a/Opus/Resources/Portable Class/HomeItem.cs
+++ b/Opus/Code/DataStructure/HomeItem.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
-namespace Opus.Resources.values
+namespace Opus.DataStructure
{
[System.Serializable]
public class HomeItem
diff --git a/Opus/Resources/Portable Class/HomeSection.cs b/Opus/Code/DataStructure/HomeSection.cs
similarity index 92%
rename from Opus/Resources/Portable Class/HomeSection.cs
rename to Opus/Code/DataStructure/HomeSection.cs
index f8c70a7..97c47f6 100644
--- a/Opus/Resources/Portable Class/HomeSection.cs
+++ b/Opus/Code/DataStructure/HomeSection.cs
@@ -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
diff --git a/Opus/Resources/Portable Class/LineSongHolder.cs b/Opus/Code/DataStructure/LineSongHolder.cs
similarity index 95%
rename from Opus/Resources/Portable Class/LineSongHolder.cs
rename to Opus/Code/DataStructure/LineSongHolder.cs
index 3e96fb7..9a85ea3 100644
--- a/Opus/Resources/Portable Class/LineSongHolder.cs
+++ b/Opus/Code/DataStructure/LineSongHolder.cs
@@ -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
{
diff --git a/Opus/Resources/Portable Class/QueueHolder.cs b/Opus/Code/DataStructure/QueueHolder.cs
similarity index 96%
rename from Opus/Resources/Portable Class/QueueHolder.cs
rename to Opus/Code/DataStructure/QueueHolder.cs
index 4eb916b..0c0ee88 100644
--- a/Opus/Resources/Portable Class/QueueHolder.cs
+++ b/Opus/Code/DataStructure/QueueHolder.cs
@@ -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
{
diff --git a/Opus/Resources/Portable Class/Suggestion.cs b/Opus/Code/DataStructure/Suggestion.cs
similarity index 92%
rename from Opus/Resources/Portable Class/Suggestion.cs
rename to Opus/Code/DataStructure/Suggestion.cs
index 0e03201..f37c68f 100644
--- a/Opus/Resources/Portable Class/Suggestion.cs
+++ b/Opus/Code/DataStructure/Suggestion.cs
@@ -1,6 +1,6 @@
using SQLite;
-namespace Opus.Resources.values
+namespace Opus.DataStructure
{
[System.Serializable]
[Table("Suggestion")]
diff --git a/Opus/Code/MainActivity.cs b/Opus/Code/MainActivity.cs
index 9cf2223..1caf60d 100644
--- a/Opus/Code/MainActivity.cs
+++ b/Opus/Code/MainActivity.cs
@@ -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 GetReadPermission()
+ public async Task 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 songs = new List();
- 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(Resource.Id.snackBar), Resource.String.no_song_mix, Snackbar.LengthLong);
- snackBar.View.FindViewById(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(Resource.Id.ytProgress).Visibility = ViewStates.Gone;
diff --git a/Opus/Resources/Portable Class/AccountTarget.cs b/Opus/Code/Others/AccountTarget.cs
similarity index 94%
rename from Opus/Resources/Portable Class/AccountTarget.cs
rename to Opus/Code/Others/AccountTarget.cs
index c31a04f..337bc94 100644
--- a/Opus/Resources/Portable Class/AccountTarget.cs
+++ b/Opus/Code/Others/AccountTarget.cs
@@ -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
{
diff --git a/Opus/Resources/Portable Class/CastProvider.cs b/Opus/Code/Others/CastProvider.cs
similarity index 100%
rename from Opus/Resources/Portable Class/CastProvider.cs
rename to Opus/Code/Others/CastProvider.cs
diff --git a/Opus/Resources/Portable Class/FixedLinearLayoutManager.cs b/Opus/Code/Others/FixedLinearLayoutManager.cs
similarity index 96%
rename from Opus/Resources/Portable Class/FixedLinearLayoutManager.cs
rename to Opus/Code/Others/FixedLinearLayoutManager.cs
index 49ca17d..a072306 100644
--- a/Opus/Resources/Portable Class/FixedLinearLayoutManager.cs
+++ b/Opus/Code/Others/FixedLinearLayoutManager.cs
@@ -5,7 +5,7 @@ using Android.Util;
using Java.Lang;
using System;
-namespace Opus.Resources.Portable_Class
+namespace Opus.Others
{
public class FixedLinearLayoutManager : LinearLayoutManager
{
diff --git a/Opus/Resources/Portable Class/HeadphonesActions.cs b/Opus/Code/Others/HeadphonesActions.cs
similarity index 97%
rename from Opus/Resources/Portable Class/HeadphonesActions.cs
rename to Opus/Code/Others/HeadphonesActions.cs
index df47d28..543fcf4 100644
--- a/Opus/Resources/Portable Class/HeadphonesActions.cs
+++ b/Opus/Code/Others/HeadphonesActions.cs
@@ -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
{
diff --git a/Opus/Code/Others/ItemTouchCallback.cs b/Opus/Code/Others/ItemTouchCallback.cs
index 1c64d2e..f9e484f 100644
--- a/Opus/Code/Others/ItemTouchCallback.cs
+++ b/Opus/Code/Others/ItemTouchCallback.cs
@@ -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
{
diff --git a/Opus/Resources/Portable Class/PercentTransform.cs b/Opus/Code/Others/PercentTransform.cs
similarity index 91%
rename from Opus/Resources/Portable Class/PercentTransform.cs
rename to Opus/Code/Others/PercentTransform.cs
index 95e63d2..dccbe8e 100644
--- a/Opus/Resources/Portable Class/PercentTransform.cs
+++ b/Opus/Code/Others/PercentTransform.cs
@@ -1,6 +1,6 @@
using Org.Adw.Library.Widgets.Discreteseekbar;
-namespace Opus.Resources.Portable_Class
+namespace Opus.Others
{
public class PercentTransform : DiscreteSeekBar.NumericTransformer
{
diff --git a/Opus/Code/UI/Adapter/BrowseAdapter.cs b/Opus/Code/UI/Adapter/BrowseAdapter.cs
index 10596a0..c564014 100644
--- a/Opus/Code/UI/Adapter/BrowseAdapter.cs
+++ b/Opus/Code/UI/Adapter/BrowseAdapter.cs
@@ -94,7 +94,7 @@ namespace Opus.Adapter
public override void HeaderClicked(int position)
{
- MainActivity.instance.ShuffleAll();
+ LocalManager.ShuffleAll();
}
public override void Clicked(Song song)
diff --git a/Opus/Code/UI/Adapter/FolderAdapter.cs b/Opus/Code/UI/Adapter/FolderAdapter.cs
index 0c4660a..22271d2 100644
--- a/Opus/Code/UI/Adapter/FolderAdapter.cs
+++ b/Opus/Code/UI/Adapter/FolderAdapter.cs
@@ -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
diff --git a/Opus/Code/UI/Adapter/HomeAdapter.cs b/Opus/Code/UI/Adapter/HomeAdapter.cs
index 85a1c7e..543f99f 100644
--- a/Opus/Code/UI/Adapter/HomeAdapter.cs
+++ b/Opus/Code/UI/Adapter/HomeAdapter.cs
@@ -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;
diff --git a/Opus/Resources/Portable Class/PlaylistTrackAdapter.cs b/Opus/Code/UI/Adapter/PlaylistTrackAdapter.cs
similarity index 100%
rename from Opus/Resources/Portable Class/PlaylistTrackAdapter.cs
rename to Opus/Code/UI/Adapter/PlaylistTrackAdapter.cs
diff --git a/Opus/Code/UI/Adapter/QueueAdapter.cs b/Opus/Code/UI/Adapter/QueueAdapter.cs
index 2e070aa..ba2d6de 100644
--- a/Opus/Code/UI/Adapter/QueueAdapter.cs
+++ b/Opus/Code/UI/Adapter/QueueAdapter.cs
@@ -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;
diff --git a/Opus/Code/UI/Adapter/SuggestionAdapter.cs b/Opus/Code/UI/Adapter/SuggestionAdapter.cs
index 0476ee0..fa59dab 100644
--- a/Opus/Code/UI/Adapter/SuggestionAdapter.cs
+++ b/Opus/Code/UI/Adapter/SuggestionAdapter.cs
@@ -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
diff --git a/Opus/Resources/Portable Class/TwoLineAdapter.cs b/Opus/Code/UI/Adapter/TwoLineAdapter.cs
similarity index 98%
rename from Opus/Resources/Portable Class/TwoLineAdapter.cs
rename to Opus/Code/UI/Adapter/TwoLineAdapter.cs
index 9f591ad..c99597b 100644
--- a/Opus/Resources/Portable Class/TwoLineAdapter.cs
+++ b/Opus/Code/UI/Adapter/TwoLineAdapter.cs
@@ -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;
diff --git a/Opus/Resources/Portable Class/ViewPagerAdapter.cs b/Opus/Code/UI/Adapter/ViewPagerAdapter.cs
similarity index 97%
rename from Opus/Resources/Portable Class/ViewPagerAdapter.cs
rename to Opus/Code/UI/Adapter/ViewPagerAdapter.cs
index e9fd3e3..0baa6e8 100644
--- a/Opus/Resources/Portable Class/ViewPagerAdapter.cs
+++ b/Opus/Code/UI/Adapter/ViewPagerAdapter.cs
@@ -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
{
diff --git a/Opus/Code/UI/Adapter/YtAdapter.cs b/Opus/Code/UI/Adapter/YtAdapter.cs
index 5852571..7b51407 100644
--- a/Opus/Code/UI/Adapter/YtAdapter.cs
+++ b/Opus/Code/UI/Adapter/YtAdapter.cs
@@ -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;
diff --git a/Opus/Code/UI/Fragments/Browse.cs b/Opus/Code/UI/Fragments/Browse.cs
index 613c6a4..6cfda58 100644
--- a/Opus/Code/UI/Fragments/Browse.cs
+++ b/Opus/Code/UI/Fragments/Browse.cs
@@ -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;
diff --git a/Opus/Code/UI/Fragments/DownloadFragment.cs b/Opus/Code/UI/Fragments/DownloadFragment.cs
index 4656193..399841b 100644
--- a/Opus/Code/UI/Fragments/DownloadFragment.cs
+++ b/Opus/Code/UI/Fragments/DownloadFragment.cs
@@ -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;
diff --git a/Opus/Code/UI/Fragments/DownloadQueue.cs b/Opus/Code/UI/Fragments/DownloadQueue.cs
index 986264f..c803215 100644
--- a/Opus/Code/UI/Fragments/DownloadQueue.cs
+++ b/Opus/Code/UI/Fragments/DownloadQueue.cs
@@ -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
{
diff --git a/Opus/Code/UI/Fragments/EditMetaData.cs b/Opus/Code/UI/Fragments/EditMetaData.cs
index 3549783..abe73d2 100644
--- a/Opus/Code/UI/Fragments/EditMetaData.cs
+++ b/Opus/Code/UI/Fragments/EditMetaData.cs
@@ -279,6 +279,11 @@ namespace Opus.Fragments
else
Snackbar.Make(FindViewById(Resource.Id.contentView), Resource.String.no_permission, Snackbar.LengthShort).Show();
}
+ else
+ {
+ hasPermission = false;
+ Snackbar.Make(FindViewById(Resource.Id.contentView), Resource.String.no_permission, Snackbar.LengthShort).Show();
+ }
}
}
diff --git a/Opus/Resources/Portable Class/FolderBrowse.cs b/Opus/Code/UI/Fragments/FolderBrowse.cs
similarity index 81%
rename from Opus/Resources/Portable Class/FolderBrowse.cs
rename to Opus/Code/UI/Fragments/FolderBrowse.cs
index 07f4b6e..69750c9 100644
--- a/Opus/Resources/Portable Class/FolderBrowse.cs
+++ b/Opus/Code/UI/Fragments/FolderBrowse.cs
@@ -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 pathDisplay = new List();
public List paths = new List();
public List pathUse = new List();
- 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(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 trackPaths = new List();
- 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();
diff --git a/Opus/Resources/Portable Class/FolderTracks.cs b/Opus/Code/UI/Fragments/FolderTracks.cs
similarity index 99%
rename from Opus/Resources/Portable Class/FolderTracks.cs
rename to Opus/Code/UI/Fragments/FolderTracks.cs
index f8884fc..1006e32 100644
--- a/Opus/Resources/Portable Class/FolderTracks.cs
+++ b/Opus/Code/UI/Fragments/FolderTracks.cs
@@ -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
{
diff --git a/Opus/Code/UI/Fragments/Home.cs b/Opus/Code/UI/Fragments/Home.cs
index ba6c764..b290753 100644
--- a/Opus/Code/UI/Fragments/Home.cs
+++ b/Opus/Code/UI/Fragments/Home.cs
@@ -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();
}
}
diff --git a/Opus/Resources/Portable Class/PagerFragment.cs b/Opus/Code/UI/Fragments/PagerFragment.cs
similarity index 89%
rename from Opus/Resources/Portable Class/PagerFragment.cs
rename to Opus/Code/UI/Fragments/PagerFragment.cs
index c8450ff..3247f47 100644
--- a/Opus/Resources/Portable Class/PagerFragment.cs
+++ b/Opus/Code/UI/Fragments/PagerFragment.cs
@@ -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(Resource.Id.tabs);
ViewPager pager = view.FindViewById(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(Resource.Id.pager).CurrentItem);
- //}
}
}
\ No newline at end of file
diff --git a/Opus/Code/UI/Fragments/PlaylistTracks.cs b/Opus/Code/UI/Fragments/PlaylistTracks.cs
index 4a09cec..01774e5 100644
--- a/Opus/Code/UI/Fragments/PlaylistTracks.cs
+++ b/Opus/Code/UI/Fragments/PlaylistTracks.cs
@@ -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;
diff --git a/Opus/Code/UI/Fragments/Preferences.cs b/Opus/Code/UI/Fragments/Preferences.cs
index 430841a..95d7498 100644
--- a/Opus/Code/UI/Fragments/Preferences.cs
+++ b/Opus/Code/UI/Fragments/Preferences.cs
@@ -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;
diff --git a/Opus/Code/UI/Fragments/Queue.cs b/Opus/Code/UI/Fragments/Queue.cs
index d9286e4..756b8e1 100644
--- a/Opus/Code/UI/Fragments/Queue.cs
+++ b/Opus/Code/UI/Fragments/Queue.cs
@@ -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;
diff --git a/Opus/Code/UI/Fragments/SearchableActivity.cs b/Opus/Code/UI/Fragments/SearchableActivity.cs
index 8a1a821..7956dcb 100644
--- a/Opus/Code/UI/Fragments/SearchableActivity.cs
+++ b/Opus/Code/UI/Fragments/SearchableActivity.cs
@@ -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;
diff --git a/Opus/Code/UI/Fragments/YoutubeSearch.cs b/Opus/Code/UI/Fragments/YoutubeSearch.cs
index e9a2d74..618b45d 100644
--- a/Opus/Code/UI/Fragments/YoutubeSearch.cs
+++ b/Opus/Code/UI/Fragments/YoutubeSearch.cs
@@ -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;
diff --git a/Opus/Resources/Portable Class/FixedNestedScrollView.cs b/Opus/Code/UI/Views/FixedNestedScrollView.cs
similarity index 100%
rename from Opus/Resources/Portable Class/FixedNestedScrollView.cs
rename to Opus/Code/UI/Views/FixedNestedScrollView.cs
diff --git a/Opus/Code/UI/Views/Player.cs b/Opus/Code/UI/Views/Player.cs
index db58287..17253db 100644
--- a/Opus/Code/UI/Views/Player.cs
+++ b/Opus/Code/UI/Views/Player.cs
@@ -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;
diff --git a/Opus/Resources/Portable Class/PlayerBehavior.cs b/Opus/Code/UI/Views/PlayerBehavior.cs
similarity index 100%
rename from Opus/Resources/Portable Class/PlayerBehavior.cs
rename to Opus/Code/UI/Views/PlayerBehavior.cs
diff --git a/Opus/Code/UI/Views/SeekbarPreference.cs b/Opus/Code/UI/Views/SeekbarPreference.cs
index 89faa90..0de67f7 100644
--- a/Opus/Code/UI/Views/SeekbarPreference.cs
+++ b/Opus/Code/UI/Views/SeekbarPreference.cs
@@ -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;
diff --git a/Opus/Opus.csproj b/Opus/Opus.csproj
index d5fe692..0dce334 100644
--- a/Opus/Opus.csproj
+++ b/Opus/Opus.csproj
@@ -330,78 +330,73 @@
-
+
-
+
-
+
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
+
+
+
-
+
diff --git a/Opus/Resources/Portable Class/Folder.cs b/Opus/Resources/Portable Class/Folder.cs
deleted file mode 100644
index 7be97a8..0000000
--- a/Opus/Resources/Portable Class/Folder.cs
+++ /dev/null
@@ -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;
- }
- }
-}
\ No newline at end of file
diff --git a/Opus/Resources/Portable Class/Holder.cs b/Opus/Resources/Portable Class/Holder.cs
deleted file mode 100644
index 91c71c7..0000000
--- a/Opus/Resources/Portable Class/Holder.cs
+++ /dev/null
@@ -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(Resource.Id.reorder);
- textLayout = v.FindViewById(Resource.Id.textLayout);
- Title = v.FindViewById(Resource.Id.title);
- Artist = v.FindViewById(Resource.Id.artist);
- AlbumArt = v.FindViewById(Resource.Id.albumArt);
- youtubeIcon = v.FindViewById(Resource.Id.youtubeIcon);
- more = v.FindViewById(Resource.Id.moreButton);
- }
- }
-}
\ No newline at end of file
diff --git a/Opus/Resources/Portable Class/HomeChannelHolder.cs b/Opus/Resources/Portable Class/HomeChannelHolder.cs
deleted file mode 100644
index fad515a..0000000
--- a/Opus/Resources/Portable Class/HomeChannelHolder.cs
+++ /dev/null
@@ -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 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);
-
- itemView.Click += (sender, e) => listener(AdapterPosition);
- itemView.LongClick += (sender, e) => longListener(AdapterPosition);
- }
- }
-}
\ No newline at end of file
diff --git a/Opus/Resources/Portable Class/HomeMultipleSong.cs b/Opus/Resources/Portable Class/HomeMultipleSong.cs
deleted file mode 100644
index 41216e0..0000000
--- a/Opus/Resources/Portable Class/HomeMultipleSong.cs
+++ /dev/null
@@ -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 listener, Action longListener) : base(itemView)
- {
- Title = itemView.FindViewById(Resource.Id.title);
- Artist = itemView.FindViewById(Resource.Id.artist);
- AlbumArt = itemView.FindViewById(Resource.Id.albumArt);
- more = itemView.FindViewById(Resource.Id.moreButton);
-
- itemView.Click += (sender, e) => listener(AdapterPosition);
- itemView.LongClick += (sender, e) => longListener(AdapterPosition);
- }
- }
-}
\ No newline at end of file
diff --git a/Opus/Resources/Portable Class/PaddingChange.cs b/Opus/Resources/Portable Class/PaddingChange.cs
deleted file mode 100644
index 92b2e2e..0000000
--- a/Opus/Resources/Portable Class/PaddingChange.cs
+++ /dev/null
@@ -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;
- }
- }
-}
\ No newline at end of file