-
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.
- Loading branch information
1 parent
156fb05
commit d8f01c8
Showing
31 changed files
with
1,750 additions
and
321 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
62 changes: 62 additions & 0 deletions
62
app/src/main/java/com/seunggyu/stitch/Util/SnackBarLabelCustom.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,62 @@ | ||
package com.seunggyu.stitch.Util | ||
|
||
import android.content.res.Resources | ||
import android.util.TypedValue | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.core.content.ContextCompat | ||
import androidx.databinding.DataBindingUtil | ||
import com.google.android.material.snackbar.BaseTransientBottomBar.ANIMATION_MODE_SLIDE | ||
import com.google.android.material.snackbar.Snackbar | ||
import com.seunggyu.stitch.R | ||
import com.seunggyu.stitch.databinding.SnackbarCustomBinding | ||
import com.seunggyu.stitch.databinding.SnackbarCustomLabelBinding | ||
|
||
class SnackBarLabelCustom(view: View, private val message: String) { | ||
|
||
companion object { | ||
|
||
fun make(view: View, message: String) = SnackBarLabelCustom(view, message) | ||
} | ||
|
||
private val context = view.context | ||
private val snackbar = Snackbar.make(view, "", 5000) | ||
private val snackbarLayout = snackbar.view as Snackbar.SnackbarLayout | ||
|
||
private val inflater = LayoutInflater.from(context) | ||
private val snackbarBinding: SnackbarCustomLabelBinding = DataBindingUtil.inflate(inflater, R.layout.snackbar_custom_label, null, false) | ||
|
||
init { | ||
initView() | ||
initData() | ||
} | ||
|
||
private fun initView() { | ||
with(snackbarLayout) { | ||
removeAllViews() | ||
val mlayoutParams = snackbarLayout.layoutParams as ViewGroup.MarginLayoutParams | ||
mlayoutParams.setMargins(16.dpToPx(), 0, 16.dpToPx(), 100.dpToPx()) | ||
layoutParams = mlayoutParams | ||
setPadding(0, 0, 0, 0) | ||
setBackgroundColor(ContextCompat.getColor(context, android.R.color.transparent)) | ||
addView(snackbarBinding.root, 0) | ||
} | ||
} | ||
|
||
private fun initData() { | ||
snackbarBinding.tvSnackbarMsg.text = message | ||
} | ||
|
||
fun show() { | ||
snackbar.animationMode = ANIMATION_MODE_SLIDE | ||
snackbar.show() | ||
} | ||
|
||
fun Int.dpToPx(): Int { | ||
return TypedValue.applyDimension( | ||
TypedValue.COMPLEX_UNIT_DIP, this.toFloat(), | ||
Resources.getSystem().displayMetrics | ||
).toInt() | ||
} | ||
} |
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
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
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
9 changes: 9 additions & 0 deletions
9
app/src/main/java/com/seunggyu/stitch/data/model/request/JoinMatchRequest.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,9 @@ | ||
package com.seunggyu.stitch.data.model.request | ||
|
||
|
||
import com.squareup.moshi.Json | ||
|
||
data class JoinMatchRequest( | ||
@Json(name = "id") | ||
val id: String? | ||
) |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/seunggyu/stitch/data/model/request/ReportRequest.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,15 @@ | ||
package com.seunggyu.stitch.data.model.request | ||
|
||
|
||
import com.squareup.moshi.Json | ||
|
||
data class ReportRequest( | ||
@Json(name = "matchId") | ||
val matchId: String?, | ||
@Json(name = "memberId") | ||
val memberId: String?, | ||
@Json(name = "reason") | ||
val reason: String?, | ||
@Json(name = "reporterId") | ||
val reporterId: String? | ||
) |
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
21 changes: 21 additions & 0 deletions
21
app/src/main/java/com/seunggyu/stitch/data/model/response/ReportResponse.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,21 @@ | ||
package com.seunggyu.stitch.data.model.response | ||
|
||
|
||
import com.squareup.moshi.Json | ||
|
||
data class ReportResponse( | ||
@Json(name = "id") | ||
val id: String?, | ||
@Json(name = "matchId") | ||
val matchId: String?, | ||
@Json(name = "memberId") | ||
val memberId: String?, | ||
@Json(name = "reason") | ||
val reason: String?, | ||
@Json(name = "reporterId") | ||
val reporterId: String?, | ||
@Json(name = "sk") | ||
val sk: String?, | ||
@Json(name = "type") | ||
val type: String? | ||
) |
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
63 changes: 63 additions & 0 deletions
63
app/src/main/java/com/seunggyu/stitch/dialog/CustomAlertLabelDialog.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,63 @@ | ||
package com.seunggyu.stitch.dialog | ||
|
||
import android.app.Dialog | ||
import android.content.Context | ||
import android.os.Bundle | ||
import androidx.core.content.ContextCompat | ||
import androidx.databinding.DataBindingUtil | ||
import com.seunggyu.stitch.R | ||
import com.seunggyu.stitch.databinding.DialogCustomAlertBinding | ||
|
||
class CustomAlertLabelDialog( | ||
context: Context, | ||
private val _title: String, | ||
private val _description: String, | ||
private val _negativeText: String, | ||
private val _positiveText: String, | ||
private val _color: String, | ||
) : Dialog(context) { | ||
|
||
private lateinit var binding: DialogCustomAlertBinding | ||
|
||
private var listener: ((Boolean) -> Unit)? = null | ||
|
||
fun setDialogListener(listener: (Boolean) -> Unit) { | ||
this.listener = listener | ||
} | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding = DialogCustomAlertBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
|
||
init() | ||
} | ||
|
||
fun init() { | ||
with(binding) { | ||
title = _title | ||
description = _description | ||
negativeText = _negativeText | ||
positiveText = _positiveText | ||
|
||
when(_color) { | ||
"error" -> { | ||
binding.btnAlertPositive.setBackgroundDrawable(ContextCompat.getDrawable(context, R.drawable.button_round_100_stroke_75_error)) | ||
binding.btnAlertPositive.text = "삭제하기" | ||
binding.btnAlertPositive.setTextColor(ContextCompat.getColor(context, R.color.white)) | ||
} | ||
} | ||
|
||
btnAlertNegative.setOnClickListener { | ||
listener?.invoke(false) | ||
dismiss() | ||
} | ||
|
||
btnAlertPositive.setOnClickListener { | ||
listener?.invoke(true) | ||
dismiss() | ||
} | ||
} | ||
} | ||
|
||
} |
55 changes: 55 additions & 0 deletions
55
app/src/main/java/com/seunggyu/stitch/dialog/MenuMemberBottomSheetDialog.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 @@ | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import android.util.Log | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.activityViewModels | ||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment | ||
import com.seunggyu.stitch.GlobalApplication | ||
import com.seunggyu.stitch.databinding.DialogBottomsheetMatchDetailTimeBinding | ||
import com.seunggyu.stitch.databinding.DialogBottomsheetMenuMemberBinding | ||
import com.seunggyu.stitch.ui.ReportMatchActivity | ||
import com.seunggyu.stitch.viewModel.CreateNewMatchViewModel | ||
|
||
// accessType | ||
// 0 : 매치에서 참여자인경우 (신고하기, 매치취소하기, 취소) | ||
// 1 : 매치에서 참여자가 아닌경우 (신고하기, 취소) | ||
// 2 : 프로필 상대방 신고하는 경우 (신고하기, 취소) | ||
|
||
class MenuMemberBottomSheetDialog(accessType: Int) : | ||
BottomSheetDialogFragment() { | ||
private lateinit var binding: DialogBottomsheetMenuMemberBinding | ||
private val viewModel by activityViewModels<MatchDetailPageViewModel>() | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View { | ||
super.onCreateView(inflater, container, savedInstanceState) | ||
binding = DialogBottomsheetMenuMemberBinding.inflate(inflater, container, false) | ||
|
||
dialogInit() | ||
|
||
return binding.root | ||
} | ||
|
||
private fun dialogInit() { | ||
binding.btnMenuReport?.setOnClickListener { | ||
val intent = Intent(requireContext(), ReportMatchActivity::class.java) | ||
intent.putExtra("matchId", viewModel.passedMatchId.toString()) | ||
intent.putExtra("memberId", "0") | ||
intent.putExtra("reporterId", GlobalApplication.prefs.getString("userId")) | ||
startActivity(intent) | ||
dismiss() | ||
} | ||
binding.btnMenuQuit?.setOnClickListener { | ||
viewModel.quitMatch() | ||
dismiss() | ||
} | ||
binding.btnMenuCancel?.setOnClickListener { | ||
dismiss() | ||
} | ||
} | ||
} |
Oops, something went wrong.