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.
Co-authored-by: BENDENG1 <[email protected]> Co-authored-by: yy0ung <[email protected]>
- Loading branch information
1 parent
fdc9e9e
commit 1b072a3
Showing
3 changed files
with
225 additions
and
135 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
47 changes: 47 additions & 0 deletions
47
Aos/app/src/main/java/com/avengers/nibobnebob/presentation/util/BottomSheetManager.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,47 @@ | ||
package com.avengers.nibobnebob.presentation.util | ||
|
||
import android.content.Context | ||
import android.view.LayoutInflater | ||
import com.avengers.nibobnebob.R | ||
import com.avengers.nibobnebob.databinding.BottomSheetRestaurantBinding | ||
import com.google.android.material.bottomsheet.BottomSheetDialog | ||
|
||
|
||
internal fun restaurantSheet( | ||
context: Context, | ||
restaurantId: Int, | ||
isWish: Boolean, | ||
onClickAddWishRestaurant: (Int, Boolean) -> Boolean, | ||
onClickAddMyRestaurant: (Int) -> Unit, | ||
onClickGoReview: (Int) -> Unit | ||
): BottomSheetDialog { | ||
val dialog = BottomSheetDialog(context) | ||
val binding = BottomSheetRestaurantBinding.inflate(LayoutInflater.from(context)) | ||
dialog.setContentView(binding.root) | ||
|
||
var isWishState = isWish | ||
|
||
binding.btnAddMyRestaurant.setOnClickListener { | ||
onClickAddMyRestaurant(restaurantId) | ||
} | ||
|
||
binding.btnAddWishRestaurant.setOnClickListener { | ||
val result = onClickAddWishRestaurant(restaurantId, isWish) | ||
|
||
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(restaurantId) | ||
} | ||
|
||
return dialog | ||
} |
Oops, something went wrong.