Skip to content

Commit

Permalink
handle bottom insets in NotificationRequestDetailsActivity (#4930)
Browse files Browse the repository at this point in the history
  • Loading branch information
connyduck authored Feb 21, 2025
1 parent 1d2adef commit cc79aac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.activity.viewModels
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat.Type.systemBars
import androidx.core.view.updatePadding
import androidx.lifecycle.lifecycleScope
import com.keylesspalace.tusky.BottomSheetActivity
import com.keylesspalace.tusky.R
Expand Down Expand Up @@ -69,6 +72,12 @@ class NotificationRequestDetailsActivity : BottomSheetActivity() {
setDisplayShowHomeEnabled(true)
}

ViewCompat.setOnApplyWindowInsetsListener(binding.bottomBar) { view, insets ->
val bottomInsets = insets.getInsets(systemBars()).bottom
view.updatePadding(bottom = bottomInsets)
insets.inset(0, 0, 0, bottomInsets)
}

lifecycleScope.launch {
viewModel.finish.collect { finishMode ->
setResult(RESULT_OK, Intent().apply { putExtra(EXTRA_NOTIFICATION_REQUEST_ID, intent.getStringExtra(EXTRA_NOTIFICATION_REQUEST_ID)!!) })
Expand All @@ -79,7 +88,7 @@ class NotificationRequestDetailsActivity : BottomSheetActivity() {
binding.acceptButton.setOnClickListener {
viewModel.acceptNotificationRequest()
}
binding.dismissButtin.setOnClickListener {
binding.dismissButton.setOnClickListener {
viewModel.dismissNotificationRequest()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
app:layout_behavior="@string/appbar_scrolling_view_behavior" />

<LinearLayout
android:id="@+id/bottomBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
Expand All @@ -35,7 +36,7 @@
android:text="@string/action_accept_notification_request" />

<Button
android:id="@+id/dismissButtin"
android:id="@+id/dismissButton"
style="@style/TuskyButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
Expand Down

0 comments on commit cc79aac

Please sign in to comment.