Skip to content

Commit

Permalink
Merge pull request #273 from braille-systems/release/1.0.2
Browse files Browse the repository at this point in the history
Release/1.0.2
  • Loading branch information
zuevval authored Sep 28, 2020
2 parents 994ec79 + d039f9a commit fc8e555
Show file tree
Hide file tree
Showing 127 changed files with 4,945 additions and 2,326 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# credit: https://habr.com/ru/post/488134/


name: Android CI

on:
push:
branches:
- master
- dev
pull_request:

jobs:
build-and-test: # instrumental tests run on MacOS to enable hardware acceleration
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: grant permissions to gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew assembleDebug
- name: Run unit tests
run: ./gradlew test
- name: Run instrumental tests
# warning: it depends on "grant permission to gradlew" step
uses: reactivecircus/android-emulator-runner@v1
with:
api-level: 29
script: ./gradlew connectedCheck
- name: Generate documentation
run: ./gradlew dokka
- name: Upload APK to artifacts
uses: actions/upload-artifact@v1
with:
name: learn-braille-debug
path: app/build/outputs/apk/debug/app-debug.apk
- name: Upload documentation to artifacts
uses: actions/upload-artifact@v1
with:
name: documentation-html
path: app/build/dokka/
- name: Upload artifact (test reports)
uses: actions/upload-artifact@v1
with:
name: test-reports
path: app/build/reports/
if: success() || failure()

static-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up detekt # detekt gradle plugin uses newer gradle version than is used
run: curl -sSLO https://github.com/detekt/detekt/releases/download/v1.12.0-RC1/detekt && chmod a+x detekt
- name: Static check with detekt
run: ./detekt -c detekt-config.yml --build-upon-default-config
- name: Check not using developer's course
run: grep UsersCourse app/src/main/java/com/github/braillesystems/learnbraille/LearnBrailleApplication.kt
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# auto-generated scripts
detekt
android-wait-for-emulator

# Created by https://www.toptal.com/developers/gitignore/api/androidstudio,android,gradle
# Edit at https://www.toptal.com/developers/gitignore?templates=androidstudio,android,gradle
Expand Down
10 changes: 10 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 35 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,50 @@ For building and running the app, your either need to download a virtual Android

## Git workflow

- Write short and informative commit messages. Start them with reference to issue (begins with `#`). [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/).
- Write short and informative commit messages. Mention the issue you're working on (begins with `#`), e. g. `implement something(#0)`. [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/).
- Follow [a successful Git branching model](https://nvie.com/posts/a-successful-git-branching-model/).

## Coding style

- Kotlin [coding conventions](https://kotlinlang.org/docs/reference/coding-conventions.html) + Java [google style guides](https://google.github.io/styleguide/javaguide.html) and [oracle](https://www.oracle.com/technetwork/java/codeconvtoc-136057.html).
- Also look around each time you do something new to see, how such thing was formatted and impelemented before.
- Set up Android Studio proper kotlin code style `editor -> code style -> kotlin -> set from -> predefined -> Kotlin style guide`.
- Also look around each time you do something new to see, how such a thing was formatted and implemented before.
- Set up Android Studio proper Kotlin code style `editor -> code style -> kotlin -> set from -> predefined -> Kotlin style guide`.
- Apply autoformatting to edited files each time before commit.

## Adding content

There are handy DSL that allows write content in the typesafe way.
There is a handy DSL that allows writing content in a typesafe way.

- All app content should be placed into `com.github.braillesystems.learnbraille.res` package.
- Use `DslTest.kt` file as DSL tutorial.

Information correctness should be checked in compile-time or during app initialization runtime as much as possible. If some additional info is needed, do not hardcode it. Just request the new DSL feature via GitHub Issues.

Adding rules, prevent lambda of capturing context that will be invalid next time the fragment entered, so use `Fragment.getString` outside of lambdas.

#### Adding course

1. Create lessons by `lessons` delegate.
2. Create a course in `CourseBuilder` and add lessons to it.

Always use `com.github.braillesystems.learnbraille.res.content` value to get materials, they are indexed here in a proper way.

#### Adding deck

1. Add a new deck tag to `DeckTags`.
2. Map tag to deck's predicate in `DecksBuilder`.
3. Map deck's tag to user-visible string in `deckTagToName`.

#### Adding materials

1. Create materials by one of delegates: `markers` or `symbols`.
2. Add created materials to the `contens` (`materials` delegate).
3. Add to `inputSymbolPrintRules` and `showSymbolPrintRules`, or to `inputMarkerPrintRules` and `showMarkerPrintRules`.

Symbols that are not from a particular alphabet and do not exist on the classical American keyboard should be treated as special and be added via `enum class`.

New materials can be marked as known by default in `knownMaterials` (`known` delegate).

## Database

Database scheme is described [here](https://github.com/braille-systems/learn-braille/blob/master/database.md).
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Learn Braille

Learn Braille is an android application for teaching Braille writing system.
[![Actions Status](https://github.com/braille-systems/learn-braille/workflows/Android%20CI/badge.svg)](https://github.com/braille-systems/learn-braille/actions)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

It is one of the few apps primarily designed for Russian Braille system,
Learn Braille is an Android application for teaching the tactile writing system created
by Louis Braille.

It is one of the few apps primarily designed for the Russian Braille system,
but also other systems could be easily added.

App can be used with
[braille trainer](https://github.com/braille-systems/braille-trainer)
The app can be used with
[Braille Trainer](https://github.com/braille-systems/braille-trainer)
and [tiles](https://github.com/braille-systems/braille-tiles)
or without them.

Expand All @@ -16,14 +20,14 @@ Take a look at [wiki pages (Russian)](https://github.com/braille-systems/learn-b

## User's Guidelines

The app is [available](https://play.google.com/store/apps/details?id=com.github.braillesystems.learnbraille&hl=ru) in the google play.
The app is [available](https://play.google.com/store/apps/details?id=com.github.braillesystems.learnbraille&hl=ru) in the Google Play.

### System Requirements and limitations

To successfully run this application, your smartphone or tablet PC must satisfy the following conditions:
- Android 4.4 KitKat or higher (`5.1` is required for `google talkback` optimisations).
- Screen of size not less then 4 inches.
- Android 4.4 KitKat or higher (`5.1` is required for `Google TalkBack` optimizations).
- Screen of size not less than 4 inches.

For accessibility, you will require TalkBack service.
It is pre-installed by default on a majority of devices.
For others it is available in the Google Play.
It is pre-installed by default on a majority of devices. <br>
For others, it is available in the Google Play.
20 changes: 18 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ apply plugin: 'androidx.navigation.safeargs'

apply plugin: 'kotlinx-serialization'

apply plugin: 'org.jetbrains.dokka'

android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -24,8 +26,8 @@ android {
applicationId "com.github.braillesystems.learnbraille"
minSdkVersion 19
targetSdkVersion 29
versionCode 13
versionName "1.1.0"
versionCode 14
versionName "1.2.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled = true
Expand All @@ -38,6 +40,20 @@ android {
}
productFlavors {
}
dokka {
outputDirectory = "$buildDir/dokka"
packageOptions {
prefix = "android"
suppress = true
}
packageOptions{
prefix = "androidx"
suppress = true
}
}
lintOptions {
abortOnError false
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ import org.junit.Test
import org.junit.runner.RunWith
import java.io.IOException


/**
* Tests data serialization first of all.
*/
@RunWith(AndroidJUnit4::class)
class LearnBrailleDatabaseTest {

Expand Down Expand Up @@ -87,15 +83,15 @@ class LearnBrailleDatabaseTest {
id = 3,
data = ShowDots(
text = "Перед Вами полное шеститочие",
dots = BrailleDots(F, F, F, F, F, F)
brailleDots = BrailleDots(F, F, F, F, F, F)
),
lessonId = 1, courseId = 1
),
Step(
id = 4,
data = InputDots(
text = "Введите все шесть точек",
dots = BrailleDots(F, F, F, F, F, F)
brailleDots = BrailleDots(F, F, F, F, F, F)
),
lessonId = 2, courseId = 1
),
Expand Down Expand Up @@ -157,30 +153,30 @@ class LearnBrailleDatabaseTest {

@Test
fun testUsers() = runBlocking {
assertEquals("default", db.userDao.getUser(1)!!.login)
assertEquals("default", db.userDao.user(1)!!.login)
}

@Test
fun testMaterials() = runBlocking {
val data = db.materialDao.getMaterial(1)!!.data
val data = db.materialDao.material(1)!!.data
require(data is Symbol)
assertEquals(BrailleDots(F, E, E, E, E, E), data.brailleDots)
}

@Test
fun testDecks() = runBlocking {
assertEquals("Ru letters", db.deckDao.getDeck(1)!!.tag)
assertEquals("Ru letters", db.deckDao.deck(1)!!.tag)
}

@Test
fun testCourses() = runBlocking {
assertEquals("Super course", db.courseDao.getCourse(1)!!.name)
assertEquals("Super course", db.courseDao.course(1)!!.name)
}

@Test
fun testSteps() = runBlocking {
for ((i, step) in steps.withIndex()) {
val fromDb = db.stepDao.getStep(i + 1L)!!
val fromDb = db.stepDao.step(i + 1L)!!
assertEquals(step, fromDb)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ class ActionsRepositoryTest {

@Test
fun getAll() = runBlocking {
assertEquals(actions.toList(), repo.getActionsFrom(Days(100)))
assertEquals(actions.toList(), repo.actionsFrom(Days(100)))
}

@Test
fun rejectLast() = runBlocking {
assertEquals(listOf(actions.first()), repo.getActionsFrom(Days(10)))
fun getSince() = runBlocking {
assertEquals(listOf(actions.first()), repo.actionsFrom(Days(25)))
}
}
Loading

0 comments on commit fc8e555

Please sign in to comment.