本文整理汇总了Scala中android.app.ProgressDialog类的典型用法代码示例。如果您正苦于以下问题:Scala ProgressDialog类的具体用法?Scala ProgressDialog怎么用?Scala ProgressDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProgressDialog类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: RalletsWebClient
//设置package包名称以及导入依赖的类
package com.rallets
import android.app.{Activity, AlertDialog, ProgressDialog}
import android.content.DialogInterface
import android.webkit.{WebView, WebViewClient}
import android.widget.Toast
import com.github.shadowsocks.R
class RalletsWebClient(activity: Activity, title: String) extends WebViewClient {
val alertDialog = new AlertDialog.Builder(activity).create()
val progressBar = ProgressDialog.show(activity, title, activity.getString(R.string.loading))
override def onReceivedSslError(view: _root_.android.webkit.WebView, handler: _root_.android.webkit.SslErrorHandler, error: _root_.android.net.http.SslError): Unit = {
import android.content.DialogInterface
val builder = new AlertDialog.Builder(activity)
builder.setMessage(R.string.ssl_error_alert)
builder.setPositiveButton(R.string.continue_browse, new DialogInterface.OnClickListener() {
override def onClick(dialog: DialogInterface, which: Int): Unit = {
handler.proceed
}
})
builder.setNegativeButton(R.string.cancel_browse, new DialogInterface.OnClickListener() {
override def onClick(dialog: DialogInterface, which: Int): Unit = {
handler.cancel
}
})
val dialog = builder.create
dialog.show()
}
override def shouldOverrideUrlLoading(view: WebView, url: String): Boolean = {
view.loadUrl(url)
return false
}
override def onPageFinished(view: WebView, url: String): Unit = {
RUtils.log("Finished loading URL: " + url)
if (progressBar.isShowing()) {
progressBar.dismiss()
}
}
override def onReceivedError(view: WebView, errorCode: Int, description: String, failingUrl: String): Unit = {
RUtils.log("Error: " + description)
Toast.makeText(activity, "Oh no! " + description, Toast.LENGTH_SHORT).show()
alertDialog.setTitle("Error")
alertDialog.setMessage(description)
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
def onClick(dialog: DialogInterface, which: Int) {}
})
alertDialog.show()
}
}
示例2: cw
//设置package包名称以及导入依赖的类
package app.bitrader.helpers
import android.app.ProgressDialog
import android.content.DialogInterface
import android.content.DialogInterface.OnClickListener
import app.bitrader.helpers.UiThreading
import macroid.FullDsl._
import macroid.{ContextWrapper, Ui}
trait Dialogs extends UiThreading{
protected[this] implicit def cw: ContextWrapper
def showToast(t: String) = Ui.run(toast(t)(cw) <~ fry)
def showLongToast(t: String) = Ui.run(toast(t)(cw) <~ long <~ fry)
def spinner(t: String): Unit = spinnerDialog(t, null)
def spinner(): Unit = spinner("?????????...")
@inline def spinnerDialog(title: CharSequence, message: CharSequence) =
runOnUiThread(ProgressDialog.show(cw.bestAvailable, title, message, true))
// alerts
def action(doAction: => Unit): DialogInterface.OnClickListener = {
new OnClickListener {
override def onClick(dialog: DialogInterface, which: Int): Unit = doAction
}
}
@inline def confirm(t: String, yes: => Unit, no: => Unit = () => ()) = {
Ui.run {
dialog(t) <~
positiveYes(action(yes)) <~
negativeNo(action(no)) <~
speak
}
}
@inline def alert(t: String, d: String, yes: => Unit = () => ()) = {
Ui.run {
dialog(t + " " + d) <~
positiveYes(action(yes)) <~
speak
}
}
}