Skip to content

Commit

Permalink
fixing exception reported to play (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelvogt authored Jan 18, 2019
1 parent f4bb6ed commit a9a6592
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class WebViewFragment : AppFragment(), View.OnClickListener {

NavigationUI.setupWithNavController(top_toolbar, navController)

val content = WebViewFragmentArgs.fromBundle(arguments).contentUrl
val content = WebViewFragmentArgs.fromBundle(arguments!!).contentUrl
when (content) {
R.string.about_key -> content_info.loadUrl(getString(R.string.file_prefix) + getString(R.string.about_url))
R.string.location_intro_key -> initLocationIntro()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import eu.michaelvogt.ar.author.R
import eu.michaelvogt.ar.author.data.*
import eu.michaelvogt.ar.author.data.utils.Converters
import eu.michaelvogt.ar.author.fragments.AreaEditCard
import java.io.FileNotFoundException

@InverseMethod("floatFromString")
fun floatToString(value: Float): String {
Expand Down Expand Up @@ -78,8 +79,13 @@ fun setImage(view: ImageView, url: String, placeholder: Drawable) {
if (url.isEmpty()) {
view.setImageDrawable(placeholder)
} else if (url.startsWith(ImageUtils.assetPathPrefix)) {
val asset = view.resources.assets.open(url.removePrefix(ImageUtils.assetPathPrefix))
view.setImageDrawable(Drawable.createFromStream(asset, null))
try {
val asset = view.resources.assets.open(url.removePrefix(ImageUtils.assetPathPrefix))
view.setImageDrawable(Drawable.createFromStream(asset, null))
} catch (e: FileNotFoundException) {
Log.i("ViewConverters", "Image not found", e)
view.setImageResource(R.drawable.touristar_logo)
}
} else {
val bitmap: Bitmap
try {
Expand Down

0 comments on commit a9a6592

Please sign in to comment.