Skip to content

Commit

Permalink
Merge pull request #11 from WishBunny/feat/#1
Browse files Browse the repository at this point in the history
Feat/#1
  • Loading branch information
codeSweet0828 authored Jan 23, 2024
2 parents 349884d + 279a202 commit 6a2beaf
Show file tree
Hide file tree
Showing 23 changed files with 562 additions and 11 deletions.
1 change: 1 addition & 0 deletions api.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NATIVE_APP_KEY="9b2f66acc93d43f7e7b78b7158409ed4"
1 change: 1 addition & 0 deletions app/api.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NATIVE_APP_KEY="9b2f66acc93d43f7e7b78b7158409ed4"
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.ar.sceneform:filament-android:1.17.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
Expand Down
9 changes: 1 addition & 8 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,7 @@
<activity
android:name=".MainActivity"
android:exported="true">
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
<!-- </intent-filter>-->
</activity>
<activity
android:name="com.kakao.sdk.auth.AuthCodeHandlerActivity"
android:exported="true">

<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/wish/bunny/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.wish.bunny

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.google.android.material.bottomnavigation.BottomNavigationView
import androidx.appcompat.app.AppCompatActivity
import android.util.Log
import com.kakao.sdk.common.util.Utility
import com.wish.bunny.databinding.ActivityMainBinding
Expand Down
129 changes: 129 additions & 0 deletions app/src/main/java/com/wish/bunny/wish/WishInsert.kt
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)
}
}
}
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/arrow_back.xml
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>
19 changes: 19 additions & 0 deletions app/src/main/res/drawable/button_background.xml
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>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/cancel.xml
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>
19 changes: 19 additions & 0 deletions app/src/main/res/drawable/content_id.xml
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>
Binary file added app/src/main/res/drawable/img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/img_date.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/reset_img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions app/src/main/res/drawable/select_day.xml
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>
19 changes: 19 additions & 0 deletions app/src/main/res/drawable/some_id.xml
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>
Loading

0 comments on commit 6a2beaf

Please sign in to comment.