mirror of
https://github.com/zoriya/Opus.git
synced 2025-12-06 06:26:15 +00:00
adding tabs
This commit is contained in:
@@ -146,6 +146,7 @@
|
||||
<Compile Include="Resources\Portable Class\Browse.cs" />
|
||||
<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\MusicPlayer.cs" />
|
||||
<Compile Include="Resources\Portable Class\Playlist.cs" />
|
||||
<Compile Include="Resources\Portable Class\PlaylistTracks.cs" />
|
||||
@@ -316,6 +317,11 @@
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\ic_expand_more_black_24dp.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\tabs.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -8,14 +8,20 @@ using MusicApp.Resources.values;
|
||||
using Android.Content;
|
||||
using Android;
|
||||
using Android.Support.Design.Widget;
|
||||
using Android.Support.V7.Widget;
|
||||
using Android.Views;
|
||||
using Android.Content.PM;
|
||||
using Android.Support.V4.App;
|
||||
using Android.Support.V4.View;
|
||||
using Android.Support.V7.App;
|
||||
using Android.Support.V4.Widget;
|
||||
using Android.Runtime;
|
||||
using System;
|
||||
using Java.Lang;
|
||||
|
||||
namespace MusicApp.Resources.Portable_Class
|
||||
{
|
||||
public class Browse : ListFragment//, ActionBar.ITabListener
|
||||
public class Browse : ListFragment
|
||||
{
|
||||
public static Browse instance;
|
||||
public static Context act;
|
||||
@@ -34,43 +40,26 @@ namespace MusicApp.Resources.Portable_Class
|
||||
base.OnActivityCreated(savedInstanceState);
|
||||
act = Activity;
|
||||
inflater = LayoutInflater;
|
||||
View tabs = LayoutInflater.Inflate(Resource.Layout.tabs, null);
|
||||
emptyView = LayoutInflater.Inflate(Resource.Layout.NoSong, null);
|
||||
ListView.EmptyView = emptyView;
|
||||
|
||||
//ActionBar.Tab tab = MainActivity.instance.SupportActionBar.NewTab();
|
||||
//tab.SetText("Songs");
|
||||
//tab.SetTabListener(this);
|
||||
//MainActivity.instance.SupportActionBar.AddTab(tab);
|
||||
TabLayout tabLayout = tabs.FindViewById<TabLayout>(Resource.Id.tabs);
|
||||
ViewPager pager = tabs.FindViewById<ViewPager>(Resource.Id.pager);
|
||||
ViewPagerAdapter adapter = new ViewPagerAdapter(FragmentManager);
|
||||
adapter.AddFragment(this, "Songs");
|
||||
//adapter.AddFragment(new FolderBrowse(), "Folders");
|
||||
|
||||
//tab = MainActivity.instance.SupportActionBar.NewTab();
|
||||
//tab.SetText("Folders");
|
||||
//tab.SetTabListener(this);
|
||||
//MainActivity.instance.SupportActionBar.AddTab(tab);
|
||||
pager.Adapter = adapter;
|
||||
tabLayout.SetupWithViewPager(pager);
|
||||
|
||||
//tab = MainActivity.instance.SupportActionBar.NewTab();
|
||||
//tab.SetText("Albums");
|
||||
//tab.SetTabListener(this);
|
||||
//MainActivity.instance.SupportActionBar.AddTab(tab);
|
||||
tabs.SetPadding(0, 100, 0, 0);
|
||||
Activity.AddContentView(tabs, View.LayoutParameters);
|
||||
|
||||
GetStoragePermission();
|
||||
InitialiseSearchService();
|
||||
}
|
||||
|
||||
//public void OnTabReselected(ActionBar.Tab tab, FragmentTransaction ft)
|
||||
//{
|
||||
// throw new System.NotImplementedException();
|
||||
//}
|
||||
|
||||
//public void OnTabSelected(ActionBar.Tab tab, FragmentTransaction ft)
|
||||
//{
|
||||
// throw new System.NotImplementedException();
|
||||
//}
|
||||
|
||||
//public void OnTabUnselected(ActionBar.Tab tab, FragmentTransaction ft)
|
||||
//{
|
||||
// throw new System.NotImplementedException();
|
||||
//}
|
||||
|
||||
public override void OnDestroy()
|
||||
{
|
||||
MainActivity.instance.RemoveSearchService(0);
|
||||
@@ -132,7 +121,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
|
||||
void PopulateList()
|
||||
{
|
||||
Uri musicUri = MediaStore.Audio.Media.ExternalContentUri;
|
||||
Android.Net.Uri musicUri = MediaStore.Audio.Media.ExternalContentUri;
|
||||
|
||||
CursorLoader cursorLoader = new CursorLoader(Android.App.Application.Context, musicUri, null, null, null, null);
|
||||
ICursor musicCursor = (ICursor)cursorLoader.LoadInBackground();
|
||||
@@ -262,7 +251,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
playList.Add("Create a playlist");
|
||||
playListId.Add(0);
|
||||
|
||||
Uri uri = MediaStore.Audio.Playlists.ExternalContentUri;
|
||||
Android.Net.Uri uri = MediaStore.Audio.Playlists.ExternalContentUri;
|
||||
CursorLoader loader = new CursorLoader(Android.App.Application.Context, uri, null, null, null, null);
|
||||
ICursor cursor = (ICursor)loader.LoadInBackground();
|
||||
|
||||
@@ -323,10 +312,46 @@ namespace MusicApp.Resources.Portable_Class
|
||||
public void CreatePlaylist(string name)
|
||||
{
|
||||
ContentResolver resolver = Activity.ContentResolver;
|
||||
Uri uri = MediaStore.Audio.Playlists.ExternalContentUri;
|
||||
Android.Net.Uri uri = MediaStore.Audio.Playlists.ExternalContentUri;
|
||||
ContentValues value = new ContentValues();
|
||||
value.Put(MediaStore.Audio.Playlists.InterfaceConsts.Name, name);
|
||||
resolver.Insert(uri, value);
|
||||
}
|
||||
}
|
||||
|
||||
public class ViewPagerAdapter : FragmentPagerAdapter
|
||||
{
|
||||
private List<Fragment> fragmentList = new List<Fragment>();
|
||||
private List<string> titles = new List<string>();
|
||||
|
||||
|
||||
public ViewPagerAdapter(FragmentManager fm) : base(fm)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected ViewPagerAdapter(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override int Count => fragmentList.Count;
|
||||
|
||||
public override Fragment GetItem(int position)
|
||||
{
|
||||
return fragmentList[position];
|
||||
}
|
||||
|
||||
public void AddFragment (Fragment fragment, string title)
|
||||
{
|
||||
fragmentList.Add(fragment);
|
||||
titles.Add(title);
|
||||
}
|
||||
|
||||
public override ICharSequence GetPageTitleFormatted(int position)
|
||||
{
|
||||
ICharSequence title = CharSequence.ArrayFromStringArray(new string[] { titles[position] })[0];
|
||||
return title;
|
||||
}
|
||||
}
|
||||
}
|
||||
9
MusicApp/Resources/Portable Class/FolderBrowse.cs
Normal file
9
MusicApp/Resources/Portable Class/FolderBrowse.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Android.Support.V4.App;
|
||||
|
||||
namespace MusicApp.Resources.Portable_Class
|
||||
{
|
||||
public class FolderBrowse : ListFragment
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
41
MusicApp/Resources/Resource.Designer.cs
generated
41
MusicApp/Resources/Resource.Designer.cs
generated
@@ -2477,8 +2477,8 @@ namespace MusicApp
|
||||
// aapt resource value: 0x7f07008b
|
||||
public const int bottomView = 2131165323;
|
||||
|
||||
// aapt resource value: 0x7f0700bc
|
||||
public const int browseLayout = 2131165372;
|
||||
// aapt resource value: 0x7f0700be
|
||||
public const int browseLayout = 2131165374;
|
||||
|
||||
// aapt resource value: 0x7f070073
|
||||
public const int browseList = 2131165299;
|
||||
@@ -2567,8 +2567,8 @@ namespace MusicApp
|
||||
// aapt resource value: 0x7f070012
|
||||
public const int disableHome = 2131165202;
|
||||
|
||||
// aapt resource value: 0x7f0700bd
|
||||
public const int downloadLayout = 2131165373;
|
||||
// aapt resource value: 0x7f0700bf
|
||||
public const int downloadLayout = 2131165375;
|
||||
|
||||
// aapt resource value: 0x7f070066
|
||||
public const int edit_query = 2131165286;
|
||||
@@ -2672,8 +2672,8 @@ namespace MusicApp
|
||||
// aapt resource value: 0x7f070088
|
||||
public const int mainView = 2131165320;
|
||||
|
||||
// aapt resource value: 0x7f0700ba
|
||||
public const int masked = 2131165370;
|
||||
// aapt resource value: 0x7f0700bc
|
||||
public const int masked = 2131165372;
|
||||
|
||||
// aapt resource value: 0x7f070094
|
||||
public const int media_actions = 2131165332;
|
||||
@@ -2687,8 +2687,8 @@ namespace MusicApp
|
||||
// aapt resource value: 0x7f070019
|
||||
public const int multiply = 2131165209;
|
||||
|
||||
// aapt resource value: 0x7f0700bb
|
||||
public const int musicLayout = 2131165371;
|
||||
// aapt resource value: 0x7f0700bd
|
||||
public const int musicLayout = 2131165373;
|
||||
|
||||
// aapt resource value: 0x7f07007d
|
||||
public const int navigation_header_container = 2131165309;
|
||||
@@ -2714,6 +2714,9 @@ namespace MusicApp
|
||||
// aapt resource value: 0x7f070096
|
||||
public const int notification_main_column_container = 2131165334;
|
||||
|
||||
// aapt resource value: 0x7f0700ba
|
||||
public const int pager = 2131165370;
|
||||
|
||||
// aapt resource value: 0x7f070037
|
||||
public const int parallax = 2131165239;
|
||||
|
||||
@@ -2741,8 +2744,8 @@ namespace MusicApp
|
||||
// aapt resource value: 0x7f0700a8
|
||||
public const int playerTitle = 2131165352;
|
||||
|
||||
// aapt resource value: 0x7f0700be
|
||||
public const int playlistLayout = 2131165374;
|
||||
// aapt resource value: 0x7f0700c0
|
||||
public const int playlistLayout = 2131165376;
|
||||
|
||||
// aapt resource value: 0x7f070074
|
||||
public const int playlistName = 2131165300;
|
||||
@@ -2825,8 +2828,8 @@ namespace MusicApp
|
||||
// aapt resource value: 0x7f070072
|
||||
public const int select_dialog_listview = 2131165298;
|
||||
|
||||
// aapt resource value: 0x7f0700bf
|
||||
public const int settings = 2131165375;
|
||||
// aapt resource value: 0x7f0700c1
|
||||
public const int settings = 2131165377;
|
||||
|
||||
// aapt resource value: 0x7f07005c
|
||||
public const int shortcut = 2131165276;
|
||||
@@ -2888,6 +2891,9 @@ namespace MusicApp
|
||||
// aapt resource value: 0x7f070011
|
||||
public const int tabMode = 2131165201;
|
||||
|
||||
// aapt resource value: 0x7f0700b9
|
||||
public const int tabs = 2131165369;
|
||||
|
||||
// aapt resource value: 0x7f0700a3
|
||||
public const int text = 2131165347;
|
||||
|
||||
@@ -2954,8 +2960,8 @@ namespace MusicApp
|
||||
// aapt resource value: 0x7f07000e
|
||||
public const int view_offset_helper = 2131165198;
|
||||
|
||||
// aapt resource value: 0x7f0700b9
|
||||
public const int visible = 2131165369;
|
||||
// aapt resource value: 0x7f0700bb
|
||||
public const int visible = 2131165371;
|
||||
|
||||
// aapt resource value: 0x7f070027
|
||||
public const int withText = 2131165223;
|
||||
@@ -3275,10 +3281,13 @@ namespace MusicApp
|
||||
public const int support_simple_spinner_dropdown_item = 2130903125;
|
||||
|
||||
// aapt resource value: 0x7f030056
|
||||
public const int TimerLayout = 2130903126;
|
||||
public const int tabs = 2130903126;
|
||||
|
||||
// aapt resource value: 0x7f030057
|
||||
public const int toolbar = 2130903127;
|
||||
public const int TimerLayout = 2130903127;
|
||||
|
||||
// aapt resource value: 0x7f030058
|
||||
public const int toolbar = 2130903128;
|
||||
|
||||
static Layout()
|
||||
{
|
||||
|
||||
21
MusicApp/Resources/layout/tabs.xml
Normal file
21
MusicApp/Resources/layout/tabs.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:padding="4dip"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:tabMode="fixed"
|
||||
app:tabGravity="fill" />
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="net.voidynullness.android.tabitytabs.TabLayoutActivity"/>
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user