Skip to content

Commit e202e05

Browse files
committed
cleanup and linting
1 parent 1732b16 commit e202e05

14 files changed

Lines changed: 49 additions & 15 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<!-- omit in toc -->
1010
# Android.EweSticker
1111

12-
<img src="readme-assets/icons/name.png" alt="Project Icon" width="750">
12+
<img src="metadata/en-US/images/featureGraphic.png" alt="Feature Graphic" width="750">
1313

1414
Sticker-board for android inspired by uSticker (forked from woosticker).
1515

app/src/main/java/com/fredhappyface/ewesticker/ImageKeyboard.kt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,25 @@ class ImageKeyboard : InputMethodService(), StickerClickListener {
304304
}
305305
}
306306

307+
/**
308+
* onStickerClicked
309+
*
310+
* When a sticker is tapped/ clicked. Update the cache and send the sticker
311+
*
312+
* @param sticker: File
313+
*/
307314
override fun onStickerClicked(sticker: File) {
308315
this.recentCache.add(sticker.absolutePath)
309316
this.stickerSender.sendSticker(sticker)
310317
}
311318

319+
/**
320+
* onStickerLongClicked
321+
*
322+
* When a sticker is long tapped/ clicked. Attach a new view to see an enlarged version of the sticker
323+
*
324+
* @param sticker: File
325+
*/
312326
override fun onStickerLongClicked(sticker: File) {
313327
val fullStickerLayout =
314328
layoutInflater.inflate(R.layout.sticker_preview, this.keyboardRoot, false) as
@@ -409,4 +423,3 @@ fun trimString(str: String): String {
409423
}
410424
return str
411425
}
412-

app/src/main/java/com/fredhappyface/ewesticker/MainActivity.kt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,26 +85,33 @@ class MainActivity : AppCompatActivity() {
8585
/**
8686
* Called on button press to launch settings
8787
*
88-
* @param view: View
88+
* @param ignoredView: View
8989
*/
90-
fun enableKeyboard(view: View) {
90+
fun enableKeyboard(ignoredView: View) {
9191
val intent = Intent(Settings.ACTION_INPUT_METHOD_SETTINGS)
9292
startActivity(intent)
9393
}
9494

9595
/**
9696
* Called on button press to choose a new directory
9797
*
98-
* @param view: View
98+
* @param ignoredView: View
9999
*/
100-
fun chooseDir(view: View) {
100+
fun chooseDir(ignoredView: View) {
101101
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)
102102
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
103103
intent.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION)
104104
chooseDirResultLauncher.launch(intent)
105105
}
106106

107-
fun reloadStickers(view: View) {
107+
/**
108+
* reloadStickers
109+
*
110+
* Call this function when a user taps the reload stickers button. If we have a set stickerDirPath, call importStickers()
111+
*
112+
* @param ignoredView: View
113+
*/
114+
fun reloadStickers(ignoredView: View) {
108115
val stickerDirPath = this.sharedPreferences.getString(
109116
"stickerDirPath", null
110117
)

app/src/main/java/com/fredhappyface/ewesticker/StickerImporter.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ class StickerImporter(
123123
}
124124
}
125125
}
126-
inputStream.close()
126+
withContext(Dispatchers.IO) {
127+
inputStream.close()
128+
}
127129
totalStickers++
128130
}
129131
} catch (_: IOException) {

app/src/main/java/com/fredhappyface/ewesticker/adapter/StickerPackAdapter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class StickerPackAdapter(
4242
return@setOnLongClickListener true
4343
}
4444
holder.stickerThumbnail.setOnTouchListener { _, event ->
45-
gestureDetector.onTouchEvent(event)
45+
return@setOnTouchListener gestureDetector.onTouchEvent(event)
4646
}
4747
}
4848

app/src/main/lint.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<lint>
3+
<issue id="UseCompatLoadingForDrawables">
4+
<ignore path="**/*.kt" />
5+
<ignore path="**/*.java" />
6+
</issue>
7+
</lint>

app/src/main/res/layout/activity_main.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@
77
android:background="@color/bg">
88

99
<com.google.android.material.appbar.AppBarLayout
10-
android:id="@+id/appBarLayout"
1110
android:layout_width="match_parent"
1211
android:layout_height="wrap_content"
1312
android:background="@color/accent">
1413

1514
<com.google.android.material.appbar.CollapsingToolbarLayout
16-
android:id="@+id/collapsingToolbarLayout"
1715
android:layout_width="match_parent"
1816
android:layout_height="wrap_content"
1917
app:layout_scrollFlags="scroll|exitUntilCollapsed"
@@ -28,7 +26,6 @@
2826
android:background="@color/accent" />
2927

3028
<androidx.appcompat.widget.Toolbar
31-
android:id="@+id/toolbar"
3229
android:layout_width="match_parent"
3330
android:layout_height="?attr/actionBarSize"
3431
app:layout_collapseMode="none"

app/src/main/res/layout/sticker_preview.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
android:scaleType="fitCenter" />
2525

2626
<TextView
27-
android:id="@+id/stickerPreview"
2827
style="@style/body_text"
2928
android:layout_below="@id/stickerButton"
3029
android:layout_centerHorizontal="true"

app/src/main/res/values-es/strings.xml

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

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,6 @@ Copyright © Randy Zhou</string>
6565
<string name="imported_031">E031: Some stickers failed to import (%1$d imported). Max stickers reached</string>
6666
<string name="imported_032">E032: Some stickers failed to import (%1$d imported). Max pack size reached</string>
6767
<string name="imported_033">E033: Some stickers failed to import (%1$d imported). Unsupported formats found</string>
68-
<string name="imported_034">E034: Reload stickers failed, try choosing a sticker source directory</string>
68+
<string name="imported_034">E034: Reloading stickers failed, try choosing a sticker source directory</string>
6969
<string name="fallback_041">E041: Unexpected IOException when converting sticker</string>
7070
</resources>

0 commit comments

Comments
 (0)