Skip to content

Commit 5916e45

Browse files
author
appt2
committed
test add api for test
1 parent 1705588 commit 5916e45

File tree

6 files changed

+57
-50
lines changed

6 files changed

+57
-50
lines changed

.androidide/editor/openedFiles.json

Lines changed: 0 additions & 50 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package Ninja.coder.Ghostemane.code.PluginManager;
2+
3+
import Ninja.coder.Ghostemane.code.PluginManager.IntentHelper;
4+
import android.content.BroadcastReceiver;
5+
import android.content.Context;
6+
import android.content.Intent;
7+
8+
public class FilePostBroadcastReceiver extends BroadcastReceiver {
9+
10+
public static final String ACTION_SEND_FILE_PATH = "Ninja.coder.code.Ghostemane.SEND_FILE_PATH";
11+
public static final String EXTRA_FILE_PATH = "/sdcard/";
12+
13+
@Override
14+
public void onReceive(Context context, Intent intent) {
15+
if (intent != null && intent.getAction().equals(ACTION_SEND_FILE_PATH)) {
16+
String path = intent.getStringExtra(EXTRA_FILE_PATH);
17+
}
18+
}
19+
}
20+
//Ninja.coder.code.Ghostemane.SEND_FILE_PATH
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package Ninja.coder.Ghostemane.code.PluginManager;
2+
3+
import android.os.Build;
4+
5+
@ismodule
6+
public class IntentHelper extends Plugin {
7+
/** this class helper to intent api ghost web ide */
8+
protected String name = "";
9+
10+
@isField(api = Build.VERSION_CODES.KITKAT)
11+
public static String getFilePath = "FilePath";
12+
13+
@isField(api = Build.VERSION_CODES.KITKAT)
14+
public static String getRunTerminal = "Terminal";
15+
16+
public IntentHelper(String name) {
17+
this.name = name;
18+
}
19+
}

Plugin/src/main/java/Ninja/coder/Ghostemane/code/PluginManager/Plugin.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public class Plugin {
1111
protected String id;
1212
protected File file;
1313
protected PluginFactory f;
14+
public Plugin(){}
1415

1516
public Plugin(String name, boolean Enabel, PluginFactory f) {
1617
this.name = name;

app/src/main/AndroidManifest.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,5 +472,10 @@
472472
android:process=":PHPWebServerService"
473473

474474
/>
475+
<receiver android:name="Ninja.coder.Ghostemane.code.PluginManager.FilePostBroadcastReceiver">
476+
<intent-filter>
477+
<action android:name="Ninja.coder.code.Ghostemane.SEND_FILE_PATH" />
478+
</intent-filter>
479+
</receiver>
475480
</application>
476481
</manifest>

app/src/main/java/Ninja/coder/Ghostemane/code/activities/FileDirActivity.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package Ninja.coder.Ghostemane.code.activities;
22

3+
import Ninja.coder.Ghostemane.code.PluginManager.IntentHelper;
34
import Ninja.coder.Ghostemane.code.R;
45
import Ninja.coder.Ghostemane.code.RequestNetwork;
56
import Ninja.coder.Ghostemane.code.RequestNetworkController;
@@ -40,6 +41,7 @@
4041
import android.content.Context;
4142
import android.content.DialogInterface;
4243
import android.content.Intent;
44+
import android.content.IntentFilter;
4345
import android.content.SharedPreferences;
4446
import android.content.pm.PackageInfo;
4547
import android.content.pm.PackageManager;
@@ -49,6 +51,7 @@
4951
import android.graphics.drawable.GradientDrawable;
5052
import android.media.MediaPlayer;
5153
import android.net.Uri;
54+
import Ninja.coder.Ghostemane.code.PluginManager.FilePostBroadcastReceiver;
5255
import android.os.AsyncTask;
5356
import android.os.Build;
5457
import android.os.Bundle;
@@ -417,6 +420,7 @@ void savePath() {
417420
Folder = FileUtil.getExternalStorageDir();
418421
reLoadFile();
419422
}
423+
IntentHelper.getFilePath = Folder;
420424
}
421425

422426
public void setViewType(ViewType viewType) {
@@ -435,6 +439,13 @@ public void setViewType(ViewType viewType) {
435439
}
436440
}
437441

442+
public void sendFilePathToReceiver(String filePath) {
443+
FilePostBroadcastReceiver files = new FilePostBroadcastReceiver();
444+
IntentFilter intentFilter = new IntentFilter();
445+
intentFilter.addAction("Ninja.coder.code.Ghostemane.SEND_FILE_PATH");
446+
registerReceiver(files, intentFilter);
447+
}
448+
438449
private void initStartApp() {
439450

440451
getWindow()
@@ -549,6 +560,7 @@ public void FilterFile() {
549560
layout.setEndIconScaleType(ImageView.ScaleType.CENTER_INSIDE);
550561
layout.setEndIconDrawable(R.drawable.deletear);
551562
layout.setEndIconOnClickListener(v -> et.getText().clear());
563+
sendFilePathToReceiver(Folder);
552564

553565
et.addTextChangedListener(
554566
new TextWatcher() {

0 commit comments

Comments
 (0)