-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Various improvements. 1. Compose to be up to date with android standards. 2. Kotlin since Java is no longer the programming language for Android. 3. Coroutines instead of threads for better multithreaded management. 4. Flows instead of LiveData 5. Document the code somewhat.
- Loading branch information
1 parent
8c61e0f
commit 550a818
Showing
19 changed files
with
511 additions
and
384 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
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: 0 additions & 26 deletions
26
...le/src/androidTest/java/cz/adaptech/tesseract4android/sample/ExampleInstrumentedTest.java
This file was deleted.
Oops, something went wrong.
20 changes: 13 additions & 7 deletions
20
sample/src/main/java/cz/adaptech/tesseract4android/sample/MainActivity.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 |
---|---|---|
@@ -1,17 +1,23 @@ | ||
package cz.adaptech.tesseract4android.sample | ||
|
||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import androidx.activity.enableEdgeToEdge | ||
import androidx.appcompat.app.AppCompatActivity | ||
import cz.adaptech.tesseract4android.sample.ui.main.MainFragment | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.ui.Modifier | ||
import cz.adaptech.tesseract4android.sample.ui.main.MainView | ||
import cz.adaptech.tesseract4android.sample.ui.theme.Tesseract4AndroidTheme | ||
|
||
class MainActivity : AppCompatActivity() { | ||
class MainActivity : ComponentActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_main) | ||
if (savedInstanceState == null) { | ||
supportFragmentManager.beginTransaction() | ||
.replace(R.id.container, MainFragment.newInstance()) | ||
.commitNow() | ||
enableEdgeToEdge() | ||
setContent { | ||
MainView() | ||
} | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
sample/src/main/java/cz/adaptech/tesseract4android/sample/OCRState.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,52 @@ | ||
package cz.adaptech.tesseract4android.sample | ||
|
||
|
||
/** | ||
* Represents the various states that the OCR can be in. | ||
* | ||
* @since 2024/07/22 | ||
* @author Clocks | ||
*/ | ||
sealed interface OCRState { | ||
/** | ||
* OCR is loading up. | ||
*/ | ||
data object Loading : OCRState | ||
|
||
/** | ||
* OCR is prepared. | ||
* | ||
* @param version Version of tesseract | ||
* @param flavour Build flavour of tesseract | ||
*/ | ||
data class StartUp(val version: String, val flavour: String) : OCRState | ||
|
||
/** | ||
* OCR has been stopped. | ||
*/ | ||
data object Stopped : OCRState | ||
|
||
/** | ||
* OCR is being stopped. | ||
*/ | ||
data object Stopping : OCRState | ||
|
||
/** | ||
* OCR is starting up. | ||
*/ | ||
data object Processing : OCRState | ||
|
||
/** | ||
* OCR is currently in process. | ||
* | ||
* @param progress 0-100 progress indication. | ||
*/ | ||
data class Progress(val progress: Int) : OCRState | ||
|
||
/** | ||
* OCR has completed its task. | ||
* | ||
* @param time How many seconds it took to process the image. | ||
*/ | ||
data class Finished(val time: Float) : OCRState | ||
} |
74 changes: 0 additions & 74 deletions
74
sample/src/main/java/cz/adaptech/tesseract4android/sample/ui/main/MainFragment.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.