ktlint + trailing-whitespace + end-of-file-fixer

This commit is contained in:
Kieran BW 2021-10-26 22:45:29 +01:00
parent 6be9d26c83
commit b0ef631f7e
25 changed files with 65 additions and 47 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@ output-metadata.json
.idea/misc.xml
app/debug/
/captures
/ktlint
# Built application files
# *.apk

2
.idea/.name generated
View File

@ -1 +1 @@
EweSticker
EweSticker

View File

@ -114,4 +114,4 @@
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>
</component>

View File

@ -2,4 +2,4 @@
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>
</component>

2
.idea/compiler.xml generated
View File

@ -3,4 +3,4 @@
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>
</project>

View File

@ -958,4 +958,4 @@
<inspection_tool class="WhenWithOnlyElse" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="ZeroLengthArrayInitialization" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>
</component>

6
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer

View File

@ -12,10 +12,10 @@
Sticker-board for android inspired by uSticker (forked from woosticker).
- [Features](#features)
- [Screenshots](#screenshots)
- [How to use](#how-to-use)
- [Lint with](#lint-with)
- [Language Information](#language-information)
- [Kotlin and Android Version](#kotlin-and-android-version)
- [Download Android Studio](#download-android-studio)
@ -40,13 +40,14 @@ Sticker-board for android inspired by uSticker (forked from woosticker).
## Features
- Add a directory containing stickers
- Supported formats include .png, .gif, .jpg , .webp
- Select the keyboard
- Wide range of custom stickers supported
- Formats include image/gif (.gif), image/png (.png), image/webp
(.webp), image/jpg (.jpg, .jpeg, .jpe, ...), image/heif (.heif, .heifs, .heic, ...)
- Send stickers in supported apps (.png is used as a fallback)
- Vertical and Horizontal scrolling
- Change number of rows and sticker preview size
- Ties in with the system theme
## Screenshots
<p>
@ -61,15 +62,20 @@ Sticker-board for android inspired by uSticker (forked from woosticker).
## How to use
See the [Tutorial](/TUTORIAL.md) for more information.
## Lint with
```txt
java -jar .\ktlint --experimental --android --disabled_rules='indent,parameter-list-wrapping,experimental:argument-list-wrapping'
```
## Language Information
### Kotlin and Android Version
This app has been written in Kotlin 1.5.0 with the Android Studio IDE.
- The target SDK version is 30 (Android 11)
- The minimum SDK version is 28 (Android 9 Pie)
#### Download Android Studio
Download the Android Studio IDE from <https://developer.android.com/studio/>.
For Windows, double click the downloaded .exe file and follow the instructions
@ -78,13 +84,16 @@ Android SDK. Additional information can be found at
<https://developer.android.com/studio/install>
## How to Run
### Build From Source
1. Download or clone this GitHub repository
2. (If downloaded) Extract the zip archive
3. In Android Studio click File > Open and then navigate to the project file
(Android studio defaults to the directory of the last opened file)
### Get it on F-Droid
1. Open the F-Droid app
2. Search for EweSticker
@ -97,6 +106,7 @@ Follow the link to the listing on F-Droid by clicking on the badge above,
then download/ install
### Get it on Google Play
1. Open the Google Play app
2. Search for EweSticker
@ -108,9 +118,8 @@ alt="Get it on Google Play" height="80">](https://play.google.com/store/apps/det
Follow the link to the listing on Google Play by clicking on the badge above,
then download/ install
### Download the APK
1. For releases, navigate to the /app/release directory. For debug, navigate to /app/debug
2. Select the debug or release APK depending on your preference. Note that the
filenames are in the form: app-(debug/release)_(version)_yyyy-mm-dd.apk (I would recommend
@ -125,27 +134,32 @@ Follow the link to the /app/release directory by clicking on the badge above, th
select the preferred version.
## Download Project
### Clone
#### Using The Command Line
1. Press the Clone or download button in the top right
2. Copy the URL (link)
3. Open the command line and change directory to where you wish to
clone to
4. Type 'git clone' followed by URL in step 2
```bash
$ git clone https://github.com/FredHappyface/Android.EweSticker
```
```bash
git clone https://github.com/FredHappyface/BlendModes
```
More information can be found at
<https://help.github.com/en/articles/cloning-a-repository>
https://help.github.com/en/articles/cloning-a-repository
#### Using GitHub Desktop
1. Press the Clone or download button in the top right
2. Click open in desktop
3. Choose the path for where you want and click Clone
More information can be found at
<https://help.github.com/en/desktop/contributing-to-projects/cloning-a-repository-from-github-to-github-desktop>
https://help.github.com/en/desktop/contributing-to-projects/cloning-a-repository-from-github-to-github-desktop
### Download Zip File
@ -154,10 +168,9 @@ More information can be found at
3. Copy/ move to the desired location
## Community Files
### Licence
MIT License
Copyright (c) FredHappyface
Copyright (c) Randy Zhou
(See the [LICENSE](/LICENSE.md) for more information.)
### Changelog

View File

@ -18,4 +18,4 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile

View File

@ -1,7 +1,7 @@
package com.fredhappyface.ewesticker
import java.io.File
import java.util.*
import java.util.LinkedList
/**
* Basically this behaved like an ordered set with some maximum capacity. When this capacity is

View File

@ -10,7 +10,9 @@ import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import android.widget.*
import android.widget.FrameLayout
import android.widget.ImageButton
import android.widget.Toast
import androidx.core.content.FileProvider
import androidx.core.content.res.ResourcesCompat
import androidx.core.view.inputmethod.EditorInfoCompat
@ -25,7 +27,7 @@ import coil.load
import java.io.File
import java.io.FileOutputStream
import java.io.IOException
import java.util.*
import java.util.Arrays
import kotlin.collections.HashMap
/**
@ -202,7 +204,6 @@ class ImageKeyboard : InputMethodService() {
// Remove old stickers
val remSticker = mCompatCache.add(compatStickerName)
remSticker?.let { File(mInternalDir, "__compatSticker__/$remSticker.png").delete() }
}
/**
@ -325,7 +326,6 @@ class ImageKeyboard : InputMethodService() {
pack.addView(imageCard)
}
return packContainer
}
private fun addPackButton(icon: Drawable? = null): ImageButton {

View File

@ -20,7 +20,7 @@ import androidx.preference.PreferenceManager
import com.google.android.material.snackbar.Snackbar
import java.io.File
import java.nio.file.Files
import java.util.*
import java.util.Calendar
import java.util.concurrent.Executors
/**
@ -79,7 +79,6 @@ class MainActivity : AppCompatActivity() {
editor.putBoolean(sharedPrefKey, isChecked)
editor.apply()
}
}
/**
@ -131,7 +130,7 @@ class MainActivity : AppCompatActivity() {
*/
private fun deleteRecursive(fileOrDirectory: File) {
if (fileOrDirectory.isDirectory) {
for (child in Objects.requireNonNull(fileOrDirectory.listFiles())) {
for (child in fileOrDirectory.listFiles() ?: arrayOf()) {
deleteRecursive(child)
}
}
@ -203,7 +202,7 @@ class MainActivity : AppCompatActivity() {
* Import files from storage to internal directory
*/
private fun importStickers() {
//Use worker thread because this takes several seconds
// Use worker thread because this takes several seconds
val executor = Executors.newSingleThreadExecutor()
val handler = Handler(Looper.getMainLooper())
reportEvent(

View File

@ -13,4 +13,3 @@
</androidx.gridlayout.widget.GridLayout>
</HorizontalScrollView>

View File

@ -13,4 +13,3 @@
</androidx.gridlayout.widget.GridLayout>
</ScrollView>

View File

@ -2,4 +2,4 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
</adaptive-icon>
</adaptive-icon>

View File

@ -12,7 +12,7 @@
<string name="sub_options">&#xf423; Opciones</string>
<string name="show_back_button">¿Mostrar botón atrás en navbar?</string>
<string name="vertical">¿Usar layout vertical?</string>
<string name="icons_per_row_status">"Iconos por columna: "</string>
<string name="icons_per_row_status">"Iconos por fila: "</string>
<string name="icon_size_status">"Tamaño del icono: "</string>
<!-- About -->

View File

@ -3,4 +3,4 @@
<color name="bg">#181a1f</color>
<color name="fg">#e6e6e6</color>
<color name="sticker">#21252b</color>
</resources>
</resources>

View File

@ -3,4 +3,4 @@
<color name="accent">#00796B</color>
<color name="accentDark">#00695C</color>
<color name="onAccent">#e6e6e6</color>
</resources>
</resources>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#00796B</color>
</resources>
</resources>

View File

@ -13,7 +13,7 @@
<string name="sub_options">&#xf423; Options</string>
<string name="show_back_button">Show back button in navbar?</string>
<string name="vertical">Use vertical layout?</string>
<string name="icons_per_row_status">"Icons per column: "</string>
<string name="icons_per_row_status">"Icons per row: "</string>
<string name="icon_size_status">"Icon size: "</string>
<!-- About -->
@ -22,11 +22,12 @@
> Features
- Add a directory containing stickers
- Supported formats include .png, .gif, .jpg, .webp
- Select the keyboard
- Wide range of custom stickers supported
- Formats include image/gif (.gif), image/png (.png), image/webp (.webp), image/jpg (.jpg, .jpeg, .jpe, …), image/heif (.heif, .heifs, .heic, …)
- Send stickers in supported apps (.png is used as a fallback)
- Ties in with the system theme</string>
- Vertical and Horizontal scrolling
- Change number of rows and sticker preview size
- Ties in with the system theme</string>
<string name="repo">See https://github.com/FredHappyface/Android.EweSticker for more information."</string>
<string name="tutorial">Select a directory containing stickers and send them in your favourite apps! See https://github.com/FredHappyface/Android.EweSticker/blob/main/TUTORIAL.md for more information on how to use this app.</string>

View File

@ -3,4 +3,4 @@
<color name="bg">#f0f0f1</color>
<color name="fg">#383a42</color>
<color name="sticker">#e7e7e9</color>
</resources>
</resources>

View File

@ -3,4 +3,4 @@
<files-path
name="added_stickers"
path="stickers/" />
</paths>
</paths>

View File

@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<input-method />
<input-method />

View File

@ -22,4 +22,4 @@ allprojects {
task clean(type: Delete) {
delete rootProject.buildDir
}
}

View File

@ -16,4 +16,4 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
kotlin.code.style=official