-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: UseUse editor library as module
- Loading branch information
1 parent
4434abe
commit f618e00
Showing
641 changed files
with
446,797 additions
and
62 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
Binary file not shown.
62 changes: 0 additions & 62 deletions
62
app/src/main/java/android/code/editor/common/utils/FileUtils.java
This file was deleted.
Oops, something went wrong.
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 @@ | ||
/build |
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,38 @@ | ||
plugins { | ||
id 'com.android.library' | ||
} | ||
|
||
android { | ||
compileSdk 32 | ||
buildToolsVersion "33.0.2" | ||
useLibrary 'org.apache.http.legacy' | ||
namespace "android.code.editor.common" | ||
|
||
defaultConfig { | ||
minSdk 21 | ||
targetSdk 28 | ||
compileSdkVersion 33 | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_17 | ||
targetCompatibility JavaVersion.VERSION_17 | ||
} | ||
|
||
buildFeatures { | ||
viewBinding true | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation 'androidx.appcompat:appcompat:1.6.1' | ||
implementation 'com.google.android.material:material:1.9.0' | ||
implementation 'com.google.code.gson:gson:2.8.7' | ||
} |
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,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
32 changes: 32 additions & 0 deletions
32
common/src/main/java/android/code/editor/common/interfaces/FileDeleteListener.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,32 @@ | ||
/* | ||
* This file is part of Android Code Editor. | ||
* | ||
* Android Code Editor is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Android Code Editor is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Android Code Editor. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package android.code.editor.common.interfaces; | ||
|
||
import java.io.File; | ||
|
||
public interface FileDeleteListener { | ||
public void onProgressUpdate(int deleteDone); | ||
|
||
public void onTotalCount(int total); | ||
|
||
public void onDeleting(File path); | ||
|
||
public void onDeleteComplete(File path); | ||
|
||
public void onTaskComplete(); | ||
} |
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"))); | ||
} | ||
} |
Oops, something went wrong.