Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .gradle/5.4.1/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/5.4.1/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/5.4.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/5.4.1/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
3 changes: 3 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/app.iml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

object PlanningServiceImpl {
private const val BASE_URL = "http://13.125.42.117:3000/"
private const val BASE_URL = "http://tokddak.ap-northeast-2.elasticbeanstalk.com/"

private val retrofit: Retrofit = Retrofit.Builder()
.baseUrl(BASE_URL)
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/sopt/tokddak/api/Service.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.sopt.tokddak.api

import com.sopt.tokddak.feature.history.HistoryServerItem
import com.sopt.tokddak.feature.expense.PostExpense
import com.sopt.tokddak.feature.history.HistoryServerItem
import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.GET
Expand All @@ -17,4 +17,5 @@ interface Service {
@Body body:PostExpense
) : Call<Unit>

//@POST("/trips/{CityId}")
}
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ class BottomSheetDialog : BottomSheetDialogFragment(), View.OnClickListener {
}
Log.v("Bottm", contents)
(activity as DayActivity).getContents(contents)
//Toast.makeText(context, contents, Toast.LENGTH_SHORT).show()
}
}

Expand Down
14 changes: 11 additions & 3 deletions app/src/main/java/com/sopt/tokddak/feature/day/DayActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.os.Bundle
import android.util.Log
import android.widget.ImageView
import androidx.appcompat.app.AppCompatActivity
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager.HORIZONTAL
Expand All @@ -14,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView
import com.sopt.tokddak.R
import com.sopt.tokddak.feature.bottom.BottomSheetDialog
import com.sopt.tokddak.feature.main.MainActivity
import com.sopt.tokddak.feature.main.OnTripFragment
import kotlinx.android.synthetic.main.activity_day.*


Expand All @@ -33,14 +35,15 @@ class DayActivity : AppCompatActivity() {

private var currentDay = 0

private lateinit var ctnPerfect : ConstraintLayout

private lateinit var layoutManager : LinearLayoutManager

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_day)
ctnPerfect = findViewById(R.id.ctn_perfect)
init()


outer()

img_bar = findViewById(R.id.img_bar)
Expand All @@ -54,6 +57,12 @@ class DayActivity : AppCompatActivity() {
startActivity(intent)
finish()
}

ctnPerfect.setOnClickListener {
val intent = Intent(this, OnTripFragment::class.java)
startActivity(intent)
finish()
}
}

fun init(){
Expand All @@ -67,7 +76,6 @@ class DayActivity : AppCompatActivity() {
dayContents.add(arrayListOf("카페", "노잼", "간편식"))
dayContents.add(arrayListOf("일반호텔"))


}

private fun outer() {
Expand Down
27 changes: 1 addition & 26 deletions app/src/main/java/com/sopt/tokddak/feature/day/DayAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.sopt.tokddak.R
import com.sopt.tokddak.feature.inner.InnerAdapter
import com.sopt.tokddak.feature.inner.InnerData

class DayAdapter(private val context : Context, var dayContents : ArrayList<ArrayList<String>>) : RecyclerView.Adapter<DayAdapter.DayViewHolder>(){

private val innerData = InnerData()
//private val innerData = InnerData()
var data = listOf<DayItem>()
lateinit var innerAdapter : InnerAdapter

Expand All @@ -36,39 +35,15 @@ class DayAdapter(private val context : Context, var dayContents : ArrayList<Arra
val txt_dayNo : TextView = view.findViewById(R.id.txt_dayNo)
val rv_inner : RecyclerView = view.findViewById(R.id.rv_inner)

// fun bind(data : DayItem){
// txt_dayNo.text = data.day
//
// innerAdapter = InnerAdapter(context)
// rv_inner.adapter = innerAdapter
// rv_inner.layoutManager = LinearLayoutManager(context, HORIZONTAL, false)
// rv_inner.setHasFixedSize(true)
//
// //val holder = rv_inner.findViewHolderForAdapterPosition(position) as InnerAdapter.InnerViewHolder
//
// innerAdapter.data = innerData.getInner()
// innerAdapter.notifyDataSetChanged()
// }

fun bind(dayContents : ArrayList<String>){
innerAdapter = InnerAdapter(context, dayContents)
rv_inner.adapter = innerAdapter
rv_inner.layoutManager = LinearLayoutManager(context)
rv_inner.setHasFixedSize(true)

//val holder = rv_inner.findViewHolderForAdapterPosition(position) as InnerAdapter.InnerViewHolder
//
// innerAdapter.data = innerData.getInner()
// innerAdapter.notifyDataSetChanged()
}
}

fun updateDay(){
innerAdapter.notifyDataChange()
}

// fun updateDay(idx : Int, dayContents : ArrayList<String>){
// Log.v("YGYG", innerAdapter.dayContents.toString())
// innerAdapter.notifyDataSetChanged()
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ class ExpenseActivity : AppCompatActivity() {

btn_checked.setOnClickListener {
val cost = tv_extense_input.text.toString().toIntOrNull()
val detail = tv_detail_input.toString()
val detail = tv_detail_input.text.toString()
Log.v("YGYG", "In2")


if (cost == null) {
//TODO: 코스트 입력하라고 토스트 띄우고
Toast.makeText(this, "금액을 입력하세요.", Toast.LENGTH_SHORT).show()
Expand All @@ -49,18 +48,14 @@ class ExpenseActivity : AppCompatActivity() {

sendData(cost, typeInt, detail)
}
}

btn_back_black.setOnClickListener {
finish()
}

btn_checked.setOnClickListener {
// 통신 함수
btn_back_black.setOnClickListener {
finish()
}


}

private fun sendData(cost: Int, category: Int, content: String) {
Expand All @@ -75,29 +70,12 @@ class ExpenseActivity : AppCompatActivity() {

override fun onResponse(call: Call<Unit>, response: Response<Unit>) {
if (response.isSuccessful) {
Toast.makeText(this@ExpenseActivity, "성공", Toast.LENGTH_SHORT).show()
//Toast.makeText(this@ExpenseActivity, "성공", Toast.LENGTH_SHORT).show()
} else {
Log.v("YGYG", response.errorBody().toString())

}
}

})

// setExpense.setExpense().enqueue(object : Callback<ExpenseServerItem>{
// override fun onFailure(call: Call<ExpenseServerItem>, t: Throwable) {
// Log.e("서버 보내기 오류", "t = $t")
// }
//
// override fun onResponse(
// call: Call<ExpenseServerItem>,
// response: Response<ExpenseServerItem>
// ) {
// if(response.isSuccessful){
// val sendData = response.body()!!
// }
// }
// })
}

private fun checking() {
Expand All @@ -118,8 +96,7 @@ class ExpenseActivity : AppCompatActivity() {

private fun setCheckButtonState() {
btn_checked.isEnabled =
type.isNotEmpty() &&
tv_extense_input.text.isNotEmpty()
type.isNotEmpty() && tv_extense_input.text.isNotEmpty()

Log.v("YGYG", tv_extense_input.text.isNotEmpty().toString())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager.VERTICAL
import androidx.recyclerview.widget.RecyclerView
import com.sopt.tokddak.R
import com.sopt.tokddak.common.toDecimalFormat
import kotlinx.android.synthetic.main.activity_expense_history.*
import retrofit2.Call
import retrofit2.Callback
Expand All @@ -28,29 +29,27 @@ class HistoryActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_expense_history)
init()

history_rv_outer = findViewById(R.id.history_rv_outer)
init(history_rv_outer)

img_back.setOnClickListener {
finish()
}
}

private fun init(){
private fun init(view : RecyclerView){

txt_total_price = findViewById(R.id.txt_total_price)
var total = txt_total_price.text.toString().toInt()


divider = DividerItemDecoration(this, 1)
divider.setDrawable(resources.getDrawable(R.drawable.rv_divider))

history_rv_outer = findViewById(R.id.history_rv_outer)

historyAdapter = HistoryAdapter(this)

history_rv_outer.adapter = historyAdapter
history_rv_outer.layoutManager = LinearLayoutManager(this, VERTICAL, false)
history_rv_outer.addItemDecoration(divider)
view.adapter = historyAdapter
view.layoutManager = LinearLayoutManager(this, VERTICAL, false)
view.addItemDecoration(divider)

getHistory.getHistory(1).enqueue(object : Callback<HistoryServerItem>{
override fun onFailure(call: Call<HistoryServerItem>, t: Throwable) {
Expand All @@ -67,6 +66,10 @@ class HistoryActivity : AppCompatActivity() {

historyAdapter.data = historyIn
historyAdapter.notifyDataSetChanged()
var total = 0
historyIn.forEach { total += it.price }
txt_total_price.text = total.toDecimalFormat()

}
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.sopt.tokddak.R
import com.sopt.tokddak.common.toDecimalFormat

class HistoryAdapter(private val context: Context) : RecyclerView.Adapter<HistoryAdapter.HistoryViewHolder>(){

Expand All @@ -32,9 +33,17 @@ class HistoryAdapter(private val context: Context) : RecyclerView.Adapter<Histor
val txt_price : TextView = view.findViewById(R.id.txt_price)

fun bind(historyItem: HistoryServerInItem){
txt_category.text = historyItem.category.toString()

when(historyItem.category.toString()){
"1" -> txt_category.text = "숙박"
"2" -> txt_category.text = "식사"
"3" -> txt_category.text = "간식/주류"
"4" -> txt_category.text = "교통"
"5" -> txt_category.text = "쇼핑"
"6" -> txt_category.text = "액티비티"
}
txt_detail.text = historyItem.detail
txt_price.text = historyItem.price.toString()
txt_price.text = historyItem.price.toDecimalFormat()
}
}
}
13 changes: 10 additions & 3 deletions app/src/main/java/com/sopt/tokddak/feature/inner/InnerAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class InnerAdapter (private val context : Context, var dayContents : ArrayList<S

var data = listOf<InnerItem>()


override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): InnerViewHolder {
val view = LayoutInflater.from(context).inflate(R.layout.rv_item_inner,parent,false)
return InnerViewHolder(view)
Expand All @@ -26,14 +25,22 @@ class InnerAdapter (private val context : Context, var dayContents : ArrayList<S
return holder.bind(dayContents[position])
}

inner class InnerViewHolder (view : View) : RecyclerView.ViewHolder(view){//, BottomAdapter.BottomListener
val ctn_inner : View = view.findViewById(R.id.ctn_inner)
inner class InnerViewHolder (view : View) : RecyclerView.ViewHolder(view), View.OnLongClickListener{//, BottomAdapter.BottomListener
val ctn_inner : View = view.findViewById(R.id.ctn_inner)
val txt_category : TextView = view.findViewById(R.id.txt_category)
val img_category : ImageView = view.findViewById(R.id.img_category)


fun bind(innerItem : String){
txt_category.text = innerItem
ctn_inner.setOnLongClickListener(this)
}

override fun onLongClick(view : View): Boolean {
val position = adapterPosition
dayContents.removeAt(position)
notifyItemRemoved(position)
return true
}
}

Expand Down
15 changes: 11 additions & 4 deletions app/src/main/res/layout/activity_day.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
app:srcCompat="@drawable/navi_btn_back_w" />

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/ctn_perfect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/txt_perfect"
android:layout_width="wrap_content"
Expand All @@ -53,7 +60,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

<TextView
Expand Down Expand Up @@ -85,10 +92,10 @@
android:id="@+id/txt_total_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:textColor="#ffffff"
android:text="000,000"
android:text="0"
android:textSize="24sp"
app:layout_constraintTop_toBottomOf="@+id/txt_explain"
app:layout_constraintStart_toEndOf="@+id/txt_won" />
Expand Down
Loading