Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions common/resource/src/main/res/drawable/img_friend_accept.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12,0L12,0A12,12 0,0 1,24 12L24,12A12,12 0,0 1,12 24L12,24A12,12 0,0 1,0 12L0,12A12,12 0,0 1,12 0z"
android:fillColor="#5C8EED"/>
<path
android:pathData="M17.325,7.913C16.935,7.572 16.356,7.588 15.985,7.934L15.914,8.008L10.823,13.825L8.077,10.775C7.707,10.364 7.075,10.331 6.664,10.7C6.254,11.07 6.221,11.702 6.59,12.113L10.09,16.002C10.281,16.214 10.555,16.335 10.84,16.333C11.126,16.331 11.398,16.206 11.586,15.991L17.419,9.324L17.482,9.244C17.776,8.831 17.715,8.254 17.325,7.913Z"
android:fillColor="#ffffff"/>
</vector>
13 changes: 13 additions & 0 deletions common/resource/src/main/res/drawable/img_friend_empty_plus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="132dp"
android:height="270dp"
android:viewportWidth="132"
android:viewportHeight="270">
<path
android:pathData="M4,266C4,208.5 31.56,76.89 128,4M128,4L122.47,41.92M128,4H89.29"
android:strokeLineJoin="round"
android:strokeWidth="8"
android:fillColor="#00000000"
android:strokeColor="#E6E6E6"
android:strokeLineCap="round"/>
</vector>
12 changes: 12 additions & 0 deletions common/resource/src/main/res/drawable/img_friend_reject.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12,0L12,0A12,12 0,0 1,24 12L24,12A12,12 0,0 1,12 24L12,24A12,12 0,0 1,0 12L0,12A12,12 0,0 1,12 0z"
android:fillColor="#DD0303"/>
<path
android:pathData="M15.293,7.293C15.684,6.902 16.316,6.902 16.707,7.293C17.097,7.683 17.097,8.316 16.707,8.707L13.414,12L16.707,15.293L16.776,15.369C17.096,15.762 17.073,16.341 16.707,16.707C16.341,17.073 15.762,17.096 15.369,16.776L15.293,16.707L12,13.414L8.707,16.707C8.316,17.097 7.683,17.097 7.293,16.707C6.902,16.316 6.902,15.684 7.293,15.293L10.586,12L7.293,8.707L7.224,8.631C6.904,8.238 6.927,7.659 7.293,7.293C7.659,6.927 8.238,6.904 8.631,7.224L8.707,7.293L12,10.586L15.293,7.293Z"
android:fillColor="#ffffff"/>
</vector>
1 change: 1 addition & 0 deletions feature/friend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
15 changes: 15 additions & 0 deletions feature/friend/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
plugins {
id("convention.android.feature")
}

android {
namespace = "com.idiotfrogs.friend"
}

dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.ext)
androidTestImplementation(libs.androidx.test.espresso)
}
Empty file.
21 changes: 21 additions & 0 deletions feature/friend/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,24 @@
package com.idiotfrogs.friend

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* 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.idiotfrogs.friend.test", appContext.packageName)
}
}
4 changes: 4 additions & 0 deletions feature/friend/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>
192 changes: 192 additions & 0 deletions feature/friend/src/main/java/com/idiotfrogs/friend/FriendScreen.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
package com.idiotfrogs.friend

import android.content.Intent
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.material3.Icon
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.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.DpOffset
import androidx.compose.ui.unit.dp
import androidx.compose.ui.zIndex
import androidx.core.content.FileProvider
import com.idiotfrogs.designsystem.component.MSDetailHeader
import com.idiotfrogs.designsystem.component.MSMenuFab
import com.idiotfrogs.designsystem.component.MSText
import com.idiotfrogs.designsystem.model.MSMenuFabModel
import com.idiotfrogs.designsystem.theme.MSTheme
import com.idiotfrogs.designsystem.util.noRippleClickable
import com.idiotfrogs.friend.component.FriendListItem
import com.idiotfrogs.friend.component.FriendTopNotification
import com.idiotfrogs.resource.R
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch

@Composable
fun FriendScreen(
modifier: Modifier = Modifier,
) {
val context = LocalContext.current

var isEmpty by remember { mutableStateOf(false) }
var isAccept by remember { mutableStateOf(false) }
var isReject by remember { mutableStateOf(false) }
var isCopy by remember { mutableStateOf(false) }
var expanded by remember { mutableStateOf(false) }
val menuList by remember {
mutableStateOf(
listOf(
MSMenuFabModel("์ฐธ์—ฌ ๋งํฌ ๊ณต์œ ") {
expanded = false

// val imageUri = FileProvider.getUriForFile(
// context,
// "${context.packageName}.provider", // provider authority
// imageFile // File ๊ฐ์ฒด
// )

// ๊ณต์œ  ์ธํ…ํŠธ ์ƒ์„ฑ
val shareIntent = Intent(Intent.ACTION_SEND).apply {
type = "image/*"
// putExtra(Intent.EXTRA_STREAM, imageUri)
putExtra(
Intent.EXTRA_TEXT,
"๋‚ด๊ฐ€ ๋งŒ๋“  ํƒ€์ž„ ํ‹ฐ์ผ“์— ํ•จ๊ป˜ํ•ด์ค˜! ์•„๋ž˜ ๋งํฌ๋กœ ์ฐธ์—ฌ ์š”์ฒญ์„ ๋ณด๋‚ด๋ฉด โ€œํƒ€์ž„ ์บก์А ์ด๋ฆ„โ€์— ํ•ฉ๋ฅ˜ํ•  ์ˆ˜ ์žˆ์–ด์š”. [์ดˆ๋Œ€ ๋งํฌ]"
)
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
}

// ์‹œ์Šคํ…œ ๊ณต์œ  ๋ฐ”ํ…€ ์‹œํŠธ ํ‘œ์‹œ
context.startActivity(
Intent.createChooser(shareIntent, "๊ณต์œ ํ•˜๊ธฐ")
)
},
MSMenuFabModel("์ฐธ์—ฌ ์ฝ”๋“œ ๋ณต์‚ฌ") {
expanded = false
isCopy = true
},
)
)
}

LaunchedEffect(
isAccept,
isReject,
isCopy
) {
delay(1000L)
isAccept = false
isReject = false
isCopy = false
}

Box {
MSMenuFab(
modifier = Modifier
.align(Alignment.TopEnd)
.navigationBarsPadding()
.padding(end = 20.dp),
expanded = expanded,
hasFab = false,
offset = DpOffset(x = 0.dp, y = 40.dp),
menuList = menuList,
onClick = { expanded = !expanded },
onDismiss = { expanded = false },
)

if (isAccept || isReject || isCopy) {
FriendTopNotification(
modifier = Modifier
.align(Alignment.TopCenter)
.navigationBarsPadding()
.zIndex(1f),
isAccept = isAccept,
isCopy = isCopy
)
}

Column(
modifier = modifier
.fillMaxSize()
.background(MSTheme.color.white)
.systemBarsPadding()
.padding(horizontal = 20.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
MSDetailHeader(
title = "๋งด๋ฒ„ ์ถ”๊ฐ€",
navigateToBack = {},
paddingValues = PaddingValues(horizontal = 0.dp, vertical = 16.dp)
) {
Icon(
painter = painterResource(R.drawable.ic_plus),
contentDescription = "Back",
modifier = Modifier.noRippleClickable { expanded = true }
)
}
if (isEmpty) {
Spacer(Modifier.height(25.dp))
Icon(
painter = painterResource(R.drawable.img_friend_empty_plus),
contentDescription = "emptyIcon",
tint = MSTheme.color.greyG1,
modifier = Modifier
.align(Alignment.End)
.padding(end = 40.dp)
)
Spacer(Modifier.height(32.dp))
MSText(
text = "๋Œ€๊ธฐ์ค‘์ธ ๋งด๋ฒ„๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.\n" + "์ฝ”๋“œ ๋˜๋Š” ๋งํฌ๋กœ ๋งด๋ฒ„๋ฅผ ์ดˆ๋Œ€ํ•ด๋ณด์„ธ์š”.",
color = MSTheme.color.greyG4,
fontWeight = FontWeight.Normal,
textAlign = TextAlign.Center
)
} else {
repeat(10) { // TODO ํ…Œ์ŠคํŠธ์šฉ ์ฝ”๋“œ -> ์ถ” ํ›„ ์‹ค์ œ list ๋ณ€๊ฒฝ ํ•„์š”
Spacer(Modifier.height(8.dp))
FriendListItem(
nickName = when (it) {
0 -> "ํŒŒ๋ž€ ๋ฐ”๋‚˜๋‚˜"
1 -> "๊ฒ€์ • ๋ณต์ˆญ์•„"
2 -> "๋ณ„ ๋ชจ์–‘ ํŒŒ์ธ์• ํ”Œ"
3 -> "์ดˆ์ฝ” ์ฒด๋ฆฌ"
4 -> "์ž๋‘ ์ˆ˜๋ฐ•"
else -> "๋ฏผํŠธ ๋„ค๋ชจ ์ˆ˜๋ฐ•"
},
onAccept = { isAccept = true },
onReject = { isReject = true }
)
Spacer(Modifier.height(8.dp))
}
}
}
}
}

@Preview
@Composable
fun FriendScreenPreview() {
FriendScreen()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package com.idiotfrogs.friend.component

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
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.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.idiotfrogs.designsystem.component.MSText
import com.idiotfrogs.designsystem.theme.MSTheme
import com.idiotfrogs.designsystem.util.noRippleClickable
import com.idiotfrogs.resource.R

@Composable
fun FriendListItem(
nickName: String,
onAccept: () -> Unit,
onReject: () -> Unit,
modifier: Modifier = Modifier,
) {
Row(
modifier = modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
) {
Image( // TODO ์ถ” ํ›„ AsyncImage ๋ณ€๊ฒฝ ํ•„์š”
painter = painterResource(R.drawable.img_profile),
contentDescription = "ํ”„๋กœํ•„",
modifier = Modifier.size(48.dp)
)
Spacer(Modifier.width(8.dp))
MSText(
text = nickName,
color = MSTheme.color.greyG5,
fontSize = 16.dp,
fontWeight = FontWeight.Normal,
)

Spacer(Modifier.weight(1f))
MSText(
modifier = Modifier
.background(
color = MSTheme.color.greyG1,
shape = RoundedCornerShape(8.dp)
)
.padding(horizontal = 12.dp, vertical = 7.5.dp)
.noRippleClickable { onReject() },
text = "๊ฑฐ์ ˆ",
color = MSTheme.color.greyG4,
fontSize = 14.dp,
)
Spacer(Modifier.width(8.dp))
MSText(
modifier = Modifier
.background(
color = MSTheme.color.primaryLight,
shape = RoundedCornerShape(8.dp)
)
.padding(horizontal = 12.dp, vertical = 7.5.dp)
.noRippleClickable { onAccept() },
text = "์ˆ˜๋ฝ",
color = MSTheme.color.primaryDark,
fontSize = 14.dp,
)
}
}

@Preview(showBackground = true)
@Composable
fun FriendListItemPreview() {
FriendListItem(
"nickName",
onAccept = {},
onReject = {},
)
}
Loading