pass the context instead of whole activity on a couple places

This commit is contained in:
tibbi 2017-04-26 23:04:01 +02:00
parent 25d3eebb4f
commit 7257fc7926
1 changed files with 5 additions and 5 deletions

View File

@ -169,7 +169,7 @@ fun Activity.hasNavBar(): Boolean {
realWidth - displayWidth > 0 || realHeight - displayHeight > 0 realWidth - displayWidth > 0 || realHeight - displayHeight > 0
} else { } else {
val hasMenuKey = ViewConfiguration.get(this).hasPermanentMenuKey() val hasMenuKey = ViewConfiguration.get(applicationContext).hasPermanentMenuKey()
val hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK) val hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK)
!hasMenuKey && !hasBackKey !hasMenuKey && !hasBackKey
} }
@ -271,7 +271,7 @@ fun Activity.loadImage(path: String, target: MySquareImageView) {
} }
fun Activity.loadPng(path: String, target: MySquareImageView) { fun Activity.loadPng(path: String, target: MySquareImageView) {
val builder = Glide.with(this) val builder = Glide.with(applicationContext)
.load(path) .load(path)
.asBitmap() .asBitmap()
.signature(getFileSignature(path)) .signature(getFileSignature(path))
@ -283,7 +283,7 @@ fun Activity.loadPng(path: String, target: MySquareImageView) {
} }
fun Activity.loadJpg(path: String, target: MySquareImageView) { fun Activity.loadJpg(path: String, target: MySquareImageView) {
val builder = Glide.with(this) val builder = Glide.with(applicationContext)
.load(path) .load(path)
.signature(getFileSignature(path)) .signature(getFileSignature(path))
.diskCacheStrategy(DiskCacheStrategy.RESULT) .diskCacheStrategy(DiskCacheStrategy.RESULT)
@ -294,7 +294,7 @@ fun Activity.loadJpg(path: String, target: MySquareImageView) {
} }
fun Activity.loadAnimatedGif(path: String, target: MySquareImageView) { fun Activity.loadAnimatedGif(path: String, target: MySquareImageView) {
val builder = Glide.with(this) val builder = Glide.with(applicationContext)
.load(path) .load(path)
.asGif() .asGif()
.signature(getFileSignature(path)) .signature(getFileSignature(path))
@ -306,7 +306,7 @@ fun Activity.loadAnimatedGif(path: String, target: MySquareImageView) {
} }
fun Activity.loadStaticGif(path: String, target: MySquareImageView) { fun Activity.loadStaticGif(path: String, target: MySquareImageView) {
val builder = Glide.with(this) val builder = Glide.with(applicationContext)
.load(path) .load(path)
.asBitmap() .asBitmap()
.signature(getFileSignature(path)) .signature(getFileSignature(path))