Skip to content

Commit

Permalink
Fix entry cannot lost focus issue for iOS and Android
Browse files Browse the repository at this point in the history
Add testing demo for entry.
  • Loading branch information
jessejiang0214 committed Aug 31, 2016
1 parent c3a7812 commit 4d1c5b0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
7 changes: 7 additions & 0 deletions SlideOverKit.Droid/SlideOverKitDroidHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
using Android.Animation;
using System.Linq;
using Android.Util;
using Android.Views.InputMethods;
using Android.Content;

namespace SlideOverKit.Droid
{
Expand Down Expand Up @@ -211,7 +213,12 @@ void HideBackgroundForPopup ()
{
_currentPopup = null;
if (_popupRenderer != null) {
if (_popupRenderer.ViewGroup.HasFocus) {
InputMethodManager inputManager = (InputMethodManager)Forms.Context.GetSystemService (Context.InputMethodService);
inputManager.HideSoftInputFromWindow (_popupRenderer.ViewGroup.WindowToken, HideSoftInputFlags.None);
}
_pageRenderer.RemoveView (_popupRenderer.ViewGroup);
_popupRenderer.Dispose();
_popupRenderer = null;
}
if (_backgroundOverlay != null) {
Expand Down
1 change: 1 addition & 0 deletions SlideOverKit.iOS/SlideOverKitiOSHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ void HideBackgroundOverlay ()
_backgroundOverlay.Dispose ();
_backgroundOverlay = null;
}
_menuOverlayRenderer.NativeView.EndEditing (true);
}

void HideBackgroundForPopup ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<t:SlidePopupView xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:t="clr-namespace:SlideOverKit" x:Class="SlideOverKit.MoreSample.PopOverView">
<StackLayout Padding="15,10,15,30" Spacing="20" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<Label HeightRequest="30" Text="Build some Awesome SlideOver's" FontSize="24" XAlign="Center" />
<Entry Placeholder="Testing..." HeightRequest="40"/>
<Image HeightRequest="40" Source="xamconsulting.png">
</Image>
<Button x:Name="DoneButton" Text="Close" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,32 @@
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label Text="Right Side Menu" FontSize="18" Grid.ColumnSpan="2" XAlign="Center" YAlign="Center" TextColor="Black" />
<Grid Grid.Column="0" Grid.Row="1" BackgroundColor="#E15771">
<Entry Placeholder="Search..." Grid.ColumnSpan="2" Grid.Row="1" HeightRequest="40" VerticalOptions="Center" />
<Grid Grid.Column="0" Grid.Row="2" BackgroundColor="#E15771">
<Image Source="Home.png" WidthRequest="50" HeightRequest="50" HorizontalOptions="Center" VerticalOptions="Center" />
</Grid>
<Grid Grid.Column="1" Grid.Row="1" BackgroundColor="#348ECA">
<Grid Grid.Column="1" Grid.Row="2" BackgroundColor="#348ECA">
<Image Source="Happy.png" WidthRequest="50" HeightRequest="50" HorizontalOptions="Center" VerticalOptions="Center" />
</Grid>
<Grid Grid.Column="0" Grid.Row="2" BackgroundColor="#348ECA">
<Grid Grid.Column="0" Grid.Row="3" BackgroundColor="#348ECA">
<Image Source="Settings.png" WidthRequest="50" HeightRequest="50" HorizontalOptions="Center" VerticalOptions="Center" />
</Grid>
<Grid Grid.Column="1" Grid.Row="2" BackgroundColor="#348ECA">
<Grid Grid.Column="1" Grid.Row="3" BackgroundColor="#348ECA">
<Image Source="VideoCall.png" WidthRequest="50" HeightRequest="50" HorizontalOptions="Center" VerticalOptions="Center" />
</Grid>
<Grid Grid.Column="0" Grid.Row="3" BackgroundColor="#348ECA">
<Grid Grid.Column="0" Grid.Row="4" BackgroundColor="#348ECA">
<Image Source="Microphone.png" WidthRequest="50" HeightRequest="50" HorizontalOptions="Center" VerticalOptions="Center" />
</Grid>
<Grid Grid.Column="1" Grid.Row="3" BackgroundColor="#3AAA70">
<Grid Grid.Column="1" Grid.Row="4" BackgroundColor="#3AAA70">
<Image Source="Enter.png" WidthRequest="50" HeightRequest="50" HorizontalOptions="Center" VerticalOptions="Center" />
</Grid>
<Grid Grid.Column="0" Grid.Row="4" BackgroundColor="#348ECA">
<Grid Grid.Column="0" Grid.Row="5" BackgroundColor="#348ECA">
<Image Source="Pencil.png" WidthRequest="50" HeightRequest="50" HorizontalOptions="Center" VerticalOptions="Center" />
</Grid>
<Grid Grid.Column="1" Grid.Row="4" BackgroundColor="#348ECA">
<Grid Grid.Column="1" Grid.Row="5" BackgroundColor="#348ECA">
<Image Source="MessageFilled.png" WidthRequest="50" HeightRequest="50" HorizontalOptions="Center" VerticalOptions="Center" />
</Grid>
<Image Grid.ColumnSpan="2" Grid.Row="5" WidthRequest="10" HeightRequest="10" HorizontalOptions="Center" VerticalOptions="Center" Source="DoubleDown_Black.png"/>
<Image Grid.ColumnSpan="2" Grid.Row="6" WidthRequest="10" HeightRequest="10" HorizontalOptions="Center" VerticalOptions="Center" Source="DoubleDown_Black.png"/>
</Grid>
</t:SlideMenuView>

0 comments on commit 4d1c5b0

Please sign in to comment.