Solving Rendering Artifacts in Frame Buffer with WebView and EditText on Android 5.0? - android-edittext

After upgrading Nexus 5 to Android 5.0, an activity with default focus on an EditText does not render correctly (EditText repeats down across the screen with grey dots in between and if you click again or dump the ViewHierarchy with UiAutomator, it will return to normal rendering).
(I would upload the image, but don't yet have reputation for images).
NOTE: This is ONLY after I have loaded a WebView within the application (though in a separate activity). The same screen renders correctly prior to loading the first WebView in the application.
NOTE: This is ONLY a problem on Android 5.0 and (so far) on Nexus 5. I do not have another 5.0 (non-nexus) device to try.
EDIT: This also happened on HTC One with Android 5.01.
NOTE: I have tried disabling hardware acceleration, modifying inputMode, and defaultFocus.
Has anyone seen or solved this problem?

Ended up solving this by changing softInputMode (similar to previous WebView/Keyboard issues, but this time with a native View and EditText).
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);

I had a similar issue on Lollipop 5.0.1 devices. My solution was to deactivate hardware acceleration in the WebView on these devices before loading any content with loadURL or loadData.
int SDKversion = android.os.Build.VERSION.SDK_INT;
if(SDKversion >= android.os.Build.VERSION_CODES.LOLLIPOP){
webview.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
If you do not want to do this, I could also drastically reduce the problem by adding a visibility="gone" webview to the disturbed activities and then calling something like:
webview_dummy.loadData("<head></head><body></body>", "text/html", "utf8");
after the loadURL of the actual webview.
Man, this is really some weird bug!

What solved my problem was to disable the hardware acceleration only on the activity which hosted my fragment. Not on the whole app, but specifically on that activity.

Related

Appium: iOS, real device, driver.hidekeyboard() doesn't operate

I'm using Appium on Mac OS with iPhone 5S with operation system 9.2.
When i'm trying to hide the Keyboard with the method:
driver.hidekeyboard();
Nothing happens and the application crash.
Need help please
Thanks
Ohad
If in case your application is crashing on when you are trying to hide the keyboard, then that could be a possible bug you are looking at and to understand the cause of that and get it fixed would be the topmost recommendation. Your statement
driver.hidekeyboard();
is good enough for what you desire out of the execution assuming the driver used is AppiumDriver or its subclass.
Also if you are sure that the keyboard is displayed and you can even manually hide the keyboard, a forced way to do that is as #Gaurav has suggested in the comments using the following code :
driver.navigate().back();
In case of uncertainty of the visibility of keyboard, you can give this a try :
driver.getKeyboard();
driver.hideKeyboard();

iOS UI Automated Testing: How to pull down, drag or scroll in a CollectionView?

I am testing my app with the UI Automated Testing framework. I have a UIACollectionView I would like to pull down or drag my CollectionView. I already tried the ways from the documentation:
to drag up
target.dragInsideWithOptions({startOffset:{x:0.5, y:0.9}, endOffset:{x:0.5, y:0.2}, duration:2.0});
or to pull down:
target.dragInsideWithOptions({startOffset:{x:0.5, y:0.3}, endOffset:{x:0.5, y:0.8}, duration:2.0});
when this didnt work I tried to use the inheritated methods of the UIAScrollView. chatList is my UIACollectionView
archivedChatCell = chatList.cells()["Noise"]
archivedChatCell.scrollToElementWithValueForKey(1, "isVisible")
chatList.scrollDown()
chatList.scrollToElementWithPredicate("Noise")
But nothing is moving in the screen. I read in some threads that this (dragInsideWithOptions) is a Apple problem that needs to be fixed for the iOS7 UI Testing.
Does someone have any idea what the problem is? Am I missing something or is there a work around for that?
The weird thing is, I am using the same code in a different CollectionView in my App, the dragInsideWithOptions works fine and drags or pulls the screen.
thank you
Yes, dragInsideWithOptions and flickInsideWithOptions are not working on the simulator. However, they do work on a real device. Therefore, my suggestion is to use a real device until Apple fixes the problem.

iPhone Simulator suddenly started running very slow

I have been working on an app in iphone simulator for a number of weeks and it has been running well up until now, but all of a sudden has begun running very slow both when loading content and animations. I have not made any changes to my code since I last tested it successfully.
I tried restarting the simulator (multiple times) and removing the app and doing a completely clean rebuild, but no luck. I also checked my cpu usage through the monitor while the simulator is running and I am only using about 30% of my cpu and 40% of memory.
I fully understand that the simulator is never a quick as the device itself, but it seems strange that it has suddenly started running slow after such a long time, and by slow I mean less than a quarter of its original speed.
In the iOS simulator, at the bar on the top, click on Debug → Toggle Slow Animations (or Slow Animations with Xcode 10+). Chances are you accidentally toggled it on.
Simple Command + T will fix this problem.
Command + T toggles the simulator's Slow Animations, which can be found under the Simulator Menu: Debug -> Slow Animations.
Go to the simulator's Debug menu and select "Toggle Slow Animations".
Update: In Xcode 10, it's just "Slow Animations":
Select Simulator,
Select Debug and uncheck slow animation.
shortcut
command + t
That's work for me.
If the Cmd-T (slow animations) option doesn't work for you and Debug -> Slow Animations is off but you still have slow animations try Simulator -> Reset Contents and Settings (or possibly Hardware -> Erase All Content and Settings). That worked for me when none of the other answers in here did. Anyone have a suggestion as to why?
Also having a debugger attached (at all) may make the animations very slow.
Another potential fix for React-Native users:
Chrome de-prioritizes Javascript running in any tabs not in the foreground. So if you have enabled remote debugging, be sure to put the debugger in its own window.
You accidentally pressed the slow animation on debug when using simulator.
So Run Simulator -> Debug -> Uncheck Slow Animation.
I think you pressed command + T instead of command + R by mistake.
I don't have the rep yet to leave a comment, but I upvoted some answers here and wanted to say more. I had a problem with slow animations in the iOS Simulator, especially on rotation, and I found this post via Google. Indeed, somehow "Toggle Slow Animations" must have been on, because three shifts fixed it. At first, I didn't think this was a problem because there's no checkmark next to "Toggle Slow Animations." It turns out there's never a checkmark, or any indication from the menu whether it's on or off. So just try toggling it and see if the rotation/navigation is faster/slower.
So, thank you!
Simulator -> Reset contents and settings works for me. The issue seems to reappear when I debug my react-native code remotely. It could also be to do with AsyncStorage as nomad suggested.
It is NOT only about slow animations. Xcode simulator has extremely low performance in global. It is Apple's bug. I have reported it via Feedback Assistant. I have created demo with code demonstrating that simulator is 200 times slower than any old real device. I have found that JavaScript code with Date object executed in WKWebView is pain for simulator. Changing options in simulator does not help in my case. See jsfiddle https://jsfiddle.net/kjms16cw/ I hope Apple will fix it soon!
var log = document.getElementById("log");
document.getElementById("button").onclick = function() { run(); };
function run() {
var d1 = new Date();
for (var i = 0; i < 1000; i++) {
var x = new Date();
x.setMilliseconds(0);
x.setSeconds(0);
x.setMinutes(0);
}
var d2 = new Date();
log.innerHTML = ((d2.getTime() - d1.getTime()) / 1000) + " seconds";
}
<h3>Xcode Simulator Extremely Low Performance</h3>
<p>This test runs fast (several tens milliseconds e.g. 30 ms)
in any browser any device any platform including very old iOS device
e.g. iPhone 5C and several years old iPad 2, BUT IN SIMULATOR IT TAKES 6000 ms
(yes, 6 seconds!). Terrible!</p>
<button id="button">run()</button>
<div id="log"></div>
You can try to turn off remote debugging (Cmd-D -> Stop Remote JS Debugging). That usually speed things up.
When the chrome debug is active and the browser tab is not in the foreground, the emulator is slow too. For me, I decided to put the guide in the foreground.
Go to menu of simulator
Device -> Restart
Then everything faster than you think -_-

iOS5: UIScrollView dispaying and scrolling differently from iOS4

This is a curious one.
I have an IBOutlet UIScrollView playScrollView whose height is exactly 1/3 of it's contentSize's height. The app is in landscape. I call this code...
[playScrollView scrollRectToVisible:CGRectMake(0.0f, page * PLAY_VIEW_PAGE_HEIGHT,
480.0, PLAY_VIEW_PAGE_HEIGHT)
animated:animated];
... (the int page ranges from 0 to 2) to start on page 1 (displaying the middle third) then go up or down as needed when the user presses buttons.
This works fine for iOS4 both device and simulator, and has been live on the app store for months with no problems. Even iOS5 devices are fine with existing builds, it was only when the app was recompiled for iOS5 that it stopped working correctly on iOS5 devices.
Since updating to XCode 4.2, This doesn't work for iOS5. It goes one page too low, showing the bottom page when it should show the middle. I can get the code to work for iOS5 (device and simulator) by changing page to (page-1)...
[playScrollView scrollRectToVisible:CGRectMake(0.0f, (page-1) * PLAY_VIEW_PAGE_HEIGHT,
480.0, PLAY_VIEW_PAGE_HEIGHT)
animated:animated];
...but of course this breaks iOS4, which works fine with the old code, but gets stuck one page too high with this new code. iOS4 and iOS5 are exactly PLAY_VIEW_PAGE_HEIGHT out-of-step (288 pixels, a third of the height of playScrollView). The same thing happens if I use setContentOffset: instead.
One other curious thing, probably the key to this. If I don't do the scrollRectToVisible at all, then iOS4 sits at the top of playScrollView, wheras iOS5 shows the middle third, (ie PLAY_VIEW_PAGE_HEIGHT pixels down).
I could detect the iOS and use different code for each, but that's a horrible kludge. If it's an iOS5 bug and they fix it in a future release, that would break the live app.
Has anyone any ideas, or noticed anything similar? Thanks.

iAD on iPAD is transparent but clickable (Monotouch)

I am using monotouch 4.0.7 and was able to get iAd to show up sucessfully on iPhone(normal) and iPhone(retina).
It seems that the iPad version is loaded successfully, clickable but it's completely empty. In the emulator it has the mousedown color too.
I've tried extending the frame of both the view controller and the view to 1024x768 but it's still not showing up.
Is this normal behavior in Portrait mode? I am using ADBannerContentSizeIdentifierPortrait.
By the way, AdLoaded is getting called and there are no warnings in application output.
I've been looking into the issue, the problem (I'm guessing) is that you're using "ADBannerContentSizeIdentifierPortrait" as the identifier in your "RequiredContentSizeIdentifiers" set. The problem is that the string is not the same as the identifier. You should instead use the class properties on ADBannerView which are ADBannerView.SizeIdentifierPortrait or ADBannerView.SizeIdentifierLandscape.
Let me know if this sorts out your issue,
ChrisNTR

Resources