Flyout Page with "split" FlyoutLayoutBehavior + Right-to-Left in Xamarin.Forms V5 - xamarin.android

Description
I'm trying to apply RTL direction on the Flyout page with split behavior , it works correctly on IOS(master page on the right ) .But in the android It stays on the left side. Any ideas or could somebody help me with custom renderer?
I used Different solution without any result like below :
1- add android:supportsRtl="true" to AndroidManifest.xml
2- add FlowDirection = FlowDirection.RightToLeft in the constructor of the Flyout page
3- add Window.DecorView.LayoutDirection = LayoutDirection.Rtl; in the MainActivity File
Steps to Reproduce
use Xamarin forms version 5
create flyout page and apply the above solutions
Deploy the app in android device or emulator
Expected Behavior
the master page should appear in the right side
Actual Behavior
the master page it is still appear in the left side
FLayout RTL issue

To display the FlyoutPage on the right side, please set FlowDirection to RightToLeft for the flyoutPage.
So, you can add code FlowDirection="RightToLeft" to your FlyoutPage1.xaml
<?xml version="1.0" encoding="utf-8" ?>
<FlyoutPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="POCXamarinForm.FlyoutPage1"
FlowDirection="RightToLeft"
xmlns:pages="clr-namespace:POCXamarinForm">
<FlyoutPage.Flyout>
<pages:FlyoutPage1Flyout x:Name="FlyoutPage" />
</FlyoutPage.Flyout>
<FlyoutPage.Detail>
<NavigationPage>
<x:Arguments>
<pages:FlyoutPage1Detail />
</x:Arguments>
</NavigationPage>
</FlyoutPage.Detail>
</FlyoutPage>
For more,you can check: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/localization/right-to-left .

To display flyout page on right side, try adding the following code in the constructor of FlyoutPage1.xaml.cs
this.FlowDirection = FlowDirection.RightToLeft;
Flyout.FlowDirection = FlowDirection.RightToLeft;
Detail.FlowDirection = FlowDirection.RightToLeft;
enter image description here

Related

In google sheets add some kind of dialog box that will display on an ipad

I am trying to add a yes/no message box to a google sheet that will display on an iPad. I have tried all the things below but none of them display the message. My goal is if the user changes a field the macro will change other fields if the user says it is ok. I can get this to work on a windows machine with no issues but when I try it on an ipad the message never appears. At this point I am just trying to get a message box to appear. This is what I have tried
1.
function onEdit(e) {
Browser.msgBox("test");
}
Result: The macros times out
2.
function onEdit(e) {
var html = HtmlService.createHtmlOutputFromFile('Page')
.setWidth(400)
.setHeight(300);
SpreadsheetApp.getUi() // Or DocumentApp or SlidesApp or FormApp.
.showModalDialog(html, 'My custom dialog');
}
Page.html:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
Hello, world! <input type="button" value="Close" onclick="google.script.host.close()" />
</body>
</html>
I enabled the trigger for onEdit to get it to work and it works on the windows machine without issues but when run on the iPad I get:
Exception: You do not have permission to call Ui.showModalDialog. Required permissions: https://www.googleapis.com/auth/script.container.ui
So next I tried:
3.
function myFunction(){
Logger.log("myFun")
var html = HtmlService.createTemplateFromFile( 'Page' )
.evaluate()
.setWidth( 800 )
.setHeight( 400 );
SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
.showModalDialog( html, 'My page title' );
}
function onEdit(){
ScriptApp.newTrigger('myFunction')
.forSpreadsheet(SpreadsheetApp.getActive())
.onEdit()
.create();
}
Using the same page.html, this time in executions it looks like it runs but no box appears on the ipad(it does work on windows). I also tried spreadsheetApp.getUi().alert and prompt, these had the same results.
And Yes I have to use the iPad, I can not use another type of tablet.
Issue:
"Exception: You do not have permission to call Ui.showModalDialog. Required permissions: googleapis.com/auth/script.container.ui"
Fix:
What you can do is installing the trigger instead of using a simple trigger. The image below shows the difference between an installed (above) and a simple (below) trigger using the same code.
Output:
Note:
Don't use reserved function names on installed triggers to avoid it being executed twice like what's shown above. Change onEdit to something like promptUI or something else.
If the above fix isn't enough to show the dialog box, then we need to confirm if the issue might just be on the safari browser (if you are using one) since it worked on your other devices which I assumed are not using safari. You can try using an alternative browser in your device such as Google Chrome and see if the same issue persists. I recommended doing this since i'm seeing a number of issues between showModalDialog and safari
EDIT:
I have seen these related posts pointing out that there are some limitations on mobile apps. See the references below.
Also, some answers suggests that you need to access the spreadsheet via browser (google chrome desktop mode) and then trigger the script there.
References:
Add a script trigger to Google Sheet that will work in Android mobile app
google speadsheet api onOpen does not work on mobile ios
Executing Google Apps Script Functions from Mobile App
How to get scripts to work with phones and tablets

Android Xamarin Not Seeing My Resource.Id.TagName

I have a project and am trying to use SetTag on my views. But I need a resource id, so according to internet advices, I have created a tags.xml file in my Resources/values folder, like below:
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<item name="TAG_VIEWPAGER_PAGELAYOUT" type="id"/>
<item name="TAG_VIEWPAGER_PAGEPOSITION" type="id"/>
</resources>
Then I try to access it like so after a clean and rebuild, but it doesn't find it. It says TAG_VIEWPAGER_PAGEPOSITION cannot be found.
view.SetTag(Resource.Id.TAG_VIEWPAGER_PAGEPOSITION, position);
Help? I am using Android 5.0 Level 21, C# Xamarin
TRY:
Open the resourcedesigner.cs file [you might want to back it up if you've never done this before]
Click in the file
use CTRL + A to highlight all the code
delete the contents of resourcedesigner.cs completely
clean the solution
rebuild the solution [resourcedesigner.cs should reload automatically]
Sometimes the resource designer file can't keep up with your changes.
If this doesn't work then try searching for TAG_VIEWPAGER_PAGEPOSITION in your resourcedesigner.cs file and let me know if it's in there
It just required a restart for VS, and then everything worked.. so much time trying other solutions.. so agitating...

How to display pdf in a WebView in terms of UI and UX - iOS Swift

Brief about the app: The app parses html documents and load it in the app as a web view.
In the iOS app I like to show PDF files. There is a structure XML that would contain the whole structure.
Case 1: For a simple PDF file it would look like the following in the structure.xml
<node id="Nc13d37aa" node_id="82cd790d-e5f0-4ee6-a26c-a6e400af8541" type="publication" default="TEST_Pub" secured="false">
<language name="en-GB" path="X-BIKE-401/en-GB/publications/TEST_Pub-003.00.pdf">
<title>(Test-)Publication</title>
</language>
</node>
Case 2: In a more complex scenario one publication might contain a so called ATI's(Additional technical information) This would look like this:
<node id="Nd747c4dc" node_id="b4528fb8-c615-4b96-945d-a5af009325f2" type="publication" default="TEST_Pub_ATI" secured="false">
<language name="en-GB" path="X-BIKE-401/en-GB/publications/TEST_Pub_ATI-003.00.pdf">
<title>(Test-)Publication with ATI</title>
<atis>
<ati id="ati584a41ee" internal_id="af720ef4-5238-4fb4-ba8b-a5ae00debfae" code="Test_ATI" type="Service Letter" required="false" issuecode="Test_ATI_03" issuenumber="3" revisionnumber="0" href="X-BIKE-401\en-GB\ati\Test_ATI-003.00.pdf">(Test-)ATI</ati>
</atis>
</language>
</node>
The idea here is, that we have additional legacy documents accompanying a legacy publication. The idea here would be, that we show the normal legacy publication, but have an additional area in the view, that indicates the user, that there ARE ATIs, and a way for him to view the ATIs - but also get back to the original publication. An ATI is usually some information
Case 3: There is also the case, that one or many ATIs are mandatory.
This means, that the user needs to read & confirm those first, before he can read the actual publication. This will be like:
<node id="N5a3c00f" node_id="09fe8d7b-a95d-4da8-bf06-a5af00933ddc" type="publication" default="TEST_Pub_mATI" secured="false">
<language name="en-GB" path="X-BIKE-401/en-GB/publications/TEST_Pub_mATI-003.00.pdf">
<title>(Test-)Publication with MANDATORY ATI</title>
<atis>
<ati id="ati35c8ee0e" internal_id="60dfaa70-f017-44ea-9190-a5ae00df2494" code="Test_ATI_MAND1" type="Service Bulletin" required="true" issuecode="Test_mATI_03" issuenumber="3" revisionnumber="0" href="X-BIKE-401\en-GB\ati\Test_ATI_MAND1-003.00.pdf">(Test-)ATI1 (MANDATORY)</ati>
<ati id="atic771b1b6" internal_id="d1cffa4b-b1be-4bbb-8dc0-a743010cf246" code="Test_ATI_MAND2" type="Service Bulletin" required="true" issuecode="Test_mATI2_01" issuenumber="1" revisionnumber="0" href="X-BIKE-401\en-GB\ati\Test_ATI_MAND2-001.00.pdf">(Test-)ATI2 (MANDATORY)</ati>
</atis>
</language>
</node>
You can see, that two have the #required set to "true".
In this case we need to first show the first ATI, request the user to "confirm" somewhere that he read it. move on to the next required ATI and conform this as well. and once he has confirmed all the ATIs, he can view the publication itself.
Still he needs to be able to reopen the ATIs (similar to the previous point) and look them up again - without confirmation again.
The user needs to reconfirm, once the publication is closed.
Question: For case 2 & 3, how would this might look like? a mockup of it how would it be? Ideally a proposed solution best in terms of UI and UX.
I can suggest you this way , it may solve your question :
CASE 1 :
Simply Take a UIWebView and show PDF url link , then WebView will render it perfectly .
CASE 2 :
In case 2 you are first showing the case 1 where you show simple PDF and showing it by rendering the web view but then this PDF has extra information called ATI that we need to show this somehow on the web view. So for example a button that when you click on it it will show the extra information maybe in a pop up and then there should be a navigation back to the original PDF
CASE 3:
Use some Image Flipper library to show multiple pdf doc in which you can show some sort of info to acknowledge the user about there are more than one doc is there for navigation .
For Flipper follow this library : https://cocoapods.org/pods/DJKFlipper
Thanks.

Issue with FDF on different platforms PDFTron

I am facing an issue wherein I am unable to show annotations on my PDF on IOS device that are made from some other platforms e.g web, Windows or android. What is actually happening is if I am editing an already created annotation like an underline by changing the notes associated with it from my iOS device, then it is not reflecting on other platforms.
On further Investigation, I found that the PDF format generated by PDFTRON on iOS is different from the format generated by PDFTRON on any other platform. For example, I draw an underline annotation on a document from the web. The initial FDF received is as follows:
<squiggly subject="Squiggly" page="0" rect="275.93,656.703203,336.2084,665.759453" flags="print" name="0eabf5b2-77ab-4c04-3379-438e7a8fc714" title="testuser" date="D:20161027122930+05'30'" color="#FF0000" opacity="1" creationdate="D:20161027121425+05'30'" coords="275.93,665.76,336.21,665.76,275.93,656.7,336.21,656.7"><contents-richtext><body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:spec="2.0.2" xfa:APIVersion="Acrobat:10.1.3"><p dir="ltr"><span dir="ltr" style="font-size:10.0pt;text-align:left;color:#000000;font-weight:normal;font-style:normal">under_line</span></p></body></contents-richtext><contents>under_line</contents><popup flags="print,nozoom,norotate" page="0" rect="0,692,150,792" open="no"/></squiggly>
I have entered the text under_line in the notes initially. Now when I edit this annotation from the web (Changing the text from under_line to under_lines) , the resulting FDF is as follows:
<squiggly subject="Squiggly" page="0" rect="275.93,656.703203,336.2084,665.759453" flags="print" name="0eabf5b2-77ab-4c04-3379-438e7a8fc714" title="testuser" date="D:20161027122930+05'30'" color="#FF0000" opacity="1" creationdate="D:20161027121425+05'30'" coords="275.93,665.76,336.21,665.76,275.93,656.7,336.21,656.7"><contents-richtext><body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:spec="2.0.2" xfa:APIVersion="Acrobat:10.1.3"><p dir="ltr"><span dir="ltr" style="font-size:10.0pt;text-align:left;color:#000000;font-weight:normal;font-style:normal">under_lines</span></p></body></contents-richtext><contents>under_lines</contents><popup flags="print,nozoom,norotate" page="0" rect="0,692,150,792" open="no"/></squiggly>
The same annotation when edited from an iOS device produces the following FDF:
<squiggly subject="Squiggly" page="0" rect="275.93,656.703203,336.2084,665.759453" flags="print" name="0eabf5b2-77ab-4c04-3379-438e7a8fc714" title="testuser" date="D:20161027122930+05'30'" color="#FF0000" opacity="1" creationdate="D:20161027121425+05'30'" coords="275.93,665.76,336.21,665.76,275.93,656.7,336.21,656.7"><contents-richtext><body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:spec="2.0.2" xfa:APIVersion="Acrobat:10.1.3"><p dir="ltr"><span dir="ltr" style="font-size:10.0pt;text-align:left;color:#000000;font-weight:normal;font-style:normal">under_line</span></p></body></contents-richtext><contents>under_lines</contents><popup flags="print,nozoom,norotate" page="0" rect="0,692,150,792" open="no"/></squiggly>
Now you can see the difference. When I edit the text on the web, the text is changed at both points wherever it appears while when it is changed from the iOS device , the text is updated at only one place.
I believe this is causing a problem for me. How can I resolve this?
Annotation can actually have two Contents. The regular one, and a Rich Contents (essentially a minimal subset of HTML). The two are not guaranteed to be the same, which is the case here. One field got updated, the other didn't, as this actually depends on the specific PDF software used.
There is no difference between our different SDK's in this regards, so either you used two different files, or two different PDF readers. It sounds like on iOS used a 3rd party program.

iOS 8 + Swift - Looking to define multiple lanes, but draw them based on events

I have 3 buttons in one of my app storyboards. Based on the button pressed by the user, I would like to have a different line drawn. I'm new to iOS development and I was looking at Apple's Developer Library for details on how to create a context, path and line definition, but I was not able to figure out the implementation to define the contexts and paths for multiple lines.
Thanks in advance for the help.
Edit - 2015-02-24: To clarify the question and adding a video explaining how I do this on another platform.
Because the question might be difficult to understand, and because I have more experience with Windows development, I created a Windows Phone app showing what I'd like to do on iOS+Swift.
Here is how I do this in XAML + C# for Windows Universal Apps (Runtime)
First, I define the line in MainPage.xaml (The Tranform tags are added later):
<Line x:Name="line1" Stroke="Black" StrokeThickness="6" Y1="60" Y2="60" RenderTransformOrigin="0.5,0.5" Margin="1,0,-1,0" X1="30" X2="30">
<Line.RenderTransform>
<CompositeTransform/>
</Line.RenderTransform>
</Line>
Then I define the storyboard animation within the Page.Resources section in the XAML file:
<Storyboard x:Name="anLine2">
<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="line1" d:IsOptimized="True"/>
<DoubleAnimationUsingKeyFrames EnableDependentAnimation="True" Storyboard.TargetProperty="(Line.X2)" Storyboard.TargetName="line2">
<EasingDoubleKeyFrame KeyTime="0" Value="30"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.30" Value="380"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
I define the button:
<Button x:Name="btnL1" Content="Line 1" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="10,0,0,0" Click="btnL1_Click"/>
And finally I trigger the animation <> when the button is pressed:
private void btnL1_Click(object sender, RoutedEventArgs e)
{
anLine1.Begin();
}
I defined 3 lines and 3 buttons. The result is seen in this video (It looks a bit choppy in the video, but it is because of the screen capture software. The execution in the emulator and test devices is very smooth):
http://youtu.be/Y4i2IUehl7U
Now, what I want is being able to do exactly this, but on iOS using Swift. I hope this helps clarifying the question.
Thanks in advance!
I think what you want is to animate a line being drawn - if so, see this questions:
how to draw line with animation?
In particular one of the answers has this link:
http://tumbljack.com/post/179975074/complex-interpolation-with-cashapelayer-free
Basically, use a CAShapeLayer and animate from an empty path to a path with your destination.

Resources