Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
- Removed unused libraries
Browse files Browse the repository at this point in the history
- Added about page with licenses to open source libraries
  • Loading branch information
itsaky committed Aug 7, 2021
1 parent f99d51c commit feffb8a
Show file tree
Hide file tree
Showing 126 changed files with 898 additions and 7,052 deletions.
15 changes: 6 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ android {
disable "VectorPath",
"NestedWeights",
"UnusedResources",
"ContentDescription"
"ContentDescription",
"SmallSp"
}

buildFeatures.viewBinding true
Expand Down Expand Up @@ -59,7 +60,7 @@ android {
stringfog.enable false
}
release {
minifyEnabled false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
stringfog.enable true
Expand All @@ -75,9 +76,8 @@ android {
}

stringfog {
def isRelease = getGradle().getStartParameter().getTaskRequests().toString().contains("release")
key 'WVV0aGMwaEFZVzVFVW05SlJFbGtaUT09'
enable false
enable true
implementation 'com.github.megatronking.stringfog.xor.StringFogImpl'
}

Expand All @@ -101,9 +101,9 @@ dependencies {

// AndroidX
implementation 'androidx.annotation:annotation:1.2.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
implementation 'androidx.drawerlayout:drawerlayout:1.1.1'
implementation 'androidx.multidex:multidex:2.0.1'
Expand All @@ -121,9 +121,6 @@ dependencies {

// Local projects
implementation project(':treeview')
implementation project(':spinkit')
implementation project(':slidr')
implementation project(':javadocparser')
implementation project(':lsp')

implementation fileTree(dir: 'libs', include: ['*.jar'])
Expand Down
18 changes: 16 additions & 2 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
-keepattributes SourceFile, LineNumberTable
-keepattributes Signature
-keepattributes *Annotation*
-renamesourcefileattribute FuckYou
-obfuscationdictionary dictionary.txt
-packageobfuscationdictionary dictionary.txt
Expand All @@ -8,21 +9,34 @@
-dontwarn
-dontnote

-dontwarn sun.misc.**
-dontwarn android.arch.**
-dontwarn android.lifecycle.**
-keep class android.arch.** { *; }
-keep class android.lifecycle.** { *; }
-keep class com.google.gson.examples.android.model.** { <fields>; }
-keep class * extends com.google.gson.TypeAdapter
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

-dontwarn androidx.arch.**
-dontwarn androidx.lifecycle.**
-keep class androidx.arch.** { *; }
-keep class androidx.lifecycle.** { *; }

-keepclasseswithmembernames,includedescriptorclasses class * { native <methods>; }
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep class * extends com.bumptech.glide.module.AppGlideModule { <init>(...); }
-keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder { *** rewind(); }

-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}

-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
-keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder { *** rewind(); }
5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

<application
tools:ignore="UnusedAttribute"
android:name=".app.StudioApp"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
Expand Down Expand Up @@ -44,6 +45,10 @@
android:name=".PreferencesActivity"
android:configChanges="orientation|screenSize">
</activity>
<activity
android:name=".AboutActivity"
android:configChanges="orientation|screenSize|uiMode">
</activity>
<service
android:name="com.itsaky.androidide.services.IDEService"
android:exported="false">
Expand Down
62 changes: 62 additions & 0 deletions app/src/main/assets/licenses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[
{
"name": "AndroidX Libraries",
"license": "Apache License 2.0",
"url": "https://github.com/androidx/androidx"
},
{
"name": "Material Components for Android",
"license": "Apache License 2.0",
"url": "https://github.com/material-components/material-components-android"
},
{
"name": "Gson",
"license": "Apache License 2.0",
"url": "https://github.com/google/gson"
},
{
"name": "Guava",
"license": "Apache License 2.0",
"url": "https://github.com/google/guava"
},
{
"name": "ANTLR4",
"license": "The 3-Clause BSD License",
"url": "https://github.com/antlr/antlr4"
},
{
"name": "Glide",
"license": "BSD, part MIT and Apache 2.0",
"url": "https://github.com/bumptech/glide"
},
{
"name": "Android UtilCode",
"license": "Apache License 2.0",
"url": "https://github.com/Blankj/AndroidUtilCode"
},
{
"name": "UnicornFilePicker",
"license": "Apache License 2.0",
"url": "https://github.com/abhishekti7/UnicornFilePicker"
},
{
"name": "QuickAction",
"license": "Apache License 2.0",
"url": "https://github.com/piruin/quickaction"
},
{
"name": "XmlToJson",
"license": "Apache License 2.0",
"url": "https://github.com/smart-fun/XmlToJson"
},
{
"name": "AndroidTreeView",
"license": "Apache License 2.0",
"url": "https://github.com/bmelnychuk/AndroidTreeView"
},
{
"name": "CodeEditor",
"license": "GPL-3.0 License",
"url": "https://github.com/Rosemoe/CodeEditor"
}
]
61 changes: 61 additions & 0 deletions app/src/main/java/com/itsaky/androidide/AboutActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.itsaky.androidide;

import android.os.Bundle;
import android.view.View;
import com.itsaky.androidide.app.StudioActivity;
import com.itsaky.androidide.databinding.ActivityAboutBinding;
import com.itsaky.androidide.fragments.sheets.OptionsListFragment;
import com.itsaky.androidide.models.License;
import com.itsaky.androidide.tasks.TaskExecutor;
import com.itsaky.androidide.tasks.callables.LicenseReader;
import java.util.List;

public class AboutActivity extends StudioActivity {

private ActivityAboutBinding binding;

@Override
protected View bindLayout() {
binding = ActivityAboutBinding.inflate(getLayoutInflater());
return binding.getRoot();
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

binding.items.footerText.setText(getFooter());

new TaskExecutor().executeAsync(new LicenseReader(this), __ -> {
setupLicenses(__);
});
}

private void setupLicenses(List<License> licenses) {
if(licenses == null || licenses.size() <= 0) {
binding.items.licenses.setText(getString(R.string.msg_about_no_licenses));
} else {
StringBuilder sb = new StringBuilder();
for(License license : licenses) {
sb.append("\u2022 ");
sb.append(license.name);
sb.append("\n");
sb.append(getString(R.string.msg_about_licensed_under, license.license));
sb.append("\n");
sb.append(getString(R.string.msg_about_license_source, license.url));
sb.append("\n\n");
}
binding.items.licenses.setText(sb);
}
}

private String getFooter() {
final String arch = android.os.Build.SUPPORTED_ABIS[0];
try {
final String version = getPackageManager().getPackageInfo("com.itsaky.androidide", 0).versionName;
return getString(R.string.about_footer, version, arch);
} catch (Throwable th) {
return getString(R.string.about_footer_alternate, arch);
}
}
}
3 changes: 3 additions & 0 deletions app/src/main/java/com/itsaky/androidide/EditorActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,7 @@ public void openFile(File file) {
if(i >= 0 && !mBinding.tabs.getTabAt(i).isSelected())
mBinding.tabs.getTabAt(i).select();
mBinding.editorDrawerLayout.closeDrawer(GravityCompat.END);
invalidateOptionsMenu();
}

@Override
Expand Down Expand Up @@ -1521,5 +1522,7 @@ private void closeFile(int index, boolean selectOther) {
DidCloseTextDocumentParams p = new DidCloseTextDocumentParams();
p.textDocument = id;
didClose(p);

invalidateOptionsMenu();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ protected void onCreate(Bundle savedInstanceState) {
setSupportActionBar(binding.toolbar);
getSupportActionBar().setTitle(R.string.ide_preferences);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);

loadFragment(getPrefsFragment());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void onBindViewHolder(VH holder, int position) {
if(symbols == null || symbols[position] == null) return;
final Symbol symbol = symbols[position];
holder.binding.symbol.setText(symbol.label);
TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(holder.binding.symbol, 16, 27, 1, TypedValue.COMPLEX_UNIT_SP);
// TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(holder.binding.symbol, 16, 27, 1, TypedValue.COMPLEX_UNIT_SP);
holder.binding.symbol.setOnClickListener(__ -> channel.insertSymbol(symbol.commit, symbol.offset));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import android.view.View;
import android.widget.ImageView;
import androidx.core.content.ContextCompat;
import com.github.ybq.android.spinkit.style.Circle;
import com.itsaky.androidide.R;
import com.itsaky.androidide.app.StudioActivity;
import com.itsaky.androidide.databinding.LayoutFiletreeItemBinding;
Expand Down Expand Up @@ -60,7 +59,6 @@ else if (file.getName().endsWith(".json"))
}

public void setLoading() {
chevron.setImageDrawable(new Circle());
chevron.getDrawable().setColorFilter(ContextCompat.getColor(context, R.color.secondaryLightColor), PorterDuff.Mode.SRC_ATOP);
}

Expand Down
12 changes: 11 additions & 1 deletion app/src/main/java/com/itsaky/androidide/app/StudioApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ public class StudioApp extends MultiDexApplication

public static final String TELEGRAM_GROUP_URL = "https://t.me/androidide_discussions";
public static final String SUGGESTIONS_URL = "https://github.com/itsaky/AndroidIDE";

public static final String WEBSITE = "https://androidide.com";

private Thread.UncaughtExceptionHandler uncaughtExceptionHandler;

@Override
Expand Down Expand Up @@ -338,6 +339,7 @@ public File getRootDirOld() {
return new File(getFilesDir(), "framework");
}

@SuppressLint("SdCardPath")
public File getIDEDataDir() {
return Environment.mkdirIfNotExits(new File("/data/data/com.itsaky.androidide/files"));
}
Expand Down Expand Up @@ -489,4 +491,12 @@ public void openIssueTracker() {
open.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(open);
}

public void openWebsite() {
Intent open = new Intent();
open.setAction(Intent.ACTION_VIEW);
open.setData(Uri.parse(StudioApp.WEBSITE));
open.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(open);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,14 @@ public void onSetSelection(int startLine, int startCol, int endLine, int endCol)
@Override
public void afterDelete(CodeEditor editor, CharSequence content, int startLine, int startColumn, int endLine, int endColumn, CharSequence deletedContent) {
isModified = true;
requestSignature();
}

@Override
public void afterInsert(CodeEditor editor, CharSequence content, int startLine, int startColumn, int endLine, int endColumn, CharSequence insertedContent) {
isModified = true;

if(getFile() != null && getFile().getName().endsWith(".java")) {
if(getFile() != null && getFile().getName().endsWith(EXT_XML)) {
boolean isOpen = false;
try {
isOpen = editor.getText().charAt(editor.getCursor().getLeft() - 2) == '<';
Expand All @@ -326,10 +327,7 @@ public void afterInsert(CodeEditor editor, CharSequence content, int startLine,
}
}

char c = insertedContent.charAt(0);
if(c == '(' || c == ',') {
requestSignature();
}
requestSignature();
}

private void requestSignature() {
Expand Down
Loading

0 comments on commit feffb8a

Please sign in to comment.