-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
23 changed files
with
562 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
NATIVE_APP_KEY="9b2f66acc93d43f7e7b78b7158409ed4" |
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 @@ | ||
NATIVE_APP_KEY="9b2f66acc93d43f7e7b78b7158409ed4" |
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,129 @@ | ||
package com.wish.bunny.wish | ||
|
||
import android.app.DatePickerDialog | ||
import android.graphics.Color | ||
import android.os.Bundle | ||
import android.text.Html | ||
import android.view.View | ||
import android.widget.Button | ||
import android.widget.TextView | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.core.content.ContextCompat | ||
import com.wish.bunny.R | ||
import java.text.SimpleDateFormat | ||
import java.util.Calendar | ||
import java.util.Locale | ||
|
||
class WishInsertActivity : AppCompatActivity() { | ||
private val btnOpenCalendar: Button by lazy { findViewById<Button>(R.id.btnOpenCalendar) } | ||
private val tvSelectedDate: TextView by lazy { findViewById<TextView>(R.id.tvSelectedDate) } | ||
private val selectedDate: Calendar = Calendar.getInstance() | ||
private val selectedButtons: MutableList<Button> = mutableListOf() | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_insert) | ||
|
||
val button1: Button = findViewById(R.id.button1) | ||
val button2: Button = findViewById(R.id.button2) | ||
val button3: Button = findViewById(R.id.button3) | ||
|
||
val pinkColor = ContextCompat.getColor(this, R.color.pink) | ||
val changeTextColor = ContextCompat.getColor(this, R.color.white) | ||
val transparentColor = ContextCompat.getColor(this, R.color.ivory) | ||
val originalTextColor = ContextCompat.getColor(this, R.color.black) // 원래의 글자색 저장 | ||
|
||
button1.setOnClickListener { | ||
button1.setBackgroundColor(pinkColor) // 핑크색으로 변경 | ||
button1.setTextColor(changeTextColor) // 글자색을 원래대로 | ||
button2.setBackgroundColor(transparentColor) // 다른 버튼은 원래 색으로 | ||
button2.setTextColor(originalTextColor) | ||
button3.setBackgroundColor(transparentColor) | ||
button3.setTextColor(originalTextColor) | ||
} | ||
|
||
button2.setOnClickListener { | ||
button2.setBackgroundColor(pinkColor) | ||
button2.setTextColor(changeTextColor) // 글자색을 원래대로 | ||
button1.setBackgroundColor(transparentColor) // 다른 버튼은 원래 색으로 | ||
button1.setTextColor(originalTextColor) | ||
button3.setBackgroundColor(transparentColor) | ||
button3.setTextColor(originalTextColor) | ||
} | ||
|
||
button3.setOnClickListener { | ||
button3.setBackgroundColor(pinkColor) | ||
button3.setTextColor(changeTextColor) // 글자색을 원래대로 | ||
button1.setBackgroundColor(transparentColor) // 다른 버튼은 원래 색으로 | ||
button1.setTextColor(originalTextColor) | ||
button2.setBackgroundColor(transparentColor) | ||
button2.setTextColor(originalTextColor) | ||
} | ||
} | ||
|
||
// 클릭 이벤트 핸들러 | ||
fun onCalendarButtonClick(view: View) { | ||
openDatePickerDialog() | ||
} | ||
|
||
private fun openDatePickerDialog() { | ||
val datePickerDialog = DatePickerDialog( | ||
this, | ||
dateSetListener, | ||
selectedDate[Calendar.YEAR], | ||
selectedDate[Calendar.MONTH], | ||
selectedDate[Calendar.DAY_OF_MONTH] | ||
) | ||
datePickerDialog.show() | ||
} | ||
|
||
private val dateSetListener = | ||
DatePickerDialog.OnDateSetListener { _, year, month, dayOfMonth -> | ||
selectedDate[Calendar.YEAR] = year | ||
selectedDate[Calendar.MONTH] = month | ||
selectedDate[Calendar.DAY_OF_MONTH] = dayOfMonth | ||
updateSelectedDate() | ||
} | ||
|
||
private fun updateSelectedDate() { | ||
val dateFormat = SimpleDateFormat("yyyy년 MM월 dd일 EEEE까지", Locale.getDefault()) | ||
val formattedDate = dateFormat.format(selectedDate.time) | ||
tvSelectedDate.text = formattedDate | ||
} | ||
|
||
// 해시태그 버튼 클릭 이벤트 처리 | ||
fun onHashtagButtonClick(view: View) { | ||
val clickedButton = view as Button | ||
|
||
// 이미 선택된 버튼인지 확인 | ||
if (selectedButtons.contains(clickedButton)) { | ||
// 이미 선택된 경우, 선택 해제 | ||
selectedButtons.remove(clickedButton) | ||
updateButtonState(clickedButton, isSelected = false) | ||
} else { | ||
// 선택되지 않은 경우, 최대 선택 개수 확인 후 선택 | ||
if (selectedButtons.size < 2) { | ||
selectedButtons.add(clickedButton) | ||
updateButtonState(clickedButton, isSelected = true) | ||
} | ||
} | ||
} | ||
|
||
// 버튼의 선택 여부에 따라 상태 업데이트하는 함수 | ||
private fun updateButtonState(button: Button, isSelected: Boolean) { | ||
val pinkColor = ContextCompat.getColor(this, R.color.pink) | ||
val transparentColor = ContextCompat.getColor(this, R.color.ivory) | ||
|
||
button.isSelected = isSelected | ||
|
||
if (isSelected) { | ||
// 선택된 경우 | ||
button.setTextColor(Color.WHITE) | ||
button.setBackgroundColor(pinkColor) | ||
} else { | ||
// 선택 해제된 경우 | ||
button.setTextColor(Color.BLACK) | ||
button.setBackgroundColor(transparentColor) | ||
} | ||
} | ||
} |
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,5 @@ | ||
<vector android:autoMirrored="true" android:height="24dp" | ||
android:tint="#000000" android:viewportHeight="24" | ||
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path android:fillColor="@android:color/white" android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<vector | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:aapt="http://schemas.android.com/aapt" | ||
android:width="319dp" | ||
android:height="39dp" | ||
android:viewportWidth="319" | ||
android:viewportHeight="39" | ||
> | ||
<group> | ||
<clip-path | ||
android:pathData="M15 0H304C312.284 0 319 6.71573 319 15V24C319 32.2843 312.284 39 304 39H15C6.71573 39 0 32.2843 0 24V15C0 6.71573 6.71573 0 15 0Z" | ||
/> | ||
<path | ||
android:pathData="M0 0V39H319V0" | ||
android:fillColor="#F7F3F1" | ||
/> | ||
</group> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<vector android:height="24dp" android:tint="#000000" | ||
android:viewportHeight="24" android:viewportWidth="24" | ||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path android:fillColor="@android:color/white" android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2zM17,15.59L15.59,17 12,13.41 8.41,17 7,15.59 10.59,12 7,8.41 8.41,7 12,10.59 15.59,7 17,8.41 13.41,12 17,15.59z"/> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<vector | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:aapt="http://schemas.android.com/aapt" | ||
android:width="299dp" | ||
android:height="88dp" | ||
android:viewportWidth="299" | ||
android:viewportHeight="88" | ||
> | ||
<group> | ||
<clip-path | ||
android:pathData="M8 0H291C295.418 0 299 3.58172 299 8V80C299 84.4183 295.418 88 291 88H8C3.58172 88 0 84.4183 0 80V8C0 3.58172 3.58172 0 8 0Z" | ||
/> | ||
<path | ||
android:pathData="M0 0V88H299V0" | ||
android:fillColor="#F7F3F1" | ||
/> | ||
</group> | ||
</vector> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<vector | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:aapt="http://schemas.android.com/aapt" | ||
android:width="299dp" | ||
android:height="44dp" | ||
android:viewportWidth="299" | ||
android:viewportHeight="44" | ||
> | ||
<group> | ||
<clip-path | ||
android:pathData="M8 0H291C295.418 0 299 3.58172 299 8V36C299 40.4183 295.418 44 291 44H8C3.58172 44 0 40.4183 0 36V8C0 3.58172 3.58172 0 8 0Z" | ||
/> | ||
<path | ||
android:pathData="M0 0V44H299V0" | ||
android:fillColor="#F7F3F1" | ||
/> | ||
</group> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<vector | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:aapt="http://schemas.android.com/aapt" | ||
android:width="319dp" | ||
android:height="39dp" | ||
android:viewportWidth="319" | ||
android:viewportHeight="39" | ||
> | ||
<group> | ||
<clip-path | ||
android:pathData="M15 0H304C312.284 0 319 6.71573 319 15V24C319 32.2843 312.284 39 304 39H15C6.71573 39 0 32.2843 0 24V15C0 6.71573 6.71573 0 15 0Z" | ||
/> | ||
<path | ||
android:pathData="M0 0V39H319V0" | ||
android:fillColor="#F7F3F1" | ||
/> | ||
</group> | ||
</vector> |
Oops, something went wrong.