Skip to content

Commit

Permalink
[feat] #98 - 옆으로 드로워 레이아웃 제스처 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
mdb1217 committed Jul 16, 2022
1 parent 91b34fa commit 8e7f48f
Show file tree
Hide file tree
Showing 16 changed files with 143 additions and 93 deletions.
13 changes: 9 additions & 4 deletions app/src/main/java/org/helfoome/presentation/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.view.LayoutInflater
import android.view.View
import androidx.activity.viewModels
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.drawerlayout.widget.DrawerLayout
import androidx.fragment.app.add
import androidx.fragment.app.commit
import com.google.android.material.appbar.AppBarLayout
Expand All @@ -25,7 +26,7 @@ import com.navercorp.nid.NaverIdLoginSDK
import dagger.hilt.android.AndroidEntryPoint
import org.helfoome.R
import org.helfoome.databinding.ActivityMainBinding
import org.helfoome.databinding.LogoutDialogBinding
import org.helfoome.databinding.DialogLogoutBinding
import org.helfoome.presentation.drawer.MyReviewActivity
import org.helfoome.presentation.scrap.MyScrapActivity
import org.helfoome.presentation.drawer.ProfileModifyActivity
Expand All @@ -38,12 +39,16 @@ import org.helfoome.presentation.type.FoodType
import org.helfoome.presentation.type.HashtagViewType
import org.helfoome.util.ChipFactory
import org.helfoome.util.DialogUtil
import org.helfoome.util.ResolutionMetrics
import org.helfoome.util.binding.BindingActivity
import org.helfoome.util.ext.stringListFrom
import timber.log.Timber
import javax.inject.Inject

@AndroidEntryPoint
class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main), OnMapReadyCallback {
@Inject
lateinit var resolutionMetrics: ResolutionMetrics
private val String.toChip: Chip
get() = ChipFactory.create(layoutInflater).also { it.text = this }
private val viewModel: MainViewModel by viewModels()
Expand Down Expand Up @@ -144,6 +149,7 @@ class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main
private fun initView() {
behavior = BottomSheetBehavior.from(binding.layoutBottomSheet)
behavior.state = BottomSheetBehavior.STATE_HIDDEN
binding.layoutDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED)

with(binding.layoutRestaurantDialog) {
vpRestaurantDetail.adapter = restaurantDetailAdapter
Expand Down Expand Up @@ -219,8 +225,8 @@ class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main
startActivity(Intent(this@MainActivity, SettingActivity::class.java))
}
tvLogout.setOnClickListener {
val bind = LogoutDialogBinding.inflate(LayoutInflater.from(this@MainActivity))
val dialog = DialogUtil.makeDialog(this@MainActivity, bind, 288, 241)
val bind = DialogLogoutBinding.inflate(LayoutInflater.from(this@MainActivity))
val dialog = DialogUtil.makeDialog(this@MainActivity, bind, resolutionMetrics.toPixel(288), resolutionMetrics.toPixel(241))

bind.btnYes.setOnClickListener {
NaverIdLoginSDK.logout()
Expand Down Expand Up @@ -308,7 +314,6 @@ class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main

override fun onStop() {
super.onStop()
binding.layoutDrawer.closeDrawers()
behavior.removeBottomSheetCallback(bottomSheetCallback)
binding.layoutRestaurantDialog.layoutRestaurantTabMenu.removeOnTabSelectedListener(listener)
binding.layoutRestaurantDialog.layoutAppBar.removeOnOffsetChangedListener(appbarOffsetListener)
Expand Down
20 changes: 17 additions & 3 deletions app/src/main/java/org/helfoome/presentation/WithdrawalActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,36 @@ import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import androidx.activity.viewModels
import dagger.hilt.android.AndroidEntryPoint
import org.helfoome.R
import org.helfoome.databinding.ActivityWithdrawalBinding
import org.helfoome.databinding.WithdrawDialogBinding
import org.helfoome.databinding.DialogWithdrawBinding
import org.helfoome.util.DialogUtil
import org.helfoome.util.ResolutionMetrics
import org.helfoome.util.binding.BindingActivity
import javax.inject.Inject

@AndroidEntryPoint
class WithdrawalActivity : BindingActivity<ActivityWithdrawalBinding>(R.layout.activity_withdrawal) {
@Inject
lateinit var resolutionMetrics: ResolutionMetrics
private val withdrawalViewModel: WithdrawalViewModel by viewModels()

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding.viewModel = withdrawalViewModel

initListener()
}

private fun initListener() {
binding.ivBack.setOnClickListener {
finish()
}

binding.btConfirm.setOnClickListener {
val bind: WithdrawDialogBinding = WithdrawDialogBinding.inflate(LayoutInflater.from(this@WithdrawalActivity))
val dialog = DialogUtil.makeDialog(this, bind, 288, 222)
val bind = DialogWithdrawBinding.inflate(LayoutInflater.from(this@WithdrawalActivity))
val dialog = DialogUtil.makeDialog(this, bind, resolutionMetrics.toPixel(288), resolutionMetrics.toPixel(222))

bind.btnYes.setOnClickListener {
startActivity(Intent(this@WithdrawalActivity, LoginActivity::class.java))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,26 @@ package org.helfoome.presentation.drawer
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import dagger.hilt.android.AndroidEntryPoint
import org.helfoome.R
import org.helfoome.databinding.ActivityMyReviewBinding
import org.helfoome.databinding.MyreviewDialogBinding
import org.helfoome.databinding.DialogMyreviewBinding
import org.helfoome.domain.entity.MyReviewInfo
import org.helfoome.presentation.MainActivity
import org.helfoome.presentation.drawer.adapter.MyReviewAdapter
import org.helfoome.presentation.drawer.adapter.MyReviewAdapter.Companion.DELETE
import org.helfoome.presentation.drawer.adapter.MyReviewAdapter.Companion.EDIT
import org.helfoome.presentation.drawer.adapter.MyReviewAdapter.Companion.ENLARGE
import org.helfoome.util.DialogUtil
import org.helfoome.util.ResolutionMetrics
import org.helfoome.util.binding.BindingActivity
import org.helfoome.util.ext.startActivity
import javax.inject.Inject

@AndroidEntryPoint
class MyReviewActivity : BindingActivity<ActivityMyReviewBinding>(R.layout.activity_my_review) {
@Inject
lateinit var resolutionMetrics: ResolutionMetrics

private val myReviewAdapter = MyReviewAdapter {
adapterClickListener(it)
Expand Down Expand Up @@ -48,8 +54,8 @@ class MyReviewActivity : BindingActivity<ActivityMyReviewBinding>(R.layout.activ
startActivity<MainActivity>()
}
DELETE -> {
val bind = MyreviewDialogBinding.inflate(LayoutInflater.from(this@MyReviewActivity))
val dialog = DialogUtil.makeDialog(this, bind, 288, 223)
val bind = DialogMyreviewBinding.inflate(LayoutInflater.from(this@MyReviewActivity))
val dialog = DialogUtil.makeDialog(this, bind, resolutionMetrics.toPixel(288), resolutionMetrics.toPixel(223))

bind.btnYes.setOnClickListener {
dialog.dismiss()
Expand Down Expand Up @@ -79,6 +85,9 @@ class MyReviewActivity : BindingActivity<ActivityMyReviewBinding>(R.layout.activ
}

private fun initListeners() {
binding.ivBack.setOnClickListener {
finish()
}
binding.btnGoToStore.setOnClickListener {
finish()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ class ProfileModifyActivity : BindingActivity<ActivityProfileModifyBinding>(R.la
}

private fun initListener() {
binding.ivBack.setOnClickListener {
finish()
}

binding.btModify.setOnClickListener {
viewModel.checkNicknameFormat()
// 중복 닉네임 체크 먼저 하기
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@ class SettingActivity : BindingActivity<ActivitySettingBinding>(R.layout.activit
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

initListener()
}

private fun initListener() {
binding.tvWithdrawal.setOnClickListener {
startActivity(Intent(this, WithdrawalActivity::class.java))
}
binding.ivBack.setOnClickListener {
finish()
}
}
}
4 changes: 2 additions & 2 deletions app/src/main/java/org/helfoome/presentation/type/FoodType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import org.helfoome.R
enum class FoodType(val color: Int, val icon: Int, val iconTint: Int) {
FOOD_SALAD(R.color.selector_chip_bg_diet, R.drawable.ic_salad, R.color.selector_chip_icon_diet),
FOOD_POKE(R.color.selector_chip_bg_diet, R.drawable.ic_poke, R.color.selector_chip_icon_diet),
FOOD_QUITO(R.color.selector_chip_bg_diet, R.drawable.ic_kimbap, R.color.selector_chip_icon_diet),
FOOD_SANDWICH(R.color.selector_chip_bg_normal, R.drawable.ic_sandwich, R.color.selector_chip_icon_normal),
FOOD_SHABU(R.color.selector_chip_bg_normal, R.drawable.ic_shabushabu, R.color.selector_chip_icon_normal),
FOOD_BOSAM(R.color.selector_chip_bg_normal, R.drawable.ic_bossam, R.color.selector_chip_icon_normal),
FOOD_MEAT(R.color.selector_chip_bg_normal, R.drawable.ic_meat, R.color.selector_chip_icon_normal),
FOOD_RICEBOWL(R.color.selector_chip_bg_normal, R.drawable.ic_dupbap, R.color.selector_chip_icon_normal),
FOOD_QUITO(R.color.selector_chip_bg_diet, R.drawable.ic_kimbap, R.color.selector_chip_icon_diet)
FOOD_RICEBOWL(R.color.selector_chip_bg_normal, R.drawable.ic_dupbap, R.color.selector_chip_icon_normal)
}
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
android:backgroundTint="@color/white"
android:src="@drawable/ic_currentposition"
app:borderWidth="0dp"
app:layout_dodgeInsetEdges="bottom"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_main_drawer_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="64dp"
android:lineSpacingExtra="3dp"
android:text="@string/main_drawer_welcome"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/res/layout/activity_profile_modify.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
tools:context=".presentation.drawer.ProfileModifyActivity">

<ImageView
android:id="@+id/iv_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="26dp"
Expand Down Expand Up @@ -108,12 +109,12 @@

<org.helfoome.presentation.custom.SnackBarView
android:id="@+id/snv_profile_modify"
android:visibility="invisible"
android:layout_width="wrap_content"
app:layout_constraintStart_toStartOf="parent"
android:layout_height="wrap_content"
android:visibility="invisible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_height="wrap_content"/>
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
14 changes: 13 additions & 1 deletion app/src/main/res/layout/activity_setting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
tools:context=".presentation.drawer.SettingActivity">

<ImageView
android:id="@+id/iv_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="26dp"
Expand Down Expand Up @@ -74,6 +75,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_inquiry" />

<TextView
android:id="@+id/tv_declaration"
style="@style/TextView.Setting.TextAppearance_16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="36dp"
android:text="@string/setting_declaration"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_withdrawal" />

<TextView
android:id="@+id/tv_terms_plicies"
style="@style/TextView.Setting.TextAppearance_14"
Expand All @@ -83,7 +95,7 @@
android:layout_marginTop="54dp"
android:text="@string/setting_terms_policies"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_withdrawal" />
app:layout_constraintTop_toBottomOf="@id/tv_declaration" />

<TextView
android:id="@+id/tv_open_soruce_info"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_withdrawal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
tools:context=".presentation.WithdrawalActivity">

<ImageView
android:id="@+id/iv_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="26dp"
Expand Down
66 changes: 66 additions & 0 deletions app/src/main/res/layout/dialog_logout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="288dp"
android:layout_height="@dimen/size_logout_dialog_height_241"
android:background="@drawable/rectangle_white_radius_15">

<TextView
android:id="@+id/tv_caution"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:text="@string/logout_dialog_caution"
android:textColor="@color/gray_800"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/tv_caution_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:text="@string/logout_dialog_caution_description"
android:textColor="@color/gray_800"
android:textSize="12sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_caution" />

<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_yes"
style="@style/Button.Basic.Style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"
android:layout_marginTop="24dp"
android:background="@drawable/rectangle_red_radius_8"
android:paddingVertical="11dp"
android:text="@string/logout_dialog_yes"
android:textColor="@color/white"
android:textSize="15sp"
android:textStyle="bold"
app:layout_constraintTop_toBottomOf="@id/tv_caution_description" />

<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_no"
style="@style/Button.Basic.Style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="24dp"
android:background="@drawable/rectangle_white_radius_8"
android:paddingVertical="11dp"
android:text="@string/logout_dialog_no"
android:textColor="@color/gray_600"
android:textSize="15sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/btn_yes" />

</androidx.constraintlayout.widget.ConstraintLayout>
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 8e7f48f

Please sign in to comment.