android recyclerView's view item's onConfigurationChanged is not called - android-recyclerview

Has
android:configChanges="orientation|screenSize"
and there are some custom view (root from RelativeLayout), which has
override fun onConfigurationChanged(newConfig: Configuration?) {
super.onConfigurationChanged(newConfig)
// do something to react
}
the same custom view is used in either scrollView or recyclerView.
in same activity/fragment when place the custom view in the scrollerView its onConfigurationChanged is called when rotate, but place it in the recyclerView the onConfigurationChanged is not called.
The code has no difference except one use scrollView, one use recyclerView.
Is it a known behavior? Or how to make the view item's onConfigurationChanged to be called when place it in the recyclerView?

Turns out there is different how the custom view is placed in the parent container.
When add to recyclerview view holder, it is wrapped in a FrameLayout first, so one more layer view which seems prevents the custom view's onConfigurationChange getting called (since the custome view is not the direct view in the viewholder).

Related

In TornadoFX, how can I separate layouts to different classes and then use them in builder?

For example, I want to have a TabPane, but I want to have tabs each in its separate class. Is there a way to make this work with the builder? I want to do something like this:
tabpane {
MyFirstTab()
MySecondTab()
etc.
}
On a general basis you add the root node from another View with the add command:
add(SomeView::class)
You can also inject a View and add it:
val someView: SomeView by inject()
override val root: borderpane {
center {
add(someView)
}
}
add is the same as doing this += someView. What happens here is that the framework find the root node of the View and appends it to the children property of the parent Node. It also knows about special containers like the BorderPane, so it does the right thing when you add something inside the center builder etc.
The TabPane however, takes Tab instances, which are not nodes. You need to add the tab using the tab builder and assign some content to it. The builders are smart enought to understand that if you do add inside a Tab, it should assign to the content property of the Tab. Therefore you can write:
tab("My First Tab") {
add(MyFirstTab::class)
}
Or if you already have an instance of the content you'd like to assign:
tab("My First Tab") {
add(myFirstTab)
}
The MyFirstTab class must be a View or Fragment.

how to get position of recylerview databinding

i am using data binding recycler view .i want to get that clicked position and show that position id(image) in view pager.i created data binding XML for image.
Position of clicked view does not matter, because views reused again and again while you scrolling content. You can directly set EventLisener to ViewHolder at onBindViewHolder(final ViewHolder holder, int position) method of RecyclerView.Adapter class

tvOS navigating through ui elements

I am developing for tvOS at the moment and I have added a UISegmentedControl, this gets focused automatically by the tvOS focus engine. When I added a UIButton, this became the first focused item.
How I do go about setting the first focused item and being able to navigate between them?
Add a read only preferredFocusedView property to your view controller that returns the view you would like to start focused:
override weak var preferredFocusedView: UIView? {
get {
return segmentedControl
}
}

Sencha Touch 2.1 calling another view based on MVC

Using ST 2.1 and MVC I am trying to call another view. Shouldn't I have a view and a controller for each panel? If needed of course. I think a static about page will not need a controller.
So my layout would be.
app
controller
Main.js
Contact.js
view
Main.js
Contact.js
About.js
resources
css
images
app.js
index.html
Here is my overall project structure.
My app.js calls Main.js. This is my main view and controller. My Main view extends Container. On the Main view I have created a titlebar with left and right buttons and a title. Then I created a panel that holds my main buttons. Then I created a toolbar at the bottom that just has an image.
I want my Main container to change the panel in the middle but keep the top and bottom bars. Each of my views is a panel with various things on them. I can get the overall screen to change but it takes my titlebar and toolbar with it.
I hope this is enough info. Thanks, Donnie
If you want to change just the panel you have to put that panel as item into parent panel. When you want to change this panel with other panel or anything else just get reference of parent panel and remove existing content before adding new panel.
var p = Ext.getCmp("myPanel");
var pp = Ext.getCmp("parentPanel");
var newPanel = Ext.create('Ext.panel', {html : "some content"});
pp.remove(p, true);
pp.add(newPanel);
PS - I haven't tested this code, its just guideline.

MvvmCross application freezes and crashes when re-showing modal view model

The app I'm working on consists of a hierarchy of data and a filter to search through that data. The data is displayed in a hierarchy of table views, and navigation through that hierarchy works fine. However, when I try to navigate to my filter view model (which is shown as a modal view controller), I run into problems.
The first time I open the modal view, everything works fine, and I can close it and all navigation still works. When I try to open it a second time, however, the modal view will appear and the app will freeze and crash after a couple of seconds.
Here is the code from my custom presenter (which is a subclass of MvxModalSupportTouchViewPresenter) that is handling the modal navigation request:
public override void Show (IMvxTouchView view)
{
if (view is IMvxModalTouchView) {
var newNav = new UINavigationController ();
newNav.PushViewController (view as UIViewController, false);
newNav.NavigationBar.TintColor = UIColor.Black;
PresentModalViewController (newNav, true);
return;
...
(taken from MvvmCross Using a modal ViewController from a Tab)
I close the modal by dismissing it in the view itself. Does anyone have any idea why the app is crashing?
follow up on this by email was...
"As to my previous question, I found where the error was. The view
associated with my modal view model got into an infinite loop of
Dispose() calls. It would only happen if the modal was shown multiple
times. Commenting out the Dispose() method allowed me to open it
multiple times."
Not sure currently whether this was a fault in the mvx framework or in the app code - but thought I'd post this here in case it helps others