Skip to content

Commit

Permalink
- iOS: clear the image after the drawer effect
Browse files Browse the repository at this point in the history
- Android: Android < 4.4 was below par
  • Loading branch information
EddyVerbruggen committed Sep 27, 2014
1 parent 67ffe89 commit 54bc8d8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<plugin
xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="com.telerik.plugins.nativepagetransitions"
version="0.1.0">
version="0.1.1">

<name>Native Page Transitions</name>

Expand Down
17 changes: 14 additions & 3 deletions src/android/NativePageTransitions.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public class NativePageTransitions extends CordovaPlugin {
// this plugin listens to page changes, so only kick in a transition when it was actually requested by the JS bridge
private boolean calledFromJS;
private FrameLayout layout;
private final boolean requiresRedraw = Build.VERSION.SDK_INT < 19; // Build.VERSION_CODES.KITKAT
private static final boolean BEFORE_KITKAT = Build.VERSION.SDK_INT < 19;
private final boolean requiresRedraw = BEFORE_KITKAT;

class MyCordovaWebViewClient extends CordovaWebViewClient {
public MyCordovaWebViewClient(CordovaInterface cordova, CordovaWebView view) {
Expand Down Expand Up @@ -341,6 +342,13 @@ public void onAnimationRepeat(Animation animation) {
webView.setAnimation(webViewAnimation);
layout.startLayoutAnimation();

if (BEFORE_KITKAT) {
// This fixes an issue observed on a Samsung Galaxy S3 /w Android 4.3 where the img is shown,
// but the transition doesn't kick in unless the screen is touched again.
imageView.requestFocusFromTouch();
webView.requestFocus();
}

calledFromJS = false;
}
});
Expand All @@ -360,9 +368,12 @@ private void enableHardwareAcceleration() {
cordova.getActivity().getWindow().setFlags(
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
imageView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
if (BEFORE_KITKAT) {
webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
} else {
webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
}
}
}

}
3 changes: 2 additions & 1 deletion src/ios/NativePageTransitions.m
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ - (void) drawer:(CDVInvokedUrlCommand*)command {
}
completion:^(BOOL finished) {
if ([action isEqualToString:@"close"]) {
[_screenShotImageView removeFromSuperview];
_screenShotImageView = nil;
// [_screenShotImageView removeFromSuperview];
}
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
Expand Down

0 comments on commit 54bc8d8

Please sign in to comment.