Skip to content

[Bug] Null safe bug fix #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 28, 2020
Merged
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 @@ -50,6 +50,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import androidx.cardview.widget.CardView
import androidx.core.content.ContextCompat
import androidx.core.content.ContextCompat.getSystemService
import androidx.core.content.res.ResourcesCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
Expand Down Expand Up @@ -1263,7 +1264,8 @@ class MediaAppTestingActivity : AppCompatActivity() {
// Gets the current screen height in pixels
fun getScreenHeightPx(context: Context): Int {
val displayMetrics = DisplayMetrics()
val windowManager = ContextCompat.getSystemService(context, WindowManager::class.java)
val windowManager = getSystemService(context, WindowManager::class.java)
?: throw IllegalStateException("Could not get WindowManager")
val display = windowManager.defaultDisplay
display.getMetrics(displayMetrics)
return displayMetrics.heightPixels
Expand Down