mirror of
https://github.com/zoriya/Opus.git
synced 2025-12-06 06:26:15 +00:00
Folders browsing done
This commit is contained in:
@@ -10,6 +10,8 @@ using Android.Runtime;
|
||||
using Android.Widget;
|
||||
using Android.Content;
|
||||
|
||||
using SearchView = Android.Support.V7.Widget.SearchView;
|
||||
|
||||
namespace MusicApp
|
||||
{
|
||||
[Activity(Label = "MusicApp", MainLauncher = true, Icon = "@drawable/MusicIcon", Theme = "@style/Theme")]
|
||||
@@ -35,7 +37,6 @@ namespace MusicApp
|
||||
ToolBar = (Android.Support.V7.Widget.Toolbar) FindViewById(Resource.Id.toolbar);
|
||||
SetSupportActionBar(ToolBar);
|
||||
SupportActionBar.Title = "MusicApp";
|
||||
HideTabs();
|
||||
}
|
||||
|
||||
public override bool OnCreateOptionsMenu(IMenu menu)
|
||||
@@ -66,72 +67,58 @@ namespace MusicApp
|
||||
Navigate(Resource.Id.playlistLayout);
|
||||
}
|
||||
}
|
||||
else if(item.ItemId == Resource.Id.search)
|
||||
{
|
||||
var searchItem = MenuItemCompat.GetActionView(item);
|
||||
var searchView = searchItem.JavaCast<Android.Support.V7.Widget.SearchView>();
|
||||
|
||||
searchView.QueryTextChange += Search;
|
||||
|
||||
searchView.QueryTextSubmit += (s, e) =>
|
||||
{
|
||||
if (DownloadList.instance != null)
|
||||
DownloadList.instance.Search(e.Query);
|
||||
|
||||
e.Handled = true;
|
||||
};
|
||||
}
|
||||
else if(item.ItemId == Resource.Id.settings)
|
||||
{
|
||||
//HideTabs();
|
||||
//SupportActionBar.SetDisplayHomeAsUpEnabled(true);
|
||||
//FindViewById<BottomNavigationView>(Resource.Id.bottomView).Visibility = ViewStates.Gone;
|
||||
//SupportFragmentManager.BeginTransaction().Replace(Resource.Id.contentView, fragment).AddToBackStack(null).Commit();
|
||||
|
||||
//FragmentTransaction transaction = FragmentManager.BeginTransaction();
|
||||
//transaction.Replace(Resource.Id.contentView, fragment);
|
||||
//transaction.AddToBackStack(null);
|
||||
//transaction.Commit();
|
||||
|
||||
Intent intent = new Intent(Android.App.Application.Context, typeof(Preferences));
|
||||
Intent intent = new Intent(Application.Context, typeof(Preferences));
|
||||
StartActivity(intent);
|
||||
//startActivity(mainIntent);
|
||||
}
|
||||
return base.OnOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
public void CreateSearch(int requestID)
|
||||
void Search(object sender, SearchView.QueryTextChangeEventArgs e)
|
||||
{
|
||||
var item = menu.FindItem(Resource.Id.search);
|
||||
item.SetVisible(true);
|
||||
var searchItem = MenuItemCompat.GetActionView(item);
|
||||
var searchView = searchItem.JavaCast<Android.Support.V7.Widget.SearchView>();
|
||||
|
||||
if (requestID == 0)
|
||||
searchView.QueryTextChange += (s, e) =>
|
||||
{
|
||||
if(Browse.instance != null)
|
||||
Browse.instance.Search(e.NewText);
|
||||
};
|
||||
if (requestID == 1)
|
||||
searchView.QueryTextChange += (s, e) =>
|
||||
{
|
||||
if(PlaylistTracks.instance != null)
|
||||
PlaylistTracks.instance.Search(e.NewText);
|
||||
};
|
||||
if (requestID == 2)
|
||||
searchView.QueryTextSubmit += (s, e) =>
|
||||
{
|
||||
if(DownloadList.instance != null)
|
||||
DownloadList.instance.Search(e.Query);
|
||||
};
|
||||
|
||||
searchView.QueryTextSubmit += (s, e) =>
|
||||
{
|
||||
e.Handled = true;
|
||||
};
|
||||
if (Browse.instance != null)
|
||||
Browse.instance.Search(e.NewText);
|
||||
if (PlaylistTracks.instance != null)
|
||||
PlaylistTracks.instance.Search(e.NewText);
|
||||
if (PlaylistTracks.instance != null)
|
||||
PlaylistTracks.instance.Search(e.NewText);
|
||||
if (FolderTracks.instance != null)
|
||||
FolderTracks.instance.Search(e.NewText);
|
||||
}
|
||||
|
||||
public void RemoveSearchService(int requestID)
|
||||
void HideSearch()
|
||||
{
|
||||
if (menu == null)
|
||||
return;
|
||||
|
||||
var item = menu.FindItem(Resource.Id.search);
|
||||
item.SetVisible(false);
|
||||
var searchItem = MenuItemCompat.GetActionView(item);
|
||||
var searchView = searchItem.JavaCast<Android.Support.V7.Widget.SearchView>();
|
||||
|
||||
searchView.ClearFocus();
|
||||
}
|
||||
|
||||
if (requestID == 0)
|
||||
searchView.QueryTextChange -= (s, e) => Browse.instance.Search(e.NewText);
|
||||
if (requestID == 1)
|
||||
searchView.QueryTextChange -= (s, e) => PlaylistTracks.instance.Search(e.NewText);
|
||||
if (requestID == 2)
|
||||
searchView.QueryTextSubmit -= (s, e) => DownloadList.instance.Search(e.Query);
|
||||
public void DisplaySearch()
|
||||
{
|
||||
var item = menu.FindItem(Resource.Id.search);
|
||||
item.SetVisible(true);
|
||||
}
|
||||
|
||||
private void PreNavigate(object sender, BottomNavigationView.NavigationItemSelectedEventArgs e)
|
||||
@@ -146,20 +133,24 @@ namespace MusicApp
|
||||
{
|
||||
case Resource.Id.musicLayout:
|
||||
HideTabs();
|
||||
HideSearch();
|
||||
fragment = Queue.NewInstance();
|
||||
break;
|
||||
|
||||
case Resource.Id.browseLayout:
|
||||
SetTabs();
|
||||
DisplaySearch();
|
||||
break;
|
||||
|
||||
case Resource.Id.downloadLayout:
|
||||
HideTabs();
|
||||
DisplaySearch();
|
||||
fragment = DownloadList.NewInstance();
|
||||
break;
|
||||
|
||||
case Resource.Id.playlistLayout:
|
||||
HideTabs();
|
||||
HideSearch();
|
||||
fragment = Playlist.NewInstance();
|
||||
break;
|
||||
}
|
||||
@@ -192,10 +183,9 @@ namespace MusicApp
|
||||
|
||||
pager.Adapter = adapter;
|
||||
tabs.SetupWithViewPager(pager);
|
||||
//tabs.TabSelected += (sender, e) => { Console.WriteLine("Clicked"); pager.SetCurrentItem(e.Tab.Position, true); };
|
||||
}
|
||||
|
||||
void HideTabs()
|
||||
public void HideTabs()
|
||||
{
|
||||
TabLayout tabs = FindViewById<TabLayout>(Resource.Id.tabs);
|
||||
tabs.RemoveAllTabs();
|
||||
|
||||
@@ -148,6 +148,7 @@
|
||||
<Compile Include="Resources\Portable Class\DownloadList.cs" />
|
||||
<Compile Include="Resources\Portable Class\FolderAdapter.cs" />
|
||||
<Compile Include="Resources\Portable Class\FolderBrowse.cs" />
|
||||
<Compile Include="Resources\Portable Class\FolderTracks.cs" />
|
||||
<Compile Include="Resources\Portable Class\MusicPlayer.cs" />
|
||||
<Compile Include="Resources\Portable Class\Playlist.cs" />
|
||||
<Compile Include="Resources\Portable Class\PlaylistTracks.cs" />
|
||||
@@ -323,6 +324,9 @@
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\TwoLineLayout.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\PreferenceToolbar.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -43,13 +43,12 @@ namespace MusicApp.Resources.Portable_Class
|
||||
emptyView = LayoutInflater.Inflate(Resource.Layout.NoSong, null);
|
||||
ListView.EmptyView = emptyView;
|
||||
|
||||
GetStoragePermission();
|
||||
InitialiseSearchService();
|
||||
if(ListView.Adapter == null)
|
||||
GetStoragePermission();
|
||||
}
|
||||
|
||||
public override void OnDestroy()
|
||||
{
|
||||
MainActivity.instance.RemoveSearchService(0);
|
||||
if (isEmpty)
|
||||
{
|
||||
ViewGroup rootView = Activity.FindViewById<ViewGroup>(Android.Resource.Id.Content);
|
||||
@@ -75,12 +74,6 @@ namespace MusicApp.Resources.Portable_Class
|
||||
return instance;
|
||||
}
|
||||
|
||||
private void InitialiseSearchService()
|
||||
{
|
||||
HasOptionsMenu = true;
|
||||
MainActivity.instance.CreateSearch(0);
|
||||
}
|
||||
|
||||
void GetStoragePermission()
|
||||
{
|
||||
const string permission = Manifest.Permission.ReadExternalStorage;
|
||||
@@ -231,7 +224,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
context.StartService(intent);
|
||||
}
|
||||
|
||||
public void GetPlaylist(Song item)
|
||||
public static void GetPlaylist(Song item)
|
||||
{
|
||||
List<string> playList = new List<string>();
|
||||
List<long> playListId = new List<long>();
|
||||
@@ -266,14 +259,14 @@ namespace MusicApp.Resources.Portable_Class
|
||||
builder.Show();
|
||||
}
|
||||
|
||||
public void AddToPlaylist(Song item, string playList, long playlistID)
|
||||
public static void AddToPlaylist(Song item, string playList, long playlistID)
|
||||
{
|
||||
if (playList == "Create a playlist")
|
||||
CreatePlalistDialog();
|
||||
|
||||
else
|
||||
{
|
||||
ContentResolver resolver = Activity.ContentResolver;
|
||||
ContentResolver resolver = act.ContentResolver;
|
||||
ContentValues value = new ContentValues();
|
||||
value.Put(MediaStore.Audio.Playlists.Members.AudioId, item.GetID());
|
||||
value.Put(MediaStore.Audio.Playlists.InterfaceConsts.Id, playlistID);
|
||||
@@ -282,9 +275,9 @@ namespace MusicApp.Resources.Portable_Class
|
||||
}
|
||||
}
|
||||
|
||||
public void CreatePlalistDialog()
|
||||
public static void CreatePlalistDialog()
|
||||
{
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(Activity, Resource.Style.AppCompatAlertDialogStyle);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(act, Resource.Style.AppCompatAlertDialogStyle);
|
||||
builder.SetTitle("Playlist name");
|
||||
View view = inflater.Inflate(Resource.Layout.CreatePlaylistDialog, null);
|
||||
builder.SetView(view);
|
||||
@@ -296,9 +289,9 @@ namespace MusicApp.Resources.Portable_Class
|
||||
builder.Show();
|
||||
}
|
||||
|
||||
public void CreatePlaylist(string name)
|
||||
public static void CreatePlaylist(string name)
|
||||
{
|
||||
ContentResolver resolver = Activity.ContentResolver;
|
||||
ContentResolver resolver = act.ContentResolver;
|
||||
Android.Net.Uri uri = MediaStore.Audio.Playlists.ExternalContentUri;
|
||||
ContentValues value = new ContentValues();
|
||||
value.Put(MediaStore.Audio.Playlists.InterfaceConsts.Name, name);
|
||||
|
||||
@@ -42,8 +42,6 @@ namespace MusicApp.Resources.Portable_Class
|
||||
ListView.ItemLongClick += ListView_ItemLongClick; ;
|
||||
ListAdapter = null;
|
||||
Activity.AddContentView(emptyView, View.LayoutParameters);
|
||||
|
||||
InitialiseSearchService();
|
||||
}
|
||||
|
||||
public override void OnDestroy()
|
||||
@@ -55,12 +53,6 @@ namespace MusicApp.Resources.Portable_Class
|
||||
}
|
||||
base.OnDestroy();
|
||||
instance = null;
|
||||
MainActivity.instance.RemoveSearchService(2);
|
||||
}
|
||||
|
||||
private void InitialiseSearchService()
|
||||
{
|
||||
MainActivity.instance.CreateSearch(2);
|
||||
}
|
||||
|
||||
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
|
||||
@@ -11,6 +11,7 @@ using Android.Support.Design.Widget;
|
||||
using Android.Views;
|
||||
using Android.Content.PM;
|
||||
using Android.Support.V4.App;
|
||||
using Android.Support.V7.App;
|
||||
|
||||
namespace MusicApp.Resources.Portable_Class
|
||||
{
|
||||
@@ -37,7 +38,8 @@ namespace MusicApp.Resources.Portable_Class
|
||||
emptyView = LayoutInflater.Inflate(Resource.Layout.NoSong, null);
|
||||
ListView.EmptyView = emptyView;
|
||||
|
||||
GetStoragePermission();
|
||||
if(ListView.Adapter == null)
|
||||
GetStoragePermission();
|
||||
}
|
||||
|
||||
public override void OnDestroy()
|
||||
@@ -146,16 +148,17 @@ namespace MusicApp.Resources.Portable_Class
|
||||
|
||||
}
|
||||
|
||||
void ListSongs(string paths)
|
||||
void ListSongs(string path)
|
||||
{
|
||||
//AppCompatActivity act = (AppCompatActivity)Activity;
|
||||
//act.SupportActionBar.SetHomeButtonEnabled(true);
|
||||
//act.SupportActionBar.SetDisplayHomeAsUpEnabled(true);
|
||||
//act.SupportActionBar.Title = playList[e.Position];
|
||||
//FragmentTransaction transaction = FragmentManager.BeginTransaction();
|
||||
//transaction.Replace(Resource.Id.contentView, PlaylistTracks.NewInstance(playlistId[e.Position]));
|
||||
//transaction.AddToBackStack(null);
|
||||
//transaction.Commit();
|
||||
AppCompatActivity act = (AppCompatActivity)Activity;
|
||||
act.SupportActionBar.SetHomeButtonEnabled(true);
|
||||
act.SupportActionBar.SetDisplayHomeAsUpEnabled(true);
|
||||
act.SupportActionBar.Title = path;
|
||||
MainActivity.instance.HideTabs();
|
||||
FragmentTransaction transaction = FragmentManager.BeginTransaction();
|
||||
transaction.Replace(Resource.Id.contentView, FolderTracks.NewInstance(path));
|
||||
transaction.AddToBackStack(null);
|
||||
transaction.Commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
160
MusicApp/Resources/Portable Class/FolderTracks.cs
Normal file
160
MusicApp/Resources/Portable Class/FolderTracks.cs
Normal file
@@ -0,0 +1,160 @@
|
||||
using Android.Content;
|
||||
using Android.OS;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using MusicApp.Resources.values;
|
||||
using Android.Support.V4.App;
|
||||
using System.Collections.Generic;
|
||||
using Android.Provider;
|
||||
using Android.Database;
|
||||
using Android.Content.PM;
|
||||
using Android.Support.Design.Widget;
|
||||
using Android;
|
||||
using Android.Net;
|
||||
using Android.Support.V7.App;
|
||||
|
||||
namespace MusicApp.Resources.Portable_Class
|
||||
{
|
||||
public class FolderTracks : ListFragment
|
||||
{
|
||||
public static FolderTracks instance;
|
||||
public Adapter adapter;
|
||||
public View emptyView;
|
||||
public bool isEmpty = false;
|
||||
public string path;
|
||||
|
||||
private List<Song> tracks = new List<Song>();
|
||||
private string[] actions = new string[] { "Play", "Play Next", "Play Last", "Add To Playlist" };
|
||||
|
||||
|
||||
public override void OnActivityCreated(Bundle savedInstanceState)
|
||||
{
|
||||
base.OnActivityCreated(savedInstanceState);
|
||||
emptyView = LayoutInflater.Inflate(Resource.Layout.NoPlaylist, null);
|
||||
ListView.EmptyView = emptyView;
|
||||
ListAdapter = adapter;
|
||||
|
||||
PopulateList();
|
||||
MainActivity.instance.DisplaySearch();
|
||||
}
|
||||
|
||||
public override void OnDestroy()
|
||||
{
|
||||
instance = null;
|
||||
base.OnDestroy();
|
||||
}
|
||||
|
||||
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
View view = base.OnCreateView(inflater, container, savedInstanceState);
|
||||
view.SetPadding(0, 100, 0, 100);
|
||||
return view;
|
||||
}
|
||||
|
||||
public static Fragment NewInstance(string path)
|
||||
{
|
||||
instance = new FolderTracks { Arguments = new Bundle() };
|
||||
instance.path = path;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void PopulateList()
|
||||
{
|
||||
Uri musicUri = MediaStore.Audio.Media.GetContentUriForPath(path);
|
||||
|
||||
CursorLoader cursorLoader = new CursorLoader(Android.App.Application.Context, 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";
|
||||
|
||||
tracks.Add(new Song(Title, Artist, Album, AlbumArt, id, path));
|
||||
}
|
||||
while (musicCursor.MoveToNext());
|
||||
musicCursor.Close();
|
||||
}
|
||||
|
||||
adapter = new Adapter(Android.App.Application.Context, Resource.Layout.SongList, tracks);
|
||||
ListAdapter = adapter;
|
||||
ListView.TextFilterEnabled = true;
|
||||
ListView.ItemClick += ListView_ItemClick;
|
||||
ListView.ItemLongClick += ListView_ItemLongClick;
|
||||
|
||||
if (adapter == null || adapter.Count == 0)
|
||||
{
|
||||
isEmpty = true;
|
||||
Activity.AddContentView(emptyView, View.LayoutParameters);
|
||||
}
|
||||
}
|
||||
|
||||
public void Search(string search)
|
||||
{
|
||||
List<Song> result = new List<Song>();
|
||||
foreach (Song item in tracks)
|
||||
{
|
||||
if (item.GetName().ToLower().Contains(search.ToLower()) || item.GetArtist().ToLower().Contains(search.ToLower()))
|
||||
{
|
||||
result.Add(item);
|
||||
}
|
||||
}
|
||||
ListAdapter = new Adapter(Android.App.Application.Context, Resource.Layout.SongList, result);
|
||||
}
|
||||
|
||||
private void ListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
|
||||
{
|
||||
Browse.act = Activity;
|
||||
Browse.Play(tracks[e.Position]);
|
||||
}
|
||||
|
||||
private void ListView_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e)
|
||||
{
|
||||
Browse.act = Activity;
|
||||
Browse.inflater = LayoutInflater;
|
||||
Song item = tracks[e.Position];
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(Activity, Resource.Style.AppCompatAlertDialogStyle);
|
||||
builder.SetTitle("Pick an action");
|
||||
builder.SetItems(actions, (senderAlert, args) =>
|
||||
{
|
||||
switch (args.Which)
|
||||
{
|
||||
case 0:
|
||||
Browse.Play(item);
|
||||
break;
|
||||
case 1:
|
||||
Browse.PlayNext(item);
|
||||
break;
|
||||
case 2:
|
||||
Browse.PlayLast(item);
|
||||
break;
|
||||
case 3:
|
||||
Browse.GetPlaylist(item);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
builder.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,8 @@ namespace MusicApp.Resources.Portable_Class
|
||||
emptyView = LayoutInflater.Inflate(Resource.Layout.NoPlaylist, null);
|
||||
ListView.EmptyView = emptyView;
|
||||
|
||||
GetStoragePermission();
|
||||
if(ListView.Adapter == null)
|
||||
GetStoragePermission();
|
||||
}
|
||||
|
||||
public override void OnDestroy()
|
||||
|
||||
@@ -34,21 +34,33 @@ namespace MusicApp.Resources.Portable_Class
|
||||
ListView.EmptyView = emptyView;
|
||||
ListAdapter = adapter;
|
||||
|
||||
InitialiseSearchService();
|
||||
PopulateList();
|
||||
MainActivity.instance.DisplaySearch();
|
||||
}
|
||||
|
||||
public override void OnDestroy()
|
||||
{
|
||||
instance = null;
|
||||
MainActivity.instance.RemoveSearchService(1);
|
||||
if(isEmpty)
|
||||
{
|
||||
ViewGroup rootView = Activity.FindViewById<ViewGroup>(Android.Resource.Id.Content);
|
||||
rootView.RemoveView(emptyView);
|
||||
}
|
||||
|
||||
ActionBar toolbar = MainActivity.instance.SupportActionBar;
|
||||
if (toolbar != null)
|
||||
{
|
||||
toolbar.Title = "MusicApp";
|
||||
toolbar.SetDisplayHomeAsUpEnabled(false);
|
||||
}
|
||||
|
||||
base.OnDestroy();
|
||||
instance = null;
|
||||
}
|
||||
|
||||
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
View view = base.OnCreateView(inflater, container, savedInstanceState);
|
||||
view.SetPadding(0, 100, 0, 0);
|
||||
view.SetPadding(0, 100, 0, 100);
|
||||
return view;
|
||||
}
|
||||
|
||||
@@ -59,11 +71,6 @@ namespace MusicApp.Resources.Portable_Class
|
||||
return instance;
|
||||
}
|
||||
|
||||
private void InitialiseSearchService()
|
||||
{
|
||||
MainActivity.instance.CreateSearch(1);
|
||||
}
|
||||
|
||||
void PopulateList()
|
||||
{
|
||||
Uri musicUri = MediaStore.Audio.Playlists.Members.GetContentUri("external", playlistId);
|
||||
@@ -130,6 +137,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
private void ListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
|
||||
{
|
||||
Browse.act = Activity;
|
||||
Browse.Play(tracks[e.Position]);
|
||||
}
|
||||
|
||||
private void ListView_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e)
|
||||
|
||||
@@ -11,6 +11,7 @@ using Android.Content;
|
||||
using Android.App;
|
||||
|
||||
using AlertDialog = Android.Support.V7.App.AlertDialog;
|
||||
using Toolbar = Android.Support.V7.Widget.Toolbar;
|
||||
|
||||
namespace MusicApp.Resources.Portable_Class
|
||||
{
|
||||
@@ -22,6 +23,16 @@ namespace MusicApp.Resources.Portable_Class
|
||||
base.OnCreate(savedInstanceState);
|
||||
FragmentManager.BeginTransaction().Replace(Android.Resource.Id.Content, new PreferencesFragment()).Commit();
|
||||
}
|
||||
|
||||
protected override void OnPostCreate(Bundle savedInstanceState)
|
||||
{
|
||||
base.OnPostCreate(savedInstanceState);
|
||||
LinearLayout root = (LinearLayout) FindViewById(Android.Resource.Id.List).Parent.Parent.Parent;
|
||||
Toolbar toolbar = (Toolbar) LayoutInflater.From(this).Inflate(Resource.Layout.PreferenceToolbar, root, false);
|
||||
root.AddView(toolbar, 0);
|
||||
toolbar.Title = "Settings";
|
||||
toolbar.NavigationClick += (sender, e) => { Finish(); };
|
||||
}
|
||||
}
|
||||
|
||||
public class PreferencesFragment : PreferenceFragment
|
||||
@@ -51,6 +62,13 @@ namespace MusicApp.Resources.Portable_Class
|
||||
instance = null;
|
||||
}
|
||||
|
||||
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
View view = base.OnCreateView(inflater, container, savedInstanceState);
|
||||
view.SetPadding(0, 100, 0, 0);
|
||||
return view;
|
||||
}
|
||||
|
||||
private void Pref_PreferenceClick(object sender, Preference.PreferenceClickEventArgs e)
|
||||
{
|
||||
folders = ListFolders();
|
||||
|
||||
21
MusicApp/Resources/Resource.Designer.cs
generated
21
MusicApp/Resources/Resource.Designer.cs
generated
@@ -3260,31 +3260,34 @@ namespace MusicApp
|
||||
public const int Preferences = 2130903119;
|
||||
|
||||
// aapt resource value: 0x7f030050
|
||||
public const int search_layout = 2130903120;
|
||||
public const int PreferenceToolbar = 2130903120;
|
||||
|
||||
// aapt resource value: 0x7f030051
|
||||
public const int select_dialog_item_material = 2130903121;
|
||||
public const int search_layout = 2130903121;
|
||||
|
||||
// aapt resource value: 0x7f030052
|
||||
public const int select_dialog_multichoice_material = 2130903122;
|
||||
public const int select_dialog_item_material = 2130903122;
|
||||
|
||||
// aapt resource value: 0x7f030053
|
||||
public const int select_dialog_singlechoice_material = 2130903123;
|
||||
public const int select_dialog_multichoice_material = 2130903123;
|
||||
|
||||
// aapt resource value: 0x7f030054
|
||||
public const int SongList = 2130903124;
|
||||
public const int select_dialog_singlechoice_material = 2130903124;
|
||||
|
||||
// aapt resource value: 0x7f030055
|
||||
public const int support_simple_spinner_dropdown_item = 2130903125;
|
||||
public const int SongList = 2130903125;
|
||||
|
||||
// aapt resource value: 0x7f030056
|
||||
public const int tabs = 2130903126;
|
||||
public const int support_simple_spinner_dropdown_item = 2130903126;
|
||||
|
||||
// aapt resource value: 0x7f030057
|
||||
public const int TimerLayout = 2130903127;
|
||||
public const int tabs = 2130903127;
|
||||
|
||||
// aapt resource value: 0x7f030058
|
||||
public const int TwoLineLayout = 2130903128;
|
||||
public const int TimerLayout = 2130903128;
|
||||
|
||||
// aapt resource value: 0x7f030059
|
||||
public const int TwoLineLayout = 2130903129;
|
||||
|
||||
static Layout()
|
||||
{
|
||||
|
||||
11
MusicApp/Resources/layout/PreferenceToolbar.xml
Normal file
11
MusicApp/Resources/layout/PreferenceToolbar.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<android.support.v7.widget.Toolbar
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:navigationIcon="?attr/homeAsUpIndicator"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
||||
Reference in New Issue
Block a user