mirror of
https://github.com/zoriya/Opus.git
synced 2026-06-02 06:05:01 +00:00
Solving queue clear bugs and preference theme bugs.
This commit is contained in:
@@ -474,6 +474,9 @@ namespace MusicApp
|
||||
|
||||
public bool OnMenuItemActionCollapse(IMenuItem item) //Youtube search collapse
|
||||
{
|
||||
if (YoutubeEngine.instances == null)
|
||||
return true;
|
||||
|
||||
if(Browse.instance != null)
|
||||
{
|
||||
ViewGroup rootView = FindViewById<ViewGroup>(Android.Resource.Id.Content);
|
||||
@@ -494,7 +497,10 @@ namespace MusicApp
|
||||
}
|
||||
rootView.RemoveView(YoutubeEngine.loadingView);
|
||||
YoutubeEngine.instances = null;
|
||||
HideTabs();
|
||||
SupportFragmentManager.PopBackStack();
|
||||
if (Home.instance != null)
|
||||
ShowQuickPlay();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,10 @@ namespace MusicApp.Resources.Portable_Class
|
||||
folders = ListFolders();
|
||||
ListView.SetPadding(0, Preferences.instance.toolbar.Height, 0, 0);
|
||||
adapter = new FolderAdapter(Application.Context, Resource.Layout.folderList, folders);
|
||||
if (path != null)
|
||||
adapter.selectedPosition = folders.FindIndex(x => x.uri == path);
|
||||
else
|
||||
adapter.selectedPosition = -1;
|
||||
ListView.Divider = null;
|
||||
ListView.ItemClick += ListView_ItemClick;
|
||||
ListView.TextFilterEnabled = true;
|
||||
@@ -33,9 +37,10 @@ namespace MusicApp.Resources.Portable_Class
|
||||
ListAdapter = adapter;
|
||||
}
|
||||
|
||||
public static Fragment NewInstance()
|
||||
public static Fragment NewInstance(string path)
|
||||
{
|
||||
instance = new DownloadFragment { Arguments = new Bundle() };
|
||||
instance.path = path;
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
@@ -1159,7 +1159,6 @@ namespace MusicApp.Resources.Portable_Class
|
||||
{
|
||||
isRunning = false;
|
||||
title = null;
|
||||
queue?.Clear();
|
||||
parsing = false;
|
||||
currentID = -1;
|
||||
progress = 0;
|
||||
|
||||
@@ -50,6 +50,10 @@ namespace MusicApp.Resources.Portable_Class
|
||||
ISharedPreferencesEditor editor = prefManager.Edit();
|
||||
editor.PutString("downloadPath", DownloadFragment.instance.path);
|
||||
editor.Apply();
|
||||
Preference downloadPref = PreferencesFragment.instance.PreferenceScreen.FindPreference("downloadPath");
|
||||
downloadPref.Summary = DownloadFragment.instance.path ?? "not set";
|
||||
PreferencesFragment.instance.path = DownloadFragment.instance.path;
|
||||
|
||||
DownloadFragment.instance = null;
|
||||
FragmentManager.PopBackStack();
|
||||
}
|
||||
@@ -66,6 +70,18 @@ namespace MusicApp.Resources.Portable_Class
|
||||
editor.Apply();
|
||||
TopicSelector.instance = null;
|
||||
FragmentManager.PopBackStack();
|
||||
|
||||
Preference topicPreference = PreferencesFragment.instance.PreferenceScreen.FindPreference("topics");
|
||||
if (topics.Count == 0)
|
||||
topicPreference.Summary = "Actually nothing";
|
||||
else if (topics.Count == 1)
|
||||
topicPreference.Summary = topics[0].Substring(0, topics[0].IndexOf("/#-#/"));
|
||||
else if (topics.Count == 2)
|
||||
topicPreference.Summary = topics[0].Substring(0, topics[0].IndexOf("/#-#/")) + " and " + topics[1].Substring(0, topics[1].IndexOf("/#-#/"));
|
||||
else if (topics.Count == 3)
|
||||
topicPreference.Summary = topics[0].Substring(0, topics[0].IndexOf("/#-#/")) + ", " + topics[1].Substring(0, topics[1].IndexOf("/#-#/")) + " and " + topics[2].Substring(0, topics[2].IndexOf("/#-#/"));
|
||||
else if (topics.Count > 3)
|
||||
topicPreference.Summary = topics[0].Substring(0, topics[0].IndexOf("/#-#/")) + ", " + topics[1].Substring(0, topics[1].IndexOf("/#-#/")) + ", " + topics[2].Substring(0, topics[2].IndexOf("/#-#/")) + " and more.";
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -108,6 +124,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
public class PreferencesFragment : PreferenceFragment
|
||||
{
|
||||
public static PreferencesFragment instance;
|
||||
public string path;
|
||||
private View view;
|
||||
|
||||
//Local Shortcut
|
||||
@@ -142,6 +159,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
Preference downloadPref = PreferenceScreen.FindPreference("downloadPath");
|
||||
downloadPref.PreferenceClick += DownloadClick;
|
||||
downloadPref.Summary = prefManager.GetString("downloadPath", "not set");
|
||||
path = prefManager.GetString("downloadPath", null);
|
||||
|
||||
//Skip Exist Verification
|
||||
Preference skipExistVerification = PreferenceScreen.FindPreference("skipExistVerification");
|
||||
@@ -219,7 +237,6 @@ namespace MusicApp.Resources.Portable_Class
|
||||
private void TopicPreference(object sender, Preference.PreferenceClickEventArgs e)
|
||||
{
|
||||
FragmentManager.BeginTransaction().Replace(Android.Resource.Id.Content, TopicSelector.NewInstance()).AddToBackStack(null).Commit();
|
||||
instance = null;
|
||||
Preferences.instance.toolbar.Title = "Music Genres";
|
||||
}
|
||||
#endregion
|
||||
@@ -227,8 +244,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
#region Download location
|
||||
private void DownloadClick(object sender, Preference.PreferenceClickEventArgs e)
|
||||
{
|
||||
FragmentManager.BeginTransaction().Replace(Android.Resource.Id.Content, DownloadFragment.NewInstance()).AddToBackStack(null).Commit();
|
||||
instance = null;
|
||||
FragmentManager.BeginTransaction().Replace(Android.Resource.Id.Content, DownloadFragment.NewInstance(path)).AddToBackStack(null).Commit();
|
||||
Preferences.instance.toolbar.Title = "Download Location";
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -81,9 +81,10 @@ namespace MusicApp.Resources.Portable_Class
|
||||
{
|
||||
try
|
||||
{
|
||||
using (WebClient client = new WebClient { Encoding = System.Text.Encoding.UTF8 })
|
||||
using (WebClient client = new WebClient { Encoding = System.Text.Encoding.Unicode })
|
||||
{
|
||||
string json = client.DownloadString("http://suggestqueries.google.com/complete/search?client=youtube&ds=yt&client=firefox&q=" + e.NewText);
|
||||
client.Headers.Add(HttpRequestHeader.AcceptCharset, "UTF-8");
|
||||
string json = client.DownloadString("http://suggestqueries.google.com/complete/search?client=youtube&ds=yt&client=firefox&q=" + WebUtility.HtmlEncode(e.NewText));
|
||||
json = json.Substring(4 + e.NewText.Length);
|
||||
json = json.Remove(json.Length - 1);
|
||||
System.Console.WriteLine("&" + json);
|
||||
|
||||
Reference in New Issue
Block a user