mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
fix: apply top bar insets as padding and make the status bar color white
Since the toolbars have primary color as bg, we should make the status bar white
This commit is contained in:
parent
74c987f73d
commit
6649f22606
3 changed files with 32 additions and 1 deletions
|
|
@ -7,6 +7,10 @@ import android.speech.RecognizerIntent
|
|||
import android.view.View
|
||||
import androidx.activity.result.ActivityResult
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.updatePadding
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import fr.free.nrw.commons.CommonsApplication
|
||||
|
|
@ -20,6 +24,7 @@ import fr.free.nrw.commons.description.EditDescriptionConstants.WIKITEXT
|
|||
import fr.free.nrw.commons.recentlanguages.RecentLanguagesDao
|
||||
import fr.free.nrw.commons.settings.Prefs
|
||||
import fr.free.nrw.commons.theme.BaseActivity
|
||||
import fr.free.nrw.commons.utils.applyEdgeToEdgeBottomInsets
|
||||
import fr.free.nrw.commons.upload.UploadMediaDetail
|
||||
import fr.free.nrw.commons.upload.UploadMediaDetailAdapter
|
||||
import fr.free.nrw.commons.utils.DialogUtil.showAlertDialog
|
||||
|
|
@ -87,6 +92,17 @@ class DescriptionEditActivity :
|
|||
super.onCreate(savedInstanceState)
|
||||
|
||||
binding = ActivityDescriptionEditBinding.inflate(layoutInflater)
|
||||
applyEdgeToEdgeBottomInsets(binding.btnEditSubmit)
|
||||
WindowCompat.getInsetsController(window, window.decorView)
|
||||
.isAppearanceLightStatusBars = false
|
||||
ViewCompat.setOnApplyWindowInsetsListener(binding.toolbar) { v, windowInsets ->
|
||||
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
|
||||
v.updatePadding(
|
||||
top = insets.top
|
||||
)
|
||||
WindowInsetsCompat.CONSUMED
|
||||
}
|
||||
setContentView(binding.root)
|
||||
|
||||
val bundle = intent.extras
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@ import androidx.core.content.ContextCompat
|
|||
import androidx.core.content.IntentCompat
|
||||
import androidx.core.os.BundleCompat
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.updatePadding
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
import fr.free.nrw.commons.CameraPosition
|
||||
import fr.free.nrw.commons.CommonsApplication
|
||||
|
|
@ -330,6 +334,16 @@ class LocationPickerActivity : BaseActivity(), LocationPermissionCallback {
|
|||
*/
|
||||
private fun getToolbarUI() {
|
||||
val toolbar: ConstraintLayout = findViewById(R.id.location_picker_toolbar)
|
||||
WindowCompat.getInsetsController(window, window.decorView)
|
||||
.isAppearanceLightStatusBars = false
|
||||
ViewCompat.setOnApplyWindowInsetsListener(toolbar) { v, windowInsets ->
|
||||
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
|
||||
v.updatePadding(
|
||||
top = insets.top
|
||||
)
|
||||
WindowInsetsCompat.CONSUMED
|
||||
}
|
||||
largeToolbarText = findViewById(R.id.location_picker_toolbar_primary_text_view)
|
||||
smallToolbarText = findViewById(R.id.location_picker_toolbar_secondary_text_view)
|
||||
toolbar.setBackgroundColor(ContextCompat.getColor(this, R.color.primaryColor))
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/location_picker_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="78dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="@dimen/small_gap"
|
||||
tools:background="@color/primaryColor">
|
||||
|
||||
<TextView
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue