How to dismiss dialog fragment started via Android Navigation library - android-architecture-navigation

In Navigation 2.1.0-alpha03 they added functionality to navigate to a DialogFragment with <dialog> tag.
However, how can the source fragment/activity then dismiss this dialog fragment? Its very easy to do this in pure AOSP android with dialogFragment.dismiss(), but I don't see an accompanying way in Navigation library.

findNavController().navigateUp() is the one what you are looking for.
<dialog> is treated same as <fragment>. Controlling destinations are all identical.

Related

iOS SwiftUI how to bring up extra actions like "Embed in VStack" when interacting with code?

I am looking at this SwiftUI tutorial and it suggests I can see extra actions upon Command-Clicking the SwiftUI elements in code. In my Xcode, this jumps me to the class definition.
I see there's an option in XCode 11.0 t change the Option key to show SwiftUI inspector, however, this still does not let me modify SwiftUI code elements using actions like "Embed in VStack"
How can I get both inspector and extra SwiftUI actions when interacting with SwiftUI Code (not the preview)?
Extra SwiftUI actions show when Canvas is opened (shortcut: Option-Command-Enter or ⌥+⌘+↵):
canvas is closed
canvas is opened
The accepted answer doesn't work for me on macOS 10.15.5 and Xcode 11.4.1.
The Good news is that you can get it via a shortcut of [Command][Shift][Left Click] on a SwiftUI element or by clicking Show Code Actions on the right click menu.
Instead of using the mouse, I recommend using the Xcode hotkey for bringing up code actions. Navigate to Preferences -> Key Bindings and search for Show Code Actions. You'll see the preset hotkey which you can then customize. My default key binding was Shift+Command+A. Just make sure you cursor is over the intended element when you press the hotkey.
You can change the command click behavior where you were looking under Xcode -> Preferences, Navigate tab.
Rather unintuitively, if you pick "Selects Code Structure", then command+click will bring up the SwiftUI menu options you're looking for (granted the canvas is open).
If you do this, you can still jump to definition via control+command+click
Conversely, if you'd prefer to continue to use command+click to jump to definition, you can instead use control+command+click to bring up the SwiftUI menu options.
Command clicking on a view will not work in Xcode 12.2 and 12.3 (under MacOS 10.15.5) if you have your preferences different than Xcode expects.
You have to change your Navigation preferences for Command-click on Code: to Selects Code Structure before the proper menu will appear when you command click on a View.
To change this. press command , to open your preferences and select the Navigation button. The option you need to change is in the first popup menu.

iOS Custom Tab Bar

I am looking to implement a custom Tab Bar in iOS where selected item is bigger size than the rest of the tabs and peeks out over the content similar to this screenshot.
Could someone point to a tutorial of how to accomplish this preferably in Swift?
I faced with this task several times. I found a lot of tutorials but I've never found one that gives the ability to create a center button that part of it is out of the tab bar.
At the end, I created an approach to have it done correctly. I implemented a simple example project with instructions how to do that. Please check my Custom Tabbar Center Button repo as an example.
One more benefit of it it's center button hides correctly with the tab bar when you use Hide Button Bar on Push property.
A UITabBar contains an array of UITabBarItems, which inherit from
UIBarItem. But unlike UIBarButtonItem that also inherits from
UIBarItem, there is no API to create a UITabBarItem with a customView.
So instead of trying to create a custom UITabBarItem, we’ll just
create a regular one and then put the custom UIButton on top of the
UITabBar
Not swift, but should be easily translated.
https://github.com/boctor/idev-recipes/tree/master/RaisedCenterTabBar
This one is Swift:
https://github.com/itsKaynine/SwiftRaisedTab
Source code for a similar question, using Swift 3:
https://stackoverflow.com/a/36016377/300897

GDK : How to show status similar to 'Recording" and 'Complete"

I'm developing a GDK app where I need to provide an user experience to display status text similar to video recording status that Glass provides ( displaying "Recording" status then displaying progress indicator and finally showing 'Complete' text ). Appreciate your input.
Right now, you'll need to write your own UI logic to do this (perhaps by using a Dialog with a custom layout that has the appropriate centered label and icon, with a progress bar at the bottom, and changing the label and dismissing the dialog when the action is complete).
You may want to follow issue 271 in our issue tracker, which covers the progress indicator part of this flow.
Tony is right. There is no way to do this naively but you can build it yourself. You can create a layout that is build exactly like the menu is built in the GDK, and then just update the setcontentview() with a new layout each time you want to move to the next card. Also you can build a layout with the holo horizontal progressbar to get the general idea but it won't be like the one Google uses.
Also wanted to add that I have built a repo that you can drop into your project for this. Here is the link: https://github.com/w9jds/GDK-ProgressBar

Update a view plugin from an action in text editor plugin

I have two eclipse plugins(custom text editor plugin and a view plugin as two different projects). There is an action in the text editor that builds index of 'functions' of all dependent source files. At the end of this action I would like to show index(list of 'functions') in a tableviewer of the view plugin. What would you say the best way to achieve this? The view does not have to listen to the editor. It should be updated only when an action from editor plugin fires.
I exported a package from the editor plugin and exported another package from the view plug because text editor plugin needs to reference view type to populate tableViewer in the view plugin, and the view plugin needs to reference editor type in tableviewer's contentProvider. But I am getting an build path error:
A cycle was detected in the build path of project
How can I resolve this? Or If this is a bad approach, do I have a better way?
Thanks.
tk.
First of all, circular references between plug-ins are not allowed. So when you need to share information bidirectional between plug-ins, you often have to refactor the problem, to have a listener pattern for one of the directions.
In this case, I would use the same structure for your view as used for the existing Outline view. So your view should sub-class the PageBookView which have a rather simple protocol for how a participating editor can provide data to the view.
Basically I would do the same as done for the Outline view, and let the editor itself provide the content of the view via adaption. The Outline view does this by tracking the current editor, and whenever a new editor is "seen", the Outline view attempts to adapt the IEditorPart to IContentOutlinePage. The editor is responsible for the SWT widgets and listeners, etc that will be needed in the view page for this particular editor... Have a close look at the JavaDoc for ContentOutline - this is a rather good description of the protocols involved.
If you have multiple "open" editors, then the new view will automatically show the relevant information for the active editor and not "just" the editor that was active the last time you executed your action.
With this scheme, your action will simply
Show (and activate) the new view. This can be done via IWorkbenchPage.showView(...).
Request the provide page to update its view...

Standalone jQuery or MooTools version of YooTools YOOcarousel

I was wondering if anyone knows of a jQuery or MooTools script that will do the exact same thing as YOOcarousel (http://tools.yootheme.com/extensions/yoocarousel).
I'm looking to emulate the 'List Styling' setup they have where on the left you have the tabbed navigation and on the right it fades in/out thru each of the tabbed items as they are clicked.
Thanks,
Ryan
iCarousel might work for your purposes (demo and code examples here as well), created by Fabio Zendhi Nagao. The functionality isn't exactly identical (tab based control) to the YooTools Carousel but foundation is there to make it very close to the YooTools offering.
slideItMoo is another alternative- however, it appears to have fewer customized examples and less of a fan base.