Open Additional Fragment - google-app-maker

Is there a way to open a second Fragment Page? (ie. open multiple fragment pages at the same time)
I have a database setup and when users click a button a Fragment Page pops up so they can edit the fields. I would like to try and have a sub-menu appear for comments (so they don't have to scroll all the way to the bottom of the screen).
Something like the Menu in the Material Gallery Sample would be great.
Note:
I am currently using app.showDialog(app.pageFragments.Menu); to open the Page Fragments.
Having both Fragments open side by side would be a usable options as well.
Thanks!
Here is an example diagram.

Sorry for the late reply. I'll put this as an answer because I think it will get you what you need. You could implement this if you put the page fragments directly into your page, and toggled their visible property to show/hide them.
The biggest trick here is how does the first page fragment tell the second to open? That ends up being simple, just add a custom boolean property to the first fragment. Then in the base page (which contains the two fragments) bind the visible property of the second fragment to the custom property of the first fragment. Then in the first fragment, you can set that property to "true" when you want the second fragment to show, and "false" when you want it to hide.

Related

Espresso perform click on button located in fragment

I've got the following problem. I want to test my application with Espresso. Therefore I want to click a button which is part of the "Buttons" fragment, this fragment is located in a frame-layout in the MainActivity.
Ofcourse I can check if the frame-layout is displayed but I can not reach the layout of the fragment which is located into the frame-layout.
So my question is, how can I reach the layout of the fragment into the frame-layout, so I can click on a button into the fragment.
The result at the moment is a NoViewMatchException:
android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with id:...
Thanks in advance!
Edit: The exception shows the view hierarchy
These are the methods I'm calling:
onView(ViewMatchers.withId(R.id.buttons)).check(matches(isDisplayed()));
This is the frame-layout in the MainActivity for the buttons fragment:
onView(withText("LOCATIONS")).perform(click());
The locations buttons is in the Buttons fragment
withId on the button id in stead of withText doesn't make sense.
The question is not very clear. It does not matter which layout you are using. Espresso can locate the element on the view hierarchy. If your case, you're getting NoViewMatchException. That means the view (R.id.buttons) is not there when you're checking.
For debugging, you can add some wait (SystemClock.sleep(2000)) and check if it works.
If that works, you need to write the idling resource to wait for the buttons fragment to appear.

Editing the navigation controller from push segue

So i have a static tableview with 4 rows, i'm connecting them to different viewcontrollers without using any code instead i'm simply dragging the cell and setting up the segue.
The issue i'm having is that when this segue is performed a navigation controller is automatically generated and embed at the top so i get the following result below.
How could i edit the text and the icon? I want to remove the settings text and use my own custom icon.
It's also worth noting that i have embed other navigation controllers throughout my app. So i'd like to target this view specifically rather than all of my views.
I suspect the accepted answer on this question may help: how to replace/customize back button image in storyboard navigationcontroller
You'll need to do it in your prepareForSegue I believe.

Drop dialog on a list page not disappearing automatically

When I add a drop-dialog to a list page, the drop dialog drops down when I click on it, but does not disappear when I click somewhere else.
I am trying to add my own drop-dialog, but I can reproduce this issue with standard Dynamics AX objects. I guess I am just missing some property on an object, but I just cannot figure out which one.
If you want to reproduce my problem in order to solve it, do the following:
Create a new Form. (Form 1)
Change the FormTemplate property to ListPage (Click on Yes)
Add the query MainAccountListPage to the DataSources
Create an ActionPanTab.
Add a Drop-dialog button with the menu item MainAccountListPageBalanceParameters.
Save and open the new List page by right clicking and choosing open. (or open the menu item)
In my case, when I click on Parameters, the drop dialog drops down. When I then click outside the drop-dialog, it disappears as it should.
Create a new display menu item. Set the object to the new list page (Form 1)
Drag the Menu item to any menu. I added mine to General ledger (Common)
Restore, open new workspace. Click on the new menu item in the general ledger menu.
Click on “parameters” and click outside the drop dialog.
When I do this the drop dialog does not disappear again. You can see this same drop dialog working fine on the Main Accounts list page. I have tried changing properties on both menu items, on the menu, on the form etc. I have tried different drop dialogs and different list pages. It always works on the details page and when opened from the AOT.
Am I missing a property? Is the entire way I am adding the drop dialog wrong?
The answer to the above example is.. add the MainAccountDetailPart Form part to the list page's (Form1) Parts.
With my other example, EcoResProductPerCompanyListPage, I had to add the EcoResProductVariantsPerCompanyFactBox to Parts.
I have no idea why this is, but adding a part to a list page fixes the drop dialogs. For example, adding MainAccountDetailPart Form part to a new list page not only fixes the MainAccountListPageBalanceParameters in my example, but it also fixes any other drop dialog that previously did not want to close. Removing the part the breaks all the drop dialogs in the list page again.
Thanks, FH-Inway, for the suggestion, I would have never have found the answer without your method. The solution really surprised me!

replace fragments inside fragment displayed by the viewpager

Please see the wireframe image http://i.imgur.com/dPAMA.png first.
I am using a ViewPager to display fragments inside a FragmentActivity. ViewPager gets fragments from the attached FragmentPagerAdapter
mViewPager = (ViewPager) findViewById(R.id.view_pager);
mAdapter = new HomePagerAdapter(getSupportFragmentManager());
mViewPager.setAdapter(mAdapter);
Suppose viewpager has 3 fragments to display say Fragment1, Fragment2, Fragment3.
In the above image 'displaying fragment1' is the title for the first fragment, "Fragment1". This fragment is a list fragment and displays a list. Fragment2 and Fragment3 have their own content to display. when the user swipes on the screen, ViewPager will display the next fragment, "Fragment2".
What i want is that, when an item from the list(displayed by Fragment1) is clicked, Fragment1 should be completely replaced with some other Fragment, say Fragment4 (this is different fragment and is not returned by the attached adapter). when Fragment4 is displayed, the actionbar should change its content. whenever user works on Fragment4 and onBackPress or an action from the ActionBar, Fragment1 with the list should be displayed again. Meanwhile ViewPager should behave the same i.e on swipe, and the next fragment(in our case Fragment2) will be displayed.
basically, i want to get the same behavior as in example at :
http://developer.android.com/training/basics/fragments/fragment-ui.html#Replace
In this example the ListFragment is displayed directly inside a FragmentActivity. I am displaying the ListFragment with a ViewPager. I want the same functionality from the above example but inside fragments displayed with ViewPager. This was very difficult to achieve before the release of Android 4.2. this version of android supports nested fragments using getChildFragmentManager() so, i see some hope.
I am trying this on my side for many days and also scanned entire stackoverflow for Q & A related to nested fragments but didn't get what i want.
So, is this possible to achieve? if yes, then how to?
This was a big problem before Android 4.2 but it seems to easier now with nested fragments, apart from ensuring the back button works. I posted my solution to your question over here: https://stackoverflow.com/a/13925130/467509
My solution answers everything you asked apart from changing the ActionBar.

How to identify the viewcontroller is clicked from More Tab or Separate tab in UITabBarController?

I have the navigationcontroller based viewcontroller and I overriding the root view controller navigation bar back button in to my custom segment control with different purpose. This navigation controller is placed one of the separate tab in the uitabbarcontroller. If this is used as the separate tab bar then no problem.
But if i use this navigationcontroller inside the more option in tabbarcontroller i am not able to come back to the more option list because of backbutton is overridden in my navigationcontroller.
My idea is add one back button only if my navigationcontroller is used more option tab otherwise i need to hidden the back button.
Please help me in this issue?
You can check if a view controller is in the 'more' section as follows:
BOOL isOnMoreNavigationController = [tabBarController.moreNavigationController.viewControllers containsObject:myViewController.navigationController];
From a UI consistency perspective it might be better to always show the back button in its standard position and move your custom buttons to some other place.

Resources