-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from braille-systems/release/0.2
Release/0.2
- Loading branch information
Showing
98 changed files
with
1,028 additions
and
1,707 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,8 @@ | ||
# braille4 | ||
OCR (optical character recognition) system for Braille Trainer | ||
## Описание | ||
Тренажёр Брайля для обучения незрячих чтению рельефным шрифтом задуман как комплекс из четырёх компонент: | ||
# Learn Braille | ||
|
||
1. Наборная доска с лунками, в которые кладутся шары, образующие шеститочечные символы Брайля. | ||
1. Обучающее приложение для смартфона с передачей тактильных ощущений вибрацией и с возможностью проверить написанное на наборной доске, отсканировав поверхность доски камерой (для этого и нужно распознавание символов). | ||
1. Камера на штативе, с которой удобнее сканировать поверхность наборной доски | ||
1. Дисплей Брайля с одной или несколькими ячейками. | ||
Android application for teaching Braille writing system.<br> | ||
One of the few apps primarily designed for Russian Braille system. <br> | ||
This app is still in develop. Soon we are going to add interaction with physical (3D-printed) **Braille Cards** and **Braille Tiles**. | ||
|
||
Этот репозиторий посвящён | ||
1. Приложению на Android | ||
1. **распознаванию шеститочечных символов** и табличек с номерами ячеек на фотографиях наборной брайлевской доски. <br> | ||
Подробнее: [github.com/zuevval/braille/wiki/Тренажёр-Брайля-4](https://github.com/zuevval/braille/wiki/%D0%A2%D1%80%D0%B5%D0%BD%D0%B0%D0%B6%D1%91%D1%80-%D0%91%D1%80%D0%B0%D0%B9%D0%BB%D1%8F-4) | ||
*** | ||
См. другие репозитории проекта: <br> | ||
[github.com/zuevval/braille](https://github.com/zuevval/braille) <br> | ||
[github.com/zuevval/braille3](https://github.com/zuevval/braille3) <br> | ||
[github.com/zuevval/braille3parts](https://github.com/zuevval/braille3parts) <br> | ||
|
||
## Руководства для разработки | ||
1. [Code Style](https://github.com/zuevval/braille4/wiki/codestyle) | ||
1. [Git Workflow (правила оформления веток)](https://github.com/zuevval/braille4/wiki/gitflow) | ||
1. [CONTRIBUTING.ru.md](CONTRIBUTING.ru.md) | ||
Feel free to [contribute](https://github.com/braille-systems/learn-braille/blob/master/CONTRIBUTING.md)! <br> | ||
Take a look at [wiki pages (Russian)](https://github.com/braille-systems/learn-braille/wiki) |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 0 additions & 21 deletions
21
android/app/src/main/java/ru/spbstu/amd/learnbraille/ExitFragment.kt
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
android/app/src/main/java/ru/spbstu/amd/learnbraille/LearnBrailleApplication.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,12 @@ | ||
package ru.spbstu.amd.learnbraille | ||
|
||
import android.app.Application | ||
import timber.log.Timber | ||
|
||
class LearnBrailleApplication : Application() { | ||
|
||
override fun onCreate() { | ||
super.onCreate() | ||
Timber.plant(Timber.DebugTree()) | ||
} | ||
} |
9 changes: 7 additions & 2 deletions
9
android/app/src/main/java/ru/spbstu/amd/learnbraille/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,14 +1,19 @@ | ||
package ru.spbstu.amd.learnbraille | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import android.content.pm.ActivityInfo | ||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.databinding.DataBindingUtil | ||
import ru.spbstu.amd.learnbraille.databinding.ActivityMainBinding | ||
|
||
class MainActivity : AppCompatActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
DataBindingUtil.setContentView<ActivityMainBinding>(this, R.layout.activity_main) | ||
DataBindingUtil.setContentView<ActivityMainBinding>( | ||
this, | ||
R.layout.activity_main | ||
) | ||
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT | ||
} | ||
} |
25 changes: 0 additions & 25 deletions
25
android/app/src/main/java/ru/spbstu/amd/learnbraille/MenuFragment.kt
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
android/app/src/main/java/ru/spbstu/amd/learnbraille/PracticeFragment.kt
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
android/app/src/main/java/ru/spbstu/amd/learnbraille/database/BrailleDots.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,45 @@ | ||
package ru.spbstu.amd.learnbraille.database | ||
|
||
import androidx.room.TypeConverter | ||
import ru.spbstu.amd.learnbraille.database.BrailleDot.E | ||
import ru.spbstu.amd.learnbraille.database.BrailleDot.F | ||
|
||
enum class BrailleDot { | ||
E, // Empty | ||
F; // Filled | ||
} | ||
|
||
fun brailleDot(b: Boolean) = if (b) F else E | ||
|
||
data class BrailleDots(private val dots: String) { | ||
|
||
constructor( | ||
b1: BrailleDot = E, b2: BrailleDot = E, b3: BrailleDot = E, | ||
b4: BrailleDot = E, b5: BrailleDot = E, b6: BrailleDot = E | ||
) : this( | ||
listOf(b1, b2, b3, b4, b5, b6) | ||
) | ||
|
||
constructor(dots: BooleanArray) : this( | ||
dots.map(::brailleDot) | ||
) | ||
|
||
constructor(dots: List<BrailleDot>) : this( | ||
dots.joinToString(transform = BrailleDot::toString) | ||
) { | ||
require(dots.size == 6) { | ||
"Only 6 dots braille notation supported" | ||
} | ||
} | ||
|
||
override fun toString() = dots | ||
} | ||
|
||
class BrailleDotsConverters { | ||
|
||
@TypeConverter | ||
fun to(brailleDots: BrailleDots) = brailleDots.toString() | ||
|
||
@TypeConverter | ||
fun from(data: String): BrailleDots = BrailleDots(data) | ||
} |
46 changes: 46 additions & 0 deletions
46
android/app/src/main/java/ru/spbstu/amd/learnbraille/database/Database.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,46 @@ | ||
package ru.spbstu.amd.learnbraille.database | ||
|
||
import android.annotation.SuppressLint | ||
import android.content.Context | ||
import androidx.room.Database | ||
import androidx.room.Room | ||
import androidx.room.RoomDatabase | ||
import androidx.room.TypeConverters | ||
import androidx.sqlite.db.SupportSQLiteDatabase | ||
|
||
@Database(entities = [Symbol::class], version = 1, exportSchema = false) | ||
@TypeConverters(BrailleDotsConverters::class, LanguageConverter::class) | ||
abstract class LearnBrailleDatabase : RoomDatabase() { | ||
|
||
abstract val symbolDao: SymbolDao | ||
|
||
companion object { | ||
|
||
@Volatile | ||
private var INSTANCE: LearnBrailleDatabase? = null | ||
|
||
@SuppressLint("SyntheticAccessor") | ||
fun getInstance(context: Context): LearnBrailleDatabase = | ||
INSTANCE ?: synchronized(this) { | ||
INSTANCE ?: buildDatabase(context).also { INSTANCE = it } | ||
} | ||
|
||
private fun buildDatabase(context: Context) = Room.databaseBuilder( | ||
context.applicationContext, | ||
LearnBrailleDatabase::class.java, | ||
"braille_lessons_database" | ||
) | ||
.addCallback(object : Callback() { | ||
override fun onCreate(db: SupportSQLiteDatabase) { | ||
super.onCreate(db) | ||
ioThread { | ||
getInstance(context).symbolDao.insertLetters(PREPOPULATE_LETTERS) | ||
} | ||
} | ||
}) | ||
.fallbackToDestructiveMigration() | ||
.build() | ||
} | ||
} | ||
|
||
|
12 changes: 12 additions & 0 deletions
12
android/app/src/main/java/ru/spbstu/amd/learnbraille/database/Executors.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,12 @@ | ||
package ru.spbstu.amd.learnbraille.database | ||
|
||
import java.util.concurrent.Executors | ||
|
||
private val IO_EXECUTOR = Executors.newSingleThreadExecutor() | ||
|
||
/** | ||
* Utility method to run blocks on a dedicated background thread, used for io/database work. | ||
*/ | ||
fun ioThread(f: () -> Unit) { | ||
IO_EXECUTOR.execute(f) | ||
} |
16 changes: 16 additions & 0 deletions
16
android/app/src/main/java/ru/spbstu/amd/learnbraille/database/Language.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,16 @@ | ||
package ru.spbstu.amd.learnbraille.database | ||
|
||
import androidx.room.TypeConverter | ||
|
||
enum class Language { | ||
NONE, EN, RU | ||
} | ||
|
||
class LanguageConverter { | ||
|
||
@TypeConverter | ||
fun to(language: Language) = language.toString() | ||
|
||
@TypeConverter | ||
fun from(data: String) = Language.valueOf(data) | ||
} |
Oops, something went wrong.