-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Match ace editor monokai theme with app colors
- Loading branch information
1 parent
a923d46
commit c453df6
Showing
11 changed files
with
286 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
common/src/main/java/android/code/editor/common/utils/AssetsManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package android.code.editor.common.utils; | ||
|
||
import android.content.Context; | ||
import android.content.res.AssetManager; | ||
|
||
public class AssetsManager { | ||
private Context myContext; | ||
|
||
public AssetsManager(Context c) { | ||
myContext = c; | ||
} | ||
|
||
public void saveFile(String path, String pathTo) { | ||
copyFile(path, pathTo); | ||
} | ||
|
||
public void saveFolder(String path, String pathTo) { | ||
copyAssets(path, pathTo); | ||
} | ||
|
||
private void copyAssets(final String _folder, final String _to) { | ||
AssetManager assetManager = myContext.getAssets(); | ||
String[] files = null; | ||
try { | ||
files = assetManager.list(_folder); | ||
} catch (java.io.IOException e) { | ||
} | ||
if (files != null) | ||
for (String filename : files) { | ||
java.io.InputStream in = null; | ||
java.io.OutputStream out = null; | ||
try { | ||
in = assetManager.open(_folder + "/" + filename); | ||
if (!new java.io.File(_to).exists()) { | ||
new java.io.File(_to).mkdir(); | ||
|
||
java.io.File outFile = new java.io.File(_to, filename); | ||
if (!(outFile.exists())) { | ||
out = new java.io.FileOutputStream(outFile); | ||
copyFile(in, out); | ||
} | ||
|
||
} else { | ||
|
||
java.io.File outFile = new java.io.File(_to, filename); | ||
if (!(outFile.exists())) { | ||
out = new java.io.FileOutputStream(outFile); | ||
copyFile(in, out); | ||
} | ||
} | ||
} catch (java.io.IOException e) { | ||
} finally { | ||
if (in != null) { | ||
try { | ||
in.close(); | ||
} catch (java.io.IOException e) { | ||
} | ||
} | ||
if (out != null) { | ||
try { | ||
out.close(); | ||
} catch (java.io.IOException e) { | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
private void copyFile(java.io.InputStream in, java.io.OutputStream out) | ||
throws java.io.IOException { | ||
byte[] buffer = new byte[1024]; | ||
int read; | ||
while ((read = in.read(buffer)) != -1) { | ||
out.write(buffer, 0, read); | ||
} | ||
} | ||
|
||
private void copyFile(String filename, String outPath) { | ||
AssetManager assetManager = myContext.getAssets(); | ||
|
||
java.io.InputStream in; | ||
java.io.OutputStream out; | ||
try { | ||
in = assetManager.open(filename); | ||
String newFileName = outPath + "/" + filename; | ||
out = new java.io.FileOutputStream(newFileName); | ||
|
||
byte[] buffer = new byte[1024]; | ||
int read; | ||
while ((read = in.read(buffer)) != -1) { | ||
out.write(buffer, 0, read); | ||
} | ||
in.close(); | ||
out.flush(); | ||
out.close(); | ||
} catch (Exception e) { | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
common/src/main/java/android/code/editor/common/utils/ColorUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package android.code.editor.common.utils; | ||
|
||
import android.content.Context; | ||
import com.google.android.material.color.MaterialColors; | ||
|
||
public class ColorUtils { | ||
public static String materialIntToHexColor(Context context, int res) { | ||
return String.format("#%06X", (0xFFFFFF & MaterialColors.getColor(context, res, "#000000"))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
editor/src/main/assets/Editor/Ace-Editor/AceEditor/css/themes/monokai.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
.ace-monokai { | ||
/* Background */ | ||
/* Orginal Background */ | ||
/* background-color: #272822; */ | ||
background-color: ace_background; | ||
/* Text color */ | ||
color: #F8F8F2; | ||
} | ||
|
||
.ace-monokai .ace_gutter { | ||
/* line number background */ | ||
/* background: #2F3129; */ | ||
background: ace_gutter_background; | ||
/* line number color */ | ||
/* color: #8F908A; */ | ||
color: ace_gutter_text_color; | ||
} | ||
|
||
.ace-monokai .ace_marker-layer .ace_active-line { | ||
/* Active line */ | ||
/* background: #202020; */ | ||
background: ace_active_line; | ||
} | ||
|
||
.ace-monokai .ace_gutter-active-line { | ||
/* Side bar active line color */ | ||
/* background-color: #272727; */ | ||
background-color: ace_gutter_active_line; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.