Last active
September 9, 2019 12:40
-
-
Save audkar/c8d9c34dfc1c4d06accef741a4f3d385 to your computer and use it in GitHub Desktop.
Coil bug example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/coil-sample/src/main/java/coil/sample/MainActivity.kt b/coil-sample/src/main/java/coil/sample/MainActivity.kt | |
index 9024afa..9140e08 100644 | |
--- a/coil-sample/src/main/java/coil/sample/MainActivity.kt | |
+++ b/coil-sample/src/main/java/coil/sample/MainActivity.kt | |
@@ -9,6 +9,7 @@ import androidx.core.view.isVisible | |
import androidx.lifecycle.Observer | |
import androidx.recyclerview.widget.RecyclerView | |
import androidx.recyclerview.widget.StaggeredGridLayoutManager | |
+import android.net.Uri | |
import coil.api.load | |
class MainActivity : AppCompatActivity() { | |
@@ -33,13 +34,19 @@ class MainActivity : AppCompatActivity() { | |
viewModel.screenLiveData.observe(this, Observer(::setScreen)) | |
viewModel.imagesLiveData.observe(this, Observer(listAdapter::submitList)) | |
+ | |
+ val packageName = "com.android.settings" | |
+ val appInfo = packageManager.getApplicationInfo(packageName, 0) | |
+ val uri = Uri.parse("android.resource://" + packageName + "/" + appInfo.icon) | |
+// detail.setImageURI(uri) | |
+ detail.load(uri) | |
} | |
private fun setScreen(screen: Screen) { | |
when (screen) { | |
is Screen.List -> { | |
list.isVisible = true | |
- detail.isVisible = false | |
+ detail.isVisible = true | |
} | |
is Screen.Detail -> { | |
list.isVisible = false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment