forked from yy0ung/nibobnebob
-
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.
#86 refactor : BottomSheet 함수 -> class 변경
- Loading branch information
Showing
3 changed files
with
59 additions
and
53 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
...pp/src/main/java/com/avengers/nibobnebob/presentation/customview/RestaurantBottomSheet.kt
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,55 @@ | ||
package com.avengers.nibobnebob.presentation.customview | ||
|
||
import android.content.Context | ||
import android.view.LayoutInflater | ||
import com.avengers.nibobnebob.R | ||
import com.avengers.nibobnebob.databinding.BottomSheetRestaurantBinding | ||
import com.avengers.nibobnebob.presentation.ui.main.home.model.UiMarkerData | ||
import com.google.android.material.bottomsheet.BottomSheetDialog | ||
|
||
|
||
class RestaurantBottomSheet( | ||
context: Context, | ||
private val data: UiMarkerData, | ||
private val onClickAddWishRestaurant: (Int, Boolean) -> Boolean, | ||
private val onClickAddMyRestaurant: (Int) -> Unit, | ||
private val onClickGoReview: (Int) -> Unit | ||
): BottomSheetDialog(context) { | ||
|
||
private var binding: BottomSheetRestaurantBinding | ||
private var isWishState = data.isInWishList | ||
|
||
init{ | ||
binding = BottomSheetRestaurantBinding.inflate(LayoutInflater.from(context)) | ||
setContentView(binding.root) | ||
binding.item = data | ||
setBottomSheetListener() | ||
} | ||
|
||
private fun setBottomSheetListener(){ | ||
binding.btnAddMyRestaurant.setOnClickListener { | ||
onClickAddMyRestaurant(data.id) | ||
dismiss() | ||
} | ||
|
||
binding.btnAddWishRestaurant.setOnClickListener { | ||
val result = onClickAddWishRestaurant(data.id, data.isInWishList) | ||
|
||
if (result) { | ||
isWishState = !isWishState | ||
|
||
if (isWishState) { | ||
binding.btnAddWishRestaurant.setBackgroundResource(R.drawable.ic_star_full) | ||
} else { | ||
binding.btnAddWishRestaurant.setBackgroundResource(R.drawable.ic_star_border) | ||
} | ||
} | ||
} | ||
|
||
binding.btnGoReview.setOnClickListener { | ||
onClickGoReview(data.id) | ||
dismiss() | ||
} | ||
} | ||
|
||
} |
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
50 changes: 0 additions & 50 deletions
50
Aos/app/src/main/java/com/avengers/nibobnebob/presentation/util/BottomSheetManager.kt
This file was deleted.
Oops, something went wrong.