mirror of
https://github.com/zoriya/Opus.git
synced 2025-12-06 06:26:15 +00:00
Tabs Finished
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
using Android.Widget;
|
||||
using Android.App;
|
||||
using Android.App;
|
||||
using Android.OS;
|
||||
using Android.Support.V7.App;
|
||||
using Android.Support.Design.Widget;
|
||||
using MusicApp.Resources.Fragments;
|
||||
using MusicApp.Resources.Portable_Class;
|
||||
using Android.Views;
|
||||
using System;
|
||||
using Android.Util;
|
||||
using Android.Support.V4.View;
|
||||
using Android.Runtime;
|
||||
using Android.Widget;
|
||||
|
||||
namespace MusicApp
|
||||
{
|
||||
@@ -33,9 +31,10 @@ namespace MusicApp
|
||||
|
||||
Navigate(Resource.Id.musicLayout);
|
||||
|
||||
ToolBar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
|
||||
ToolBar = (Android.Support.V7.Widget.Toolbar) FindViewById(Resource.Id.toolbar);
|
||||
SetSupportActionBar(ToolBar);
|
||||
SupportActionBar.Title = "MusicApp";
|
||||
HideTabs();
|
||||
}
|
||||
|
||||
public override bool OnCreateOptionsMenu(IMenu menu)
|
||||
@@ -68,6 +67,7 @@ namespace MusicApp
|
||||
}
|
||||
else if(item.ItemId == Resource.Id.settings)
|
||||
{
|
||||
HideTabs();
|
||||
Android.Support.V4.App.Fragment fragment = Preferences.NewInstance();
|
||||
SupportFragmentManager.BeginTransaction().Replace(Resource.Id.contentView, fragment).Commit();
|
||||
}
|
||||
@@ -135,26 +135,66 @@ namespace MusicApp
|
||||
switch (layout)
|
||||
{
|
||||
case Resource.Id.musicLayout:
|
||||
HideTabs();
|
||||
fragment = Queue.NewInstance();
|
||||
break;
|
||||
|
||||
case Resource.Id.browseLayout:
|
||||
fragment = Browse.NewInstance();
|
||||
SetTabs();
|
||||
break;
|
||||
|
||||
case Resource.Id.downloadLayout:
|
||||
HideTabs();
|
||||
fragment = DownloadList.NewInstance();
|
||||
break;
|
||||
|
||||
case Resource.Id.playlistLayout:
|
||||
HideTabs();
|
||||
fragment = Playlist.NewInstance();
|
||||
break;
|
||||
}
|
||||
|
||||
if (fragment == null)
|
||||
return;
|
||||
fragment = EmptyFragment.NewInstance();
|
||||
|
||||
SupportFragmentManager.BeginTransaction().Replace(Resource.Id.contentView, fragment).Commit();
|
||||
}
|
||||
|
||||
void SetTabs()
|
||||
{
|
||||
FrameLayout frame = FindViewById<FrameLayout>(Resource.Id.contentView);
|
||||
frame.Visibility = ViewStates.Gone;
|
||||
|
||||
TabLayout tabs = FindViewById<TabLayout>(Resource.Id.tabs);
|
||||
tabs.Visibility = ViewStates.Visible;
|
||||
tabs.RemoveAllTabs();
|
||||
tabs.AddTab(tabs.NewTab().SetText("Songs"));
|
||||
tabs.AddTab(tabs.NewTab().SetText("Artist"));
|
||||
tabs.AddTab(tabs.NewTab().SetText("Folders"));
|
||||
ViewPager pager = FindViewById<ViewPager>(Resource.Id.pager);
|
||||
pager.SetPadding(0, 200, 0, 0);
|
||||
pager.AddOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabs));
|
||||
ViewPagerAdapter adapter = new ViewPagerAdapter(SupportFragmentManager);
|
||||
|
||||
adapter.AddFragment(Browse.NewInstance(), "Songs");
|
||||
adapter.AddFragment(DownloadFragment.NewInstance(), "Artists");
|
||||
adapter.AddFragment(DownloadFragment.NewInstance(), "Folders");
|
||||
|
||||
pager.Adapter = adapter;
|
||||
tabs.SetupWithViewPager(pager);
|
||||
//tabs.TabSelected += (sender, e) => { Console.WriteLine("Clicked"); pager.SetCurrentItem(e.Tab.Position, true); };
|
||||
}
|
||||
|
||||
void HideTabs()
|
||||
{
|
||||
TabLayout tabs = FindViewById<TabLayout>(Resource.Id.tabs);
|
||||
tabs.RemoveAllTabs();
|
||||
tabs.Visibility = ViewStates.Gone;
|
||||
ViewPager pager = FindViewById<ViewPager>(Resource.Id.pager);
|
||||
pager.Adapter = null;
|
||||
|
||||
FrameLayout frame = FindViewById<FrameLayout>(Resource.Id.contentView);
|
||||
frame.Visibility = ViewStates.Visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,6 +141,7 @@
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="MainApplication.cs" />
|
||||
<Compile Include="Resources\Fragments\DownloadFragment.cs" />
|
||||
<Compile Include="Resources\Fragments\EmptyFragment.cs" />
|
||||
<Compile Include="Resources\Fragments\playerControl.cs" />
|
||||
<Compile Include="Resources\Portable Class\Adapter.cs" />
|
||||
<Compile Include="Resources\Portable Class\Browse.cs" />
|
||||
@@ -226,11 +227,6 @@
|
||||
<SubType>Designer</SubType>
|
||||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\toolbar.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\menu\toolbar_menu.xml">
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
24
MusicApp/Resources/Fragments/EmptyFragment.cs
Normal file
24
MusicApp/Resources/Fragments/EmptyFragment.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Android.OS;
|
||||
using Android.Views;
|
||||
using Android.Support.V4.App;
|
||||
|
||||
namespace MusicApp.Resources.Fragments
|
||||
{
|
||||
public class EmptyFragment : Fragment
|
||||
{
|
||||
public override void OnCreate(Bundle savedInstanceState)
|
||||
{
|
||||
base.OnCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
public static Fragment NewInstance()
|
||||
{
|
||||
return new EmptyFragment { Arguments = new Bundle() };
|
||||
}
|
||||
|
||||
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
return base.OnCreateView(inflater, container, savedInstanceState);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,22 +40,9 @@ 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;
|
||||
|
||||
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");
|
||||
|
||||
pager.Adapter = adapter;
|
||||
tabLayout.SetupWithViewPager(pager);
|
||||
|
||||
tabs.SetPadding(0, 100, 0, 0);
|
||||
Activity.AddContentView(tabs, View.LayoutParameters);
|
||||
|
||||
GetStoragePermission();
|
||||
InitialiseSearchService();
|
||||
}
|
||||
@@ -89,6 +76,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
|
||||
private void InitialiseSearchService()
|
||||
{
|
||||
HasOptionsMenu = true;
|
||||
MainActivity.instance.CreateSearch(0);
|
||||
}
|
||||
|
||||
@@ -162,7 +150,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
ListView.ItemClick += ListView_ItemClick;
|
||||
ListView.ItemLongClick += ListView_ItemLongClick;
|
||||
|
||||
view.SetPadding(0, 100, 0, 0);
|
||||
//view.SetPadding(0, 55, 0, 0);
|
||||
|
||||
if (adapter == null || adapter.Count == 0)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,172 @@
|
||||
using Android.Support.V4.App;
|
||||
using Android.OS;
|
||||
using System.Collections.Generic;
|
||||
using Android.Widget;
|
||||
using Android.Net;
|
||||
using Android.Database;
|
||||
using Android.Provider;
|
||||
using MusicApp.Resources.values;
|
||||
using Android.Content;
|
||||
using Android;
|
||||
using Android.Support.Design.Widget;
|
||||
using Android.Views;
|
||||
using Android.Content.PM;
|
||||
using Android.Support.V4.App;
|
||||
|
||||
namespace MusicApp.Resources.Portable_Class
|
||||
{
|
||||
public class FolderBrowse : ListFragment
|
||||
{
|
||||
public static FolderBrowse instance;
|
||||
public static Context act;
|
||||
public static LayoutInflater inflater;
|
||||
public List<Song> musicList = new List<Song>();
|
||||
public Adapter adapter;
|
||||
public View emptyView;
|
||||
|
||||
}
|
||||
}
|
||||
private View view;
|
||||
private string[] actions = new string[] { "Play", "Play Next", "Play Last", "Add To Playlist" };
|
||||
private bool isEmpty = false;
|
||||
|
||||
|
||||
public override void OnActivityCreated(Bundle savedInstanceState)
|
||||
{
|
||||
base.OnActivityCreated(savedInstanceState);
|
||||
act = Activity;
|
||||
inflater = LayoutInflater;
|
||||
emptyView = LayoutInflater.Inflate(Resource.Layout.NoSong, null);
|
||||
ListView.EmptyView = emptyView;
|
||||
|
||||
GetStoragePermission();
|
||||
InitialiseSearchService();
|
||||
}
|
||||
|
||||
public override void OnDestroy()
|
||||
{
|
||||
MainActivity.instance.RemoveSearchService(0);
|
||||
if (isEmpty)
|
||||
{
|
||||
ViewGroup rootView = Activity.FindViewById<ViewGroup>(Android.Resource.Id.Content);
|
||||
rootView.RemoveView(emptyView);
|
||||
}
|
||||
base.OnDestroy();
|
||||
instance = null;
|
||||
act = null;
|
||||
inflater = null;
|
||||
}
|
||||
|
||||
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
View view = base.OnCreateView(inflater, container, savedInstanceState);
|
||||
this.view = view;
|
||||
return view;
|
||||
}
|
||||
|
||||
public static Fragment NewInstance()
|
||||
{
|
||||
instance = new FolderBrowse { Arguments = new Bundle() };
|
||||
return instance;
|
||||
}
|
||||
|
||||
private void InitialiseSearchService()
|
||||
{
|
||||
HasOptionsMenu = true;
|
||||
MainActivity.instance.CreateSearch(0);
|
||||
}
|
||||
|
||||
void GetStoragePermission()
|
||||
{
|
||||
const string permission = Manifest.Permission.ReadExternalStorage;
|
||||
if (Android.Support.V4.Content.ContextCompat.CheckSelfPermission(Android.App.Application.Context, permission) == (int)Permission.Granted)
|
||||
{
|
||||
PopulateList();
|
||||
return;
|
||||
}
|
||||
string[] permissions = new string[] { permission };
|
||||
RequestPermissions(permissions, 0);
|
||||
}
|
||||
|
||||
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults)
|
||||
{
|
||||
switch (requestCode)
|
||||
{
|
||||
case 0:
|
||||
if (grantResults[0] == Permission.Granted)
|
||||
PopulateList();
|
||||
|
||||
else
|
||||
Snackbar.Make(View, "Permission denied, can't list musics.", Snackbar.LengthShort).Show();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void PopulateList()
|
||||
{
|
||||
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();
|
||||
|
||||
|
||||
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";
|
||||
|
||||
musicList.Add(new Song(Title, Artist, Album, AlbumArt, id, path));
|
||||
}
|
||||
while (musicCursor.MoveToNext());
|
||||
musicCursor.Close();
|
||||
}
|
||||
|
||||
adapter = new Adapter(Android.App.Application.Context, Resource.Layout.SongList, musicList);
|
||||
ListAdapter = adapter;
|
||||
ListView.TextFilterEnabled = true;
|
||||
ListView.ItemClick += ListView_ItemClick;
|
||||
ListView.ItemLongClick += ListView_ItemLongClick;
|
||||
|
||||
//view.SetPadding(0, 55, 0, 0);
|
||||
|
||||
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 musicList)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
public void ListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
|
||||
{
|
||||
Song item = musicList[e.Position];
|
||||
Play(item);
|
||||
}
|
||||
@@ -49,7 +49,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
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, 150, 0, 0);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
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, 150, 0, 0);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
57
MusicApp/Resources/Resource.Designer.cs
generated
57
MusicApp/Resources/Resource.Designer.cs
generated
@@ -2474,11 +2474,11 @@ namespace MusicApp
|
||||
// aapt resource value: 0x7f070028
|
||||
public const int bottom = 2131165224;
|
||||
|
||||
// aapt resource value: 0x7f07008b
|
||||
public const int bottomView = 2131165323;
|
||||
// aapt resource value: 0x7f07008c
|
||||
public const int bottomView = 2131165324;
|
||||
|
||||
// aapt resource value: 0x7f0700be
|
||||
public const int browseLayout = 2131165374;
|
||||
// aapt resource value: 0x7f0700bc
|
||||
public const int browseLayout = 2131165372;
|
||||
|
||||
// aapt resource value: 0x7f070073
|
||||
public const int browseList = 2131165299;
|
||||
@@ -2519,8 +2519,8 @@ namespace MusicApp
|
||||
// aapt resource value: 0x7f07004e
|
||||
public const int contentPanel = 2131165262;
|
||||
|
||||
// aapt resource value: 0x7f070089
|
||||
public const int contentView = 2131165321;
|
||||
// aapt resource value: 0x7f07008b
|
||||
public const int contentView = 2131165323;
|
||||
|
||||
// aapt resource value: 0x7f0700ac
|
||||
public const int controllerLast = 2131165356;
|
||||
@@ -2567,8 +2567,8 @@ namespace MusicApp
|
||||
// aapt resource value: 0x7f070012
|
||||
public const int disableHome = 2131165202;
|
||||
|
||||
// aapt resource value: 0x7f0700bf
|
||||
public const int downloadLayout = 2131165375;
|
||||
// aapt resource value: 0x7f0700bd
|
||||
public const int downloadLayout = 2131165373;
|
||||
|
||||
// aapt resource value: 0x7f070066
|
||||
public const int edit_query = 2131165286;
|
||||
@@ -2669,11 +2669,8 @@ namespace MusicApp
|
||||
// aapt resource value: 0x7f070048
|
||||
public const int list_item = 2131165256;
|
||||
|
||||
// aapt resource value: 0x7f070088
|
||||
public const int mainView = 2131165320;
|
||||
|
||||
// aapt resource value: 0x7f0700bc
|
||||
public const int masked = 2131165372;
|
||||
// aapt resource value: 0x7f0700ba
|
||||
public const int masked = 2131165370;
|
||||
|
||||
// aapt resource value: 0x7f070094
|
||||
public const int media_actions = 2131165332;
|
||||
@@ -2687,8 +2684,8 @@ namespace MusicApp
|
||||
// aapt resource value: 0x7f070019
|
||||
public const int multiply = 2131165209;
|
||||
|
||||
// aapt resource value: 0x7f0700bd
|
||||
public const int musicLayout = 2131165373;
|
||||
// aapt resource value: 0x7f0700bb
|
||||
public const int musicLayout = 2131165371;
|
||||
|
||||
// aapt resource value: 0x7f07007d
|
||||
public const int navigation_header_container = 2131165309;
|
||||
@@ -2714,8 +2711,8 @@ 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: 0x7f07008a
|
||||
public const int pager = 2131165322;
|
||||
|
||||
// aapt resource value: 0x7f070037
|
||||
public const int parallax = 2131165239;
|
||||
@@ -2744,8 +2741,8 @@ namespace MusicApp
|
||||
// aapt resource value: 0x7f0700a8
|
||||
public const int playerTitle = 2131165352;
|
||||
|
||||
// aapt resource value: 0x7f0700c0
|
||||
public const int playlistLayout = 2131165376;
|
||||
// aapt resource value: 0x7f0700be
|
||||
public const int playlistLayout = 2131165374;
|
||||
|
||||
// aapt resource value: 0x7f070074
|
||||
public const int playlistName = 2131165300;
|
||||
@@ -2828,8 +2825,8 @@ namespace MusicApp
|
||||
// aapt resource value: 0x7f070072
|
||||
public const int select_dialog_listview = 2131165298;
|
||||
|
||||
// aapt resource value: 0x7f0700c1
|
||||
public const int settings = 2131165377;
|
||||
// aapt resource value: 0x7f0700bf
|
||||
public const int settings = 2131165375;
|
||||
|
||||
// aapt resource value: 0x7f07005c
|
||||
public const int shortcut = 2131165276;
|
||||
@@ -2891,8 +2888,8 @@ namespace MusicApp
|
||||
// aapt resource value: 0x7f070011
|
||||
public const int tabMode = 2131165201;
|
||||
|
||||
// aapt resource value: 0x7f0700b9
|
||||
public const int tabs = 2131165369;
|
||||
// aapt resource value: 0x7f070089
|
||||
public const int tabs = 2131165321;
|
||||
|
||||
// aapt resource value: 0x7f0700a3
|
||||
public const int text = 2131165347;
|
||||
@@ -2930,11 +2927,8 @@ namespace MusicApp
|
||||
// aapt resource value: 0x7f070057
|
||||
public const int title_template = 2131165271;
|
||||
|
||||
// aapt resource value: 0x7f07008a
|
||||
public const int toobar = 2131165322;
|
||||
|
||||
// aapt resource value: 0x7f07008c
|
||||
public const int toolbar = 2131165324;
|
||||
// aapt resource value: 0x7f070088
|
||||
public const int toolbar = 2131165320;
|
||||
|
||||
// aapt resource value: 0x7f070029
|
||||
public const int top = 2131165225;
|
||||
@@ -2960,8 +2954,8 @@ namespace MusicApp
|
||||
// aapt resource value: 0x7f07000e
|
||||
public const int view_offset_helper = 2131165198;
|
||||
|
||||
// aapt resource value: 0x7f0700bb
|
||||
public const int visible = 2131165371;
|
||||
// aapt resource value: 0x7f0700b9
|
||||
public const int visible = 2131165369;
|
||||
|
||||
// aapt resource value: 0x7f070027
|
||||
public const int withText = 2131165223;
|
||||
@@ -3286,9 +3280,6 @@ namespace MusicApp
|
||||
// aapt resource value: 0x7f030057
|
||||
public const int TimerLayout = 2130903127;
|
||||
|
||||
// aapt resource value: 0x7f030058
|
||||
public const int toolbar = 2130903128;
|
||||
|
||||
static Layout()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
|
||||
@@ -1,19 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/mainView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<FrameLayout
|
||||
android:id="@+id/contentView"
|
||||
android:layout_height="match_parent"
|
||||
<android.support.design.widget.CoordinatorLayout 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:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context="com.journaldev.tablayoutviewpager.MainActivity">
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_below="@+id/toobar"
|
||||
android:layout_above="@+id/bottomView" />
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
<android.support.design.widget.BottomNavigationView
|
||||
android:layout_height="wrap_content" >
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:tabTextColor="@android:color/white"
|
||||
app:tabSelectedTextColor="@android:color/white"
|
||||
app:tabIndicatorColor="@android:color/white"
|
||||
app:tabGravity="fill"
|
||||
app:tabMode="fixed" />
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
<FrameLayout
|
||||
android:id="@+id/contentView"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent" />
|
||||
<RelativeLayout
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:layout_height="wrap_content">
|
||||
<android.support.design.widget.BottomNavigationView
|
||||
android:id="@+id/bottomView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
@@ -22,4 +50,61 @@
|
||||
android:background="@android:color/white"
|
||||
app:elevation="16dp"
|
||||
app:menu="@menu/bottom_items" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
<!--<RelativeLayout 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:id="@+id/mainView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<android.support.design.widget.BottomNavigationView
|
||||
android:id="@+id/bottomView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:layout_gravity="start"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@android:color/white"
|
||||
app:elevation="16dp"
|
||||
app:menu="@menu/bottom_items" />
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
app:elevation="16dp"
|
||||
android:id="@+id/toolbarCoordinator"
|
||||
tools:context="com.journaldev.tablayoutappbar.MainActivity">
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabs"
|
||||
android:layout_width="match_parent"
|
||||
app:tabGravity="fill"
|
||||
app:tabMode="fixed"
|
||||
app:tabTextColor="@android:color/white"
|
||||
app:tabSelectedTextColor="@android:color/white"
|
||||
app:tabIndicatorColor="@android:color/white"
|
||||
android:layout_height="wrap_content"/>
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
<FrameLayout
|
||||
android:id="@+id/contentView"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_below="@+id/tabs"
|
||||
android:layout_above="@+id/bottomView" />
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_below="@id/tabs"/>
|
||||
</RelativeLayout>-->
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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="wrap_content"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
||||
Reference in New Issue
Block a user