Skip to content

Commit

Permalink
[Feat] #39 나의 지갑 화면 구성
Browse files Browse the repository at this point in the history
  • Loading branch information
PIYUJIN committed Nov 30, 2024
1 parent d9bbef5 commit b279cce
Show file tree
Hide file tree
Showing 7 changed files with 307 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/src/main/java/com/project/jangburich/MyApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class MyApplication: Application() {
var agreement4 = false
var agreement5 = false

// 유저 정보
var userName = ""

// 그룹 생성
var groupType = ""
var groupName = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.view.ViewGroup
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.project.jangburich.MyApplication
import com.project.jangburich.R
import com.project.jangburich.api.response.home.Team
import com.project.jangburich.databinding.FragmentHomeBinding
Expand Down Expand Up @@ -48,6 +49,7 @@ class HomeFragment : Fragment(), HomeGroupBottomSheetListener {
viewModel.run {
userName.observe(mainActivity) {
binding.run {
MyApplication.userName = it
textViewName.text = "${it}님 반가워요!"
}
}
Expand Down Expand Up @@ -86,7 +88,14 @@ class HomeFragment : Fragment(), HomeGroupBottomSheetListener {
buttonGroup.setOnClickListener { mainActivity.binding.bottomNavigation.selectedItemId = R.id.menu_group }
// buttonReserve.setOnClickListener { mainActivity.binding.bottomNavigation.selectedItemId = R.id.menu_reserve }

toolbar.buttonWallet.setOnClickListener {
val nextFragment = WalletFragment()

val transaction = mainActivity.manager.beginTransaction()
transaction.replace(R.id.fragmentContainerView_main, nextFragment)
transaction.addToBackStack("")
transaction.commit()
}
}

return binding.root
Expand Down
65 changes: 65 additions & 0 deletions app/src/main/java/com/project/jangburich/ui/home/WalletFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package com.project.jangburich.ui.home

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.project.jangburich.MyApplication
import com.project.jangburich.api.response.home.PurchaseHistory
import com.project.jangburich.databinding.FragmentWalletBinding
import com.project.jangburich.ui.MainActivity
import com.project.jangburich.ui.home.adapter.WalletAdapter
import com.project.jangburich.ui.home.viewModel.WalletViewModel

class WalletFragment : Fragment() {

lateinit var binding: FragmentWalletBinding
lateinit var mainActivity: MainActivity
lateinit var viewModel: WalletViewModel
lateinit var walletAdapter: WalletAdapter

var getPaymentHistory = mutableListOf<PurchaseHistory>()

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {

binding = FragmentWalletBinding.inflate(layoutInflater)
mainActivity = activity as MainActivity
viewModel = ViewModelProvider(mainActivity)[WalletViewModel::class.java]


binding.run {
buttonCharge.setOnClickListener {
}
}

return binding.root
}

override fun onResume() {
super.onResume()
initView()
}


fun initView() {
viewModel.getWalletData(mainActivity)

binding.run {
textViewUserName.text = "${MyApplication.userName}님의 보유 금액"

toolbar.run {
textViewTitle.text = "나의 지갑"
buttonBack.setOnClickListener {
fragmentManager?.popBackStack()
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

<solid android:color="@color/main_orange"/>

<corners android:radius="99dp"/>
</shape>
144 changes: 144 additions & 0 deletions app/src/main/res/layout/fragment_wallet.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/gray_95"
tools:context=".ui.home.WalletFragment">

<include
android:id="@+id/toolbar"
layout="@layout/toolbar_back_title_left"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"
android:layout_marginTop="30dp"
android:background="@drawable/background_gray100_round10"
android:padding="20dp"
app:layout_constraintTop_toBottomOf="@+id/toolbar"
tools:layout_editor_absoluteX="20dp">

<TextView
android:id="@+id/textView_user_name"
style="@style/Detail1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="님의 보유 금액"
android:textColor="@color/gray_30"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="15dp"
android:background="@color/gray_90"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView_user_name" />

<TextView
android:id="@+id/textView_user_point"
style="@style/Headline6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="0원"
android:textColor="@color/gray_20"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider" />

<TextView
android:id="@+id/button_charge"
style="@style/body2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/background_button_orange_round99"
android:paddingHorizontal="12dp"
android:paddingVertical="6dp"
android:text="충전하기"
android:textColor="@color/gray_100"
app:layout_constraintBottom_toBottomOf="@+id/textView_user_point"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/textView_user_point" />
</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="25dp"
android:background="@color/gray_100"
android:padding="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout3">

<TextView
android:id="@+id/textView_payment_title"
style="@style/Headline4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="결제 내역"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/textView_filter"
style="@style/Detail1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="전체"
android:textColor="@color/gray_60"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView_payment_title" />

<ImageView
android:id="@+id/imageView_filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_arrow_down"
app:layout_constraintBottom_toBottomOf="@+id/textView_filter"
app:layout_constraintStart_toEndOf="@+id/textView_filter"
app:layout_constraintTop_toTopOf="@+id/textView_filter" />

<ImageView
android:id="@+id/imageView_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_search_gray60"
app:layout_constraintBottom_toBottomOf="@+id/textView_filter"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/textView_filter" />

<View
android:id="@+id/divider_payment"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="15dp"
android:background="@color/gray_90"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView_filter" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView_payment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
app:layout_constraintTop_toBottomOf="@+id/divider_payment"
tools:layout_editor_absoluteX="16dp" />
</androidx.constraintlayout.widget.ConstraintLayout>


</androidx.constraintlayout.widget.ConstraintLayout>
49 changes: 49 additions & 0 deletions app/src/main/res/layout/row_wallet_payment.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp">

<TextView
android:id="@+id/textView_date"
style="@style/body3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="11.23"
android:textColor="@color/gray_60"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/textView_title"
style="@style/body2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="장부리치 지갑"
android:textColor="@color/gray_30"
app:layout_constraintStart_toEndOf="@+id/textView_date"
app:layout_constraintTop_toTopOf="@+id/textView_date" />

<TextView
android:id="@+id/textView_description"
style="@style/Label3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="지갑 충전"
android:textColor="@color/gray_50"
app:layout_constraintStart_toStartOf="@+id/textView_title"
app:layout_constraintTop_toBottomOf="@+id/textView_title" />

<TextView
android:id="@+id/textView_payment_value"
style="@style/body2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="-00원"
android:textColor="@color/gray_30"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
30 changes: 30 additions & 0 deletions app/src/main/res/layout/toolbar_back_title_left.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto">

<ImageView
android:id="@+id/button_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_back" />

<TextView
android:id="@+id/textView_title"
style="@style/Headline3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
app:layout_constraintBottom_toBottomOf="@+id/button_back"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/button_back"
app:layout_constraintTop_toTopOf="@+id/button_back" />

</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit b279cce

Please sign in to comment.