0
0
mirror of https://github.com/florisboard/florisboard.git synced 2024-09-19 11:32:18 +02:00

Clean up codebase

This commit is contained in:
Campbell Jones 2021-02-10 15:38:32 -05:00
parent c95244cc06
commit 8f28d0e81a
No known key found for this signature in database
GPG Key ID: 08AD7343E6BD4B56
40 changed files with 228 additions and 227 deletions

13
.editorconfig Normal file
View File

@ -0,0 +1,13 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 120
trim_trailing_whitespace = true
[{*.har,*.json}]
indent_size = 2

1
app/.gitignore vendored
View File

@ -1 +0,0 @@
/build

View File

@ -1,76 +0,0 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
defaultConfig {
applicationId "dev.patrickgold.florisboard"
minSdkVersion 23
targetSdkVersion 29
versionCode 26
versionName "0.3.7"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures {
viewBinding true
}
buildTypes {
debug {
applicationIdSuffix ".debug"
resValue 'string', 'floris_app_name', 'FlorisBoard Debug'
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
resValue 'string', 'floris_app_name', '@string/app_name'
}
}
testOptions {
unitTests {
includeAndroidResources = true
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.12'
testImplementation 'androidx.test:core:1.3.0'
testImplementation 'org.mockito:mockito-core:1.10.19'
testImplementation 'org.mockito:mockito-inline:2.13.0'
testImplementation 'org.robolectric:robolectric:4.4'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.google.android:flexbox:2.0.1'
implementation "com.squareup.moshi:moshi-kotlin:1.9.2"
implementation 'com.squareup.moshi:moshi-adapters:1.9.2'
implementation 'com.google.android.material:material:1.2.1'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.7"
implementation 'com.jaredrummler:colorpicker:1.1.0'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation "com.michael-bull.kotlin-result:kotlin-result:1.1.9"
implementation 'com.nambimobile.widgets:expandable-fab:1.0.2'
}

77
app/build.gradle.kts Normal file
View File

@ -0,0 +1,77 @@
plugins {
id("com.android.application") version "4.1.2"
kotlin("android") version "1.4.30"
}
android {
compileSdkVersion(29)
buildToolsVersion("29.0.2")
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
freeCompilerArgs = listOf("-Xallow-result-return-type") // enables use of kotlin.Result
}
defaultConfig {
applicationId = "dev.patrickgold.florisboard"
minSdkVersion(23)
targetSdkVersion(29)
versionCode(26)
versionName("0.3.7")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures {
viewBinding = true
}
buildTypes {
named("debug").configure {
applicationIdSuffix = ".debug"
resValue("string", "floris_app_name", "FlorisBoard Debug")
}
named("release").configure {
proguardFiles.add(getDefaultProguardFile("proguard-android-optimize.txt"))
resValue("string", "floris_app_name", "@string/app_name")
}
}
testOptions {
unitTests {
isIncludeAndroidResources = true
}
}
lintOptions {
isAbortOnError = false
}
}
dependencies {
implementation("androidx.appcompat", "appcompat", "1.2.0")
implementation("androidx.core", "core-ktx", "1.3.2")
implementation("androidx.preference", "preference-ktx", "1.1.1")
implementation("androidx.constraintlayout", "constraintlayout", "2.0.4")
implementation("com.google.android", "flexbox", "2.0.1") // requires jcenter as of version 2.0.1
implementation("com.squareup.moshi", "moshi-kotlin", "1.11.0")
implementation("com.squareup.moshi", "moshi-adapters", "1.11.0")
implementation("com.google.android.material", "material", "1.3.0")
implementation("org.jetbrains.kotlinx", "kotlinx-coroutines-android", "1.4.2")
implementation("com.jaredrummler", "colorpicker", "1.1.0")
implementation("com.jakewharton.timber", "timber", "4.7.1")
implementation("com.michael-bull.kotlin-result", "kotlin-result", "1.1.10")
implementation("com.nambimobile.widgets", "expandable-fab", "1.0.2")
testImplementation("junit", "junit", "4.13.1")
testImplementation("org.mockito", "mockito-inline", "3.7.7")
testImplementation("org.robolectric", "robolectric", "4.5.1")
androidTestImplementation("androidx.test.ext", "junit", "1.1.2")
androidTestImplementation("androidx.test.espresso", "espresso-core", "3.3.0")
}

View File

@ -1,21 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -1,13 +1,11 @@
package dev.patrickgold.florisboard package dev.patrickgold.florisboard
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
import org.junit.Assert.*
/** /**
* Instrumented test, which will execute on an Android device. * Instrumented test, which will execute on an Android device.
* *

View File

@ -29,7 +29,6 @@ import android.view.KeyCharacterMap
import android.view.KeyEvent import android.view.KeyEvent
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import android.view.inputmethod.ExtractedTextRequest import android.view.inputmethod.ExtractedTextRequest
import android.view.inputmethod.InputConnection
import android.view.inputmethod.InputContentInfo import android.view.inputmethod.InputContentInfo
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import dev.patrickgold.florisboard.ime.text.key.KeyCode import dev.patrickgold.florisboard.ime.text.key.KeyCode
@ -529,7 +528,7 @@ class EditorInstance private constructor(private val ims: InputMethodService?) {
* [KeyCode] or this call may send a weird character, as this key codes do not match!! * [KeyCode] or this call may send a weird character, as this key codes do not match!!
*/ */
fun sendSystemKeyEventCtrl(keyCode: Int) { fun sendSystemKeyEventCtrl(keyCode: Int) {
val ic = ims?.currentInputConnection ?: return ims?.currentInputConnection ?: return
sendDownUpKeyEvents(keyCode, KeyEvent.META_CTRL_ON) sendDownUpKeyEvents(keyCode, KeyEvent.META_CTRL_ON)
} }
@ -541,7 +540,7 @@ class EditorInstance private constructor(private val ims: InputMethodService?) {
* [KeyCode] or this call may send a weird character, as this key codes do not match!! * [KeyCode] or this call may send a weird character, as this key codes do not match!!
*/ */
fun sendSystemKeyEventCtrlShift(keyCode: Int) { fun sendSystemKeyEventCtrlShift(keyCode: Int) {
val ic = ims?.currentInputConnection ?: return ims?.currentInputConnection ?: return
sendDownUpKeyEvents(keyCode, KeyEvent.META_SHIFT_ON or KeyEvent.META_CTRL_ON) sendDownUpKeyEvents(keyCode, KeyEvent.META_SHIFT_ON or KeyEvent.META_CTRL_ON)
} }

View File

@ -26,7 +26,10 @@ import android.graphics.Color
import android.inputmethodservice.ExtractEditText import android.inputmethodservice.ExtractEditText
import android.inputmethodservice.InputMethodService import android.inputmethodservice.InputMethodService
import android.media.AudioManager import android.media.AudioManager
import android.os.* import android.os.Build
import android.os.Handler
import android.os.VibrationEffect
import android.os.Vibrator
import android.provider.Settings import android.provider.Settings
import android.view.* import android.view.*
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
@ -39,10 +42,10 @@ import androidx.core.graphics.drawable.DrawableCompat
import com.squareup.moshi.Json import com.squareup.moshi.Json
import dev.patrickgold.florisboard.BuildConfig import dev.patrickgold.florisboard.BuildConfig
import dev.patrickgold.florisboard.R import dev.patrickgold.florisboard.R
import dev.patrickgold.florisboard.ime.landscapeinput.LandscapeInputUiMode
import dev.patrickgold.florisboard.ime.media.MediaInputManager import dev.patrickgold.florisboard.ime.media.MediaInputManager
import dev.patrickgold.florisboard.ime.popup.PopupLayerView import dev.patrickgold.florisboard.ime.popup.PopupLayerView
import dev.patrickgold.florisboard.ime.text.TextInputManager import dev.patrickgold.florisboard.ime.text.TextInputManager
import dev.patrickgold.florisboard.ime.landscapeinput.LandscapeInputUiMode
import dev.patrickgold.florisboard.ime.text.gestures.SwipeAction import dev.patrickgold.florisboard.ime.text.gestures.SwipeAction
import dev.patrickgold.florisboard.ime.text.key.KeyCode import dev.patrickgold.florisboard.ime.text.key.KeyCode
import dev.patrickgold.florisboard.ime.text.key.KeyData import dev.patrickgold.florisboard.ime.text.key.KeyData

View File

@ -19,7 +19,6 @@ package dev.patrickgold.florisboard.ime.core
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import android.widget.ViewFlipper import android.widget.ViewFlipper
import java.lang.IllegalArgumentException
/** /**
* Custom ViewFlipper class used to prevent an unnecessary exception to be thrown when it is * Custom ViewFlipper class used to prevent an unnecessary exception to be thrown when it is

View File

@ -18,12 +18,7 @@ package dev.patrickgold.florisboard.ime.core
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import android.util.Log
import android.widget.FrameLayout import android.widget.FrameLayout
import android.widget.LinearLayout
import android.widget.ViewFlipper
import dev.patrickgold.florisboard.BuildConfig
import dev.patrickgold.florisboard.R
/** /**
* Root view of the keyboard. * Root view of the keyboard.

View File

@ -30,7 +30,6 @@ import dev.patrickgold.florisboard.ime.text.key.UtilityKeyAction
import dev.patrickgold.florisboard.ime.theme.ThemeMode import dev.patrickgold.florisboard.ime.theme.ThemeMode
import dev.patrickgold.florisboard.util.TimeUtil import dev.patrickgold.florisboard.util.TimeUtil
import dev.patrickgold.florisboard.util.VersionName import dev.patrickgold.florisboard.util.VersionName
import kotlin.collections.HashMap
/** /**
* Helper class for an organized access to the shared preferences. * Helper class for an organized access to the shared preferences.

View File

@ -20,7 +20,10 @@ import android.content.Context
import com.squareup.moshi.Moshi import com.squareup.moshi.Moshi
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import dev.patrickgold.florisboard.util.LocaleUtils import dev.patrickgold.florisboard.util.LocaleUtils
import kotlinx.coroutines.* import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch
import java.util.* import java.util.*
/** /**

View File

@ -19,13 +19,10 @@ package dev.patrickgold.florisboard.ime.extension
import android.content.Context import android.content.Context
import com.github.michaelbull.result.* import com.github.michaelbull.result.*
import com.squareup.moshi.Moshi import com.squareup.moshi.Moshi
import com.squareup.moshi.adapters.PolymorphicJsonAdapterFactory
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import dev.patrickgold.florisboard.ime.popup.PopupExtension
import dev.patrickgold.florisboard.ime.text.key.KeyTypeAdapter import dev.patrickgold.florisboard.ime.text.key.KeyTypeAdapter
import dev.patrickgold.florisboard.ime.text.key.KeyVariationAdapter import dev.patrickgold.florisboard.ime.text.key.KeyVariationAdapter
import dev.patrickgold.florisboard.ime.text.layout.LayoutTypeAdapter import dev.patrickgold.florisboard.ime.text.layout.LayoutTypeAdapter
import dev.patrickgold.florisboard.ime.theme.Theme
import timber.log.Timber import timber.log.Timber
import java.io.File import java.io.File

View File

@ -19,13 +19,11 @@ package dev.patrickgold.florisboard.ime.media.emoji
import android.content.Context import android.content.Context
import android.graphics.Paint import android.graphics.Paint
import android.graphics.Typeface import android.graphics.Typeface
import android.util.Log
import androidx.core.graphics.PaintCompat import androidx.core.graphics.PaintCompat
import timber.log.Timber import timber.log.Timber
import java.io.BufferedReader import java.io.BufferedReader
import java.io.IOException import java.io.IOException
import java.io.InputStreamReader import java.io.InputStreamReader
import java.lang.Exception
import java.util.* import java.util.*
private const val GROUP_IDENTIFIER = "# group: " private const val GROUP_IDENTIFIER = "# group: "

View File

@ -17,7 +17,9 @@
package dev.patrickgold.florisboard.ime.popup package dev.patrickgold.florisboard.ime.popup
import android.content.res.Configuration import android.content.res.Configuration
import android.view.* import android.view.Gravity
import android.view.MotionEvent
import android.view.View
import androidx.core.content.ContextCompat.getDrawable import androidx.core.content.ContextCompat.getDrawable
import dev.patrickgold.florisboard.R import dev.patrickgold.florisboard.R
import dev.patrickgold.florisboard.ime.media.emoji.EmojiKeyData import dev.patrickgold.florisboard.ime.media.emoji.EmojiKeyData

View File

@ -21,7 +21,7 @@ import android.animation.ValueAnimator
import android.content.Context import android.content.Context
import android.os.Handler import android.os.Handler
import android.view.KeyEvent import android.view.KeyEvent
import android.view.inputmethod.* import android.view.inputmethod.InputMethodManager
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.Toast import android.widget.Toast
import android.widget.ViewFlipper import android.widget.ViewFlipper

View File

@ -19,8 +19,9 @@ package dev.patrickgold.florisboard.ime.text.gestures
import android.content.Context import android.content.Context
import android.view.MotionEvent import android.view.MotionEvent
import dev.patrickgold.florisboard.R import dev.patrickgold.florisboard.R
import java.lang.Exception import kotlin.math.PI
import kotlin.math.* import kotlin.math.abs
import kotlin.math.atan
/** /**
* Wrapper class which holds all enums, interfaces and classes for detecting a swipe gesture. * Wrapper class which holds all enums, interfaces and classes for detecting a swipe gesture.

View File

@ -17,6 +17,7 @@
package dev.patrickgold.florisboard.ime.text.key package dev.patrickgold.florisboard.ime.text.key
import dev.patrickgold.florisboard.ime.popup.PopupSet import dev.patrickgold.florisboard.ime.popup.PopupSet
import dev.patrickgold.florisboard.ime.text.key.FlorisKeyData.Companion.GROUP_DEFAULT
/** /**
* Data class which describes a single key and its attributes. * Data class which describes a single key and its attributes.

View File

@ -16,7 +16,6 @@
package dev.patrickgold.florisboard.ime.text.key package dev.patrickgold.florisboard.ime.text.key
import android.annotation.SuppressLint
import com.squareup.moshi.FromJson import com.squareup.moshi.FromJson
import java.util.* import java.util.*

View File

@ -30,10 +30,10 @@ import dev.patrickgold.florisboard.ime.core.FlorisBoard
import dev.patrickgold.florisboard.ime.core.PrefHelper import dev.patrickgold.florisboard.ime.core.PrefHelper
import dev.patrickgold.florisboard.ime.popup.PopupManager import dev.patrickgold.florisboard.ime.popup.PopupManager
import dev.patrickgold.florisboard.ime.text.gestures.SwipeAction import dev.patrickgold.florisboard.ime.text.gestures.SwipeAction
import dev.patrickgold.florisboard.ime.text.key.KeyView
import dev.patrickgold.florisboard.ime.text.layout.ComputedLayoutData
import dev.patrickgold.florisboard.ime.text.gestures.SwipeGesture import dev.patrickgold.florisboard.ime.text.gestures.SwipeGesture
import dev.patrickgold.florisboard.ime.text.key.KeyCode import dev.patrickgold.florisboard.ime.text.key.KeyCode
import dev.patrickgold.florisboard.ime.text.key.KeyView
import dev.patrickgold.florisboard.ime.text.layout.ComputedLayoutData
import dev.patrickgold.florisboard.ime.theme.Theme import dev.patrickgold.florisboard.ime.theme.Theme
import dev.patrickgold.florisboard.ime.theme.ThemeManager import dev.patrickgold.florisboard.ime.theme.ThemeManager
import kotlin.math.roundToInt import kotlin.math.roundToInt

View File

@ -18,7 +18,6 @@ package dev.patrickgold.florisboard.ime.text.layout
import dev.patrickgold.florisboard.ime.text.key.FlorisKeyData import dev.patrickgold.florisboard.ime.text.key.FlorisKeyData
import dev.patrickgold.florisboard.ime.text.key.KeyCode import dev.patrickgold.florisboard.ime.text.key.KeyCode
import dev.patrickgold.florisboard.ime.text.key.KeyData
import dev.patrickgold.florisboard.ime.text.key.KeyType import dev.patrickgold.florisboard.ime.text.key.KeyType
import dev.patrickgold.florisboard.ime.text.keyboard.KeyboardMode import dev.patrickgold.florisboard.ime.text.keyboard.KeyboardMode

View File

@ -17,7 +17,6 @@
package dev.patrickgold.florisboard.ime.text.layout package dev.patrickgold.florisboard.ime.text.layout
import android.content.Context import android.content.Context
import com.github.michaelbull.result.getOr
import com.github.michaelbull.result.onSuccess import com.github.michaelbull.result.onSuccess
import com.squareup.moshi.Moshi import com.squareup.moshi.Moshi
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory

View File

@ -22,6 +22,8 @@ import android.util.AttributeSet
import android.view.LayoutInflater import android.view.LayoutInflater
import android.widget.SeekBar import android.widget.SeekBar
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.Preference.OnPreferenceChangeListener
import androidx.preference.Preference.OnPreferenceClickListener
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import dev.patrickgold.florisboard.R import dev.patrickgold.florisboard.R
import dev.patrickgold.florisboard.databinding.SeekBarDialogBinding import dev.patrickgold.florisboard.databinding.SeekBarDialogBinding
@ -161,4 +163,4 @@ class DialogSeekBarPreference : Preference {
private fun seekBarProgressToActualValue(progress: Int): Int { private fun seekBarProgressToActualValue(progress: Int): Int {
return (progress * step) + min return (progress * step) + min
} }
} }

View File

@ -22,6 +22,7 @@ import android.content.Intent
import android.content.SharedPreferences import android.content.SharedPreferences
import android.util.AttributeSet import android.util.AttributeSet
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.Preference.OnPreferenceClickListener
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import com.github.michaelbull.result.onSuccess import com.github.michaelbull.result.onSuccess
import dev.patrickgold.florisboard.R import dev.patrickgold.florisboard.R
@ -104,4 +105,4 @@ class ThemeSelectorPreference : Preference, SharedPreferences.OnSharedPreference
i.putExtra(ThemeManagerActivity.EXTRA_DEFAULT_VALUE, defaultValue) i.putExtra(ThemeManagerActivity.EXTRA_DEFAULT_VALUE, defaultValue)
context.startActivity(i) context.startActivity(i)
} }
} }

View File

@ -20,6 +20,8 @@ import android.app.TimePickerDialog
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.Preference.OnPreferenceChangeListener
import androidx.preference.Preference.OnPreferenceClickListener
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import dev.patrickgold.florisboard.R import dev.patrickgold.florisboard.R
import dev.patrickgold.florisboard.util.TimeUtil import dev.patrickgold.florisboard.util.TimeUtil
@ -82,4 +84,4 @@ class TimePickerDialogPreference : Preference {
}, time.hour, time.minute, true) }, time.hour, time.minute, true)
timePickerDialog.show() timePickerDialog.show()
} }
} }

View File

@ -22,7 +22,6 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import dev.patrickgold.florisboard.databinding.SetupFragmentFinishBinding import dev.patrickgold.florisboard.databinding.SetupFragmentFinishBinding
import dev.patrickgold.florisboard.ime.theme.Theme
class FinishFragment : Fragment() { class FinishFragment : Fragment() {
private lateinit var binding: SetupFragmentFinishBinding private lateinit var binding: SetupFragmentFinishBinding

View File

@ -18,7 +18,6 @@ package dev.patrickgold.florisboard.util
import android.content.Context import android.content.Context
import dev.patrickgold.florisboard.ime.core.PrefHelper import dev.patrickgold.florisboard.ime.core.PrefHelper
import java.lang.Exception
object AppVersionUtils { object AppVersionUtils {
fun getRawVersionName(context: Context): String { fun getRawVersionName(context: Context): String {

View File

@ -1,6 +1,6 @@
package dev.patrickgold.florisboard.ime.core package dev.patrickgold.florisboard.ime.core
import org.hamcrest.CoreMatchers.* import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.MatcherAssert.assertThat
import org.junit.Test import org.junit.Test
import java.util.* import java.util.*

View File

@ -2,7 +2,8 @@ package dev.patrickgold.florisboard.ime.core
import android.content.Context import android.content.Context
import android.content.SharedPreferences import android.content.SharedPreferences
import org.mockito.Mockito.* import org.mockito.Mockito.doReturn
import org.mockito.Mockito.mock
/** /**
* Helper class which automatically sets up all mocks for the different pref categories. * Helper class which automatically sets up all mocks for the different pref categories.

View File

@ -1,6 +1,6 @@
package dev.patrickgold.florisboard.ime.text.layout package dev.patrickgold.florisboard.ime.text.layout
import org.hamcrest.CoreMatchers.* import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.MatcherAssert.assertThat
import org.junit.Test import org.junit.Test

View File

@ -4,14 +4,16 @@ import android.content.Context
import android.content.pm.PackageInfo import android.content.pm.PackageInfo
import android.content.pm.PackageManager import android.content.pm.PackageManager
import dev.patrickgold.florisboard.ime.core.TestablePrefHelper import dev.patrickgold.florisboard.ime.core.TestablePrefHelper
import org.hamcrest.CoreMatchers.* import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.CoreMatchers.nullValue
import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.MatcherAssert.assertThat
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers import org.mockito.ArgumentMatchers
import org.mockito.Mock import org.mockito.Mock
import org.mockito.Mockito.* import org.mockito.Mockito.`when`
import org.mockito.Mockito.doReturn
import org.mockito.junit.MockitoJUnitRunner import org.mockito.junit.MockitoJUnitRunner
@RunWith(MockitoJUnitRunner.Silent::class) @RunWith(MockitoJUnitRunner.Silent::class)

View File

@ -1,29 +0,0 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.4.10'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

21
build.gradle.kts Normal file
View File

@ -0,0 +1,21 @@
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
plugins {
id("com.github.ben-manes.versions") version "0.36.0"
base // adds clean task to root project
}
subprojects {
repositories {
mavenCentral()
google()
jcenter()
}
}
// for dependency updates task, only display versions that aren't tagged with alpha or beta
tasks.named<DependencyUpdatesTask>("dependencyUpdates").configure {
rejectVersionIf {
"alpha" in candidate.version || "beta" in candidate.version
}
}

View File

@ -1,21 +1,8 @@
# Project-wide Gradle settings. # Use AndroidX package structure - https://developer.android.com/topic/libraries/support-library/androidx-rn
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX # Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete": # Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official kotlin.code.style=official
# Set max Gradle JVM memory to 2 Gigabytes
org.gradle.jvmargs=-Xmx2G

Binary file not shown.

View File

@ -1,6 +1,5 @@
#Mon Nov 16 12:10:10 CET 2020
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

53
gradlew vendored
View File

@ -1,5 +1,21 @@
#!/usr/bin/env sh #!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
############################################################################## ##############################################################################
## ##
## Gradle start up script for UN*X ## Gradle start up script for UN*X
@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"` APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS="" DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD="maximum"
@ -66,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@ -109,10 +126,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi fi
# For Cygwin, switch paths to Windows format before running java # For Cygwin or MSYS, switch paths to Windows format before running java
if $cygwin ; then if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"` APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"` JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath # We build the pattern for arguments to be converted via cygpath
@ -138,19 +156,19 @@ if $cygwin ; then
else else
eval `echo args$i`="\"$arg\"" eval `echo args$i`="\"$arg\""
fi fi
i=$((i+1)) i=`expr $i + 1`
done done
case $i in case $i in
(0) set -- ;; 0) set -- ;;
(1) set -- "$args0" ;; 1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;; 2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;; 3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;; 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac esac
fi fi
@ -159,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " " echo " "
} }
APP_ARGS=$(save "$@") APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules # Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@" exec "$JAVACMD" "$@"

43
gradlew.bat vendored
View File

@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%" == "" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS= set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init if "%ERRORLEVEL%" == "0" goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -35,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init if exist "%JAVA_EXE%" goto execute
echo. echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@ -45,28 +64,14 @@ echo location of your Java installation.
goto fail goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell

View File

@ -1,2 +0,0 @@
rootProject.name='FlorisBoard'
include ':app'

17
settings.gradle.kts Normal file
View File

@ -0,0 +1,17 @@
rootProject.name = "FlorisBoard"
include(":app")
pluginManagement {
repositories {
gradlePluginPortal()
google()
}
// allows the plugins syntax to be used with the android gradle plugin
resolutionStrategy.eachPlugin {
if (requested.id.id == "com.android.application") {
useModule("com.android.tools.build:gradle:${requested.version}")
}
}
}