Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@
<preference name="AndroidLaunchMode" value="singleTask" />
<preference name="prerendered-icon" value="false" />
<preference name="androidxEnabled" value="true" />
<preference name="GradlePluginKotlinEnabled" value="true" />
<preference name="android-targetSdkVersion" value="35" />


<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
<application android:networkSecurityConfig="@xml/network_security_config" />
<application android:hardwareAccelerated="true" />
Expand Down
10 changes: 4 additions & 6 deletions src/lib/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,10 @@ class Settings {
if (this.#initialized) return;
this.settingsFile = Url.join(DATA_STORAGE, "settings.json");

if (!IS_FREE_VERSION) {
this.#defaultSettings.appTheme = "system";
this.#defaultSettings.editorTheme = getSystemEditorTheme(
isDeviceDarkTheme(),
);
}
this.#defaultSettings.appTheme = "system";
this.#defaultSettings.editorTheme = getSystemEditorTheme(
isDeviceDarkTheme(),
);

this.#initialized = true;

Expand Down
23 changes: 20 additions & 3 deletions src/plugins/terminal/src/android/AlpineDocumentProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.Collections;
import java.util.LinkedList;
import java.util.Locale;
import com.foxdebug.acode.R;

public class AlpineDocumentProvider extends DocumentsProvider {

Expand Down Expand Up @@ -60,7 +59,7 @@ public Cursor queryRoots(String[] projection) {
MatrixCursor result = new MatrixCursor(
projection != null ? projection : DEFAULT_ROOT_PROJECTION
);
String applicationName = "Acode";
String applicationName = getApplicationLabel();

MatrixCursor.RowBuilder row = result.newRow();
row.add(DocumentsContract.Root.COLUMN_ROOT_ID, getDocIdForFile(BASE_DIR));
Expand All @@ -75,7 +74,7 @@ public Cursor queryRoots(String[] projection) {
row.add(DocumentsContract.Root.COLUMN_TITLE, applicationName);
row.add(DocumentsContract.Root.COLUMN_MIME_TYPES, ALL_MIME_TYPES);
row.add(DocumentsContract.Root.COLUMN_AVAILABLE_BYTES, BASE_DIR.getFreeSpace());
row.add(DocumentsContract.Root.COLUMN_ICON, R.mipmap.ic_launcher);
row.add(DocumentsContract.Root.COLUMN_ICON, resolveLauncherIcon());
return result;
}

Expand Down Expand Up @@ -364,4 +363,22 @@ private static String getMimeType(File file) {
return "application/octet-stream";
}
}
private int resolveLauncherIcon() {
Context context = getContext();
if (context == null) return android.R.mipmap.sym_def_app_icon;
int icon = context.getResources().getIdentifier("ic_launcher", "mipmap", context.getPackageName());
return icon != 0 ? icon : android.R.mipmap.sym_def_app_icon;
}

private String getApplicationLabel() {
Context context = getContext();
if (context == null) return "Acode";
PackageManager pm = context.getPackageManager();
try {
CharSequence label = pm.getApplicationLabel(context.getApplicationInfo());
return label != null ? label.toString() : "Acode";
} catch (Exception ignored) {
return "Acode";
}
}
}
19 changes: 14 additions & 5 deletions src/plugins/terminal/src/android/TerminalService.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import android.os.PowerManager;
import android.os.RemoteException;
import androidx.core.app.NotificationCompat;
import com.foxdebug.acode.R;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -360,13 +359,15 @@ private void updateNotification() {
String contentText = "Executor service" + (isWakeLockHeld ? " (wakelock held)" : "");
String wakeLockButtonText = isWakeLockHeld ? "Release Wake Lock" : "Acquire Wake Lock";

int notificationIcon = resolveDrawableId("ic_notification", "ic_launcher_foreground", "ic_launcher");

Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID)
.setContentTitle("Acode Service")
.setContentText(contentText)
.setSmallIcon(R.drawable.ic_launcher_foreground)
.setSmallIcon(notificationIcon)
.setOngoing(true)
.addAction(R.drawable.ic_launcher_foreground, wakeLockButtonText, wakeLockPendingIntent)
.addAction(R.drawable.ic_launcher_foreground, "Exit", exitPendingIntent)
.addAction(notificationIcon, wakeLockButtonText, wakeLockPendingIntent)
.addAction(notificationIcon, "Exit", exitPendingIntent)
.build();

startForeground(1, notification);
Expand All @@ -390,4 +391,12 @@ public void onDestroy() {
clientMessengers.clear();
threadPool.shutdown();
}
}

private int resolveDrawableId(String... names) {
for (String name : names) {
int id = getResources().getIdentifier(name, "drawable", getPackageName());
if (id != 0) return id;
}
return android.R.drawable.sym_def_app_icon;
}
}
4 changes: 2 additions & 2 deletions utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const exec = promisify(require("node:child_process").exec);
`cordova plugin add cordova-plugin-consent@2.4.0 --save`,
);
await exec(
`cordova plugin add admob-plus-cordova@1.28.0 --save --variable APP_ID_ANDROID="${AD_APP_ID}" --variable PLAY_SERVICES_VERSION="21.5.0"`,
`cordova plugin add admob-plus-cordova@2.0.0-alpha.19 --save --variable APP_ID_ANDROID="${AD_APP_ID}" --variable PLAY_SERVICES_VERSION="23.2.0"`,
);
console.log("DONE! Installing admob-plus-cordova");
} else {
Expand All @@ -96,7 +96,7 @@ const exec = promisify(require("node:child_process").exec);
}

console.log(`|--- Reinstalling platform ---|`);
const { stderr } = await exec(`yarn clean`);
const { stderr } = await exec(`npm run clean`);
if (stderr) console.error(stderr);
else console.log("DONE! Reinstalling platform");
})(),
Expand Down