mirror of https://github.com/jlelse/teleposter
Fix compile errors
This commit is contained in:
parent
a38e7a90f0
commit
986c5c4042
|
@ -92,7 +92,7 @@ object Api {
|
|||
}
|
||||
|
||||
private fun JSONObject.parsePage(): Page? {
|
||||
val result: Page = Page()
|
||||
val result = Page()
|
||||
result.path = optString("path", "")
|
||||
result.url = optString("url", "")
|
||||
result.title = optString("title", "")
|
||||
|
|
|
@ -15,8 +15,8 @@ import pub.devrel.easypermissions.EasyPermissions
|
|||
import java.io.File
|
||||
|
||||
class MainActivity : AppCompatActivity(), AdvancedWebView.Listener, FileChooserDialog.FileCallback {
|
||||
private val webView: AdvancedWebView? by lazy { findViewById(R.id.webView) as AdvancedWebView? }
|
||||
private val editor: Editor? by lazy { findViewById(R.id.editor) as Editor? }
|
||||
private val webView: AdvancedWebView? by lazy { findViewById<AdvancedWebView?>(R.id.webView) }
|
||||
private val editor: Editor? by lazy { findViewById<Editor?>(R.id.editor) }
|
||||
|
||||
private var currentUrl = ""
|
||||
private var currentPage: Page? = null
|
||||
|
@ -94,10 +94,10 @@ class MainActivity : AppCompatActivity(), AdvancedWebView.Listener, FileChooserD
|
|||
page?.let {
|
||||
var html = getString(R.string.viewer_html_head)
|
||||
html += "<h1>${it.title}</h1>"
|
||||
if (!it.author_name.isNullOrEmpty() && !it.author_url.isNullOrBlank()) html += "<a href=\"${it.author_url}\">${it.author_name}</a><br>"
|
||||
else if (!it.author_name.isNullOrEmpty()) html += "${it.author_name}<br>"
|
||||
if (!it.author_name.isEmpty() && !it.author_url.isBlank()) html += "<a href=\"${it.author_url}\">${it.author_name}</a><br>"
|
||||
else if (!it.author_name.isEmpty()) html += "${it.author_name}<br>"
|
||||
if (it.views != 0) html += "${it.views} times viewed<br><br>"
|
||||
if (it.content.isNullOrBlank()) html += it.description.replace("\n", "<br>") else html += it.content
|
||||
if (it.content.isBlank()) html += it.description.replace("\n", "<br>") else html += it.content
|
||||
html += getString(R.string.viewer_html_end)
|
||||
webView?.loadDataWithBaseURL(it.url, html, "text/html; charset=UTF-8", null, null)
|
||||
currentUrl = it.url
|
||||
|
@ -120,7 +120,7 @@ class MainActivity : AppCompatActivity(), AdvancedWebView.Listener, FileChooserD
|
|||
if (EasyPermissions.hasPermissions(this, "android.permission.READ_EXTERNAL_STORAGE")) {
|
||||
FileChooserDialog.Builder(this)
|
||||
.mimeType("image/*")
|
||||
.show()
|
||||
.show(this)
|
||||
} else {
|
||||
EasyPermissions.requestPermissions(this, "", 100, "android.permission.READ_EXTERNAL_STORAGE")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue