quickplay fab finished

This commit is contained in:
Gboy9155
2018-01-05 18:09:03 +01:00
parent 7550de0b09
commit 940ef868cd
8 changed files with 203 additions and 120 deletions

View File

@@ -50,6 +50,8 @@ namespace MusicApp
private bool canSwitch = true;
private string tab;
private bool QuickPlayOpenned = false;
private Drawable playToCross;
private Drawable crossToPlay;
private const int RequestCode = 8539;
@@ -87,6 +89,9 @@ namespace MusicApp
pagerRefresh = FindViewById<SwipeRefreshLayout>(Resource.Id.pagerRefresh);
contentRefresh = FindViewById<SwipeRefreshLayout>(Resource.Id.contentRefresh);
playToCross = GetDrawable(Resource.Drawable.PlayToCross);
crossToPlay = GetDrawable(Resource.Drawable.CrossToPlay);
if (MusicPlayer.queue.Count > 0)
ReCreateSmallPlayer();
else
@@ -835,9 +840,7 @@ namespace MusicApp
{
if(quickPlayLayout != null)
{
quickPlayLayout.Visibility = ViewStates.Visible;
FloatingActionButton fab = quickPlayLayout.FindViewById<FloatingActionButton>(Resource.Id.quickPlay);
fab.Animate().Alpha(1);
quickPlayLayout.FindViewById<LinearLayout>(Resource.Id.quickPlayLinear).Animate().Alpha(1);
return;
}
quickPlayLayout = LayoutInflater.Inflate(Resource.Layout.QuickPlayLayout, null);
@@ -845,22 +848,20 @@ namespace MusicApp
AddContentView(quickPlayLayout, rootView.LayoutParameters);
Console.WriteLine("&Starting padding bot: " + paddingBot);
quickPlayLayout.SetPadding(0, 0, 0, paddingBot + PxToDp(6));
FloatingActionButton QuickPlayFAB = quickPlayLayout.FindViewById<FloatingActionButton>(Resource.Id.quickPlay);
QuickPlayFAB.Click += QuickPlay;
quickPlayLayout.FindViewById<FloatingActionButton>(Resource.Id.quickPlay).Click += QuickPlay;
quickPlayLayout.FindViewById<FloatingActionButton>(Resource.Id.localPlay).Click += LocalPlay;
quickPlayLayout.FindViewById<FloatingActionButton>(Resource.Id.ytPlay).Click += ytPlay;
OnPaddingChanged += QuickPlayChangePosition;
}
public void HideQuickPlay()
{
FloatingActionButton QuickPlayFAB = quickPlayLayout.FindViewById<FloatingActionButton>(Resource.Id.quickPlay);
QuickPlayFAB.Animate().Alpha(0);
quickPlayLayout.FindViewById<LinearLayout>(Resource.Id.quickPlayLinear).Animate().Alpha(0);
}
private void QuickPlayChangePosition(object sender, PaddingChange e)
{
Console.WriteLine("&Padding bot: " + paddingBot);
FloatingActionButton QuickPlayFab = quickPlayLayout.FindViewById<FloatingActionButton>(Resource.Id.quickPlay);
QuickPlayFab.Animate().TranslationYBy(-(paddingBot - e.oldPadding));
quickPlayLayout.FindViewById<LinearLayout>(Resource.Id.quickPlayLinear).Animate().TranslationYBy(-(paddingBot - e.oldPadding));
}
public async void QuickPlay(object sender, EventArgs e)
@@ -868,22 +869,45 @@ namespace MusicApp
FloatingActionButton quickPlay = FindViewById<FloatingActionButton>(Resource.Id.quickPlay);
if (QuickPlayOpenned)
{
Drawable icon = quickPlay.Drawable;
((AnimatedVectorDrawable)icon).Start();
AnimatedVectorDrawable drawable = (AnimatedVectorDrawable)crossToPlay;
quickPlay.SetImageDrawable(drawable);
drawable.Start();
QuickPlayOpenned = false;
await Task.Delay(200);
quickPlay.SetImageResource(Resource.Drawable.PlayToCross);
await Task.Delay(10);
quickPlayLayout.FindViewById<FloatingActionButton>(Resource.Id.ytPlay).Animate().Alpha(0);
await Task.Delay(10);
quickPlayLayout.FindViewById<FloatingActionButton>(Resource.Id.localPlay).Visibility = ViewStates.Gone;
quickPlayLayout.FindViewById<FloatingActionButton>(Resource.Id.ytPlay).Animate().Alpha(0);
await Task.Delay(10);
quickPlayLayout.FindViewById<FloatingActionButton>(Resource.Id.ytPlay).Visibility = ViewStates.Gone;
}
else
{
Drawable icon = quickPlay.Drawable;
((AnimatedVectorDrawable)icon).Start();
AnimatedVectorDrawable drawable = (AnimatedVectorDrawable)playToCross;
quickPlay.SetImageDrawable(drawable);
drawable.Start();
QuickPlayOpenned = true;
await Task.Delay(200);
quickPlay.SetImageResource(Resource.Drawable.CrossToPlay);
await Task.Delay(10);
quickPlayLayout.FindViewById<FloatingActionButton>(Resource.Id.ytPlay).Alpha = 0;
quickPlayLayout.FindViewById<FloatingActionButton>(Resource.Id.ytPlay).Visibility = ViewStates.Visible;
quickPlayLayout.FindViewById<FloatingActionButton>(Resource.Id.ytPlay).Animate().Alpha(1);
await Task.Delay(10);
quickPlayLayout.FindViewById<FloatingActionButton>(Resource.Id.localPlay).Alpha = 0;
quickPlayLayout.FindViewById<FloatingActionButton>(Resource.Id.localPlay).Visibility = ViewStates.Visible;
quickPlayLayout.FindViewById<FloatingActionButton>(Resource.Id.localPlay).Animate().Alpha(1);
}
}
private void LocalPlay(object sender, EventArgs e)
{
}
private void ytPlay(object sender, EventArgs e)
{
}
int PxToDp(int px)
{
float scale = Resources.DisplayMetrics.Density;

View File

@@ -467,10 +467,20 @@
</AndroidResource>
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\PlayToCross.xml" />
<AndroidResource Include="Resources\drawable\PlayToCross.xml">
<SubType>Designer</SubType>
</AndroidResource>
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\CrossToPlay.xml" />
<AndroidResource Include="Resources\drawable\CrossToPlay.xml">
<SubType>Designer</SubType>
</AndroidResource>
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\YtPlay.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\ic_playlist_play_black_24dp.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<Import Project="..\packages\NETStandard.Library.2.0.1\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\packages\NETStandard.Library.2.0.1\build\netstandard2.0\NETStandard.Library.targets')" />

View File

@@ -2360,35 +2360,35 @@ namespace MusicApp
// aapt resource value: 0x7f020053
public const int avd_hide_password = 2130837587;
// aapt resource value: 0x7f020087
public const int avd_hide_password_1 = 2130837639;
// aapt resource value: 0x7f020088
public const int avd_hide_password_2 = 2130837640;
// aapt resource value: 0x7f020089
public const int avd_hide_password_3 = 2130837641;
public const int avd_hide_password_1 = 2130837641;
// aapt resource value: 0x7f02008a
public const int avd_hide_password_2 = 2130837642;
// aapt resource value: 0x7f02008b
public const int avd_hide_password_3 = 2130837643;
// aapt resource value: 0x7f020054
public const int avd_show_password = 2130837588;
// aapt resource value: 0x7f02008a
public const int avd_show_password_1 = 2130837642;
// aapt resource value: 0x7f02008b
public const int avd_show_password_2 = 2130837643;
// aapt resource value: 0x7f02008c
public const int avd_show_password_3 = 2130837644;
public const int avd_show_password_1 = 2130837644;
// aapt resource value: 0x7f02008d
public const int avd_show_password_2 = 2130837645;
// aapt resource value: 0x7f02008e
public const int avd_show_password_3 = 2130837646;
// aapt resource value: 0x7f020055
public const int CrossToPlay = 2130837589;
// aapt resource value: 0x7f02008d
public const int crosstoplay_1 = 2130837645;
// aapt resource value: 0x7f02008f
public const int crosstoplay_1 = 2130837647;
// aapt resource value: 0x7f02008e
public const int crosstoplay_2 = 2130837646;
// aapt resource value: 0x7f020090
public const int crosstoplay_2 = 2130837648;
// aapt resource value: 0x7f020056
public const int design_bottom_navigation_item_background = 2130837590;
@@ -2466,82 +2466,88 @@ namespace MusicApp
public const int ic_playlist_add_white_24dp = 2130837614;
// aapt resource value: 0x7f02006f
public const int ic_query_builder_black_24dp = 2130837615;
public const int ic_playlist_play_black_24dp = 2130837615;
// aapt resource value: 0x7f020070
public const int ic_skip_next_black_24dp = 2130837616;
public const int ic_query_builder_black_24dp = 2130837616;
// aapt resource value: 0x7f020071
public const int ic_skip_previous_black_24dp = 2130837617;
public const int ic_skip_next_black_24dp = 2130837617;
// aapt resource value: 0x7f020072
public const int ic_timer_white_24dp = 2130837618;
public const int ic_skip_previous_black_24dp = 2130837618;
// aapt resource value: 0x7f020073
public const int MusicIcon = 2130837619;
public const int ic_timer_white_24dp = 2130837619;
// aapt resource value: 0x7f020074
public const int navigation_empty_icon = 2130837620;
public const int MusicIcon = 2130837620;
// aapt resource value: 0x7f020075
public const int noAlbum = 2130837621;
public const int navigation_empty_icon = 2130837621;
// aapt resource value: 0x7f020076
public const int notification_action_background = 2130837622;
public const int noAlbum = 2130837622;
// aapt resource value: 0x7f020077
public const int notification_bg = 2130837623;
public const int notification_action_background = 2130837623;
// aapt resource value: 0x7f020078
public const int notification_bg_low = 2130837624;
public const int notification_bg = 2130837624;
// aapt resource value: 0x7f020079
public const int notification_bg_low_normal = 2130837625;
public const int notification_bg_low = 2130837625;
// aapt resource value: 0x7f02007a
public const int notification_bg_low_pressed = 2130837626;
public const int notification_bg_low_normal = 2130837626;
// aapt resource value: 0x7f02007b
public const int notification_bg_normal = 2130837627;
public const int notification_bg_low_pressed = 2130837627;
// aapt resource value: 0x7f02007c
public const int notification_bg_normal_pressed = 2130837628;
public const int notification_bg_normal = 2130837628;
// aapt resource value: 0x7f02007d
public const int notification_icon_background = 2130837629;
// aapt resource value: 0x7f020085
public const int notification_template_icon_bg = 2130837637;
// aapt resource value: 0x7f020086
public const int notification_template_icon_low_bg = 2130837638;
public const int notification_bg_normal_pressed = 2130837629;
// aapt resource value: 0x7f02007e
public const int notification_tile_bg = 2130837630;
public const int notification_icon_background = 2130837630;
// aapt resource value: 0x7f020087
public const int notification_template_icon_bg = 2130837639;
// aapt resource value: 0x7f020088
public const int notification_template_icon_low_bg = 2130837640;
// aapt resource value: 0x7f02007f
public const int notify_panel_notification_icon_bg = 2130837631;
public const int notification_tile_bg = 2130837631;
// aapt resource value: 0x7f020080
public const int PlaylistPlay = 2130837632;
public const int notify_panel_notification_icon_bg = 2130837632;
// aapt resource value: 0x7f020081
public const int PlaylistPlayIcon = 2130837633;
public const int PlaylistPlay = 2130837633;
// aapt resource value: 0x7f020082
public const int PlayToCross = 2130837634;
// aapt resource value: 0x7f02008f
public const int playtocross_1 = 2130837647;
// aapt resource value: 0x7f020090
public const int playtocross_2 = 2130837648;
public const int PlaylistPlayIcon = 2130837634;
// aapt resource value: 0x7f020083
public const int search = 2130837635;
public const int PlayToCross = 2130837635;
// aapt resource value: 0x7f020091
public const int playtocross_1 = 2130837649;
// aapt resource value: 0x7f020092
public const int playtocross_2 = 2130837650;
// aapt resource value: 0x7f020084
public const int settings = 2130837636;
public const int search = 2130837636;
// aapt resource value: 0x7f020085
public const int settings = 2130837637;
// aapt resource value: 0x7f020086
public const int YtPlay = 2130837638;
static Drawable()
{
@@ -2619,8 +2625,8 @@ namespace MusicApp
// aapt resource value: 0x7f08002f
public const int add = 2131230767;
// aapt resource value: 0x7f0800e1
public const int albumArt = 2131230945;
// aapt resource value: 0x7f0800e4
public const int albumArt = 2131230948;
// aapt resource value: 0x7f08006f
public const int alertTitle = 2131230831;
@@ -2631,8 +2637,8 @@ namespace MusicApp
// aapt resource value: 0x7f080034
public const int always = 2131230772;
// aapt resource value: 0x7f0800e2
public const int artist = 2131230946;
// aapt resource value: 0x7f0800e5
public const int artist = 2131230949;
// aapt resource value: 0x7f080040
public const int auto = 2131230784;
@@ -2646,8 +2652,8 @@ namespace MusicApp
// aapt resource value: 0x7f0800a8
public const int bottomView = 2131230888;
// aapt resource value: 0x7f0800e8
public const int browseLayout = 2131230952;
// aapt resource value: 0x7f0800eb
public const int browseLayout = 2131230955;
// aapt resource value: 0x7f08008b
public const int browseList = 2131230859;
@@ -2730,8 +2736,8 @@ namespace MusicApp
// aapt resource value: 0x7f0800d0
public const int downFAB = 2131230928;
// aapt resource value: 0x7f0800e9
public const int downloadLayout = 2131230953;
// aapt resource value: 0x7f0800ec
public const int downloadLayout = 2131230956;
// aapt resource value: 0x7f08007d
public const int edit_query = 2131230845;
@@ -2886,8 +2892,8 @@ namespace MusicApp
// aapt resource value: 0x7f0800bd
public const int line1 = 2131230909;
// aapt resource value: 0x7f0800e4
public const int line2 = 2131230948;
// aapt resource value: 0x7f0800e7
public const int line2 = 2131230951;
// aapt resource value: 0x7f0800bf
public const int line3 = 2131230911;
@@ -2901,8 +2907,11 @@ namespace MusicApp
// aapt resource value: 0x7f08005f
public const int list_item = 2131230815;
// aapt resource value: 0x7f0800e6
public const int masked = 2131230950;
// aapt resource value: 0x7f0800d8
public const int localPlay = 2131230936;
// aapt resource value: 0x7f0800e9
public const int masked = 2131230953;
// aapt resource value: 0x7f0800b1
public const int media_actions = 2131230897;
@@ -2913,14 +2922,14 @@ namespace MusicApp
// aapt resource value: 0x7f08004f
public const int mini = 2131230799;
// aapt resource value: 0x7f0800e3
public const int moreButton = 2131230947;
// aapt resource value: 0x7f0800e6
public const int moreButton = 2131230950;
// aapt resource value: 0x7f08002a
public const int multiply = 2131230762;
// aapt resource value: 0x7f0800e7
public const int musicLayout = 2131230951;
// aapt resource value: 0x7f0800ea
public const int musicLayout = 2131230954;
// aapt resource value: 0x7f080095
public const int navigation_header_container = 2131230869;
@@ -2997,8 +3006,8 @@ namespace MusicApp
// aapt resource value: 0x7f0800c9
public const int playerTitle = 2131230921;
// aapt resource value: 0x7f0800ea
public const int playlistLayout = 2131230954;
// aapt resource value: 0x7f0800ed
public const int playlistLayout = 2131230957;
// aapt resource value: 0x7f08008c
public const int playlistName = 2131230860;
@@ -3009,8 +3018,11 @@ namespace MusicApp
// aapt resource value: 0x7f080007
public const int progress_horizontal = 2131230727;
// aapt resource value: 0x7f0800da
public const int quickPlay = 2131230938;
// aapt resource value: 0x7f0800d7
public const int quickPlay = 2131230935;
public const int quickPlayLinear = 2131230935;
// aapt resource value: 0x7f080074
public const int radio = 2131230836;
@@ -3042,8 +3054,8 @@ namespace MusicApp
// aapt resource value: 0x7f080051
public const int scrollable = 2131230801;
// aapt resource value: 0x7f0800d8
public const int search = 2131230936;
// aapt resource value: 0x7f0800db
public const int search = 2131230939;
// aapt resource value: 0x7f08007f
public const int search_badge = 2131230847;
@@ -3084,8 +3096,8 @@ namespace MusicApp
// aapt resource value: 0x7f080089
public const int select_dialog_listview = 2131230857;
// aapt resource value: 0x7f0800eb
public const int settings = 2131230955;
// aapt resource value: 0x7f0800ee
public const int settings = 2131230958;
// aapt resource value: 0x7f080073
public const int shortcut = 2131230835;
@@ -3117,29 +3129,29 @@ namespace MusicApp
// aapt resource value: 0x7f0800cf
public const int songTimer = 2131230927;
// aapt resource value: 0x7f0800da
public const int spArt = 2131230938;
// aapt resource value: 0x7f0800dc
public const int spArtist = 2131230940;
// aapt resource value: 0x7f0800d9
public const int spContainer = 2131230937;
// aapt resource value: 0x7f0800dd
public const int spArt = 2131230941;
// aapt resource value: 0x7f0800df
public const int spLast = 2131230943;
public const int spArtist = 2131230943;
// aapt resource value: 0x7f0800dd
public const int spNext = 2131230941;
// aapt resource value: 0x7f0800dc
public const int spContainer = 2131230940;
// aapt resource value: 0x7f0800de
public const int spPlay = 2131230942;
// aapt resource value: 0x7f0800e2
public const int spLast = 2131230946;
// aapt resource value: 0x7f0800e0
public const int spProgress = 2131230944;
public const int spNext = 2131230944;
// aapt resource value: 0x7f0800db
public const int spTitle = 2131230939;
// aapt resource value: 0x7f0800e1
public const int spPlay = 2131230945;
// aapt resource value: 0x7f0800e3
public const int spProgress = 2131230947;
// aapt resource value: 0x7f0800de
public const int spTitle = 2131230942;
// aapt resource value: 0x7f080063
public const int spacer = 2131230819;
@@ -3249,8 +3261,8 @@ namespace MusicApp
// aapt resource value: 0x7f08000e
public const int view_offset_helper = 2131230734;
// aapt resource value: 0x7f0800e5
public const int visible = 2131230949;
// aapt resource value: 0x7f0800e8
public const int visible = 2131230952;
// aapt resource value: 0x7f08008a
public const int webview = 2131230858;
@@ -3261,6 +3273,9 @@ namespace MusicApp
// aapt resource value: 0x7f080030
public const int wrap_content = 2131230768;
// aapt resource value: 0x7f0800d9
public const int ytPlay = 2131230937;
// aapt resource value: 0x7f0800a3
public const int ytProgress = 2131230883;

View File

@@ -19,6 +19,8 @@
<objectAnimator
android:propertyName="pathData"
android:duration="200"
android:repeatCount="0"
android:repeatMode="reverse"
android:valueFrom="M 6.41 5 L 5 6.41 L 10.59 12 L 5 17.59 L 6.41 19 L 12 13.41 L 17.59 19 L 19 17.59 L 13.41 12 L 19 6.41 L 17.59 5 L 12 10.59 L 6.41 5"
android:valueTo="M 8 5 L 8 8.5 L 8 12 L 8 15.5 L 8 19 L 10.2 17.6 L 12.4 16.2 L 14.6 14.8 L 16.8 13.4 L 19 12 L 15.333 9.667 L 11.667 7.333 L 8 5"
android:valueType="pathType"

View File

@@ -19,6 +19,8 @@
<objectAnimator
android:propertyName="pathData"
android:duration="200"
android:repeatCount="0"
android:repeatMode="reverse"
android:valueFrom="M 8 5 L 8 8.5 L 8 12 L 8 15.5 L 8 19 L 10.2 17.6 L 12.4 16.2 L 14.6 14.8 L 16.8 13.4 L 19 12 L 15.333 9.667 L 11.667 7.333 L 8 5"
android:valueTo="M 6.41 5 L 5 6.41 L 10.59 12 L 5 17.59 L 6.41 19 L 12 13.41 L 17.59 19 L 19 17.59 L 13.41 12 L 19 6.41 L 17.59 5 L 12 10.59 L 6.41 5"
android:valueType="pathType"

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

View File

@@ -5,13 +5,43 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.FloatingActionButton
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="bottom|end"
app:elevation="6dp"
app:pressedTranslationZ="12dp"
android:layout_margin="25dp"
android:src="@drawable/PlayToCross"
android:id="@+id/quickPlay"/>
android:id="@+id/quickPlayLinear"
android:orientation="vertical"
android:layout_margin="20dp"
android:layout_gravity="bottom|end" >
<android.support.design.widget.FloatingActionButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:visibility="gone"
android:layout_gravity="center"
app:fabSize="mini"
app:elevation="5dp"
app:pressedTranslationZ="12dp"
app:backgroundTint="#15b7ed"
android:layout_marginBottom="15dp"
android:src="@drawable/ic_playlist_play_black_24dp"
android:id="@+id/localPlay"/>
<android.support.design.widget.FloatingActionButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:visibility="gone"
android:layout_gravity="center"
app:fabSize="mini"
app:elevation="5dp"
app:pressedTranslationZ="12dp"
app:backgroundTint="#c62828"
android:layout_marginBottom="15dp"
android:src="@drawable/YtPlay"
android:id="@+id/ytPlay"/>
<android.support.design.widget.FloatingActionButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
app:elevation="5dp"
app:pressedTranslationZ="12dp"
android:src="@drawable/PlayToCross"
android:id="@+id/quickPlay"/>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>