本文整理汇总了Scala中com.google.zxing.Result类的典型用法代码示例。如果您正苦于以下问题:Scala Result类的具体用法?Scala Result怎么用?Scala Result使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Result类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: ReadQrActivity
//设置package包名称以及导入依赖的类
package app.bitrader.activity.menu
import android.app.Activity
import android.graphics.PointF
import android.os.Bundle
import android.widget.{Button, LinearLayout, TextView}
import app.bitrader.activity.MainStyles
import com.google.zxing.Result
import macroid.{Contexts, Ui}
import macroid.FullDsl._
import macroid._
import me.dm7.barcodescanner.zxing.ZXingScannerView
class ReadQrActivity extends Activity with Contexts[Activity] with ZXingScannerView.ResultHandler with MainStyles {
override def onCreate(savedInstanceState: Bundle): Unit = {
super.onCreate(savedInstanceState)
setContentView(ui)
}
var qrText = slot[TextView]
def ui = {
l[LinearLayout](
w[TextView] <~ wire(qrText) <~ vWrap,
w[Button] <~ text("read qr") <~ onClick(runQr) <~ vWrapContent
) <~ vMatchWidth
}.get
lazy val scannerView: ZXingScannerView = new ZXingScannerView(this)
def runQr: Unit = {
setContentView(scannerView)
scannerView.setResultHandler(this)
scannerView.startCamera()
}
override def onPause(): Unit = {
super.onPause()
scannerView.stopCamera()
}
override def handleResult(result: Result): Unit = {
setContentView(ui)
println(s"got qr! ${result.getText}")
Ui.run(qrText <~ text(result.getText))
scannerView.stopCamera()
}
}