From c13bd9cd0ca37e1b619b3fdf73e486c19a4515a9 Mon Sep 17 00:00:00 2001 From: zuevval Date: Sat, 3 Oct 2020 17:59:20 +0300 Subject: [PATCH] #278 fix detekt: too many functions in Messages.kt --- .../com/github/braillesystems/learnbraille/ui/Messages.kt | 5 ----- .../learnbraille/ui/screens/practice/CardFragment.kt | 8 ++------ .../com/github/braillesystems/learnbraille/utils/Utils.kt | 6 +++++- app/src/main/res/values/strings.xml | 1 + 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/github/braillesystems/learnbraille/ui/Messages.kt b/app/src/main/java/com/github/braillesystems/learnbraille/ui/Messages.kt index c1da70e0..6e9626c9 100644 --- a/app/src/main/java/com/github/braillesystems/learnbraille/ui/Messages.kt +++ b/app/src/main/java/com/github/braillesystems/learnbraille/ui/Messages.kt @@ -16,11 +16,6 @@ fun Fragment.showCorrectToast() = toast(getString(R.string.input_correct)) fun Fragment.showIncorrectToast(hint: String = "") = toast("${getString(R.string.input_incorrect)} $hint") -fun Fragment.announceCorrect() = announce(getString(R.string.input_correct)) - -fun Fragment.announceIncorrect(hint: String = "") = - announce("${getString(R.string.input_incorrect)} $hint") - fun Fragment.dotsMode(mode: BrailleDotsViewMode): String = when (mode) { BrailleDotsViewMode.Writing -> getString(R.string.braille_dots_mode_writing) diff --git a/app/src/main/java/com/github/braillesystems/learnbraille/ui/screens/practice/CardFragment.kt b/app/src/main/java/com/github/braillesystems/learnbraille/ui/screens/practice/CardFragment.kt index 632fb72f..9fe86d35 100644 --- a/app/src/main/java/com/github/braillesystems/learnbraille/ui/screens/practice/CardFragment.kt +++ b/app/src/main/java/com/github/braillesystems/learnbraille/ui/screens/practice/CardFragment.kt @@ -1,13 +1,10 @@ package com.github.braillesystems.learnbraille.ui.screens.practice -import android.animation.ArgbEvaluator -import android.animation.ObjectAnimator import android.os.Bundle import android.os.Vibrator import android.view.* import android.widget.Button import android.widget.TextView -import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.content.ContextCompat import androidx.core.content.getSystemService import androidx.databinding.DataBindingUtil @@ -20,8 +17,8 @@ import com.github.braillesystems.learnbraille.databinding.FragmentCardBinding import com.github.braillesystems.learnbraille.res.captionRules import com.github.braillesystems.learnbraille.res.deckTagToName import com.github.braillesystems.learnbraille.res.inputMarkerPrintRules -import com.github.braillesystems.learnbraille.ui.announceCorrect -import com.github.braillesystems.learnbraille.ui.announceIncorrect +import com.github.braillesystems.learnbraille.utils.announceCorrect +import com.github.braillesystems.learnbraille.utils.announceIncorrect import com.github.braillesystems.learnbraille.ui.brailletrainer.BrailleTrainer import com.github.braillesystems.learnbraille.ui.brailletrainer.BrailleTrainerSignalHandler import com.github.braillesystems.learnbraille.ui.inputPrint @@ -29,7 +26,6 @@ import com.github.braillesystems.learnbraille.ui.screens.* import com.github.braillesystems.learnbraille.ui.showHintToast import com.github.braillesystems.learnbraille.ui.views.* import com.github.braillesystems.learnbraille.utils.* -import com.google.android.material.button.MaterialButton import org.koin.android.ext.android.inject import org.koin.core.parameter.parametersOf import timber.log.Timber diff --git a/app/src/main/java/com/github/braillesystems/learnbraille/utils/Utils.kt b/app/src/main/java/com/github/braillesystems/learnbraille/utils/Utils.kt index e401b0ca..cb1f3801 100644 --- a/app/src/main/java/com/github/braillesystems/learnbraille/utils/Utils.kt +++ b/app/src/main/java/com/github/braillesystems/learnbraille/utils/Utils.kt @@ -72,6 +72,10 @@ fun Fragment.checkedAnnounce( announce(announcement) } +fun Fragment.announceCorrect() = announce(getString(R.string.input_correct)) + +fun Fragment.announceIncorrect(hint: String = "") = + announce("${getString(R.string.input_incorrect)} $hint") val Fragment.actionBar: ActionBar? get() = (activity as AppCompatActivity).supportActionBar @@ -92,7 +96,7 @@ fun Fragment.updateTitle(title: String) { this.title = title } -fun animateView(obj: View?, colorFrom: Int?, colorTo: Int?){ +fun animateView(obj: View?, colorFrom: Int?, colorTo: Int?) { val duration = 1000 ObjectAnimator .ofObject(obj, "backgroundColor", ArgbEvaluator(), colorFrom, colorTo, colorFrom) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 721cb503..ef1b10bb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -150,6 +150,7 @@ Специальные символы Математические символы +