generated from NOW-SOPT-ANDROID/now-sopt-android-template
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/week02 xml #3
Open
t1nm1ksun
wants to merge
13
commits into
develop-xml
Choose a base branch
from
feat/week02_xml
base: develop-xml
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ef00a97
init commit
t1nm1ksun 2d76926
Add: week1 components
t1nm1ksun 20bedec
Add: MyPage add
t1nm1ksun 22db324
Add: MyProfile add
t1nm1ksun 180cbfd
Edit: delete yellow line warning
t1nm1ksun f735064
Edit: data change
t1nm1ksun 5f9bfa7
Edit: manifest change
t1nm1ksun f63dbf9
Edit: categori
t1nm1ksun 0f45066
Edit: categori add
t1nm1ksun 84688b5
Fix: Manifest path edit
t1nm1ksun c5b4502
fix: apply review
t1nm1ksun 64cd7d2
fix: constant manage by enum class
t1nm1ksun 7c7ee7a
Update LoginActivity.kt
t1nm1ksun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package com.sopt.now.Activity | ||
|
||
import android.os.Bundle | ||
import android.util.Log | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.fragment.app.Fragment | ||
import com.sopt.now.Fragment.HomeFragment | ||
import com.sopt.now.Fragment.MyPageFragment | ||
import com.sopt.now.Fragment.SearchFragment | ||
import com.sopt.now.R | ||
import com.sopt.now.databinding.ActivityHomeBinding | ||
class HomeActivity : AppCompatActivity() { | ||
private lateinit var binding: ActivityHomeBinding | ||
private val nameId="ID" | ||
private val namePassword = "PASSWORD" | ||
private val nameNickname = "NICKNAME" | ||
private val nameMbti = "MBTI" | ||
|
||
private lateinit var userId: String | ||
private lateinit var userPassword: String | ||
private lateinit var userNickname: String | ||
private lateinit var userMbti: String | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding = ActivityHomeBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
|
||
Log.d("HomeActivity","HomeActivity onCreate") | ||
|
||
|
||
userId = intent.getStringExtra(nameId).toString() | ||
userPassword = intent.getStringExtra(namePassword).toString() | ||
userNickname = intent.getStringExtra(nameNickname).toString() | ||
userMbti = intent.getStringExtra(nameMbti).toString() | ||
|
||
clickBottomNavigation() | ||
|
||
val currentFragment = supportFragmentManager.findFragmentById(binding.fcvHome.id) | ||
if (currentFragment == null) { | ||
supportFragmentManager.beginTransaction() | ||
.add(binding.fcvHome.id, HomeFragment(userNickname)) | ||
.commit() | ||
} | ||
} | ||
|
||
private fun clickBottomNavigation() { | ||
binding.bnvHome.setOnItemSelectedListener { | ||
when (it.itemId) { | ||
R.id.menu_home -> { | ||
replaceFragment(HomeFragment(userNickname)) | ||
true | ||
} | ||
|
||
R.id.menu_search -> { | ||
replaceFragment(SearchFragment()) | ||
true | ||
} | ||
|
||
R.id.menu_mypage -> { | ||
replaceFragment(MyPageFragment(userId,userPassword,userNickname,userMbti)) | ||
true | ||
} | ||
|
||
else -> false | ||
} | ||
} | ||
} | ||
|
||
private fun replaceFragment(fragment: Fragment) { | ||
supportFragmentManager.beginTransaction() | ||
.replace(binding.fcvHome.id, fragment) | ||
.commit() | ||
} | ||
} |
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,75 @@ | ||
package com.sopt.now.Activity | ||
|
||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import android.util.Log | ||
import androidx.appcompat.app.AppCompatActivity | ||
import com.google.android.material.snackbar.Snackbar | ||
import com.sopt.now.databinding.ActivityLoginBinding | ||
|
||
class LoginActivity : AppCompatActivity() { | ||
private lateinit var binding: ActivityLoginBinding | ||
private val nameId = "ID" | ||
private val namePassword = "PASSWORD" | ||
private val nameNickname = "NICKNAME" | ||
private val nameMbti = "MBTI" | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding = ActivityLoginBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
|
||
val id = intent.getStringExtra(nameId) | ||
val password = intent.getStringExtra(namePassword) | ||
val nickname = intent.getStringExtra(nameNickname) | ||
val mbti = intent.getStringExtra(nameMbti) | ||
|
||
|
||
binding.loginBtn.setOnClickListener { | ||
val enteredId = binding.editTextId.text.toString() | ||
val enteredPassword = binding.editTextPw.text.toString() | ||
|
||
when { | ||
enteredId != id -> { | ||
Snackbar.make( | ||
binding.root, | ||
"์์ด๋๋ฅผ ํ์ธํ์ธ์.", | ||
Snackbar.LENGTH_SHORT | ||
).show() | ||
} | ||
|
||
enteredPassword != password -> { | ||
Snackbar.make( | ||
binding.root, | ||
"๋น๋ฐ๋ฒํธ๋ฅผ ํ์ธํ์ธ์.", | ||
Snackbar.LENGTH_SHORT | ||
).show() | ||
} | ||
|
||
else -> { | ||
Log.d("Login Success", "Login Success") | ||
val intentHome = Intent(this, HomeActivity::class.java).apply { | ||
putExtra(nameId, id) | ||
putExtra(namePassword, password) | ||
putExtra(nameNickname, nickname) | ||
putExtra(nameMbti, mbti) | ||
} | ||
Snackbar.make( | ||
binding.root, | ||
"๋ก๊ทธ์ธ ์ฑ๊ณต!", | ||
Snackbar.LENGTH_SHORT | ||
).show() | ||
startActivity(intentHome) | ||
|
||
} | ||
} | ||
|
||
} | ||
binding.goSignupBtn.setOnClickListener { | ||
val intentSignup = Intent(this, SignUpActivity::class.java) | ||
startActivity(intentSignup) | ||
} | ||
|
||
} | ||
} |
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,77 @@ | ||
package com.sopt.now.Activity | ||
|
||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
import com.google.android.material.snackbar.Snackbar | ||
import com.sopt.now.R | ||
import com.sopt.now.databinding.ActivityMainBinding | ||
|
||
class MainActivity : AppCompatActivity() { | ||
private lateinit var binding: ActivityMainBinding | ||
private val nameId="ID" | ||
private val namePassword = "PASSWORD" | ||
private val nameNickname = "NICKNAME" | ||
private val nameMbti = "MBTI" | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding = ActivityMainBinding.inflate(layoutInflater) //TODO: inflate ๋ ๋ฒ ํ๋ฉด ์ค๋ฅ ๊ณต๋ถ | ||
setContentView(binding.root) | ||
|
||
|
||
|
||
val id = intent.getStringExtra(nameId) | ||
val password = intent.getStringExtra(namePassword) | ||
val nickname = intent.getStringExtra(nameNickname) | ||
val mbti = intent.getStringExtra(nameMbti) | ||
|
||
Snackbar.make( | ||
binding.root, | ||
"๋ก๊ทธ์ธ ์ฑ๊ณต!", | ||
Snackbar.LENGTH_SHORT | ||
).show() | ||
|
||
|
||
binding.textNickname.text = getString(R.string.nickname,nickname) | ||
binding.textMbti.text = getString(R.string.mbti,mbti) | ||
binding.textId.text="$id" | ||
binding.textPw.text="$password" | ||
|
||
|
||
|
||
val mbtiImageName = mbti?.lowercase() + ".png" | ||
val mbtiImageId = mbtiImageName.let { resources.getIdentifier(it, "drawable", packageName) } | ||
// TODO: getIdentifier ๋ง๊ณ ๋ค๋ฅธ ๋ฐฉ๋ฒ์ผ๋ก ํ์ผ ์ฐพ์๋ณด๊ธฐ | ||
if (mbtiImageId != 0) { | ||
binding.imageMbti.setImageResource(mbtiImageId) | ||
|
||
} | ||
|
||
val mbtiDescriptionMap = mapOf( | ||
"ISFP" to R.string.isfp, | ||
"ISFJ" to R.string.isfj, | ||
"ISTP" to R.string.istp, | ||
"ISTJ" to R.string.istj, | ||
"INFP" to R.string.infp, | ||
"INFJ" to R.string.infj, | ||
"INTP" to R.string.intp, | ||
"INTJ" to R.string.intj, | ||
"ESFP" to R.string.esfp, | ||
"ESFJ" to R.string.esfj, | ||
"ESTP" to R.string.estp, | ||
"ESTJ" to R.string.estj, | ||
"ENFP" to R.string.enfp, | ||
"ENFJ" to R.string.enfj, | ||
"ENTP" to R.string.entp, | ||
"ENTJ" to R.string.entj | ||
|
||
) | ||
|
||
val mbtiDescriptionResId = mbti?.let { mbtiDescriptionMap[it] } | ||
|
||
|
||
val mbtiDescription = mbtiDescriptionResId?.let { getString(it) } ?: getString(R.string.default_description) | ||
|
||
binding.textMbtiDes.text = mbtiDescription | ||
|
||
} | ||
} |
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,81 @@ | ||
package com.sopt.now.Activity | ||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
import com.google.android.material.snackbar.Snackbar | ||
import com.sopt.now.databinding.ActivitySignUpBinding | ||
|
||
class SignUpActivity : AppCompatActivity() { | ||
private lateinit var binding: ActivitySignUpBinding | ||
private val nameId="ID" | ||
private val namePassword = "PASSWORD" | ||
private val nameNickname = "NICKNAME" | ||
private val nameMbti = "MBTI" | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding = ActivitySignUpBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
|
||
|
||
binding.signupBtn.setOnClickListener { | ||
val mbtiInput = binding.editTextMbti.text.toString().uppercase() | ||
|
||
val id = binding.editTextId.text.toString() | ||
val password = binding.editTextPw.text.toString() | ||
val nickname = binding.editTextNn.text.toString() | ||
val mbti = binding.editTextMbti.text.toString().uppercase() | ||
|
||
when { | ||
id.length !in 6..10 -> { | ||
Snackbar.make( | ||
binding.root, | ||
"ID๋ 6~10๊ธ์์ฌ์ผ ํฉ๋๋ค.", | ||
Snackbar.LENGTH_SHORT | ||
).show() | ||
} | ||
password.length !in 8..12 -> { | ||
Snackbar.make( | ||
binding.root, | ||
"Password๋ 8~12๊ธ์์ฌ์ผ ํฉ๋๋ค.", | ||
Snackbar.LENGTH_SHORT | ||
).show() | ||
} | ||
nickname.isEmpty() -> { | ||
Snackbar.make( | ||
binding.root, | ||
"๋๋ค์์ ํ ๊ธ์ ์ด์์ด์ด์ผ ํฉ๋๋ค.", | ||
Snackbar.LENGTH_SHORT | ||
).show() | ||
} | ||
mbtiInput.length != 4 || !validMBTI(mbtiInput) -> { | ||
Snackbar.make( | ||
binding.root, | ||
"MBTI ํ์์ด ์ฌ๋ฐ๋ฅด์ง ์์ต๋๋ค. (E/I, S/N, F/T, P/J)", | ||
Snackbar.LENGTH_SHORT | ||
).show() | ||
} | ||
else -> { | ||
val intent = Intent(this, LoginActivity::class.java).apply { | ||
putExtra(nameId, id) | ||
putExtra(namePassword, password) | ||
putExtra(nameNickname, nickname) | ||
putExtra(nameMbti, mbti) | ||
} | ||
Snackbar.make( | ||
binding.root, | ||
"ํ์๊ฐ์ ์ฑ๊ณต", | ||
Snackbar.LENGTH_SHORT | ||
).show() | ||
startActivity(intent) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ์ด๋ ๊ฒ ๋ก๊ทธ์ธ ์กํฐ๋นํฐ๋ก ์ด๋ํ๋ค, ๋ก๊ทธ์ธ ์กํฐ๋นํฐ์์ ๋ค๋ก๊ฐ๊ธฐ ๋ฒํผ์ ๋๋ฅด๋ฉด ์ด๋ป๊ฒ ๋ ๊น์? |
||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
fun validMBTI(mbti:String):Boolean{ | ||
val validMBTIPattern = Regex("[EI][SN][TF][JP]") | ||
return validMBTIPattern.matches(mbti) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์์๋ฅผ ๊ด๋ฆฌํ๋ ๋ ์ข์ ๋ฐฉ์์ด ์์ ๊ฒ ๊ฐ์ต๋๋ค !