mirror of
https://github.com/zoriya/Opus.git
synced 2025-12-06 06:26:15 +00:00
Solving critical bugs with empty playlists.
This commit is contained in:
@@ -526,6 +526,8 @@ namespace MusicApp
|
||||
searchView.Iconified = true;
|
||||
searchView.SetQuery("", false);
|
||||
SupportActionBar.SetDisplayHomeAsUpEnabled(false);
|
||||
|
||||
SupportFragmentManager.PopBackStack(null, Android.Support.V4.App.FragmentManager.PopBackStackInclusive);
|
||||
}
|
||||
|
||||
if (PlaylistTracks.instance != null)
|
||||
|
||||
@@ -860,6 +860,9 @@
|
||||
<SubType>Designer</SubType>
|
||||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\SmallEmptyView.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
<Import Project="..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.25.4.0.2\build\MonoAndroid70\Xamarin.Android.Support.Animated.Vector.Drawable.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.25.4.0.2\build\MonoAndroid70\Xamarin.Android.Support.Animated.Vector.Drawable.targets')" />
|
||||
<Import Project="..\packages\Xamarin.Android.Support.v7.Preference.25.4.0.2\build\MonoAndroid70\Xamarin.Android.Support.v7.Preference.targets" Condition="Exists('..\packages\Xamarin.Android.Support.v7.Preference.25.4.0.2\build\MonoAndroid70\Xamarin.Android.Support.v7.Preference.targets')" />
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using Android.Graphics.Drawables;
|
||||
using Android.Support.V7.Widget;
|
||||
using Android.Support.V7.Widget.Helper;
|
||||
using Android.Widget;
|
||||
|
||||
namespace MusicApp.Resources.Portable_Class
|
||||
{
|
||||
@@ -17,7 +16,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
{
|
||||
get
|
||||
{
|
||||
if (PlaylistTracks.instance != null && !PlaylistTracks.instance.hasWriteAcess)
|
||||
if (PlaylistTracks.instance != null && (!PlaylistTracks.instance.hasWriteAcess || ((PlaylistTrackAdapter)adapter).IsEmpty))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -660,6 +660,9 @@ namespace MusicApp.Resources.Portable_Class
|
||||
nextPageToken = ytPlaylist.NextPageToken;
|
||||
}
|
||||
|
||||
if (songs.Count == 0)
|
||||
return;
|
||||
|
||||
if (MusicPlayer.isRunning)
|
||||
MusicPlayer.queue?.Clear();
|
||||
|
||||
@@ -701,6 +704,9 @@ namespace MusicApp.Resources.Portable_Class
|
||||
musicCursor.Close();
|
||||
}
|
||||
|
||||
if (tracksPath.Count == 0)
|
||||
return;
|
||||
|
||||
Intent intent = new Intent(Android.App.Application.Context, typeof(MusicPlayer));
|
||||
intent.PutStringArrayListExtra("files", tracksPath);
|
||||
intent.SetAction("RandomPlay");
|
||||
@@ -1004,7 +1010,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
void Unfork(int position, string playlistID)
|
||||
{
|
||||
AlertDialog dialog = new AlertDialog.Builder(MainActivity.instance, MainActivity.dialogTheme)
|
||||
.SetTitle(GetString(Resource.String.unfork_playlist, YoutubePlaylists[position].Name))
|
||||
.SetTitle(GetString(Resource.String.unfork_playlist, YoutubePlaylists[position - LocalPlaylists.Count].Name))
|
||||
.SetPositiveButton(Resource.String.yes, async (sender, e) =>
|
||||
{
|
||||
try
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
public event EventHandler<int> ItemClick;
|
||||
public event EventHandler<int> ItemLongClick;
|
||||
public int listPadding;
|
||||
private bool empty = false;
|
||||
public bool IsEmpty = false;
|
||||
|
||||
public PlaylistTrackAdapter(List<Song> songList)
|
||||
{
|
||||
@@ -53,7 +53,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
int count = songList.Count + (PlaylistTracks.instance.fullyLoadded ? 0 : 1) + (PlaylistTracks.instance.useHeader ? 0 : 1);
|
||||
if (count == 0 || (count == 1 && !PlaylistTracks.instance.useHeader))
|
||||
{
|
||||
empty = true;
|
||||
IsEmpty = true;
|
||||
count++;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
|
||||
public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
|
||||
{
|
||||
if(empty && position + 1 == ItemCount)
|
||||
if(IsEmpty && position + 1 == ItemCount)
|
||||
{
|
||||
((TextView)viewHolder.ItemView).Text = MainActivity.instance.GetString(Resource.String.playlist_empty);
|
||||
return;
|
||||
@@ -186,14 +186,14 @@ namespace MusicApp.Resources.Portable_Class
|
||||
}
|
||||
else
|
||||
{
|
||||
View itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.EmptyView, parent, false);
|
||||
View itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.SmallEmptyView, parent, false);
|
||||
return new EmptyHolder(itemView);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetItemViewType(int position)
|
||||
{
|
||||
if (empty && position + 1 == ItemCount)
|
||||
if (IsEmpty && position + 1 == ItemCount)
|
||||
return 3;
|
||||
|
||||
if (position == 0 && !PlaylistTracks.instance.useHeader)
|
||||
|
||||
@@ -41,7 +41,6 @@ namespace MusicApp.Resources.Portable_Class
|
||||
private bool forked;
|
||||
private string nextPageToken = null;
|
||||
public bool fullyLoadded = true;
|
||||
public bool isEmpty = false;
|
||||
public bool lastVisible = false;
|
||||
public bool useHeader = true;
|
||||
public bool navigating = false;
|
||||
@@ -766,6 +765,9 @@ namespace MusicApp.Resources.Portable_Class
|
||||
|
||||
public async void PlayInOrder(int fromPosition, bool useTransition)
|
||||
{
|
||||
if (tracks.Count < fromPosition)
|
||||
return;
|
||||
|
||||
if (YoutubeID != null && !Synced)
|
||||
{
|
||||
if (result != null && result.Count > fromPosition)
|
||||
|
||||
@@ -881,6 +881,9 @@ namespace MusicApp.Resources.Portable_Class
|
||||
nextPageToken = ytPlaylist.NextPageToken;
|
||||
}
|
||||
|
||||
if (tracks.Count == 0)
|
||||
return;
|
||||
|
||||
Random r = new Random();
|
||||
tracks = tracks.OrderBy(x => r.Next()).ToList();
|
||||
PlayFiles(tracks.ToArray());
|
||||
|
||||
21
MusicApp/Resources/Resource.Designer.cs
generated
21
MusicApp/Resources/Resource.Designer.cs
generated
@@ -6966,31 +6966,34 @@ namespace MusicApp
|
||||
public const int select_dialog_singlechoice_material = 2130903191;
|
||||
|
||||
// aapt resource value: 0x7f030098
|
||||
public const int smallLoading = 2130903192;
|
||||
public const int SmallEmptyView = 2130903192;
|
||||
|
||||
// aapt resource value: 0x7f030099
|
||||
public const int SongList = 2130903193;
|
||||
public const int smallLoading = 2130903193;
|
||||
|
||||
// aapt resource value: 0x7f03009a
|
||||
public const int SuggestionLayout = 2130903194;
|
||||
public const int SongList = 2130903194;
|
||||
|
||||
// aapt resource value: 0x7f03009b
|
||||
public const int support_simple_spinner_dropdown_item = 2130903195;
|
||||
public const int SuggestionLayout = 2130903195;
|
||||
|
||||
// aapt resource value: 0x7f03009c
|
||||
public const int tabs = 2130903196;
|
||||
public const int support_simple_spinner_dropdown_item = 2130903196;
|
||||
|
||||
// aapt resource value: 0x7f03009d
|
||||
public const int TimerLayout = 2130903197;
|
||||
public const int tabs = 2130903197;
|
||||
|
||||
// aapt resource value: 0x7f03009e
|
||||
public const int TwoLineLayout = 2130903198;
|
||||
public const int TimerLayout = 2130903198;
|
||||
|
||||
// aapt resource value: 0x7f03009f
|
||||
public const int ViewPager = 2130903199;
|
||||
public const int TwoLineLayout = 2130903199;
|
||||
|
||||
// aapt resource value: 0x7f0300a0
|
||||
public const int YtList = 2130903200;
|
||||
public const int ViewPager = 2130903200;
|
||||
|
||||
// aapt resource value: 0x7f0300a1
|
||||
public const int YtList = 2130903201;
|
||||
|
||||
static Layout()
|
||||
{
|
||||
|
||||
9
MusicApp/Resources/layout/SmallEmptyView.xml
Normal file
9
MusicApp/Resources/layout/SmallEmptyView.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<TextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:gravity="center"
|
||||
android:textSize="16dip"
|
||||
android:paddingTop="50dp"
|
||||
android:paddingBottom="50dp"/>
|
||||
Reference in New Issue
Block a user