cleanup and linting

This commit is contained in:
Kieran W 2023-08-24 19:08:51 +01:00
parent ae4ac02038
commit c2801bf340
14 changed files with 49 additions and 15 deletions

View File

@ -9,7 +9,7 @@
<!-- omit in toc -->
# Android.EweSticker
<img src="readme-assets/icons/name.png" alt="Project Icon" width="750">
<img src="metadata/en-US/images/featureGraphic.png" alt="Feature Graphic" width="750">
Sticker-board for android inspired by uSticker (forked from woosticker).

View File

@ -304,11 +304,25 @@ class ImageKeyboard : InputMethodService(), StickerClickListener {
}
}
/**
* onStickerClicked
*
* When a sticker is tapped/ clicked. Update the cache and send the sticker
*
* @param sticker: File
*/
override fun onStickerClicked(sticker: File) {
this.recentCache.add(sticker.absolutePath)
this.stickerSender.sendSticker(sticker)
}
/**
* onStickerLongClicked
*
* When a sticker is long tapped/ clicked. Attach a new view to see an enlarged version of the sticker
*
* @param sticker: File
*/
override fun onStickerLongClicked(sticker: File) {
val fullStickerLayout =
layoutInflater.inflate(R.layout.sticker_preview, this.keyboardRoot, false) as
@ -409,4 +423,3 @@ fun trimString(str: String): String {
}
return str
}

View File

@ -85,9 +85,9 @@ class MainActivity : AppCompatActivity() {
/**
* Called on button press to launch settings
*
* @param view: View
* @param ignoredView: View
*/
fun enableKeyboard(view: View) {
fun enableKeyboard(ignoredView: View) {
val intent = Intent(Settings.ACTION_INPUT_METHOD_SETTINGS)
startActivity(intent)
}
@ -95,16 +95,23 @@ class MainActivity : AppCompatActivity() {
/**
* Called on button press to choose a new directory
*
* @param view: View
* @param ignoredView: View
*/
fun chooseDir(view: View) {
fun chooseDir(ignoredView: View) {
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
intent.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION)
chooseDirResultLauncher.launch(intent)
}
fun reloadStickers(view: View) {
/**
* reloadStickers
*
* Call this function when a user taps the reload stickers button. If we have a set stickerDirPath, call importStickers()
*
* @param ignoredView: View
*/
fun reloadStickers(ignoredView: View) {
val stickerDirPath = this.sharedPreferences.getString(
"stickerDirPath", null
)

View File

@ -123,7 +123,9 @@ class StickerImporter(
}
}
}
inputStream.close()
withContext(Dispatchers.IO) {
inputStream.close()
}
totalStickers++
}
} catch (_: IOException) {

View File

@ -42,7 +42,7 @@ class StickerPackAdapter(
return@setOnLongClickListener true
}
holder.stickerThumbnail.setOnTouchListener { _, event ->
gestureDetector.onTouchEvent(event)
return@setOnTouchListener gestureDetector.onTouchEvent(event)
}
}

7
app/src/main/lint.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="UseCompatLoadingForDrawables">
<ignore path="**/*.kt" />
<ignore path="**/*.java" />
</issue>
</lint>

View File

@ -7,13 +7,11 @@
android:background="@color/bg">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/accent">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsingToolbarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
@ -28,7 +26,6 @@
android:background="@color/accent" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="none"

View File

@ -24,7 +24,6 @@
android:scaleType="fitCenter" />
<TextView
android:id="@+id/stickerPreview"
style="@style/body_text"
android:layout_below="@id/stickerButton"
android:layout_centerHorizontal="true"

View File

@ -10,6 +10,7 @@
<string name="update_sticker_pack_heading">Paquete de etiqueta actualización</string>
<string name="update_sticker_pack_button">Elija el directorio de fuente de la etiqueta</string>
<string name="update_sticker_pack_info">Paquetes de etiqueta cargada actual Información:</string>
<string name="reload_sticker_pack_button">Recargar pegatinas</string>
<string name="update_sticker_pack_info_path_lbl">- Sendero: </string>
<string name="update_sticker_pack_info_path">No se establece</string>
<string name="update_sticker_pack_info_date_lbl">- Fecha: </string>
@ -19,6 +20,8 @@
<string name="options_heading">Opciones</string>
<string name="options_show_back_button">Mostrar botón atrás en navbar</string>
<string name="options_vertical">Usar layout vertical</string>
<string name="options_restore_on_close">Restaurar el teclado anterior al cerrar el teclado</string>
<string name="options_scroll">Habilitar el deslizamiento entre paquetes (perpendicular a la dirección de desplazamiento)</string>
<string name="options_icons_per_x_lbl">"Número de filas: "</string>
<string name="options_icon_size_status_lbl">"Tamaño del icono: "</string>
<!-- Info -->
@ -61,5 +64,6 @@ Copyright © Randy Zhou</string>
<string name="imported_031">E031: Algunos pegatinas no se importaron (%1$d importado).Pegatinas max alcanzadas</string>
<string name="imported_032">E032: Algunos pegatinas no importaron (%1$d importado).Tamaño máximo del paquete alcanzado</string>
<string name="imported_033">E033: Algunos pegatinas no importaron (%1$d importado).Formatos no compatibles encontrados</string>
<string name="imported_034">E034: Falló la recarga de stickers, intenta elegir un directorio de origen de stickers</string>
<string name="fallback_041">E041: IOException inesperado al convertir la pegatina</string>
</resources>

View File

@ -65,6 +65,6 @@ Copyright © Randy Zhou</string>
<string name="imported_031">E031: Some stickers failed to import (%1$d imported). Max stickers reached</string>
<string name="imported_032">E032: Some stickers failed to import (%1$d imported). Max pack size reached</string>
<string name="imported_033">E033: Some stickers failed to import (%1$d imported). Unsupported formats found</string>
<string name="imported_034">E034: Reload stickers failed, try choosing a sticker source directory</string>
<string name="imported_034">E034: Reloading stickers failed, try choosing a sticker source directory</string>
<string name="fallback_041">E041: Unexpected IOException when converting sticker</string>
</resources>

View File

@ -1 +1,2 @@
<!--suppress CheckTagEmptyBody -->
<full-backup-content></full-backup-content>

View File

@ -1,5 +1,9 @@
package com.fredhappyface.ewesticker
import org.hamcrest.MatcherAssert
import org.hamcrest.MatcherAssert.*
import org.hamcrest.Matchers
import org.hamcrest.Matchers.*
import org.junit.Assert.assertEquals
import org.junit.Test
@ -11,6 +15,6 @@ import org.junit.Test
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
assertThat(2 + 2, `is`(4))
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB