Skip to content

Commit

Permalink
Dark mode status bar with light system icons & shop fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Hafizzle committed Sep 29, 2023
1 parent 3dc0759 commit 0bc2d6e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.os.Build
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import android.view.WindowInsetsController
import android.view.inputmethod.InputMethodManager
import androidx.appcompat.content.res.AppCompatResources
import androidx.core.content.ContextCompat
Expand Down Expand Up @@ -99,23 +100,24 @@ class SetupActivity : BaseActivity(), ViewPager.OnPageChangeListener {
}
}

val window = window
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
val decor = getWindow().decorView
decor.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
window.statusBarColor = ContextCompat.getColor(this, R.color.light_gray_bg)
} else {
window.statusBarColor = ContextCompat.getColor(this, R.color.days_gray)
}

binding.viewPager.disableFading = true

binding.previousButton.setOnClickListener { previousClicked() }
binding.nextButton.setOnClickListener { nextClicked() }

if (this.isUsingNightModeResources()) {
window.statusBarColor = ContextCompat.getColor(this, R.color.black_20_alpha)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
window.insetsController?.setSystemBarsAppearance(
WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS,
WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS
)
} else {
@Suppress("DEPRECATION")
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
}
}

}

override fun onDestroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,16 +328,12 @@ open class ShopFragment : BaseMainFragment<FragmentRefreshRecyclerviewBinding>()
}
Shop.TIME_TRAVELERS_SHOP -> {
formatTimeTravelersShop(shop1)
if (userViewModel.user.value?.isSubscribed == false) {
if ((hourglasses.value ?: 0.0) > 0.0) {
context?.let { context -> InsufficientHourglassesDialog(context).show()}
} else {
activity?.let { activity ->
val subscriptionBottomSheet = EventOutcomeSubscriptionBottomSheetFragment().apply {
eventType = EventOutcomeSubscriptionBottomSheetFragment.EVENT_HOURGLASS_SHOP_OPENED
}
subscriptionBottomSheet.show(activity.supportFragmentManager, SubscriptionBottomSheetFragment.TAG)
if (userViewModel.user.value?.isSubscribed == false && (hourglasses.value ?: 0.0) <= 0.0) {
activity?.let { activity ->
val subscriptionBottomSheet = EventOutcomeSubscriptionBottomSheetFragment().apply {
eventType = EventOutcomeSubscriptionBottomSheetFragment.EVENT_HOURGLASS_SHOP_OPENED
}
subscriptionBottomSheet.show(activity.supportFragmentManager, SubscriptionBottomSheetFragment.TAG)
}
}
}
Expand Down

0 comments on commit 0bc2d6e

Please sign in to comment.