Skip to content

Commit 1705588

Browse files
author
appt2
committed
fix read symbol.json #now load form asster not path file
1 parent b895ecd commit 1705588

File tree

3 files changed

+67
-70
lines changed

3 files changed

+67
-70
lines changed
Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"allFiles": [
33
{
4-
"file": "/storage/emulated/0/AndroidIDEProjects/Ghost-web-ide/app/src/main/java/io/github/rosemoe/sora/widget/commentRule/CommentHelper.java",
4+
"file": "/storage/emulated/0/AndroidIDEProjects/Ghost-web-ide/app/src/main/java/Ninja/coder/Ghostemane/code/activities/CodeEditorActivity.java",
55
"selection": {
66
"end": {
77
"column": 0,
@@ -16,20 +16,35 @@
1616
}
1717
},
1818
{
19-
"file": "/storage/emulated/0/AndroidIDEProjects/Ghost-web-ide/app/src/main/java/io/github/rosemoe/sora/widget/EditorTextActionWindow.java",
19+
"file": "/storage/emulated/0/AndroidIDEProjects/Ghost-web-ide/app/src/main/assets/symbol.json",
2020
"selection": {
2121
"end": {
22-
"column": 25,
23-
"index": 5403,
24-
"line": 140
22+
"column": 1,
23+
"index": 1,
24+
"line": 0
25+
},
26+
"start": {
27+
"column": 1,
28+
"index": 1,
29+
"line": 0
30+
}
31+
}
32+
},
33+
{
34+
"file": "/storage/emulated/0/AndroidIDEProjects/Ghost-web-ide/app/src/main/java/Ninja/coder/Ghostemane/code/adapter/SyspiarAdapter.java",
35+
"selection": {
36+
"end": {
37+
"column": 33,
38+
"index": 2145,
39+
"line": 56
2540
},
2641
"start": {
27-
"column": 25,
28-
"index": 5403,
29-
"line": 140
42+
"column": 33,
43+
"index": 2145,
44+
"line": 56
3045
}
3146
}
3247
}
3348
],
34-
"selectedFile": "/storage/emulated/0/AndroidIDEProjects/Ghost-web-ide/app/src/main/java/io/github/rosemoe/sora/widget/EditorTextActionWindow.java"
49+
"selectedFile": "/storage/emulated/0/AndroidIDEProjects/Ghost-web-ide/app/src/main/java/Ninja/coder/Ghostemane/code/activities/CodeEditorActivity.java"
3550
}

app/src/main/assets/symbol.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
[
2-
{
3-
"Tools" : "tools"
4-
},
52
{
63
"Tab": ""
74
},

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

Lines changed: 43 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
import io.github.rosemoe.sora.widget.SymbolInputView;
9696

9797
import java.io.File;
98+
import java.io.InputStream;
9899
import java.util.ArrayList;
99100
import java.util.HashMap;
100101
import java.util.Timer;
@@ -158,7 +159,7 @@ public class CodeEditorActivity extends AppCompatActivity {
158159
private LinearLayout newLayoutSymbolBar;
159160
private LinearLayout CustomToolbar;
160161
private ProgressBar progressbar1;
161-
162+
162163
private RecyclerView recyclerview1;
163164
private RecyclerView dir;
164165
private LinearLayout divar;
@@ -284,7 +285,7 @@ private boolean isJsonError(String string) {
284285
}
285286

286287
private void initialize(Bundle _savedInstanceState) {
287-
288+
288289
_coordinator = findViewById(R.id._coordinator);
289290
_fab = findViewById(R.id._fab);
290291
_coordinator = findViewById(R.id._coordinator);
@@ -294,11 +295,11 @@ private void initialize(Bundle _savedInstanceState) {
294295
newLayoutSymbolBar = findViewById(R.id.newLayoutSymbolBar);
295296
CustomToolbar = findViewById(R.id.CustomToolbar);
296297
progressbar1 = findViewById(R.id.progressbar1);
297-
298+
298299
recyclerview1 = findViewById(R.id.recyclerview1);
299300
dir = findViewById(R.id.dir);
300301
divar = findViewById(R.id.divar);
301-
302+
302303
linear1 = findViewById(R.id.linear1);
303304
linear2 = findViewById(R.id.linear2);
304305
badgeview3 = findViewById(R.id.badgeview3);
@@ -307,13 +308,13 @@ private void initialize(Bundle _savedInstanceState) {
307308
image = findViewById(R.id.image);
308309
redo = findViewById(R.id.redo);
309310
undo = findViewById(R.id.undo);
310-
311+
311312
menupopnew = findViewById(R.id.menupopnew);
312313
editor = findViewById(R.id.editor);
313314
FrameLayout02 = findViewById(R.id.FrameLayout02);
314315
linear3 = findViewById(R.id.linear3);
315316
proanjctor = findViewById(R.id.proanjctor);
316-
317+
317318
barSymoble = findViewById(R.id.barSymoble);
318319
linear5 = findViewById(R.id.linear5);
319320
imageview1 = findViewById(R.id.imageview1);
@@ -322,7 +323,7 @@ private void initialize(Bundle _savedInstanceState) {
322323
left = findViewById(R.id.left);
323324
up = findViewById(R.id.up);
324325
rh = findViewById(R.id.rh);
325-
326+
326327
divardown = findViewById(R.id.divardown);
327328
syspiar = findViewById(R.id.syspiar);
328329
word = getSharedPreferences("word", Activity.MODE_PRIVATE);
@@ -413,12 +414,9 @@ public void onClick(View _view) {
413414
}
414415
});
415416

416-
417-
418417
menupopnew.setOnClickListener(
419-
(___)-> {
420-
421-
_managerpanel(menupopnew);
418+
(___) -> {
419+
_managerpanel(menupopnew);
422420
});
423421

424422
imageview1.setOnClickListener(
@@ -462,7 +460,6 @@ public void onClick(View _view) {
462460
}
463461
});
464462

465-
466463
_fab.setOnClickListener(
467464
new View.OnClickListener() {
468465
@Override
@@ -707,8 +704,9 @@ public void Enter() {
707704
thememanagersoft.contains("br") ? thememanagersoft.getFloat("br", 2) : 3);
708705
} else {
709706
if (imap.containsKey("BackgroundColorLinear")) {
710-
getWindow().getDecorView().setBackgroundColor(
711-
Color.parseColor(imap.get("BackgroundColorLinear").toString()));
707+
getWindow()
708+
.getDecorView()
709+
.setBackgroundColor(Color.parseColor(imap.get("BackgroundColorLinear").toString()));
712710
} else {
713711
getWindow().getDecorView().setBackgroundColor(0xFF2B2120);
714712
}
@@ -722,7 +720,6 @@ public void Enter() {
722720
}
723721
FileUtil.writeFile(
724722
"/storage/emulated/0/GhostWebIDE/ninjacoder/openFile.json", shp.getString("path", ""));
725-
726723

727724
progressbar1.setVisibility(View.GONE);
728725

@@ -766,7 +763,7 @@ public void Enter() {
766763
WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE
767764
| WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
768765
_coderuner();
769-
766+
770767
editor.setLineNumberAlign(Paint.Align.CENTER);
771768

772769
SetThemeForJson themeForJson2 = new SetThemeForJson();
@@ -784,13 +781,13 @@ public void Enter() {
784781
themeForJson2.addImageColor(undo, this, "ImageColor", imap, Color.parseColor("#ff94e7ff"));
785782
themeForJson2.addImageColor(redo, this, "ImageColor", imap, Color.parseColor("#ff94e7ff"));
786783
themeForJson2.addImageColor(image, this, "ImageColor", imap, Color.parseColor("#ff94e7ff"));
787-
784+
788785
themeForJson2.addImageColor(
789786
menupopnew, this, "ImageColor", imap, Color.parseColor("#ff94e7ff"));
790787
themeForJson2.mfabcolor(this, _fab, imap);
791788
themeForJson2.mfab2(this, _fab, imap);
792789
AnimUtils.ClickAnimation(menupopnew);
793-
790+
794791
AnimUtils.ClickAnimation(undo);
795792
AnimUtils.ClickAnimation(redo);
796793
if (ru.contains("rup")) {
@@ -811,7 +808,6 @@ public void Enter() {
811808
Window ninjacoder = this.getWindow();
812809
ninjacoder.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
813810
ninjacoder.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
814-
815811
ninjacoder.setStatusBarColor(Color.parseColor("#FF2B2122"));
816812
ninjacoder.setNavigationBarColor(Color.parseColor("#FF2B2122"));
817813
}
@@ -845,7 +841,7 @@ public void Enter() {
845841
Typeface.createFromAsset(getAssets(), "fonts/ghostfont.ttf"), Typeface.NORMAL);
846842
typeVl.setTypeface(
847843
Typeface.createFromAsset(getAssets(), "fonts/ghostfont.ttf"), Typeface.NORMAL);
848-
844+
849845
} else {
850846
_editorsetfontfromfile(setfont.getString("mfont", ""));
851847
tvtitle.setTypeface(Typeface.createFromFile(new File(setfont.getString("mfont", ""))));
@@ -1393,45 +1389,34 @@ public void _fragmentdatapost() {
13931389
}
13941390

13951391
public void Symbloinit() {
1396-
if (!FileUtil.isExistFile("/storage/emulated/0/GhostWebIDE/Symbols/symbol.json")) {
1397-
try {
1398-
java.io.InputStream inputstream5 = getAssets().open("symbol.json");
1399-
staticSymbiolPiare =
1400-
new Gson()
1401-
.fromJson(
1402-
SketchwareUtil.copyFromInputStream(inputstream5),
1403-
new TypeToken<ArrayList<HashMap<String, Object>>>() {}.getType());
1404-
} catch (Exception e) {
1405-
SketchwareUtil.showMessage(getApplicationContext(), e.toString());
1406-
}
1407-
} else {
1408-
try {
1409-
staticSymbiolPiare =
1410-
new Gson()
1411-
.fromJson(
1412-
FileUtil.readFile("/storage/emulated/0/GhostWebIDE/Symbols/symbol.json"),
1413-
new TypeToken<ArrayList<HashMap<String, Object>>>() {}.getType());
1414-
} catch (Exception e) {
1415-
SketchwareUtil.showMessage(getApplicationContext(), e.toString());
1416-
}
1417-
}
1418-
SyspiarAdapter syspiarAdapter =
1419-
new SyspiarAdapter(
1420-
staticSymbiolPiare,
1421-
new SyspiarAdapter.OnTabView() {
1422-
@Override
1423-
public void TAB(String tab) {
1424-
_sysba(tab);
1425-
}
1392+
try {
1393+
InputStream inputstream5 = getAssets().open("symbol.json");
1394+
staticSymbiolPiare =
1395+
new Gson()
1396+
.fromJson(
1397+
SketchwareUtil.copyFromInputStream(inputstream5),
1398+
new TypeToken<ArrayList<HashMap<String, Object>>>() {}.getType());
1399+
SyspiarAdapter syspiarAdapter =
1400+
new SyspiarAdapter(
1401+
staticSymbiolPiare,
1402+
new SyspiarAdapter.OnTabView() {
1403+
@Override
1404+
public void TAB(String tab) {
1405+
_sysba(tab);
1406+
}
14261407

1427-
@Override
1428-
public void POST(String post) {
1429-
_sysba(post);
1430-
}
1431-
});
1408+
@Override
1409+
public void POST(String post) {
1410+
_sysba(post);
1411+
}
1412+
});
14321413

1433-
syspiar.setAdapter(syspiarAdapter);
1434-
syspiar.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
1414+
syspiar.setAdapter(syspiarAdapter);
1415+
syspiar.setLayoutManager(
1416+
new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
1417+
} catch (Exception e) {
1418+
SketchwareUtil.showMessage(getApplicationContext(), e.toString());
1419+
}
14351420
}
14361421

14371422
public void _closeall() {

0 commit comments

Comments
 (0)