-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use an isolatedProcess service for Rust functions FileViewModel calls
- Loading branch information
1 parent
f3b5a96
commit de6f3dc
Showing
6 changed files
with
138 additions
and
23 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
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
10 changes: 10 additions & 0 deletions
10
app/src/main/aidl/dev/soupslurpr/beautyxt/IFileViewModelRustLibraryAidlInterface.aidl
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 @@ | ||
// IFileViewModelRustLibraryAidlInterface.aidl | ||
package dev.soupslurpr.beautyxt; | ||
|
||
// Declare any non-default types here with import statements | ||
|
||
interface IFileViewModelRustLibraryAidlInterface { | ||
String markdownToHtml(String markdown); | ||
byte[] markdownToDocx(String markdown); | ||
byte[] plainTextToDocx(String plainText); | ||
} |
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
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
26 changes: 26 additions & 0 deletions
26
app/src/main/kotlin/dev/soupslurpr/beautyxt/ui/FileViewModelRustLibraryIsolatedService.kt
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,26 @@ | ||
package dev.soupslurpr.beautyxt.ui | ||
|
||
import android.app.Service | ||
import android.content.Intent | ||
import android.os.IBinder | ||
import dev.soupslurpr.beautyxt.IFileViewModelRustLibraryAidlInterface | ||
|
||
class FileViewModelRustLibraryIsolatedService : Service() { | ||
private val binder = object : IFileViewModelRustLibraryAidlInterface.Stub() { | ||
override fun markdownToHtml(markdown: String?): String { | ||
return dev.soupslurpr.beautyxt.markdownToHtml(markdown!!) | ||
} | ||
|
||
override fun markdownToDocx(markdown: String?): ByteArray { | ||
return dev.soupslurpr.beautyxt.markdownToDocx(markdown!!) | ||
} | ||
|
||
override fun plainTextToDocx(plainText: String?): ByteArray { | ||
return dev.soupslurpr.beautyxt.plainTextToDocx(plainText!!) | ||
} | ||
} | ||
|
||
override fun onBind(intent: Intent?): IBinder { | ||
return binder | ||
} | ||
} |