Cosmicmind: how to dismiss floatingViewController / return rootViewController? - cosmicmind

toolbarController?.floatingViewController = vc
to floating view controller. As expected, toolbar not showing and screen shows with full size. I want to dismiss back to rootViewController didnt achieve that.
Actually i showed apps in pagetabbar like google play and now i want to show app detail page. When user clicks app icon, app icon will animate and shows detail page and if he wants to, it will dismiss that. I used transition method first (it has animation parameter) but i want to figure out difference between floating usages etc. Is there any showcase ? Thank you for great library btw.

to hide the floatingViewController, set it to nil. There isn't a showcase at the moment. The transition method is for changing the rootViewController. Hope this helps :)

Related

How do I declaratively push BottomSheet with Navigator 2.0?

I'm new to Navigator 2.0 in Flutter, and now I'm trying to achieve BottomSheet behavior using declarative approach. Unfortunately, I only managed to come up with quite a cumbersome way to do that so I'm wondering if there's an easier way.
I'm building a shopping app and I want to show the item details card that slides out from the bottom of the screen, dimming the previous page (as shown in picture), when user taps on item in a list. I also want to allow url support, so that /item/id opens home page and then shows the details card over it.
So how I think this could be done is to push (or to add to Navigator's pages array in case of Navigator 2.0) custom non-opaque page with no transition animation using TransitionDelegate and PageRouteBuilder, and then animate dimming and sliding by hand using animation controllers. But this approach seems unnatural (and genuinely scares me to be honest) and it's still not clear to me how to handle back button in this case (Do I need to somehow notify the page to play closing animation from Navigator's onPopPage, is this the way to do this?).
If anyone has an experience of implementing similar feature, I would really appreciate sharing it! Or maybe you have come up with more elegant solution, then tell me about it and I'll give it a try! Thanks!

Are InputComponents and Dialogs incompatible?

In the simple Dialog below:
// choice of layout has no impact:
Container cont=new Container(new TextModeLayout(3, 1));
//Container cont=new Container(new BoxLayout(BoxLayout.Y_AXIS));
TextComponent firstName=new TextComponent().label("First Name").text(person.firstname);
TextComponent lastName=new TextComponent().label("Last Name").text(person.lastname);
TextComponent cost=new TextComponent().label("Cost per Session").text(person.getCostString());
cost.getField().setConstraint(TextArea.DECIMAL);
// NOTE HERE
// doesn't work: // works:
cont.add(firstName); // cont.add(firstName.getField());
cont.add(lastName); // cont.add(lastName.getField());
cont.add(cost); // cont.add(cost.getField());
Dialog.show("Edit Client", cont, new Command(CANCEL), new Command(OK));
Nothing appears in the Dialog unless I add the TextField instead of the TextComponent to my container at the NOTE HERE comment. This means I lose the nice appearance of the labelled input fields (yes I know I could label them myself, but they wouldn't look as good on different devices). My choice of layout manager at the top does not affect this issue (I've tried several). I can't find evidence online to conclude there's an incompatibility here, adding TextComponents and other InputComponents works fine on a Form, just not in a Dialog.
I'm having the same problem in another Dialog that uses PickerComponents. The PickerComponent doesn't appear unless I add the Picker itself, and then the Picker spawned from a Dialog looks all wrong. I'm hoping the simpler code question above will answer this quandary as well.
It's worth noting I've made no theme changes and this problem is noted in both the Android and Apple skins as well as on an actual Android phone. Thanks in advance for any help!
You shouldn't do input in a Dialog as it creates a very problematic user experience. If you would like things to look like they are in a dialog you can use styles and layouts to make a Form feel like a Dialog but you shouldn't use a Dialog.
The reason this fails is a bit complicated but here are the high level problems with using a dialog:
Dialogs don't grow implicitly - This is a huge problem for text input as the component needs space to resize with input and even more so for the animated TextComponent which needs to shift things around. The size of a Dialog is determined when it's shown and that's a big problem
This becomes a bigger problem on Android where the screen resizes during input and distorts the dialog completely. It's one of those things you'll only see on the device because it's really hard to simulate the virtual keyboard.
Scrollability is hard in a Dialog and text components need a scrollable parent so you can scroll between the various edit components
Picker component uses a form of Dialog to show input and this can collide with your dialog
Dialogs are hard to get right for suspend/resume behavior. Suspend/resume happens when the app is minimized or sent to the background. E.g. say you have an incoming call while typing in the dialog. When you go back to the app we want to show the last form. If we show the dialog it will block and we won't know which parent form to show anyway. So when an app is suspended dialogs are just disposed in the default code generated in the main class. It makes more sense.

How to get a callback when a View becomes visible on the screen on Android

Is there a way to get a callback when a View appears/disappears on the screen?
I need this for analytics purposes - eg. I need to check how many times people saw a view versus how many times they clicked on it.
I can tell whether a view is on screen at a certain point in time but I'm wondering whether there is a callback for that.
Also note that I'm not interested when a View's state becomes VISIBLE and not even when a view gets rendered (because eg. in a ViewPager the Views of the second page are rendered before they actually appear on screen).
We did several workarounds for certain scenarios but I'd like to have something which is more generic. We need it in ListViews, GridViews, ScrollViews and ViewPagers and each one of them presents different challenges.
Does ViewTreeObserver.OnGlobalLayoutListener help? I have never used it myself though.
See: http://developer.android.com/reference/android/view/ViewTreeObserver.OnGlobalLayoutListener.html

Can Popup page use DOM elements created in Background Page

Actually, I want to store some data in background page and the popup page just show that part of data say Data as a div element created in background page document.createElement("div"). Here, the background page will register some listeners to the tab update and change the Data elements accordingly. What the popup will do is to get that Data and appendit use the document.appendChild(Data).
(The purpose I intend is this will cause the popup changes immediately while the tab updage is triggered.)
However, the elements are shown as usual, what I am facing very headache is I have registered the onclick for the div object in backgroundpage as onclick="chrome.extension.getBackgroundPage().somefunc()". However, the first time, all the click will triger the right behavior but after the popup loses foucs and get focus again, all the click won't work.
I try to put something like change the onclick="somefunc()" and leave the func within the script of popup page. And there I want to log whether it is called by console.log("clicked"). Here, something unbelievable happens, the function is succefully trigerred BUT the console is null here, I cannot even call chrome.extension.getBackgroundPage() as well.
Here are a list of questions, maybe very hard to express for me...
1. Whether I can reuse the DOM element from the background page to the popup page directly by appendChild(chrome.extension.getBackgroundPage().getElementById()?
2.Will the onclick event registered in the background page still work in the popup pages?
3. What's the problem with the problem I am encountering? I have tried many ways to find out the reason but all in vain at last...
Best Regards,
If you need any more information, please let me know.
(PS: I am wonderning if it is called something like the event propogation, however, I am not an expert in this two pages communicating...)

Using multiple UIWebViews in a UIScrollView

I am using 5 UIWebViews in a UIScrollView to show the result of my game. Intention is to allow the user to scroll through the results screen. I had a problem where the UIWebViews won't load when scrolled to the next page. This means the first page will load successfully however when you scroll to Page 2, you will see a white blank page. Page is loaded as I can see the alert which was given in all the 5 pages, but it won't show.
I tried a workaround as mentioned here
inserting various views into UIScrollView
http://pinchzoom.com/blog/items/view/1386/one-of-the-problems-with-the-uikit-at-the-moment-is-an-issue-embedding-a-uiwebview-within-a-table
This fixed my problem, however when I submitted the app to iTunes, it got rejected with the following comment.
"3.3.1 Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs."
The non-public API that is included in your application is _documentView
I would like to fix this issue and resubmit. Can someone help please ?
Thanks
Jugs
Just use one WebView for all results (which will scroll if it doesn't fit into the screen).

Resources