Skip to content

Commit

Permalink
rfct: Apply new Ktlint formatting rules
Browse files Browse the repository at this point in the history
  • Loading branch information
cyb3rko committed Nov 4, 2023
1 parent 6654ce5 commit b122005
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[*.{kt,kts}]
ktlint_code_style = android_studio
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ import com.cyb3rko.pincredible.databinding.FragmentPinCreatorBinding
import com.cyb3rko.pincredible.utils.BackupHandler.pinDir
import com.cyb3rko.pincredible.utils.BackupHandler.pinListFile
import com.cyb3rko.pincredible.views.CoordinateViewManager
import java.io.File
import java.security.SecureRandom
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.File
import java.security.SecureRandom

class PinCreatorFragment : Fragment() {
private var _binding: FragmentPinCreatorBinding? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ import com.cyb3rko.pincredible.utils.BackupHandler.pinListFile
import com.cyb3rko.pincredible.utils.TableScreenshotHandler
import com.cyb3rko.pincredible.views.CoordinateViewManager
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.io.File
import kotlin.properties.Delegates
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.File
import kotlin.properties.Delegates

class PinViewerFragment : Fragment() {
private var _binding: FragmentPinViewerBinding? = null
Expand Down
22 changes: 15 additions & 7 deletions app/src/main/kotlin/com/cyb3rko/pincredible/utils/BackupHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,19 @@ import com.cyb3rko.backpack.utils.withoutLast
import com.cyb3rko.backpack.utils.withoutLastN
import com.cyb3rko.pincredible.R
import com.cyb3rko.pincredible.data.PinTable
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream
import java.io.File
import java.nio.ByteBuffer
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

internal object BackupHandler {
private enum class BackupType {
SINGLE_PIN, MULTI_PIN, UNKNOWN
SINGLE_PIN,
MULTI_PIN,
UNKNOWN
}
private const val PINS_FILE = "pins"
private const val SINGLE_BACKUP_FILE = ".pin"
Expand Down Expand Up @@ -304,7 +306,9 @@ internal object BackupHandler {
Log.d("PINcredible Backup", "Single backup version ${backup.getVersion()} found")
withContext(Dispatchers.Main) {
progressDialog.updateAbsolute(50)
progressDialog.updateText(context.getString(R.string.dialog_import_state_saving, 50))
progressDialog.updateText(
context.getString(R.string.dialog_import_state_saving, 50)
)
}

val nameFile = context.pinListFile()
Expand All @@ -316,7 +320,9 @@ internal object BackupHandler {
}
withContext(Dispatchers.Main) {
progressDialog.updateAbsolute(75)
progressDialog.updateText(context.getString(R.string.dialog_import_state_saving, 75))
progressDialog.updateText(
context.getString(R.string.dialog_import_state_saving, 75)
)
}

val fileHash = CryptoManager.xxHash(backup.name)
Expand Down Expand Up @@ -391,7 +397,9 @@ internal object BackupHandler {
Log.d("PINcredible Backup", "Full backup version ${backup.getVersion()} found")
withContext(Dispatchers.Main) {
progressDialog.updateAbsolute(50)
progressDialog.updateText(context.getString(R.string.dialog_import_state_saving, 50))
progressDialog.updateText(
context.getString(R.string.dialog_import_state_saving, 50)
)
}

val nameFile = context.pinListFile()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ internal object TableScreenshotHandler {
onGenerated(bitmap)
}

private fun showFileCreator(
launcher: ActivityResultLauncher<Intent>,
fileName: String
) {
private fun showFileCreator(launcher: ActivityResultLauncher<Intent>, fileName: String) {
val intent = Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
addCategory(Intent.CATEGORY_OPENABLE)
type = "image/jpeg"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import com.google.android.material.textview.MaterialTextView

internal object CoordinateViewManager {
private enum class Orientation {
HORIZONTAL, VERTICAL;
HORIZONTAL,
VERTICAL
}
private enum class Frame(val pattern: String) {
INDEX("12345671234567"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,7 @@ internal class PinTableView(
}
}

fun select(
cell: PinTableCell,
@ColorRes backgroundInt: Int,
colorBlindAlternative: Boolean
) {
fun select(cell: PinTableCell, @ColorRes backgroundInt: Int, colorBlindAlternative: Boolean) {
val selectedBackgroundInt = colorIndexToSelectedDrawableID(
backgroundInt,
colorBlindAlternative
Expand Down

0 comments on commit b122005

Please sign in to comment.