Skip to content

Commit

Permalink
use local resources instead of compose icons
Browse files Browse the repository at this point in the history
  • Loading branch information
X1nto committed Oct 27, 2023
1 parent 1028715 commit 237a4ef
Show file tree
Hide file tree
Showing 58 changed files with 489 additions and 134 deletions.
10 changes: 9 additions & 1 deletion app/src/main/java/com/xinto/mauth/core/camera/ZxingDecoder.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
package com.xinto.mauth.core.camera

import com.google.zxing.*
import com.google.zxing.BarcodeFormat
import com.google.zxing.BinaryBitmap
import com.google.zxing.DecodeHintType
import com.google.zxing.LuminanceSource
import com.google.zxing.MultiFormatReader
import com.google.zxing.NotFoundException
import com.google.zxing.PlanarYUVLuminanceSource
import com.google.zxing.RGBLuminanceSource
import com.google.zxing.Result
import com.google.zxing.common.HybridBinarizer

object ZxingDecoder {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
package com.xinto.mauth.core.otp.generator

import com.xinto.mauth.core.otp.model.OtpDigest
import java.nio.ByteBuffer
import javax.crypto.Mac
import javax.crypto.spec.SecretKeySpec
import kotlin.math.floor
import kotlin.math.pow

interface OtpGenerator {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.xinto.mauth.core.otp.parser

import android.net.Uri
import androidx.compose.ui.text.toUpperCase
import com.xinto.mauth.core.otp.model.OtpData
import com.xinto.mauth.core.otp.model.OtpDigest
import com.xinto.mauth.core.otp.model.OtpType
import java.util.Locale


class DefaultOtpUriParser : OtpUriParser {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.xinto.mauth.db.converter
import androidx.room.TypeConverter
import java.nio.ByteBuffer
import java.nio.ByteOrder
import java.util.*
import java.util.UUID

class UuidConverter {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import androidx.room.Entity
import androidx.room.PrimaryKey
import com.xinto.mauth.core.otp.model.OtpDigest
import com.xinto.mauth.core.otp.model.OtpType
import java.util.*
import java.util.UUID

@Entity(tableName = "accounts")
data class EntityAccount(
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/com/xinto/mauth/di/MauthDI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import com.xinto.mauth.core.otp.parser.DefaultOtpUriParser
import com.xinto.mauth.core.otp.parser.OtpUriParser
import com.xinto.mauth.core.otp.transformer.DefaultKeyTransformer
import com.xinto.mauth.core.otp.transformer.KeyTransformer
import com.xinto.mauth.db.AccountDatabase
import com.xinto.mauth.domain.account.AccountRepository
import com.xinto.mauth.domain.otp.OtpRepository
import com.xinto.mauth.domain.QrRepository
import com.xinto.mauth.domain.SettingsRepository
import com.xinto.mauth.core.settings.DefaultSettings
import com.xinto.mauth.core.settings.Settings
import com.xinto.mauth.db.AccountDatabase
import com.xinto.mauth.domain.AuthRepository
import com.xinto.mauth.domain.QrRepository
import com.xinto.mauth.domain.SettingsRepository
import com.xinto.mauth.domain.account.AccountRepository
import com.xinto.mauth.domain.otp.OtpRepository
import com.xinto.mauth.ui.screen.account.AccountViewModel
import com.xinto.mauth.ui.screen.auth.AuthViewModel
import com.xinto.mauth.ui.screen.home.HomeViewModel
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/com/xinto/mauth/domain/AuthRepository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.xinto.mauth.domain
import com.xinto.mauth.core.auth.AuthManager
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.last
import kotlinx.coroutines.flow.map

class AuthRepository(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package com.xinto.mauth.domain.account

import com.xinto.mauth.core.otp.model.OtpType
import com.xinto.mauth.core.settings.model.SortSetting
import com.xinto.mauth.db.dao.account.AccountsDao
import com.xinto.mauth.db.dao.account.entity.EntityAccount
import com.xinto.mauth.domain.account.model.DomainAccount
import com.xinto.mauth.domain.account.model.DomainAccountInfo
import com.xinto.mauth.core.otp.model.OtpType
import com.xinto.mauth.db.dao.rtdata.RtdataDao
import com.xinto.mauth.db.dao.rtdata.entity.EntityCountData
import com.xinto.mauth.core.settings.model.SortSetting
import com.xinto.mauth.domain.SettingsRepository
import kotlinx.coroutines.flow.*
import java.util.*
import kotlin.NoSuchElementException
import com.xinto.mauth.domain.account.model.DomainAccount
import com.xinto.mauth.domain.account.model.DomainAccountInfo
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.flow
import java.util.UUID

class AccountRepository(
private val accountsDao: AccountsDao,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.xinto.mauth.domain.account.model
import android.net.Uri
import androidx.compose.runtime.Immutable
import com.xinto.mauth.core.otp.model.OtpDigest
import java.util.*
import java.util.UUID

val DomainAccount.shortLabel: String
get() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ import androidx.compose.animation.Animatable
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.AnimationVector
import androidx.compose.animation.core.tween
import androidx.compose.foundation.clickable
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.interaction.InteractionSource
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.PressInteraction
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.requiredSize
import androidx.compose.foundation.layout.requiredSizeIn
import androidx.compose.foundation.layout.sizeIn
import androidx.compose.foundation.shape.CornerBasedShape
import androidx.compose.foundation.shape.RoundedCornerShape
Expand All @@ -40,7 +36,6 @@ import com.xinto.mauth.ui.component.Animatable
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.channels.BufferOverflow
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.consumeEach
import kotlinx.coroutines.launch

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,23 @@ import androidx.activity.compose.BackHandler
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Close
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.xinto.mauth.R
Expand All @@ -21,7 +31,7 @@ import com.xinto.mauth.ui.screen.account.state.AccountScreenLoading
import com.xinto.mauth.ui.screen.account.state.AccountScreenSuccess
import org.koin.androidx.compose.koinViewModel
import org.koin.core.parameter.parametersOf
import java.util.*
import java.util.UUID

@Composable
fun AddAccountScreen(
Expand Down Expand Up @@ -107,7 +117,7 @@ fun AccountScreen(
}
}) {
Icon(
imageVector = Icons.Rounded.Close,
painter = painterResource(R.drawable.ic_close),
contentDescription = null
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package com.xinto.mauth.ui.screen.account.component

import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.KeyboardArrowDown
import androidx.compose.material3.*
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.ExposedDropdownMenuBox
import androidx.compose.material3.Icon
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.rotate
import androidx.compose.ui.res.painterResource
import com.xinto.mauth.R

@Composable
fun <T : Enum<T>> AccountComboBox(
Expand All @@ -36,7 +40,7 @@ fun <T : Enum<T>> AccountComboBox(
val iconRotation by animateFloatAsState(if (expanded) 180f else 0f)
Icon(
modifier = Modifier.rotate(iconRotation),
imageVector = Icons.Rounded.KeyboardArrowDown,
painter = painterResource(R.drawable.ic_keyboard_arrow_down),
contentDescription = null
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ package com.xinto.mauth.ui.screen.account.state
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.ErrorOutline
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.xinto.mauth.R
Expand All @@ -22,7 +21,7 @@ fun AccountScreenError() {
horizontalAlignment = Alignment.CenterHorizontally
) {
Icon(
imageVector = Icons.Rounded.ErrorOutline,
painter = painterResource(R.drawable.ic_error),
contentDescription = null
)
Text(stringResource(R.string.account_error))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,39 @@ import android.net.Uri
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.PickVisualMediaRequest
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.animation.*
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.with
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.grid.*
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.GridItemSpan
import androidx.compose.foundation.lazy.grid.LazyGridItemScope
import androidx.compose.foundation.lazy.grid.LazyGridScope
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.*
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
Expand All @@ -29,7 +50,7 @@ import com.xinto.mauth.ui.component.UriImage
import com.xinto.mauth.ui.screen.account.component.AccountComboBox
import com.xinto.mauth.ui.screen.account.component.AccountDataField
import com.xinto.mauth.ui.screen.account.component.AccountNumberField
import java.util.*
import java.util.UUID

@Composable
fun AccountScreenSuccess(
Expand Down Expand Up @@ -92,7 +113,7 @@ fun AccountScreenSuccess(
Box(contentAlignment = Alignment.Center) {
Icon(
modifier = Modifier.size(36.dp),
imageVector = Icons.Rounded.AddAPhoto,
painter = painterResource(R.drawable.ic_add_a_photo),
contentDescription = null
)
}
Expand All @@ -109,7 +130,7 @@ fun AccountScreenSuccess(
},
leadingIcon = {
Icon(
imageVector = Icons.Rounded.Label,
painter = painterResource(R.drawable.ic_label),
contentDescription = null
)
},
Expand All @@ -125,7 +146,7 @@ fun AccountScreenSuccess(
},
leadingIcon = {
Icon(
imageVector = Icons.Rounded.Apartment,
painter = painterResource(R.drawable.ic_apartment),
contentDescription = null
)
},
Expand All @@ -141,14 +162,16 @@ fun AccountScreenSuccess(
},
leadingIcon = {
Icon(
imageVector = Icons.Rounded.Key,
painter = painterResource(R.drawable.ic_key),
contentDescription = null
)
},
trailingIcon = {
IconButton(onClick = { secretShown = !secretShown }) {
val visible = painterResource(R.drawable.ic_visibility)
val notVisible = painterResource(R.drawable.ic_visibility_off)
Icon(
imageVector = if (secretShown) Icons.Rounded.Visibility else Icons.Rounded.VisibilityOff,
painter = if (secretShown) visible else notVisible,
contentDescription = null
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.xinto.mauth.ui.screen.auth

import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
Expand All @@ -12,7 +11,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.xinto.mauth.R
import com.xinto.mauth.ui.component.BiometricHandler
import com.xinto.mauth.ui.component.pinboard.PinScaffold
import com.xinto.mauth.ui.component.pinboard.rememberPinBoardState
import com.xinto.mauth.ui.component.rememberBiometricHandler
Expand Down
Loading

0 comments on commit 237a4ef

Please sign in to comment.