Skip to content

Commit

Permalink
Merge pull request #13 from braille-systems/release/0.2
Browse files Browse the repository at this point in the history
Release/0.2
  • Loading branch information
zuevval authored Mar 16, 2020
2 parents 83fb74a + 2aac823 commit c018434
Show file tree
Hide file tree
Showing 98 changed files with 1,028 additions and 1,707 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
1. В коммите достаточно только краткое описание, опциональное расширенное описание требовать не будем.
1. Краткое описание - одна строка (<= 72 символа, хотя вряд ли превышение - серьёзное нарушение).
1. Сообщение пишем по-английски, оно содержит глагол в неопределённой форме (add, change, remove, rewrite, reformat, move, replace, enhance...)
1. Краткое описание начинается с решётки, далее номер спринта и через точку номер карточки в Trello, далее пробел и текст описания.
1. Краткое описание: номер спринта, далее через точку номер карточки в Trello, далее пробел и текст описания.
Например, если вы решаете задачу [6-написать-приложение-сканирующее-qr-код](https://trello.com/c/d5LSflfR/6-%D0%BD%D0%B0%D0%BF%D0%B8%D1%81%D0%B0%D1%82%D1%8C-%D0%BF%D1%80%D0%B8%D0%BB%D0%BE%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5-%D1%81%D0%BA%D0%B0%D0%BD%D0%B8%D1%80%D1%83%D1%8E%D1%89%D0%B5%D0%B5-qr-%D0%BA%D0%BE%D0%B4),
то коммит может выглядеть так: `#1.6 rewrite some tests for some function`
то коммит может выглядеть так: `1.6 rewrite some tests for some function`

Для интересующихся есть [статья о написании commit message](https://gist.github.com/robertpainsi/b632364184e70900af4ab688decf6f53)
## Git Workflow
Expand Down
28 changes: 6 additions & 22 deletions README.md
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)
12 changes: 12 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ android {
}

dependencies {
def lifecycle_version = "2.2.0"

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
Expand All @@ -42,11 +44,21 @@ dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'

// Room
implementation "androidx.room:room-runtime:$version_room"
kapt "androidx.room:room-compiler:$version_room"

// Testing
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

// Navigation
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.1'
implementation 'androidx.navigation:navigation-ui-ktx:2.2.1'

// Timber logging
implementation 'com.jakewharton.timber:timber:4.7.1'

// Lifecycle
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
}
17 changes: 10 additions & 7 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ru.spbstu.amd.learnbraille">
package="ru.spbstu.amd.learnbraille">

<uses-permission android:name="android.permission.VIBRATE" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:name=".LearnBrailleApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Binary file added android/app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

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())
}
}
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
}
}

This file was deleted.

This file was deleted.

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)
}
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()
}
}


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)
}
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)
}
Loading

0 comments on commit c018434

Please sign in to comment.