Skip to content

Commit 40ea457

Browse files
committed
Fixing error, again
1 parent d6f46b6 commit 40ea457

3 files changed

Lines changed: 31 additions & 6 deletions

File tree

126 Bytes
Binary file not shown.

src/android/plugin/build.gradle

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,29 @@ task exportPluginJar() {
4242
}
4343
}
4444

45+
task deployPluginToDirectory() {
46+
group "Corona-dev"
47+
dependsOn assemble
48+
doLast {
49+
copy {
50+
from {
51+
zipTree("$buildDir/outputs/aar/${project.name}-release.aar").matching {
52+
include 'classes.jar'
53+
}.singleFile
54+
}
55+
into "$buildDir/outputs/../../../../../plugins/2013.2090/android/"
56+
57+
File pluginManifestFile = file("src/main/AndroidManifest.xml")
58+
if (pluginManifestFile.exists()) {
59+
String manifestContents = pluginManifestFile.text
60+
def pluginManifestXml = new XmlSlurper().parseText(manifestContents)
61+
String packageName = pluginManifestXml.@package.toString()
62+
rename "classes.jar", "${packageName}.jar"
63+
} else {
64+
rename "classes.jar", "plugin.jar"
65+
}
66+
}
67+
}
68+
}
69+
4570
assemble.finalizedBy(exportPluginJar)

src/android/plugin/src/main/java/plugin/pasteboard/ClipboardListener.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,19 @@ public void addClipChangedListener() {
4040
final Context context = CoronaEnvironment.getApplicationContext();
4141
if (context == null) return;
4242

43-
if (clipboardManager == null) {
44-
clipboardManager = (android.content.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
45-
}
46-
if (clipboardManager == null) return;
47-
4843
// Verify environment
4944
CoronaActivity coronaActivity = CoronaEnvironment.getCoronaActivity();
5045
if (coronaActivity == null) return;
5146

5247
coronaActivity.runOnUiThread(new Runnable() {
5348
public void run() {
5449

50+
if (clipboardManager == null) {
51+
clipboardManager = (android.content.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
52+
}
53+
if (clipboardManager == null) return;
54+
55+
5556
if (primaryClipChangedListener == null) {
5657
primaryClipChangedListener = new android.content.ClipboardManager.OnPrimaryClipChangedListener() {
5758
public void onPrimaryClipChanged() {
@@ -60,7 +61,6 @@ public void onPrimaryClipChanged() {
6061
};
6162
}
6263

63-
6464
// Grab the initial clipboard contents and put them in pasteboard, if any.
6565
setNewPasteboardItem(context);
6666
clipboardManager.addPrimaryClipChangedListener(primaryClipChangedListener);

0 commit comments

Comments
 (0)