Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import androidx.lifecycle.lifecycleScope
import androidx.viewbinding.ViewBinding
import com.eatssu.android.R
import com.eatssu.android.data.repository.FirebaseRemoteConfigRepository
import com.eatssu.android.presentation.common.AndroidMessageDialogActivity
import com.eatssu.android.presentation.common.ForceUpdateDialogActivity
import com.eatssu.android.presentation.common.NetworkConnection
import com.eatssu.android.presentation.common.VersionViewModel
Expand Down Expand Up @@ -84,25 +83,35 @@ abstract class BaseActivity<B : ViewBinding>(
// refreshtoken 관리
observeTokenExpiration()

setInset()
setContainerInset()

}

private fun setInset() {
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.toolbar)) { view, insets ->
private fun setContainerInset() {
// Toolbar: topInset만 적용
val toolbar = findViewById<Toolbar>(R.id.toolbar)
ViewCompat.setOnApplyWindowInsetsListener(toolbar) { view, insets ->
val topInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).top
view.setPadding(0, topInset, 0, 24)
WindowInsetsCompat.CONSUMED
view.setPadding(
/* left = */ 0,
/* top = */ topInset,
/* right = */ 0,
/* bottom = */ 0
)
insets
}

ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.fl_content)) { view, insets ->
val systemInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars())

view.setPadding(
systemInsets.left,
view.paddingTop,
systemInsets.right,
systemInsets.bottom
/* left = */ systemInsets.left,
/* top = */ 0,
/* right = */ systemInsets.right,
/* bottom = */ systemInsets.bottom
)

// 소비된 인셋을 반환하여 자식 뷰가 다시 받지 않도록 함
WindowInsetsCompat.CONSUMED
}
}
Expand Down Expand Up @@ -164,13 +173,6 @@ abstract class BaseActivity<B : ViewBinding>(
startActivity(intent)
}

private fun showAndroidMessageDialog(message: String) {
val intent = Intent(this, AndroidMessageDialogActivity::class.java)
intent.putExtra("message",message)
Timber.d("BaseActivity", "공지사항: $message")
startActivity(intent)
}

override fun onResume() {
super.onResume()

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:navGraph="@navigation/eatssu_navigation"/>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/fragment_cafeteria.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/gray100"
tools:context=".presentation.cafeteria.CafeteriaFragment">

<!-- 로고 및 상단 바 -->
Expand Down