mirror of
https://github.com/sdkcarlos/cordova-ourcodeworld-preventscreenshots.git
synced 2026-02-04 00:06:16 +08:00
First commit
This commit is contained in:
15
README.md
15
README.md
@@ -1,2 +1,13 @@
|
||||
# cordova-ourcodeworld-preventscreenshots
|
||||
Disable
|
||||
# Cordova Our Code World SFTP Plugin for android
|
||||
|
||||
# Do not use, doesn't work yet
|
||||
|
||||
```batch
|
||||
cordova plugin add https://github.com/sdkcarlos/cordova-ourcodeworld-onedrive-filepicker.git
|
||||
```
|
||||
|
||||
# Supported Android Versions
|
||||
|
||||
The OneDrive picker library is supported at runtime for Android API revision 14 and greater. To build the picker library you need to install Android API revision 19 or greater.
|
||||
|
||||
The picker requires the OneDrive app to be installed, in order to function. If the OneDrive app is not installed, the user will be prompted to download the app when either the startPicking() or startSaving() method is invoked.
|
||||
|
||||
27
plugin.xml
Normal file
27
plugin.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
|
||||
id="com.ourcodeworld.preventscreenshots"
|
||||
version="1.0.0">
|
||||
|
||||
<name>Our Code World Prevent Screenshots</name>
|
||||
|
||||
<engines>
|
||||
<engine name="cordova" version=">=3.4.0"/>
|
||||
</engines>
|
||||
|
||||
<asset src="www/ourcodeworldpreventscreenshots.js" target="js/ourcodeworldpreventscreenshots.js"/>
|
||||
|
||||
<js-module src="www/ourcodeworldpreventscreenshots.js" name="OurCodeWorldpreventscreenshots">
|
||||
<clobbers target="OurCodeWorldpreventscreenshots" />
|
||||
</js-module>
|
||||
|
||||
<platform name="android">
|
||||
<config-file target="res/xml/config.xml" parent="/*">
|
||||
<feature name="OurCodeWorldpreventscreenshots">
|
||||
<param name="android-package" value="com.ourcodeworld.plugins.preventscreenshots.OurCodeWorldpreventscreenshots"/>
|
||||
</feature>
|
||||
</config-file>
|
||||
|
||||
<source-file src="src/android/OurCodeWorldpreventscreenshots.java" target-dir="src/com/ourcodeworld/plugin/"/>
|
||||
</platform>
|
||||
</plugin>
|
||||
36
src/android/OurCodeWorldpreventscreenshots.java
Normal file
36
src/android/OurCodeWorldpreventscreenshots.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package com.ourcodeworld.plugins.preventscreenshots;
|
||||
|
||||
import org.apache.cordova.*;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import android.view.WindowManager;
|
||||
|
||||
public class OurCodeWorldpreventscreenshots extends CordovaPlugin {
|
||||
private static final String ACTION_ENABLE = "enable";
|
||||
private static final String ACTION_DISABLE = "disable";
|
||||
|
||||
@Override
|
||||
public boolean execute(String action, JSONArray data, CallbackContext callbackContext) throws JSONException {
|
||||
if (ACTION_ENABLE.equals(action)) {
|
||||
cordova.getActivity().runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
cordova.getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
|
||||
WindowManager.LayoutParams.FLAG_SECURE);
|
||||
}
|
||||
});
|
||||
}else if(ACTION_DISABLE.equals(action)){
|
||||
cordova.getActivity().runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
cordova.getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE,
|
||||
WindowManager.LayoutParams.FLAG_SECURE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
PluginResult pluginResult = new PluginResult(PluginResult.Status.NO_RESULT);
|
||||
pluginResult.setKeepCallback(true); // Keep callback
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
18
www/ourcodeworldpreventscreenshots.js
Normal file
18
www/ourcodeworldpreventscreenshots.js
Normal file
@@ -0,0 +1,18 @@
|
||||
/*global cordova, module*/
|
||||
|
||||
module.exports = {
|
||||
enableScreenshots: function(){
|
||||
cordova.exec(function(data){
|
||||
console.info(data);
|
||||
}, function(err){
|
||||
console.error(err);
|
||||
}, "OurCodeWorldpreventscreenshots", "enable", [_settings]);
|
||||
},
|
||||
disableScreenshots: function(){
|
||||
cordova.exec(function(data){
|
||||
console.info(data);
|
||||
}, function(err){
|
||||
console.error(err);
|
||||
}, "OurCodeWorldpreventscreenshots", "disable", [_settings]);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user