-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
13 changed files
with
321 additions
and
81 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
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
57 changes: 57 additions & 0 deletions
57
app/src/main/java/com/el/yello/presentation/main/profile/schoolmod/SchoolModDialog.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,57 @@ | ||
package com.el.yello.presentation.main.profile.schoolmod | ||
|
||
import android.content.res.Resources | ||
import android.os.Bundle | ||
import android.view.View | ||
import android.view.WindowManager | ||
import androidx.fragment.app.activityViewModels | ||
import com.el.yello.R | ||
import com.el.yello.databinding.FragmentProfileModDialogBinding | ||
import com.example.ui.base.BindingDialogFragment | ||
import com.example.ui.extension.setOnSingleClickListener | ||
import dagger.hilt.android.AndroidEntryPoint | ||
|
||
@AndroidEntryPoint | ||
class SchoolModDialog : | ||
BindingDialogFragment<FragmentProfileModDialogBinding>(R.layout.fragment_profile_mod_dialog) { | ||
|
||
private val viewModel by activityViewModels<SchoolProfileModViewModel>() | ||
|
||
override fun onStart() { | ||
super.onStart() | ||
setDialogBackground() | ||
} | ||
|
||
private fun setDialogBackground() { | ||
val deviceWidth = Resources.getSystem().displayMetrics.widthPixels | ||
val dialogHorizontalMargin = (Resources.getSystem().displayMetrics.density * 16) * 2 | ||
|
||
dialog?.window?.apply { | ||
setLayout( | ||
(deviceWidth - dialogHorizontalMargin * 2).toInt(), | ||
WindowManager.LayoutParams.WRAP_CONTENT, | ||
) | ||
setBackgroundDrawableResource(R.color.transparent) | ||
} | ||
dialog?.setCanceledOnTouchOutside(false) | ||
dialog?.setCancelable(true) | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
initModBtnListener() | ||
initRejectBtnListener() | ||
} | ||
|
||
private fun initRejectBtnListener() { | ||
binding.btnProfileDialogReject.setOnSingleClickListener { dismiss() } | ||
} | ||
|
||
private fun initModBtnListener() { | ||
binding.btnProfileDialogMod.setOnSingleClickListener { | ||
viewModel.getSchoolGroupIdFromServer() | ||
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
57 changes: 57 additions & 0 deletions
57
app/src/main/java/com/el/yello/presentation/main/profile/univmod/UnivModDialog.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,57 @@ | ||
package com.el.yello.presentation.main.profile.univmod | ||
|
||
import android.content.res.Resources | ||
import android.os.Bundle | ||
import android.view.View | ||
import android.view.WindowManager | ||
import androidx.fragment.app.activityViewModels | ||
import com.el.yello.R | ||
import com.el.yello.databinding.FragmentProfileModDialogBinding | ||
import com.example.ui.base.BindingDialogFragment | ||
import com.example.ui.extension.setOnSingleClickListener | ||
import dagger.hilt.android.AndroidEntryPoint | ||
|
||
@AndroidEntryPoint | ||
class UnivModDialog : | ||
BindingDialogFragment<FragmentProfileModDialogBinding>(R.layout.fragment_profile_mod_dialog) { | ||
|
||
private val viewModel by activityViewModels<UnivProfileModViewModel>() | ||
|
||
override fun onStart() { | ||
super.onStart() | ||
setDialogBackground() | ||
} | ||
|
||
private fun setDialogBackground() { | ||
val deviceWidth = Resources.getSystem().displayMetrics.widthPixels | ||
val dialogHorizontalMargin = (Resources.getSystem().displayMetrics.density * 16) * 2 | ||
|
||
dialog?.window?.apply { | ||
setLayout( | ||
(deviceWidth - dialogHorizontalMargin * 2).toInt(), | ||
WindowManager.LayoutParams.WRAP_CONTENT, | ||
) | ||
setBackgroundDrawableResource(R.color.transparent) | ||
} | ||
dialog?.setCanceledOnTouchOutside(false) | ||
dialog?.setCancelable(true) | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
initModBtnListener() | ||
initRejectBtnListener() | ||
} | ||
|
||
private fun initRejectBtnListener() { | ||
binding.btnProfileDialogReject.setOnSingleClickListener { dismiss() } | ||
} | ||
|
||
private fun initModBtnListener() { | ||
binding.btnProfileDialogMod.setOnSingleClickListener { | ||
viewModel.postNewProfileToServer() | ||
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
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
Oops, something went wrong.