Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor changes #523

Merged
merged 2 commits into from
Oct 8, 2024
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
1 change: 0 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ android {
minSdkVersion rootProject.ext.minSdk
targetSdkVersion rootProject.ext.targetSdk

multiDexEnabled true
manifestPlaceholders.APP_NAME = projectName

buildConfigField "String", "APP_NAME", '"' + projectName + '"'
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/org/koreader/launcher/MainApp.kt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package org.koreader.launcher

import android.app.Application
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Environment
import android.os.StrictMode
import androidx.multidex.MultiDexApplication
import java.io.BufferedReader
import java.io.File
import java.io.InputStreamReader

class MainApp : MultiDexApplication() {
class MainApp : Application() {
companion object {
const val NAME = BuildConfig.APP_NAME
const val FLAVOR = BuildConfig.FLAVOR_CHANNEL
Expand Down
22 changes: 16 additions & 6 deletions assets/android.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
--[[--
Java Native Interface (JNI) wrapper.
FFI bindings for android native APIs and Java Native Interface (JNI).

see https://developer.android.com/ndk/reference/struct/a-native-activity
and https://developer.android.com/reference/games/game-activity/group/android-native-app-glue

@module android
]]
Expand All @@ -26,6 +29,8 @@ for _ = 1, 100 do end
local ffi = require("ffi")

ffi.cdef[[
// posix:
int chdir(const char *path);
// logging:
int __android_log_print(int prio, const char *tag, const char *fmt, ...);
typedef enum android_LogPriority {
Expand Down Expand Up @@ -2738,16 +2743,21 @@ local function run(android_app_state)
-- register the asset loader
table.insert(package.loaders, 2, android.asset_loader)

-- extract assets
local installed = android.extractAssets()
if not installed then
error("error extracting assets")
end
local launch = android.asset_loader("launcher")
if type(launch) == "function" then
return launch()
else
error("error loading launcher.lua")

-- the default current directory is root so we should first of all
-- change current directory to application's data directory
if C.chdir(android.dir) ~= 0 then
local err = "Unable to change working directory to '" .. android.dir .. "'"
android.LOGE(err)
error(err)
end

dofile(android.dir.."/llapp_main.lua")
end

run(...)
22 changes: 0 additions & 22 deletions assets/launcher.lua

This file was deleted.