Maintaining state when switching tabs in Jetpack Compose - android-jetpack

In Jetpack Compose if I use a Structure that has tabs at the the top of the screen and I want to change the view in the body but maintain the state of each body's content, is this done by simply having multiple bodies and hiding/showing each one as you click on the tabs by setting each with View.visibility = VISIBLE or GONE? Or is this done differently using Compose?
By maintaining state, this would include the scroll position of the content on each body.

Just stuff everything into your viewmodel. That's my way

Related

FullPageJS prevents touch scrolling on hamburger menu; how to integrate?

I have a website using the fantastic fullPageJS plugin, and it does what it does very, very well.
I have however, an issue on mobile devices, where the sliding hamburger menu does not scroll with touch controls when the menu height exceeds that of the ViewPort, as in this picture:
Question
How do I force the side menu to accept touch-based scrolling?
You should make use of the fullpage.js option called normalScrollElements.
As detailed in fullpage.js docs:
normalScrollElements: (default null) If you want to avoid the auto scroll when scrolling over some elements, this is the option you need to use. (useful for maps, scrolling divs etc.) It requires a string with the Javascript selectors for those elements. (For example: normalScrollElements: '#element1, .element2'). This option should not be applied to any section/slide element itself.
Additionally, you can call fullpage_api.setAllowScrolling(false) when opening the modal. That will prevent fullpage.js to scroll up or down when using the mousewheel or trackpad.
You can set it back to the default value when closing the menu by using fullpage_api.setAllowScrolling(true).
You should try to add overflow: scroll if you haven't already.

Appmaker panel & canvas height

I have a long form in a panel with lots of controls, however the Canvas/panel editor has a limited height of about 1000px and refuses to scroll to allow adding more controls.
I am able to make the panel 2000px and enable overflow to get the panel itself to scroll once the app is deployed, but how do I manage to drag/drop new controls/widgets?
TIA
At the bottom of the canvas is a round control which allows it to be extended beyond the default and therefore allows long controls.
A page's main panel should have a dimension property in the property editor, that specifies height and width. I'm able to set it to much larger values (e.g. 5000 pixels).
Once the main panel is large enough, you should be able to scroll down in it and drop new widgets where you need them to be.
It's also easy to accidentially drop in new panels and then stuff new widgets into the wrong panel, so make sure the panel structure is really what you believe it is (e.g. via the structure editor).

Drop scroll using select in last line of the table

I made a custom dropdown. In the last line of the table, scroll is created when dropdown is open. I need to scroll to see dropdown elements. I do not want this.
I want you to open up the body of the dropdown or enlarge the body. How can I do it?
Document is already enlarged by enlarged content/element, scroll shows that. You need only scroll to view entire enlarged element, f.e.:
elmnt.scrollIntoView(false);
Real problem (using react) is that should be done after change state and rendering enlarged element.
I probably would use setTimeout called from setState callback. It's quite common way to be sure it's called after updating state/view. You'll find examples on SO.

Adding animation in redux

I am currently building a small web page using react-redux. In my page I am rendering two containers. One container has a button that on clicking causes a change in the state and as a result the content in the other container also changes e.g initially there is a div container with text hello my name is rishi bhatia. As soon as I click on the button the a separate div container with 4 links replaces the previously displayed div container. What are the possible ways in which I can add animations when the content in the container changes. All I am doing is displaying different div containers on state change.
You can implement componentWillReceiveProps(nextProps). Here you can define your animation when component receive props playing with state.
Even if your component is just presentational id doesn't mean it cannot use state for graphical purposes.

GWT - PopupPanel, change layout when flipped

I'm creating a context menu for certain elements using a PopupPanel; the menu itself is going to be fairly large and complex. What I'm looking to do is to have a list of buttons, plus an image and some text, related to the element clicked.
My problem is that I'd like the buttons to always display directly under the clicked element, because that's convenient for the user; the issue is that when PopupPanel is near the edges of the screen, it automatically changes position to be fully visible, not aligning its left side to the element as usual. I like this behavior, but it moves the position of the buttons away.
So what I'd like to happen is: normally the buttons are on the left of the panel, the other stuff is to the right. When the panel is close to the right of the screen, I'd like the buttons to instead be on the right (and thus under the clicked element) and the other stuff on the left.
Is there a clever way to do this, either in GWT or better yet, using only CSS? PopupPanel itself doesn't seem to tell you when it's going to get flipped, sadly. The only solution I currently have is to manually check the position and width of the popup before showing it and adjust accordingly, but I'm hoping there's a better solution.
Here is what I suggest (based on my own implementation of a similar use case):
Have the position callback implementation accept references (in constructor) on:
PopupPanel element
element on which user right cliked
the content you put in the PopupPanel
Replicate (I know this not DRY but implementation is package private) the code from default position callback
When opening to the right invoke a method that changes the layout of your content (CSS based or otherwise)
I hope it helps. If you find something better let me know.

Resources