diff --git a/.idea/google-java-format.xml b/.idea/google-java-format.xml
index 8b57f4527..05946a82a 100644
--- a/.idea/google-java-format.xml
+++ b/.idea/google-java-format.xml
@@ -2,5 +2,6 @@
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index c0115a2ba..3e89e3994 100755
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -76,7 +76,7 @@ android {
exclude 'about.properties'
exclude 'about.ini'
exclude 'modeling32.png'
- }
+ }
}
dependencies {
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
index bd3c9c361..844634202 100755
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -1,45 +1,7 @@
--keepattributes Signature
--keepattributes *Annotation*
--renamesourcefileattribute FuckYou
--obfuscationdictionary dictionary.txt
--packageobfuscationdictionary dictionary.txt
--classobfuscationdictionary dictionary.txt
-
-ignorewarnings
+
-dontwarn
-dontnote
+-dontobfuscate
--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.** { ; }
--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.** { *; }
-
--keep class org.eclipse.lsp4j.** { *; }
--keep class com.itsaky.lsp.** { *; }
-
--keepclasseswithmembernames,includedescriptorclasses class * { native ; }
--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 { (...); }
--keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder { *** rewind(); }
-
--keepclassmembers,allowobfuscation class * {
- @com.google.gson.annotations.SerializedName ;
-}
-
--keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
- **[] $VALUES;
- public *;
-}
+-keep class com.sun.** { *; }
\ No newline at end of file
diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json
new file mode 100644
index 000000000..468cb9c59
--- /dev/null
+++ b/app/release/output-metadata.json
@@ -0,0 +1,20 @@
+{
+ "version": 3,
+ "artifactType": {
+ "type": "APK",
+ "kind": "Directory"
+ },
+ "applicationId": "com.itsaky.androidide",
+ "variantName": "release",
+ "elements": [
+ {
+ "type": "SINGLE",
+ "filters": [],
+ "attributes": [],
+ "versionCode": 200,
+ "versionName": "2.0.0-beta",
+ "outputFile": "app-release.apk"
+ }
+ ],
+ "elementType": "File"
+}
\ No newline at end of file
diff --git a/app/src/main/assets/changelog.json b/app/src/main/assets/changelog.json
deleted file mode 100755
index 3de250bf5..000000000
--- a/app/src/main/assets/changelog.json
+++ /dev/null
@@ -1,85 +0,0 @@
-[
- {
- "version": "1.0.3-alpha",
- "changes": [
- "Added: Terminal (supports basic commands, with java, gradle and commands provided in Android\u0027s SDK, like sdkmanager)",
- "Added: \u0027Go to Definition\u0027 option to find the definition of a method, constructor, class, field or variable in Java files",
- "Added: \u0027Find all references\u0027 to find all the references/usage of a method, class, constructor, field or variables",
- "Added: Clicking on a Diagnostic in the diagnostics list opens the respective file and selects the diagnostic range",
- "Added: Search in current file",
- "Added: Textual search in project source files",
- "Added: You can now pick any project in your device",
- "Added: IDE will open the last opened project automatically",
- "Added: Project information viewer to show some basic information about currently opened project",
- "Added: Option to choose number of spaces to be inserted in a TAB character",
- "Added: Generate debug resources when an XML file is modified",
- "Added: Show API information of classes and members (since, removed, deprecated, etc.)",
- "Added: JavaDoc syntax highlighting",
- "Added: Ability to allow environment variables specified by users",
- "Added: Append new line in String literal when \u0027ENTER\u0027 key is pressed and cursor is in a string.",
- "Added: Gradlew support",
- "Fixed: Library libz.so.1 not found on some devices",
- "Fixed: Crash when clicking the \u0027View\u0027 FAB",
- "Fixed: Installation issue when installing zip files",
- "Fixed: Crash when opening telegram group and Telegram isn\u0027t installed",
- "Fixed: Contents of file got erased on \u0027Close others\u0027 action",
- "Fixed: Invalid insertion of completion items",
- "Fixed: Unresponsive home button in Preference screen\u0027s toolbar",
- "Fixed: Signature help was being always triggered in a lambda scope",
- "Fixed: Invalid cursor position after inserting new block in Java code",
- "Fixed: Logs not being shown properly",
- "Enhanced: Reduced size of file tabs to provide more space for editor.",
- "Enhanced: Diagnostic window now does not show unnecessary information",
- "Removed: Projects list",
- "Removed: AndroidIDE now doesn\u0027t need it\u0027s Gradle Plugin. You could simply remove it from your project."
- ]
- },
- {
- "version": "1.0.2-alpha",
- "changes": [
- "Added: Realtime error checking for current file",
- "Added: Link to issue tracker on GitHub",
- "Added: Do not insert closing symbols if already present in editor",
- "Added: You can now edit any file whose encoding is UTF-8",
- "Added: You can now edit the global gradle.properties file",
- "Added: You can now delete a project from the project\u0027s list (click and hold to show delete option)",
- "Added: Show signature of methods and constructors when typing their parameters",
- "Added: Editor now pins the line number",
- "Fixed: If an opened file is deleted, it was still open even after deleting",
- "Fixed: Lag with the progress dialog while installing build tools",
- "Fixed: App crash when --debug, --info or --scan was enabled for Gradle builds",
- "Fixed: File tree keeps loading on some devices",
- "Fixed: Different text color for buttons in preferences",
- "Fixed: Color of icons in options menu remained unchanged even if the items were disabled",
- "Enhanced: Syntax highlighting of Java files (works only after services are started)",
- "Enhanced: Java completion is much more advanced than earlier versions",
- "Updated: AndroidIDE now comes with an updated JDK built specifically for AndroidIDE."
- ]
- },
- {
- "version": "1.0.1-alpha",
- "changes": [
- "Added: Option to choose custom build tools",
- "Added: Build output is now shown while starting completion services",
- "Added: A preference screen with some basic preferences",
- "Added: \u0027Stop all Daemons\u0027 option now force stops a build if it already running",
- "Added: Option which shows the status of Gradle Daemons",
- "Added: Syntax highlighting and basic (reserved) completion for Gradle files.",
- "Added: Option to recreate completion services",
- "Added: Basic options while creating a new file",
- "Added: You can now invoke the selection mode without selecting a word",
- "Fixed: Bug which caused files from previously created project to be copied to new project",
- "Fixed: Auto import issue when a completion item is selected",
- "Fixed: Orientation issue in downloads activity",
- "Fixed: Sometimes, auto closing tags won\u0027t work as expected",
- "Enhanced: Speed of Java completion has been improved. But still it needs a lot of work.",
- "Enhanced: Starting of completion services is a bit faster as compared to the previous version. But takes more time on first startup."
- ]
- },
- {
- "version": "1.0.0-alpha",
- "changes": [
- "First alpha release"
- ]
- }
-]
\ No newline at end of file
diff --git a/app/src/main/java/com/itsaky/androidide/fragments/preferences/IDEPreferences.java b/app/src/main/java/com/itsaky/androidide/fragments/preferences/IDEPreferences.java
index 83fb55afa..94017524c 100755
--- a/app/src/main/java/com/itsaky/androidide/fragments/preferences/IDEPreferences.java
+++ b/app/src/main/java/com/itsaky/androidide/fragments/preferences/IDEPreferences.java
@@ -1,8 +1,6 @@
-/************************************************************************************
+/*
* This file is part of AndroidIDE.
*
- *
- *
* AndroidIDE 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
@@ -16,53 +14,42 @@
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see .
*
- **************************************************************************************/
-
+ */
package com.itsaky.androidide.fragments.preferences;
-import android.content.Intent;
-import android.graphics.Typeface;
-import android.os.Bundle;
-import android.text.Spannable;
-import android.text.SpannableStringBuilder;
-import android.text.style.StyleSpan;
-import android.util.TypedValue;
-import android.view.ViewGroup;
-import android.widget.HorizontalScrollView;
-import android.widget.ScrollView;
-import android.widget.TextView;
+import static com.itsaky.androidide.utils.Logger.instance;
-import androidx.core.content.ContextCompat;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+
+import androidx.annotation.NonNull;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
-import com.blankj.utilcode.util.ResourceUtils;
-import com.blankj.utilcode.util.SizeUtils;
-import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.itsaky.androidide.AboutActivity;
+import com.itsaky.androidide.BuildConfig;
import com.itsaky.androidide.R;
+import com.itsaky.androidide.app.BaseApplication;
import com.itsaky.androidide.app.StudioApp;
-import com.itsaky.androidide.utils.DialogUtils;
+import com.itsaky.androidide.utils.Logger;
+import com.itsaky.toaster.Toaster;
-import org.json.JSONArray;
-import org.json.JSONObject;
+import org.jetbrains.annotations.Contract;
public class IDEPreferences extends BasePreferenceFragment {
- private GeneralPreferences mGeneralPrefs;
- private BuildPreferences mBuildPreferences;
- private EditorPreferences mEditorPreferences;
-
- private String CHANGELOG = null;
-
public static final String KEY_GENERAL = "idepref_general";
- public static final String KEY_APPEARANCE = "idepref_appearance";
public static final String KEY_EDITOR = "idepref_editor";
public static final String KEY_BUILD = "idepref_build";
public static final String KEY_TELEGRAM = "idepref_telegram";
public static final String KEY_ISSUES = "idepref_issues";
public static final String KEY_CHANGELOG = "idepref_changelog";
public static final String KEY_ABOUT = "idepref_about";
+ private static final Logger LOG = instance("IDEPreferences");
+ private GeneralPreferences mGeneralPrefs;
+ private BuildPreferences mBuildPreferences;
+ private EditorPreferences mEditorPreferences;
@Override
public void onCreatePreferences(Bundle savedState, String rootKey) {
@@ -141,75 +128,41 @@ public class IDEPreferences extends BasePreferenceFragment {
}
private void showChangelog() {
- final int dp8 = SizeUtils.dp2px(8);
- final int dp16 = SizeUtils.dp2px(16);
- final ScrollView vScroll = new ScrollView(getContext());
- vScroll.setFillViewport(true);
- vScroll.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
-
- final HorizontalScrollView scroll = new HorizontalScrollView(getContext());
- scroll.setLayoutParams(new ViewGroup.LayoutParams(-1, -2));
- scroll.setFillViewport(true);
- scroll.setPadding(dp16, dp8, dp16, dp8);
- scroll.setPaddingRelative(dp16, dp8, dp16, dp8);
-
- final TextView text = new TextView(getContext());
- text.setText(CHANGELOG == null ? CHANGELOG = changelogAsString() : CHANGELOG);
- text.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13);
- text.setTextColor(ContextCompat.getColor(getContext(), R.color.primaryTextColor));
- scroll.removeAllViews();
- vScroll.removeAllViews();
- scroll.addView(text, new ViewGroup.LayoutParams(-1, -1));
- vScroll.addView(scroll);
-
- final MaterialAlertDialogBuilder builder =
- DialogUtils.newMaterialDialogBuilder(getContext());
- builder.setTitle(R.string.pref_changelog);
- builder.setView(vScroll);
- builder.setPositiveButton(android.R.string.ok, null);
- builder.create().show();
- }
-
- private String changelogAsString() {
+ final var intent = new Intent(Intent.ACTION_VIEW);
+ intent.setData(
+ Uri.parse(
+ BaseApplication.GITHUB_URL
+ .concat("/releases/tag/v")
+ .concat(BuildConfig.VERSION_NAME)));
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
- final SpannableStringBuilder sb = new SpannableStringBuilder();
- JSONArray arr = new JSONArray(ResourceUtils.readAssets2String("changelog.json"));
- for (int i = 0; i < arr.length(); i++) {
- JSONObject version = arr.getJSONObject(i);
- sb.append(
- "v".concat(version.getString("version")),
- new StyleSpan(Typeface.BOLD),
- Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
- JSONArray changes = version.getJSONArray("changes");
- for (int j = 0; j < changes.length(); j++) {
- sb.append("\n ");
- sb.append("\u2022 ".concat(changes.getString(j)));
- }
- sb.append("\n\n");
- }
- return sb.toString();
+ startActivity(intent);
} catch (Throwable th) {
- return getString(R.string.msg_failed_get_changelog);
+ LOG.error("Unable to start activity to show changelog", th);
+ StudioApp.getInstance().toast("Unable to start activity", Toaster.Type.ERROR);
}
}
+ @NonNull
+ @Contract(pure = true)
private Preference.OnPreferenceClickListener getListener() {
- return new Preference.OnPreferenceClickListener() {
-
- @Override
- public boolean onPreferenceClick(Preference p1) {
- final String key = p1.getKey();
- if (key.equals(KEY_CHANGELOG)) {
+ return preference -> {
+ final String key = preference.getKey();
+ switch (key) {
+ case KEY_CHANGELOG:
showChangelog();
- } else if (key.equals(KEY_TELEGRAM)) {
+ break;
+ case KEY_TELEGRAM:
StudioApp.getInstance().openTelegramGroup();
- } else if (key.equals(KEY_ISSUES)) {
+ break;
+ case KEY_ISSUES:
StudioApp.getInstance().openGitHub();
- } else if (key.equals(KEY_ABOUT)) {
+ break;
+ case KEY_ABOUT:
startActivity(new Intent(getContext(), AboutActivity.class));
- }
- return true;
+ break;
}
+ return true;
};
}
}
diff --git a/build.gradle b/build.gradle
index d59537f63..6f3e6c631 100755
--- a/build.gradle
+++ b/build.gradle
@@ -6,7 +6,7 @@ buildscript {
minSdk = 26
targetSdk = 28
versionCode = 200
- versionName = "2.0-beta"
+ versionName = "2.0.0-beta"
packageName = "com.itsaky.androidide"
javaSourceVersion = JavaVersion.VERSION_11