-
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.
- Loading branch information
1 parent
c9d313c
commit 9296079
Showing
7 changed files
with
251 additions
and
58 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<layout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_gravity="center"> | ||
|
||
<data> | ||
|
||
</data> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginHorizontal="40dp" | ||
android:background="@drawable/shape_grayscales900_fill_8_rect" | ||
android:paddingBottom="26dp"> | ||
|
||
<TextView | ||
android:id="@+id/tv_profile_dialog_title" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="40dp" | ||
android:gravity="center" | ||
android:lineSpacingMultiplier="1.5" | ||
android:text="@string/profile_mod_dialog_tv_title" | ||
android:textAppearance="?textAppearanceSubtitle2" | ||
android:textColor="@color/white" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<TextView | ||
android:id="@+id/btn_profile_dialog_reject" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="27dp" | ||
android:layout_marginTop="24dp" | ||
android:gravity="center" | ||
android:paddingVertical="8dp" | ||
android:paddingEnd="14dp" | ||
android:text="@string/profile_dialog_btn_no" | ||
android:textAppearance="?textAppearanceButton" | ||
android:textColor="@color/grayscales_600" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toStartOf="@id/btn_profile_dialog_mod" | ||
app:layout_constraintHorizontal_chainStyle="packed" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/tv_profile_dialog_title" /> | ||
|
||
<TextView | ||
android:id="@+id/btn_profile_dialog_mod" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="7dp" | ||
android:layout_marginEnd="27dp" | ||
android:gravity="center" | ||
android:paddingVertical="8dp" | ||
android:text="@string/profile_mod_dialog_tv_yes" | ||
android:textAppearance="?textAppearanceButton" | ||
android:textColor="@color/yello_main_500" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintHorizontal_chainStyle="packed" | ||
app:layout_constraintStart_toEndOf="@id/btn_profile_dialog_reject" | ||
app:layout_constraintTop_toTopOf="@id/btn_profile_dialog_reject" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
|
||
</layout> |
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.