πGo to GitHub by clicking the image above!π
What is this?
Mentoring Application for Christian Students Who Will Enter the University
Tech Stack
Kotlin
Organization
java/
βββ com.suwonccc.csmproject/
β βββ alarmpage_fragment/
β β βββ AlarmInfo
β β βββ AlarmInfoDAO
β β βββ AlarmpageFragment
β β βββ AlarmPageRecyclerView.kt
β βββ etcpage/
β β βββ Etcpage_disconnect
β β βββ Etcpage_modify_mentee
β β βββ Etcpage_modify_mentor
β β βββ Etcpage_mymentee
β β βββ Etcpage_mymentee_list
β β βββ Ectpage_mymentor
β β βββ Ectpage_nomentee
β β βββ Ectpage_nomentor
β β βββ EtcpageFragment.kt
β βββ firstpage_fragment/
β β βββ LoginComplete
β β βββ LoginExtraInfo
β β βββ LoginMain
β β βββ LoginMentee
β β βββ LoginMentor
β β βββ LoginProfile
β βββ mainpage_fragment/
β β βββ MainpageFragment
β β βββ MainpageWaitMentorFragment.kt
β β βββ MainpageWelcomeMenteeFragment.kt
β β βββ MainpageWelcomeMentorFragment
β β βββ MainSearchMentorActivity
β βββ recyclerview/
β β βββ mentee.kt
β β βββ MenteelistAdapter
β β βββ SearchMentorlistAdapter
β βββ ChattingpageFragment.kt
β βββ Firstpage
β βββ MainActivity
β βββ MessagingService
β βββ UserstorypageFragment.kt
1. Login Main
λ μ΄μμ
1) ConstraintLayout
- Chainμ μ¬μ©νμ¬ νλ©΄ ν΄μλμ λ°λΌ κ° μμμ μμΉκ° λ§μ΄ λ¬λΌμ§μ§ μκ² νκΈ° μν¨
- backgroundλ₯Ό ν¬λͺ
νκ² νκ³ , srcμ μ΄λ―Έμ§ νμΌμ λ£μ κ²
νλκ·Έλ¨ΌνΈ
1) onCreateView vs onViewCreated
onCreate()
: ν΄λΉ μ½λ°±μ Fragmentκ° μμ±λ λ λ¨ ν λ²λ§ νΈμΆλλ€. λ°μ΄ν°μ κ°μ 리μμ€ μ΄κΈ°ν μμ
μ μννλ μ ν©νλ€.onCreateView()
: ν΄λΉ μ½λ°±μ Viewκ° μμ±λμ΄ λ§€κ°λ³μλ‘ μ¬μ© κ°λ₯ν μμ μ΄λ€. λν, Fragmentκ° back stackμμ λλμμ€λ μ§μ μ΄λ€.onViewCreated()
: ν΄λΉ μ½λ°±μ onCreateView()
κ° νΈμΆλ μ§ν νΈμΆλλ€. λ·°κ° μμ ν μμ±λμ΄ μλ μ§μ μ΄λ€.
2) Jetpack Navigation
- NavHost: νμ κ·Έλνμμ λμμ νμνλ λΉ μ»¨ν
μ΄λ
- NavController: NavHostμμ μ± νμμ κ΄λ¦¬νλ κ°μ²΄
- login_nav_graph.xmlμ λ³λλ‘ λ§λ€μ΄μ€
2. Login Profile
λ μ΄μμ
- ScrollViewλ₯Ό μ¬μ©ν λμ λ¬λ¦¬, λͺ¨λ Viewκ° ν¨κ» μ€ν¬λ‘€μ΄ λ μ μμ
2) CircleImageView
implementation 'de.hdodenhof:circleimageview:3.0.0'
νλκ·Έλ¨ΌνΈ
- fragment_login_profile_change_dialog.xmlμ λ³λλ‘ λ§λ€μ΄μ€
var popUpMenu = PopupMenu(wrapper, popup_req_btn)
popUpMenu.menu.add(Menu.NONE, 0, 0, "naver.com")
popUpMenu.menu.add(Menu.NONE, 1, 1, "gmail.com")
popUpMenu.menu.add(Menu.NONE, 2, 2, "hanmail.net")
3) κ°€λ¬λ¦¬ μ κ·Ό
- κ°€λ¬λ¦¬ κΆν λΆμ¬ ->
onRequestPermissionsResult()
μμ ν΄λΉνλ requestCodeμ λ°λΌ dispatchPickGalleryIntent()
μ€ν -> onActivityResult()
μμ ν΄λΉνλ resultCodeμ λ°λΌ launchImageCrop()
μ€ν
4) μΉ΄λ©λΌ μ κ·Ό
- μΉ΄λ©λΌ κΆν λΆμ¬ ->
onRequestPermissionsResult()
μμ ν΄λΉνλ requestCodeμ λ°λΌ dispatchTakePictureIntent()
μ€ν -> onActivityResult()
μμ ν΄λΉνλ resultCodeμ λ°λΌ galleryAddPic()
μ€ν
3. Login Mentor/Mentee
λ μ΄μμ
1) AutoCompleteTextView
- μλμμ± κΈ°λ₯μ μν΄ μ¬μ©
android:completionThreshold="2"
: λ¬Έμμ κ°μκ° 2κ°μΌ λλΆν° μλμμ± κ²μ μ€ν
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- ν΄λ¦νμ κ²½μ° -->
<item android:state_pressed="true" android:drawable="@drawable/firstpage_btn_next_pressed" />
<item android:state_selected="true" android:drawable="@drawable/firstpage_btn_next_pressed" />
<!-- ν΄λ¦νμ§ μμ κ²½μ° -->
<item android:state_pressed="false" android:drawable="@drawable/firstpage_btn_next" />
<item android:state_selected="false" android:drawable="@drawable/firstpage_btn_next" />
</selector>
- selector_next_btn.xmlμ λ³λλ‘ λ§λ€μ΄μ€(drawable ν΄λμ)
state_pressed
: λ·°κ° λλ Έμ λ(ν°μΉλ ν΄λ¦μ΄ λ°μνμ λ)state_selected
: λ·°λ₯Ό μ ννμ λ(λ°©ν₯ν€λ‘ μ΄λνλ€κ° μ ννμ λ)state_enabled
: μ¬μ©ν μ μλ μνμΌ λ(ν°μΉλ ν΄λ¦ μ΄λ²€νΈ λ±μ λ°μ μ μλ μνμΌ λ)
νλκ·Έλ¨ΌνΈ
νκ΅ κ²μ μλμμ±
- dataλ₯Ό ArrayListμ λ£μ΄μ£Όκ³ , ArrayAdapterλ₯Ό μ΄μ©νμ¬ μ΄κ²μ μ΄λ»κ² 보μ¬μ€μ§ μ§μ νλ€.
val textView = view.findViewById(R.id.mentor_school_edittext) as AutoCompleteTextView
val universities: Array<out String> = resources.getStringArray(R.array.universities_array)
ArrayAdapter<String>(requireContext(), android.R.layout.simple_list_item_1, universities).also { adapter ->
textView.setAdapter(adapter)
}
</selector>
also
: μμ κ°μ²΄ λλ€κ° μ λ¬λ μμ κ°μ²΄λ₯Ό μ ν μ¬μ© νμ§ μκ±°λ μμ κ°μ²΄μ μμ±μ λ³κ²½νμ§ μκ³ μ¬μ©νλ κ²½μ° also λ₯Ό μ¬μ©- νμ₯ν¨μ: κ°μ²΄λ₯Ό μ¬μ©ν λ λͺ
λ Ήλ¬Έλ€μ λΈλμΌλ‘ λ¬Άμ΄μ κ°κ²°νκ² μ¬μ©ν μ μκ² ν΄μ£Όλ ν¨μ
4. Login Extra Info
λ μ΄μμ
TableLayout
<TableRow>
λ‘ κ΅¬μ±android:completionThreshold="2"
: λ¬Έμμ κ°μκ° 2κ°μΌ λλΆν° μλμμ± κ²μ μ€ν
νλκ·Έλ¨ΌνΈ
κ° λ²νΌ μ ν¨μ± 체ν¬
- λΉμ΄ μλμ§ νμΈ
- μ νν λ²νΌμ κ°μκ° 2κ°λ₯Ό λλμ§ νμΈ
5. Login Complete
νλκ·Έλ¨ΌνΈ
Mainpage Activityλ‘ μ΄λ
activity?.let{
val intent = Intent (it, MainActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK
it.startActivity(intent)
}
let
: μμ κ°μ²΄μ μμ± λ³κ²½ κ°λ₯- T?.let { } ννμμλ non-null μ²΄ν¬ κ°λ₯
- cf>
with
λ μμ κ°μ²΄μ μμ±μ λ³κ²½ν μ μμ§λ§ this
λ₯Ό μ¬μ©νμ§ μμλ λλ€λ μ°¨μ΄μ μ‘΄μ¬
6. ν¨μν νλ‘κ·Έλλ°
apply, with, let, also, run ν¨μμ μ°¨μ΄μ
- λ²μ μ§μ ν¨μ μ νΈμΆμμ μμ κ°μ²΄κ° λ§€κ° λ³μλ‘ λͺ
μμ μΌλ‘ μ λ¬λκ±°λ μμ κ°μ²΄μ νμ₯ ν¨μλ‘ μμμ μμ κ°μ²΄ λ‘ μ λ¬λλ€.
- λ²μ μ§μ ν¨μ μ μμ κ°μ²΄ μ§μ λλ€ μ μ λ¬λλ μμ κ°μ²΄κ° λͺ
μμ λ§€κ° λ³μ λ‘ μ λ¬ λκ±°λ μμ κ°μ²΄μ νμ₯ ν¨μλ‘ μμμ μμ κ°μ²΄λ‘ μ½λ λΈλ‘ λ΄λΆλ‘ μ λ¬ λλ€.
- λ²μ μ§μ ν¨μμ κ²°κ³Όλ‘ μμ κ°μ²΄λ₯Ό κ·Έλλ‘ λ°ννκ±°λ μμ κ°μ²΄ μ§μ λλ€ μ μ€ν κ²°κ³Όλ₯Ό λ°ννλ€.
inline fun <T, R> with(receiver: T, block: T.() -> R): R {
return receiver.block()
}
- μΈμλ‘ λ°λ κ°μ²΄λ₯Ό μ΄μ΄μ§λ λΈλ‘μ 리μλ²λ‘ μ λ¬
- λΈλ‘μ κ²°κ³Όκ° λ°ν
run()
κ³Ό λ§€μ° λΉμ·(리μλ²λ‘ μ λ¬ν κ°μ²΄κ° μ΄λμ μμΉνλμ§λ§ λ€λ¦)
inline fun <T> T.also(block: (T) -> Unit): T {
block(this)
return this
}
inline fun <T> T.apply(block: T.() -> Unit): T {
block()
return this
}
- ν¨μλ₯Ό νΈμΆνλ κ°μ²΄λ₯Ό μ΄μ΄μ§λ λΈλ‘μ 리μλ²λ‘ μ λ¬
- 리μλ²: λ°λ‘ μ΄μ΄μ§λ λΈλ‘ λ΄μμ λ©μλ λ° μμ±μ λ°λ‘ μ κ·Όν μ μλλ‘ ν κ°μ²΄
- κ°μ²΄ μ체λ₯Ό λ°ν
- νμ©: νΉμ κ°μ²΄λ₯Ό μμ±νλ©΄μ ν¨κ» μ΄κΈ°νλ₯Ό ν΄μΌν λ
inline fun <T, R> T.let(block: (T) -> R): R {
return block(this)
}
- ν¨μλ₯Ό νΈμΆνλ κ°μ²΄λ₯Ό μ΄μ΄μ§λ λΈλ‘μ μΈμλ‘ λκΉ
- λΈλ‘μ κ²°κ³Όκ° λ°ν
- νμ©: ν¨μλ₯Ό νΈμΆν κ°μ²΄λ₯Ό μΈμλ‘ λ°μΌλ―λ‘, μ΄λ₯Ό μ¬μ©νμ¬ λ€λ₯Έ λ©μλλ₯Ό μ€ννκ±°λ μ°μ°μ μνν΄μΌ νλ κ²½μ°
inline fun <T, R> T.run(block: T.() -> R): R {
return block()
}
- ν¨μλ₯Ό νΈμΆνλ κ°μ²΄λ₯Ό μ΄μ΄μ§λ λΈλ‘μ 리μλ²λ‘ μ λ¬
- λΈλ‘μ κ²°κ³Όκ° λ°ν
- νμ©: νΉμ κ°μ²΄μ λ©μλλ νλλ₯Ό μ°μμ μΌλ‘ νΈμΆνκ±°λ κ°μ ν λΉν λ μ¬μ©
apply()
μ νμ©μ΄ μ μ¬νμ§λ§, apply()
λ μλ‘μ΄ κ°μ²΄λ₯Ό μμ±ν¨κ³Ό λμμ μ°μλ μμ
μ΄ νμν λ μ¬μ©νκ³ run()
μ μ΄λ―Έ μμ±λ κ°μ²΄μ μ°μλ μμ
μ΄ νμν λ μ¬μ©νλ€λ μ μ΄ μ‘°κΈ λ€λ¦
λλ€.