generated from GSM-MSG/MSG-Repository-Generator
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #180 from GSM-MSG/feature/#178_add_completion_of_l…
…ecture Feature/#178 add completion of lecture
- Loading branch information
Showing
34 changed files
with
1,343 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...design-system/src/main/java/com/msg/design_system/component/topbar/DetailSettingTopBar.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.msg.design_system.component.topbar | ||
|
||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.material3.IconButton | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import com.msg.design_system.component.icon.CloseIcon | ||
import com.msg.design_system.theme.BitgoeulAndroidTheme | ||
|
||
@Composable | ||
fun DetailSettingTopBar( | ||
modifier: Modifier = Modifier, | ||
text: String, | ||
onBackClicked: () -> Unit | ||
) { | ||
BitgoeulAndroidTheme { colors, typography -> | ||
Row( | ||
modifier = modifier.fillMaxWidth() | ||
) { | ||
Text( | ||
text = text, | ||
style = typography.titleSmall, | ||
color = colors.BLACK | ||
) | ||
Spacer(modifier = modifier.weight(1f)) | ||
IconButton( | ||
modifier = modifier.size(24.dp), | ||
content = { CloseIcon() }, | ||
onClick = onBackClicked | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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="M4.888,14C7.077,12.145 7.936,12 12,12C16.064,12 16.923,12.145 19.112,14C20.825,15.451 21.589,16.889 21.982,18.881C22.099,19.471 21.621,20 21.01,20H2.99C2.379,20 1.901,19.471 2.018,18.881C2.411,16.889 3.175,15.451 4.888,14Z" | ||
android:fillColor="#B8B8B8"/> | ||
<path | ||
android:pathData="M12,6m-4,0a4,4 0,1 1,8 0a4,4 0,1 1,-8 0" | ||
android:fillColor="#B8B8B8"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
plugins { | ||
id("bitgoeul.android.feature") | ||
id("bitgoeul.android.hilt") | ||
} | ||
|
||
android { | ||
namespace = "com.msg.certification" | ||
} |
24 changes: 24 additions & 0 deletions
24
feature/certification/src/androidTest/java/com/msg/certification/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.msg.certification | ||
|
||
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.msg.certification", appContext.packageName) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
126 changes: 126 additions & 0 deletions
126
feature/certification/src/main/java/com/msg/certification/AddCertificationScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
package com.msg.certification | ||
|
||
import android.widget.Toast | ||
import androidx.activity.ComponentActivity | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.unit.dp | ||
import androidx.hilt.navigation.compose.hiltViewModel | ||
import com.msg.certification.component.AddAcquisitionDateSection | ||
import com.msg.certification.component.AddCertificationSection | ||
import com.msg.design_system.component.button.BitgoeulButton | ||
import com.msg.design_system.component.topbar.DetailSettingTopBar | ||
import com.msg.design_system.theme.BitgoeulAndroidTheme | ||
import com.msg.design_system.theme.color.BitgoeulColor | ||
import com.msg.ui.DevicePreviews | ||
import com.msg.ui.util.toKoreanFormat | ||
import java.time.LocalDate | ||
|
||
@Composable | ||
fun AddCertificationScreenRoute( | ||
viewModel: CertificationViewModel = hiltViewModel(LocalContext.current as ComponentActivity), | ||
onBackClicked: () -> Unit, | ||
onAddClicked: () -> Unit | ||
) { | ||
AddCertificationScreen( | ||
selectedName = viewModel.selectedTitle.value, | ||
selectedDate = viewModel.selectedDate.value, | ||
onBackClicked = { | ||
onBackClicked() | ||
}, | ||
onAddClicked = { name, acquisitionDate -> | ||
viewModel.selectedCertificationId.value?.let { | ||
viewModel.editCertification(name = name, acquisitionDate = acquisitionDate) | ||
} ?: viewModel.writeCertification(name = name, acquisitionDate = acquisitionDate) | ||
onAddClicked() | ||
} | ||
) | ||
} | ||
|
||
@Composable | ||
fun AddCertificationScreen( | ||
modifier: Modifier = Modifier, | ||
selectedName: String, | ||
selectedDate: LocalDate?, | ||
onBackClicked: () -> Unit, | ||
onAddClicked: (name: String, acquisitionDate: LocalDate) -> Unit | ||
) { | ||
val name = remember { mutableStateOf(selectedName) } | ||
val date = remember { mutableStateOf(selectedDate) } | ||
|
||
Box( | ||
modifier = modifier | ||
.fillMaxSize() | ||
.background(color = BitgoeulColor.WHITE) | ||
) { | ||
val context = LocalContext.current | ||
Column( | ||
modifier = modifier | ||
.fillMaxSize() | ||
.padding( | ||
top = 24.dp, | ||
bottom = 14.dp, | ||
start = 28.dp, | ||
end = 28.dp | ||
), | ||
verticalArrangement = Arrangement.spacedBy(24.dp) | ||
) { | ||
DetailSettingTopBar( | ||
text = "자격증 세부 설정", | ||
onBackClicked = onBackClicked | ||
) | ||
AddCertificationSection( | ||
onValueChange = { | ||
name.value = it | ||
}, | ||
onClickButton = { | ||
name.value = "" | ||
} | ||
) | ||
AddAcquisitionDateSection( | ||
onDatePickerQuit = { | ||
date.value = it | ||
}, | ||
acquisitionDate = date.value?.toKoreanFormat() ?: "" | ||
) | ||
Spacer(modifier = modifier.weight(1f)) | ||
BitgoeulButton( | ||
modifier = modifier.fillMaxWidth(), | ||
text = "자격증 등록", | ||
onClick = { | ||
if (name.value.isBlank()) { | ||
Toast.makeText(context, "자격증 이름을 입력해주세요", Toast.LENGTH_SHORT).show() | ||
} else if (date.value == null) { | ||
Toast.makeText(context, "취득일을 입력해주세요", Toast.LENGTH_SHORT).show() | ||
} else { | ||
onAddClicked(name.value, date.value!!) | ||
} | ||
} | ||
) | ||
} | ||
} | ||
} | ||
|
||
|
||
@DevicePreviews | ||
@Composable | ||
fun AddCertificationScreenPre() { | ||
AddCertificationScreen( | ||
onBackClicked = {}, | ||
onAddClicked = {_,_->}, | ||
selectedName = "", | ||
selectedDate = null | ||
) | ||
} |
Oops, something went wrong.