Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/ui/login-process' into ui/login-…
Browse files Browse the repository at this point in the history
…process
  • Loading branch information
jiwon2724 committed Jul 16, 2024
2 parents fb89a58 + b4cbf0e commit c45f875
Show file tree
Hide file tree
Showing 44 changed files with 1,886 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import pokitmons.pokit.core.ui.R
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import pokitmons.pokit.core.ui.R
import pokitmons.pokit.core.ui.components.block.pokitlist.attributes.PokitListState
import pokitmons.pokit.core.ui.theme.PokitTheme

Expand All @@ -28,9 +28,11 @@ fun <T> PokitList(
title: String,
sub: String,
onClickKebab: (T) -> Unit,
onClickItem: (T) -> Unit,
modifier: Modifier = Modifier,
state: PokitListState = PokitListState.DISABLE,
onClickItem: (T) -> Unit,
modifier: Modifier = Modifier,
state: PokitListState = PokitListState.DEFAULT,
) {
val titleTextColor = getTitleTextColor(state = state)
val subTextColor = getSubTextColor(state = state)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package pokitmons.pokit.core.ui.components.template.modifybottomsheet

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import pokitmons.pokit.core.ui.R
import pokitmons.pokit.core.ui.components.template.modifybottomsheet.subcomponents.ModifyBottomSheetItem

@Composable
fun ModifyBottomSheetContent(
onClickShare: (() -> Unit)? = null,
onClickModify: (() -> Unit)? = null,
onClickRemove: (() -> Unit)? = null,
) {
Column(
modifier = Modifier.fillMaxWidth()
) {
onClickShare?.let { onClickShare ->
ModifyBottomSheetItem(
onClick = onClickShare,
title = stringResource(id = R.string.share),
painter = painterResource(id = R.drawable.icon_24_share)
)
}

onClickModify?.let { onClickModify ->
ModifyBottomSheetItem(
onClick = onClickModify,
title = stringResource(id = R.string.modify),
painter = painterResource(id = R.drawable.icon_24_edit)
)
}

onClickRemove?.let { onClickRemove ->
ModifyBottomSheetItem(
onClick = onClickRemove,
title = stringResource(id = R.string.remove),
painter = painterResource(id = R.drawable.icon_24_trash)
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package pokitmons.pokit.core.ui.components.template.modifybottomsheet

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import pokitmons.pokit.core.ui.theme.PokitTheme

@Preview(showBackground = true)
@Composable
private fun ModifyBottomSheetContentPreview() {
PokitTheme {
Surface(modifier = Modifier.fillMaxSize()) {
ModifyBottomSheetContent(
onClickRemove = {},
onClickModify = {},
onClickShare = {}
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package pokitmons.pokit.core.ui.components.template.modifybottomsheet.subcomponents

import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.unit.dp
import pokitmons.pokit.core.ui.theme.PokitTheme

@Composable
internal fun ModifyBottomSheetItem(
onClick: () -> Unit,
title: String,
painter: Painter,
) {
Row(
modifier = Modifier
.fillMaxWidth()
.clickable {
onClick()
}
.padding(horizontal = 24.dp, vertical = 20.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween
) {
Text(
text = title,
style = PokitTheme.typography.body1Medium.copy(color = PokitTheme.colors.textSecondary)
)

Image(
modifier = Modifier.size(24.dp),
painter = painter,
contentDescription = null
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package pokitmons.pokit.core.ui.components.template.removeItemBottomSheet

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import pokitmons.pokit.core.ui.components.template.removeItemBottomSheet.attributes.RemoveItemType
import pokitmons.pokit.core.ui.theme.PokitTheme

@Preview(showBackground = true)
@Composable
private fun RemoveItemBottomSheetContentPreview() {
PokitTheme {
Surface(modifier = Modifier.fillMaxSize()) {
RemoveItemBottomSheetContent(
removeItemType = RemoveItemType.LINK,
onClickCancel = {},
onClickRemove = {}
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package pokitmons.pokit.core.ui.components.template.removeItemBottomSheet

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
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.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import pokitmons.pokit.core.ui.R
import pokitmons.pokit.core.ui.components.atom.button.PokitButton
import pokitmons.pokit.core.ui.components.atom.button.attributes.PokitButtonShape
import pokitmons.pokit.core.ui.components.atom.button.attributes.PokitButtonSize
import pokitmons.pokit.core.ui.components.atom.button.attributes.PokitButtonStyle
import pokitmons.pokit.core.ui.components.atom.button.attributes.PokitButtonType
import pokitmons.pokit.core.ui.components.template.removeItemBottomSheet.attributes.RemoveItemType
import pokitmons.pokit.core.ui.theme.PokitTheme

@Composable
fun RemoveItemBottomSheetContent(
removeItemType: RemoveItemType,
onClickCancel: () -> Unit,
onClickRemove: () -> Unit,
) {
Column(
modifier = Modifier
.fillMaxWidth()
.padding(top = 36.dp, start = 20.dp, end = 20.dp, bottom = 20.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
text = stringResource(id = removeItemType.titleStringResourceId),
style = PokitTheme.typography.title2.copy(color = PokitTheme.colors.textPrimary)
)

Spacer(modifier = Modifier.height(8.dp))

Text(
text = stringResource(id = removeItemType.subStringResourceId),
style = PokitTheme.typography.body2Medium.copy(color = PokitTheme.colors.textSecondary),
textAlign = TextAlign.Center
)
}

Row(
modifier = Modifier
.fillMaxWidth()
.padding(top = 16.dp, start = 20.dp, end = 20.dp, bottom = 28.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
PokitButton(
text = stringResource(id = R.string.cancellation),
icon = null,
onClick = onClickCancel,
shape = PokitButtonShape.RECTANGLE,
type = PokitButtonType.SECONDARY,
size = PokitButtonSize.LARGE,
style = PokitButtonStyle.STROKE,
modifier = Modifier.weight(1f)
)

PokitButton(
text = stringResource(id = R.string.removal),
icon = null,
onClick = onClickRemove,
shape = PokitButtonShape.RECTANGLE,
type = PokitButtonType.PRIMARY,
size = PokitButtonSize.LARGE,
style = PokitButtonStyle.FILLED,
modifier = Modifier.weight(1f)
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package pokitmons.pokit.core.ui.components.template.removeItemBottomSheet.attributes

import pokitmons.pokit.core.ui.R

enum class RemoveItemType(val titleStringResourceId: Int, val subStringResourceId: Int) {
POKIT(
titleStringResourceId = R.string.title_remove_pokit,
subStringResourceId = R.string.sub_remove_link
),
LINK(
titleStringResourceId = R.string.title_remove_link,
subStringResourceId = R.string.sub_remove_link
),
}
12 changes: 12 additions & 0 deletions core/ui/src/main/res/values/string.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,16 @@
<resources>
<string name="not_read">안읽음</string>
<string name="pokit_count_format">링크 %d개</string>

<string name="title_remove_pokit">포킷을 정말 삭제하시겠습니까?</string>
<string name="sub_remove_pokit">함께 저장한 모든 링크가 삭제되며,\n복구하실 수 없습니다.</string>
<string name="title_remove_link">링크를 정말 삭제하시겠습니까?</string>
<string name="sub_remove_link">함께 저장한 모든 정보가 삭제되며,\n복구하실 수 없습니다.</string>

<string name="cancellation">취소</string>
<string name="removal">삭제</string>

<string name="share">공유하기</string>
<string name="modify">수정하기</string>
<string name="remove">삭제하기</string>
</resources>
1 change: 1 addition & 0 deletions feature/addlink/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
64 changes: 64 additions & 0 deletions feature/addlink/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
plugins {
alias(libs.plugins.com.android.library)
alias(libs.plugins.org.jetbrains.kotlin.android)
}

android {
namespace = "com.strayalpaca.addlink"
compileSdk = 34

defaultConfig {
minSdk = 24

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.1"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}

dependencies {

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)

implementation(libs.orbit.compose)
implementation(libs.orbit.core)
implementation(libs.orbit.viewmodel)

implementation(project(":core:ui"))
}
Empty file.
21 changes: 21 additions & 0 deletions feature/addlink/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.strayalpaca.addlink

import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.strayalpaca.addlink.test", appContext.packageName)
}
}
4 changes: 4 additions & 0 deletions feature/addlink/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
Loading

0 comments on commit c45f875

Please sign in to comment.