Initial commit for assignment 4
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
||||
44
app/build.gradle
Normal file
@ -0,0 +1,44 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk 33
|
||||
|
||||
defaultConfig {
|
||||
applicationId "de.luh.hci.mi.atomikkeyboard"
|
||||
minSdk 23
|
||||
targetSdk 33
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
namespace 'de.luh.hci.mi.atomikkeyboard'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.core:core-ktx:1.7.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'com.google.android.material:material:1.8.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
}
|
||||
21
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
@ -0,0 +1,24 @@
|
||||
package de.luh.hci.mi.atomikkeyboard
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("de.luh.hci.mi.atomikkeyboard", appContext.packageName)
|
||||
}
|
||||
}
|
||||
27
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
|
||||
<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/Theme.AtomikKeyboard"
|
||||
android:requestLegacyExternalStorage="true">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
8
app/src/main/java/de/luh/hci/mi/atomikkeyboard/Key.kt
Normal file
@ -0,0 +1,8 @@
|
||||
package de.luh.hci.mi.atomikkeyboard
|
||||
|
||||
/**
|
||||
* Represents a single key on the keyboard.
|
||||
* letter is the symbol on the key.
|
||||
* (x, y) are the coordinates of the center of the key.
|
||||
*/
|
||||
data class Key(val letter: Char, val x: Double, val y: Double)
|
||||
51
app/src/main/java/de/luh/hci/mi/atomikkeyboard/Keyboard.kt
Normal file
@ -0,0 +1,51 @@
|
||||
package de.luh.hci.mi.atomikkeyboard
|
||||
|
||||
import android.util.Log
|
||||
|
||||
/**
|
||||
* Represents a keyboard layout, i.e. 2D coordinates of keys.
|
||||
* Allows accessing center positions and number of keys.
|
||||
* The keys are arranged in 5 rows of 6 or 7 characters each. The keys are densely
|
||||
* packed. The positions of the keys are their center coordinates.
|
||||
* The coordinates are relative to a keyboard image of dimensions 635 (W) x 425 (H) pixels.
|
||||
*/
|
||||
class Keyboard {
|
||||
companion object {
|
||||
const val N = 4 + 6 + 7 + 6 + 4 // number of keys
|
||||
const val L = 52 // center of the first key - left (x)
|
||||
const val T = 58 // center of the first key - top (y)
|
||||
const val W = 88 // width of a key (on the 635x425 pixel image)
|
||||
const val H = 77 // height of a key (on the 635x425 pixel image)
|
||||
}
|
||||
|
||||
private val letters = charArrayOf(
|
||||
'b', 'k', 'd', 'g', // row 1
|
||||
'c', 'a', 'n', 'i', 'm', 'q', // row 2
|
||||
'f', 'l', 'e', ' ', 's', 'y', 'x', // row 3
|
||||
'j', 'h', 't', 'o', 'p', 'v', // row 4
|
||||
'r', 'u', 'w', 'z' // row 5
|
||||
)
|
||||
|
||||
val keys = hashMapOf<Char, Key>()
|
||||
|
||||
init {
|
||||
var i = 0
|
||||
|
||||
// TODO: Implement the keyboard layout
|
||||
|
||||
// row 1
|
||||
// ...
|
||||
|
||||
// row 2
|
||||
// ...
|
||||
|
||||
// row 3
|
||||
// ...
|
||||
|
||||
// row 4
|
||||
// ...
|
||||
|
||||
// row 5
|
||||
// ...
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package de.luh.hci.mi.atomikkeyboard
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.MotionEvent
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
|
||||
class KeyboardView(context: Context, attrs: AttributeSet?) : AppCompatImageView(context, attrs) {
|
||||
private var scale = 0.0
|
||||
|
||||
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
|
||||
scale = 635.0 / w // original atomik_keyboard.png has a width of 635 pixels
|
||||
Log.d("AtomikKeyboard", "width = $w, height = $h, scale = $scale")
|
||||
super.onSizeChanged(w, h, oldw, oldh)
|
||||
}
|
||||
|
||||
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||
val t = System.currentTimeMillis()
|
||||
val x = event.x * scale // convert to keyboard coordinate system
|
||||
val y = event.y * scale // convert to keyboard coordinate system
|
||||
Log.d("AtomikKeyboard", "touch: $x, $y")
|
||||
val k = getKey(x, y)
|
||||
if (k != null) {
|
||||
Log.d("AtomikKeyboard", "key: " + k.letter)
|
||||
val activity = context as MainActivity
|
||||
activity.keyPressed(k, x, y, t);
|
||||
} else {
|
||||
Log.d("AtomikKeyboard", "key: <none>")
|
||||
}
|
||||
return super.onTouchEvent(event)
|
||||
}
|
||||
|
||||
private fun getKey(x: Double, y: Double): Key? {
|
||||
val activity = context as MainActivity
|
||||
var keyMin: Key? = null
|
||||
var ddMin = Double.MAX_VALUE
|
||||
for (key in activity.keyboard.keys.values) {
|
||||
val dx = key.x - x
|
||||
val dy = key.y - y
|
||||
val dd = dx * dx + dy * dy // squared distance
|
||||
if (dd < ddMin) {
|
||||
keyMin = key
|
||||
ddMin = dd
|
||||
}
|
||||
}
|
||||
return keyMin
|
||||
}
|
||||
}
|
||||
193
app/src/main/java/de/luh/hci/mi/atomikkeyboard/MainActivity.kt
Normal file
@ -0,0 +1,193 @@
|
||||
package de.luh.hci.mi.atomikkeyboard
|
||||
|
||||
import android.Manifest
|
||||
import android.content.pm.PackageManager
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.os.Environment
|
||||
import android.util.Log
|
||||
import android.view.Menu
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import android.widget.TextView
|
||||
import java.io.File
|
||||
import java.io.FileWriter
|
||||
import java.io.IOException
|
||||
import java.io.PrintWriter
|
||||
import java.lang.Integer.min
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
private var textInput: TextView? = null
|
||||
private var textOutput: TextView? = null
|
||||
private var nextButton: Button? = null
|
||||
private var currentSentence = 0
|
||||
private var currentIndex = 0
|
||||
val keyboard = Keyboard()
|
||||
private var logFile: File? = null
|
||||
private var logOut: PrintWriter? = null
|
||||
private val REQUEST_CODE_PERMISSION = 123
|
||||
|
||||
private val sentences = arrayOf(
|
||||
"the quick brown fox jumps",
|
||||
"my lazy dog sleeps well",
|
||||
"east west north south",
|
||||
"up down left right"
|
||||
)
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
textInput = findViewById<TextView>(R.id.textinput) as TextView
|
||||
textOutput = findViewById<View>(R.id.textoutput) as TextView
|
||||
nextButton = findViewById<View>(R.id.nextbutton) as Button
|
||||
nextButton!!.setOnClickListener { _: View ->
|
||||
logErrors()
|
||||
textInput!!.text = ""
|
||||
currentSentence++
|
||||
if (currentSentence >= sentences.size) currentSentence = 0
|
||||
textOutput!!.text = sentences[currentSentence]
|
||||
currentIndex = 0
|
||||
}
|
||||
textOutput!!.text = sentences[currentSentence]
|
||||
requestPermissions(
|
||||
arrayOf(
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
), REQUEST_CODE_PERMISSION
|
||||
)
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(
|
||||
requestCode: Int,
|
||||
permissions: Array<String>, grantResults: IntArray
|
||||
) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
if (requestCode == REQUEST_CODE_PERMISSION) {
|
||||
if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
// permission was granted
|
||||
if (isExternalStorageWritable()) {
|
||||
logFile = createLogFile("log" + System.currentTimeMillis() + ".txt")
|
||||
try {
|
||||
logOut = PrintWriter(FileWriter(logFile))
|
||||
logOut?.let {
|
||||
// header row, values separated by ;
|
||||
it.println("sentence.letter;sentence.x;sentence.y;tap.x;tap.y;timestamp;key.letter;key.x;key.y;sentence;sentenceIndex;letterIndex")
|
||||
it.flush()
|
||||
}
|
||||
} catch (ex: IOException) {
|
||||
Log.e("AtomikKeyboard", ex.toString())
|
||||
}
|
||||
} else {
|
||||
Log.e("AtomikKeyboard", "External storage not writeable.")
|
||||
}
|
||||
} else {
|
||||
// permission denied
|
||||
Log.e("AtomikKeyboard", "You have to grant the permission!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun keyPressed(key: Key, x: Double, y: Double, t: Long) {
|
||||
val s = textInput!!.text.toString()
|
||||
textInput!!.text = s + key.letter
|
||||
saveInput(key, x, y, t)
|
||||
currentIndex++
|
||||
val n = sentences[currentSentence].length
|
||||
if (currentIndex >= n) currentIndex = n - 1
|
||||
}
|
||||
|
||||
public fun array2dOfInt(sizeOuter: Int, sizeInner: Int): Array<IntArray> =
|
||||
Array(sizeOuter) { IntArray(sizeInner) }
|
||||
|
||||
private fun min(a: Int, b: Int, c: Int): Int {
|
||||
return if (a < b) {
|
||||
if (a < c) a else c
|
||||
} else {
|
||||
if (b < c) b else c
|
||||
}
|
||||
}
|
||||
|
||||
private fun editDistance(src: String, dst: String): Int {
|
||||
val s = src.length
|
||||
var t = dst.length
|
||||
var d = Array(s + 1) { IntArray(t + 1) }
|
||||
for (i in 0..s) {
|
||||
for (j in 0..t) {
|
||||
if (i == 0) d[i][j] = j // special case row 0
|
||||
else if (j == 0) d[i][j] = i // special case column 0
|
||||
else { // assert: i > 0 && j > 0
|
||||
val del = d[i - 1][j] + 1
|
||||
val ins = d[i][j - 1] + 1
|
||||
val cop_rep = d[i - 1][j - 1] + (if (src[i - 1] == dst[j - 1]) 0 else 1)
|
||||
d[i][j] = min(del, ins, cop_rep)
|
||||
}
|
||||
}
|
||||
}
|
||||
return d[s][t];
|
||||
}
|
||||
|
||||
// Logs the error value for the current sentence. Called on each press of the next button.
|
||||
private fun logErrors() {
|
||||
val enteredSentence = textInput!!.text as String
|
||||
val e = editDistance(sentences[currentSentence], enteredSentence)
|
||||
logOut?.let {
|
||||
it.printf(
|
||||
"ERRORS;%s;%d;%s;%d\n",
|
||||
sentences[currentSentence],
|
||||
currentSentence,
|
||||
enteredSentence,
|
||||
e
|
||||
)
|
||||
it.flush()
|
||||
}
|
||||
}
|
||||
|
||||
// Saves the given input event as a line in the log.
|
||||
private fun saveInput(key: Key, tapX: Double, tapY: Double, timestamp: Long) {
|
||||
val sentenceLetter = sentences[currentSentence][currentIndex]
|
||||
val sentenceKey = keyboard.keys[sentenceLetter]
|
||||
if (logOut != null) {
|
||||
// save key input event in this format:
|
||||
// sentenceKey.letter;sentenceKey.x;sentenceKey.y;tap.x;tap.y;timestamp;key.letter;key.x;key.y
|
||||
// attention: sentenceKey and/or key may be null
|
||||
val sentenceX: Double = sentenceKey?.x ?: 0.0
|
||||
val sentenceY: Double = sentenceKey?.y ?: 0.0
|
||||
logOut!!.printf(
|
||||
"%c;%f;%f;%f;%f;%d;%c;%f;%f;%s;%d;%d\n",
|
||||
sentenceLetter, sentenceX, sentenceY,
|
||||
tapX, tapY, timestamp,
|
||||
key.letter, key.x, key.y,
|
||||
sentences[currentSentence], currentSentence, currentIndex
|
||||
)
|
||||
logOut!!.flush()
|
||||
}
|
||||
}
|
||||
|
||||
// Checks if external storage is available for reading and writing.
|
||||
private fun isExternalStorageWritable(): Boolean {
|
||||
val state = Environment.getExternalStorageState()
|
||||
if (Environment.MEDIA_MOUNTED == state) {
|
||||
return true
|
||||
}
|
||||
Log.e("AtomikKeyboard", "External storage not mounted")
|
||||
return false
|
||||
}
|
||||
|
||||
// Gets (create if necessary) the storage directory on external storage.
|
||||
private fun createLogFile(fileName: String): File? {
|
||||
val path = File(
|
||||
Environment.getExternalStoragePublicDirectory(
|
||||
Environment.DIRECTORY_DOWNLOADS
|
||||
), "myatomikkeyboard"
|
||||
)
|
||||
path.mkdirs()
|
||||
Log.d("AtomikKeyboard", "path = " + path.absolutePath)
|
||||
// path = /storage/emulated/0/Download/myatomikkeyboard
|
||||
// View --> Tool Windows --> Device File Explorer --> (select device) --> sdcard --> Download --> myatomikkeyboard
|
||||
if (!path.isDirectory) {
|
||||
Log.e("MainActivity ", "Directory could not be created")
|
||||
return null
|
||||
}
|
||||
return File(path, fileName)
|
||||
}
|
||||
}
|
||||
BIN
app/src/main/res/drawable-v24/atomik_keyboard.png
Normal file
|
After Width: | Height: | Size: 743 KiB |
30
app/src/main/res/drawable-v24/ic_launcher_foreground.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
170
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
||||
54
app/src/main/res/layout/activity_main.xml
Normal file
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textoutput"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:text="the quick brown fox jumps"
|
||||
android:textSize="10pt"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textinput"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:textSize="10pt"
|
||||
tools:text="input..."
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textoutput" />
|
||||
|
||||
<view
|
||||
android:id="@+id/keyboard"
|
||||
class="de.luh.hci.mi.atomikkeyboard.KeyboardView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/atomik_keyboard"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textinput" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/nextbutton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:text="Next sentence"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/keyboard" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 982 B |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
16
app/src/main/res/values-night/themes.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.AtomikKeyboard" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_200</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/black</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_200</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
||||
10
app/src/main/res/values/colors.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="purple_200">#FFBB86FC</color>
|
||||
<color name="purple_500">#FF6200EE</color>
|
||||
<color name="purple_700">#FF3700B3</color>
|
||||
<color name="teal_200">#FF03DAC5</color>
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
</resources>
|
||||
4
app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<resources>
|
||||
<string name="app_name">AtomikKeyboard</string>
|
||||
<string name="menu_settings">Settings</string>
|
||||
</resources>
|
||||
16
app/src/main/res/values/themes.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.AtomikKeyboard" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_500</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/white</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
||||
@ -0,0 +1,17 @@
|
||||
package de.luh.hci.mi.atomikkeyboard
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||