Android Navigation Architecture: How to access Nested native component for Deep link - android-architecture-components

I'm implementing Android navigation component and has using a nested graph. Component D is the guy who will handle this. But when I'm performing it throwing exception:
Fragment is unknown to this NavController
At one level it is pretty much clear that, Fragment-D redirected from Fragment-C, but what is possible solution in this case to get direct control on Fragment-D.
I checked same for Fragment-C and it is able to accessible but on back it throwing same error as stated.
Any suggestion!!

Fragment is unknown to this NavController is not directly related to deep linking. It is a common error message when you want navigate to a destination which ist not part of the current navigation graph.
So in your case it seems like your app has at least 2 navigation graphs (i.e. 2 NavHostFragments) and you want to navigate from NavHostFragment A to a destination in NavHostFragment B.
Of course, the current NavController A does not know about fragment B. That is what the error message is telling you.

Related

Codename One - Improve Layout Animation Usage

Following the instructions in this documentation about Animations and Transitions, it is noted that animation done on the Form level requires taking the contentpane as the actual Container. So instead of
form.animateLayout(1000);
one has to do
form.getContentPane().animateLayout(1000);
While the documentation points out this exception, wouldnt it be easier and more user-friendly to update the animateLayout() function to check whether the intended Component to do the animation for is a Form itself and if so, automatically getting its content pane?
This would remove this exception handling from the user side and make it more intuitive.
Yes that makes sense. There are a lot of methods that constantly get added/changed and we still didn't add everything that needs adding. In this commit I added a few: https://github.com/codenameone/CodenameOne/commit/4b848039ec6619bf3d6dae3cfe6b8b8d9a7ff115

Unable to simultaneously satisfy constraints after transform project from objective-c to swift

How can it be possible, that an app, that runs in objective-c without problems, get the "Unable to simultaneously satisfy constraints"-error after moving it to swift?
I´ve only copied the views of an app to a swift-project and now get this error. But when the constraints are valid in objective-c, how is it possible, that they are invalid in swift???
This is the view, I want to display:
When all fields are filled as in the screenshot, now error appears.
The error only is thrown when one or more fields are empty!
This are the contraints of this view
The constraints are the same as in the objective-c-Version...
What might i show u more, Mr Beardsley?
I uploaded the swift-Project to here
u can find the objective-c-version (very large!) here
to get the error, u must go this way:
Mr. Rob Mayoff was right: my Swift project has different constraints than my Objective-C project. :-(

javafx rotating circle while loading

I have a method which loads some data and this can take a while, the problem is that you can still click on things and this might crash the program. So I am looking for a specific implementation of a loading-circle when you click on a button and the method starts.
What I would recommend is setting the cursor to "Cursor.Wait" on the objects that are still loading
Here is the code for that:
node.setCursor(Cursor.WAIT);
If it still gives you trouble you can try temporarily disabling the nodes.
Here is the code for that:
node.setDisable(true);

Nested Hierarchy Naming Rules & How To Keep Track Of Attached Scripts

I use the MVC programming model. I am running into a problem using Unity's hierarchy inspector. Say I have a Controller script: C_CardDrag. Now, because this drags a UI item thats nested several layers deep, it won't be readily apparenty that this C_CardDrag script is attached to an icon within in the card, and NOT the root object. You see what I mean in the image below (the blue highlight is where the C_Drag needs to be attached, NOT the top level object, otherwise the whole thing gets dragged when I only want the icon in the middle dragged).
I feel that it can be VERY confusing to design and name classes when they need to appear on nested objects.
Do you have any design practices I can follow to make script names clearer to where they are attached?
For example say I have a Tree object, and it has several brances. And lets say I have a C_Tree script, and a C_Branch script. How would you handle making it clear that C_Tree goes on a Tree, a TOP level object, where as C_Branch goes on a nested UI object?
Update:
Found a good resource here: Component based game engine design
Like any software that is being developed, you should only apply the appropriate Architectural and Design patterns that fit that project.
For example:
I was building a game that would be used for different devices. Although Unity lets you switch from Android to iOS seemingly easy. This game could be played completely differently on different devices, so I wen't with MVC.
Another game was built around Peer to Peer.
So overall you have a lot of options.
The way you can organize your files is by folders in the Project section of the Editor. I like to use something like this:
You will notice the Model is not in the Hierarchy. I don't use MonoBehaviours for models. In some cases, even the Controller could be non-MonoBehaviour code. That is why I prefer to have all the organization happen in the Project not the Hierarchy.

Talking Among GWT Panels using UIBinder Layout

New to GWT here...
I'm using the UIBinder approach to layout an app, somewhat in the style of the GWT Mail sample. The app starts with a DockLayoutPanel added to RootLayoutPanel within the onModuleLoad() method. The DockLayoutPanel has a static North and a static South, using a custom center widget defined like:
public class BigLayoutWidget extends ResizeComposite {
...
}
This custom widget is laid out using BigLayoutWidget.ui.xml, which in turn consists of a TabLayoutPanel (3 tabs), the first of which contains a SplitLayoutPanel divided into WEST (Shortcuts.ui.xml) and CENTER (Workpanel.ui.xml). Shortcuts, in turn, consists of a StackLayoutPanel with 3 stacks, each defined in its own ui.xml file.
I want click events within one of Shortcuts' individual stacks to change the contents of Workpanel, but so far I've only been able to manipulate widgets within the same class. Using the simplest case, I can't get a button click w/in Shortcuts to clear the contents of Workpanel or make WorkPanel non-visible.
A few questions...
Is ResizeComposite the right type of class to extend for this? I'm following the approach from the Mail example for TopPanel, MailList, etc, so maybe not?
How can I make these clicks manipulate the contents of panels in which they do NOT reside?
Are listeners no longer recommended for handling events? I thought I saw somewhere during compilation that ClickHandlers are used these days, and the click listener "subscription" approach is being deprecated (I'm mostly using #UiHandler annotations)
Is there an easy way to get a handle to specific elements in my app/page? (Applying the "ID" field in the UI.XML file generates a deprecation warning). I'm looking for something like a document.getElementById() that get me a handle to specific elements. If that exists, how do I set the handle/ID on the element, and how can I then call that element by name/id?
Note that I have the layout itself pretty well nailed; it's the interaction from one ui.xml modularized panel to the next that I can't quite get.
Thanks in advance.
If you don't have a use for resizing events than just use Composite
What you want is what the GWT devs called message bus (implemented as HandlerManager). You can get a nice explanation in the widely discussed (for example, on the GWT Google Group, just search for 'mvp') presentation by Ray Ryan from Google I/O 2009 which can be found here. Basically, you "broadcast" an event on that message bus and then a Widget listening for that event gets the message and does its stuff.
Yep, *Handlers are the current way of handling events - the usage is basically the same so migration shouldn't be a problem (docs). They changed it so that they could introduce custom fields in the future, without breaking existing code.
If you've set an id for any DOM element (for Widgets I use someWidget.getElement().setId(id), usually in combination with DOM.createUniqueId()) you can get it via GWT.get(String id). You'll get then a RootPanel which you'll have to cast to the right Widget class - as you can see it can get a little 'hackish' (what if you change the type of the Widget by that id? Exceptions, or worse), so I'd recommend sticking with MVP (see the first point) and communicating via the message bus. Remember however, that sometimes it's also good to aggregate - not everything has to be handled via the message bus :)
Bottom line is I'd recommend embracing MVP (and History) as soon as possible - it makes GWT development much easier and less messy :) (I know from experience, that with time the code starts to look like a nightmare, if you don't divide it into presentation, view, etc.)

Resources