Saying, I have a SliverList widget with SliverChildBuilderDelegate, which produces a card with custom image widget inside of it for each index. By custom image widget I mean widget that is kind of NetworkImage, but with support for custom caching technology. It's similar to cached_network_image.
So, the problem I'm trying to solve is that when some image fails to load and user scrolls it out from the screen, I need to retry loading this image when user for example scrolls back to it or in general when this image appears in viewport again.
Is it possible to e.g. re-call image loading function in some of the State's lifecycle methods or in delegate's builder? Or which technique should I use in this case?
Github issue #29597
Related
I'd like to "preload" a view (including a SKScene) to gather the bounds of the display area of this scene.
The size information is needed to precompute additional data, the computation should be done in the background while displaying the home screen (different to the screen containing the SKScene).
Q: It it possible to preload a view and if so, how?
Thanks,
J.
OK, found a solution. I switch to the screen directly after application start, gather the needed information and immediately switch to the home screen.
I use the method onAppear() and a global variable as a flag to avoid a second automatic return to the home screen.
I am using appium java client with uiautomator2 as the automation engine for android. The application has a scrollview from which I need to fetch text off TextView. some of those are within the viewport when the screen is loaded and some of those are outside viewport. How can I fetch the text of the nodes in a right way? Right now, I have a specific test device on which I know which element is visible and which is not. So for the later, I have implemented a scrollTo method to scroll down to.
I have seen solutions on keeping scrolling until the element is in viewport. I didn't like it as it will hamper the performance of the tests. because the test could still be waiting for an element before scrolling next and that time is simply wasted.
What could be a better strategy to handle this? We are using pagefactory pattern and mostly using xpath, accessibility label and id to identify the elements. In case it helps, the app under test is a react native app.
I suggest using UiScrollable for that.
If you use page object pattern and #AndroidFindBy annotation, you can simply put:
#AndroidFindBy(uiSelector = "UiScrollable(\"className(\"android.widget.ScrollView\")\").scrollIntoView(resourceId(\"id_of_element_to_scroll_to\"))")
private MobileElement buttonOfTheScreen;
Here you need to define two locators:
one for the element which will be swiped on, let call it swipe base - className(\"android.widget.ScrollView\") in the example above
the second locator is for element that is out of the screen - resourceId(\"id_of_element_to_scroll_to\")
No additional actions are required. Once you need to interact with your element, e.g. getText() or click(), uiautomator will swipe to it automatically.
Alternatively, you can use:
String locator = "UiScrollable(\"className(\"android.widget.ScrollView\")\").scrollIntoView(resourceId(\"id_of_element_to_scroll_to\"))";
driver.findElement(MobileBy.AndroidUIAutomator(locator)).click();
Note: this approach works only if the element you are looking for is under the bottom edge of your screen.
I want to create button with three different states namely Initial, Loading, Completed.
UI for button state:
Initial -> TextLabel
Loading -> Loading indicator/multiple images
Completed -> TextLabel
It will be in Initial state normally when user clicks it then It will change its state to Loading with transforming itself to show loading indicator inside it. Once completed it will animate and transform to show the label.
How can I achieve it with Lottie?
I need to set initial and completed state texts dynamically but as per the docs I couldn't find out a way to change text into Lottie.
With Lottie I can use progress animation to handle different states of button but how can I change texts programatically without new json file.
Lottie doesn't support text layer in iOS. Any workaround for that except using shape layer?
You can modify the text for the Button in the JSON, via directly modifying the JSON itself programmatically. As Lottie animation and views are governed by JSON, it's not possible.
There's no proper API support in Lottie for this, but this thread has a discussion on possible ways you can change the text via the json file:
https://github.com/airbnb/lottie-web/issues/238
I have an app that switch views using a segue when a button is clicked.
The second view loads data from the internet and it can take a couple of seconds.
I would like to know how can i display a loading view/splash screen in the meantime so the view could finish the loading and the app wont appear like it's doing nothing.
Thanks!
Check this library SwiftSpinner. It serves the purpose of your needs. It's really brilliant.
Call the necessary function from the library in the viewDidLoad method of your ViewController which loads the data from the internet. Remove this view in DidFinishLoading method of the NSURLProtocol (It's an optional func declared in that class which detects when the request to that URL is complete). The documentation is given in that library itself.
Sounds like you're looking for an activity indicator. I've used the custom class posted https://stackoverflow.com/a/32661590/3516923 with success. Just a note of warning, in his class he blocks all input while the indicator is in view. If you want to make it so your users can back out before things finish you need to remove UIApplication.sharedApplication().beginIgnoringInteractionEvents() and UIApplication.sharedApplication().endIgnoringInteractionEvents() from the start and stop animating functions.
If what you want is really a splash screen, have a UIImageView underneath the view that you're loading. Set the image to your splash screen image. Set the loading view to hidden=YES before it's shown, then set hidden to NO after it finishes loading. You could even set the opacity of the frontmost view to give you a fading effect.
1.You need to find a kind of indicator, suck like an activity indicator or something else to show the loading UI to the user.
2.Set the user interaction unable, so that the user won`t touchup inside repeatedly.
3.Start the indicator, set the user interaction unable when you load the server data, and stop the indicator animation when you finish, hide the indicator, enabled the user interaction.
Trying to create an app that uses the UIImagePickerController for its picture taking activities. I'm using a cameraOverlayView to accomplish this (for now, it just contains two buttons, one for Taking/Keeping the Picture and the other one for Canceling/Retaking). The steps below outline what is occurring.
UIImagePickerController.view (with cameraOverlayView) is shown
I click "Shoot" and the imagePicker does its magic and I'm able to get an image out of it. However going past the image acquisition section (after I dismiss the custom view), the imagePicker goes onto "still" preview screen mode without any controls other than the "<" back button at the top of the screen. I'd like to avoid that and instead continue to use my custom view provided to the cameraOverlayView to handle "Keep/Retake" actions until I'm finished.
As you can see in the image above, there is "black" band at the bottom of the view with my two custom buttons in it. I have no idea how the black band gets there since I did not add it. My custom View only has the two buttons.
Attempting to add an UIImageView on the fly (to display a still preview of the image taken to the user while still keeping my action buttons) has the effect below .
The red arrow is pointing to an extra section below the UIImage I added after acquiring the picture data from the imagePicker.
That section is actually displaying the live preview the imagePicker is constantly producing.
What I'd like to accomplish is to be able to get the bounds of that live preview section being displayed so I can calculate the correct bounds of the UIImage I'm adding on the fly since getting the height correctly will absolutely fail when ported to different devices.
Any suggestions?