Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroOrozco committed Feb 23, 2017
1 parent 3a26723 commit 86d2127
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<param name="onload" value="true" />
</feature>
</config-file>
<source-file src="src/android/Screenshot.java" target-dir="src/org/android/screenshot" />
<source-file src="src/android/ScreenshotPlugin.java" target-dir="src/org/android/screenshot" />

</platform>

Expand Down
20 changes: 4 additions & 16 deletions src/android/screenshot.java → src/android/ScreenshotPlugin.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
package org.android.screenshot;

import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import com.github.piasy.rxscreenshotdetector.RxScreenshotDetector;
import com.google.android.gms.appindexing.Action;
import com.google.android.gms.appindexing.AppIndex;
import com.google.android.gms.appindexing.Thing;
import com.google.android.gms.common.api.GoogleApiClient;
import com.trello.rxlifecycle2.LifecycleProvider;
import com.trello.rxlifecycle2.LifecycleTransformer;
import com.trello.rxlifecycle2.RxLifecycle;
Expand All @@ -20,29 +14,23 @@
import io.reactivex.schedulers.Schedulers;
import io.reactivex.subjects.BehaviorSubject;

import android.os.Bundle;
import android.view.Gravity;
import android.widget.Toast;

import org.apache.cordova.*;

import java.lang.reflect.Method;


import javax.annotation.Nonnull;

import static android.icu.lang.UCharacter.GraphemeClusterBreak.T;

public class Screenshot extends CordovaPlugin implements LifecycleProvider<ActivityEvent> {
public class ScreenshotPlugin extends CordovaPlugin implements LifecycleProvider<ActivityEvent> {

private final BehaviorSubject<ActivityEvent> lifecycleSubject = BehaviorSubject.create();

public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
Activity activity = this.cordova.getActivity();
final CordovaWebView webView1 = webView;
RxScreenshotDetector.start(activity).compose(this.<String>bindToLifecycle()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<String>() {
@Override
public void accept(String s) throws Exception {
webView.loadUrl("javascript: alert('Screenshot');");
webView1.loadUrl("javascript: alert('Screenshot');");
}
});
}
Expand Down

0 comments on commit 86d2127

Please sign in to comment.