本文整理汇总了Scala中android.util.Log类的典型用法代码示例。如果您正苦于以下问题:Scala Log类的具体用法?Scala Log怎么用?Scala Log使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Log类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: PluginConfiguration
//设置package包名称以及导入依赖的类
package com.github.shadowsocks.plugin
import android.util.Log
import com.github.shadowsocks.utils.Commandline
import scala.collection.mutable
class PluginConfiguration(val pluginsOptions: Map[String, PluginOptions], val selected: String) {
private def this(plugins: Array[PluginOptions]) =
this(plugins.filter(_.id.nonEmpty).map(opt => opt.id -> opt).toMap, if (plugins.isEmpty) "" else plugins(0).id)
def this(plugin: String) = this(if (plugin == null) Array[PluginOptions]() else plugin.split("\n").map {
case line if line.startsWith("kcptun ") =>
val opt = new PluginOptions()
opt.id = "kcptun"
try {
val args = mutable.Queue(Commandline.translateCommandline(line): _*)
args.dequeue()
while (args.nonEmpty) args.dequeue() match {
case "--nocomp" => opt.put("nocomp", null)
case option if option.startsWith("--") => opt.put(option.substring(2), args.dequeue())
case option => throw new IllegalArgumentException("Unknown kcptun parameter: " + option)
}
} catch {
case exc: Exception => Log.w("PluginConfiguration", exc.getMessage)
}
opt
case line => new PluginOptions(line)
})
def getOptions(id: String): PluginOptions = if (id.isEmpty) new PluginOptions() else pluginsOptions.get(id) match {
case Some(options) => options
case None => new PluginOptions(id, PluginManager.fetchPlugins()(id).defaultConfig)
}
def selectedOptions: PluginOptions = getOptions(selected)
override def toString: String = {
val result = new mutable.ListBuffer[PluginOptions]()
for ((id, opt) <- pluginsOptions) id match {
case this.selected => result.prepend(opt)
case _ => result.append(opt)
}
if (!pluginsOptions.contains(selected)) result.prepend(selectedOptions)
result.map(_.toString(false)).mkString("\n")
}
}
示例2: DonaldTrump
//设置package包名称以及导入依赖的类
package com.github.shadowsocks.job
import android.util.Log
import com.evernote.android.job.JobCreator
object DonaldTrump extends JobCreator {
def create(tag: String) = {
val parts = tag.split(":")
parts(0) match {
case AclSyncJob.TAG => new AclSyncJob(parts(1))
case _ =>
Log.w("DonaldTrump", "Unknown job tag: " + tag)
null
}
}
}
示例3: DonaldTrump
//设置package包名称以及导入依赖的类
package com.github.shadowsocks.job
import android.util.Log
import com.evernote.android.job.JobCreator
object DonaldTrump extends JobCreator {
def create(tag: String) = {
val parts = tag.split(":")
parts(0) match {
case AclSyncJob.TAG => new AclSyncJob(parts(1))
case SSRSubUpdateJob.TAG => new SSRSubUpdateJob()
case _ =>
Log.w("DonaldTrump", "Unknown job tag: " + tag)
null
}
}
}
示例4: LogLogger
//设置package包名称以及导入依赖的类
package sgl.android.util
import sgl.util._
import android.util.Log
trait AndroidLoggingProvider extends LoggingProvider {
import Logger._
abstract class LogLogger extends Logger {
override protected def log(level: LogLevel, tag: Tag, msg: String): Unit = level match {
case NoLogging => ()
case Error => Log.e(tag.name, msg)
case Warning => Log.w(tag.name, msg)
case Info => Log.i(tag.name, msg)
case Debug => Log.d(tag.name, msg)
case Trace => Log.v(tag.name, msg)
}
}
}
trait AndroidDefaultLoggingProvider extends AndroidLoggingProvider {
case object DefaultLogLogger extends LogLogger {
override val logLevel: Logger.LogLevel = Logger.Warning
}
override val logger = DefaultLogLogger
}
trait AndroidVerboseConsoleLoggingProvider extends AndroidLoggingProvider {
case object VerboseLogLogger extends LogLogger {
override val logLevel: Logger.LogLevel = Logger.Debug
}
override val logger = VerboseLogLogger
}
示例5: WizardActivity
//设置package包名称以及导入依赖的类
package com.happyheal.happyhealapp.ui.wizard
import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.util.Log
import com.happyheal.happyhealapp.{TypedFindView, TR}
import com.happyheal.happyhealapp.commons.ContextWrapperProvider
import com.happyheal.happyhealapp.modules.persistence.impl.PersistenceServicesComponentImpl
import com.happyheal.happyhealapp.ui.main.MainActivity
import macroid.{ContextWrapper, Contexts}
import macroid.FullDsl._
class WizardActivity
extends AppCompatActivity
with Contexts[AppCompatActivity]
with ContextWrapperProvider
with PersistenceServicesComponentImpl
with TypedFindView
with WizardComposer {
override implicit lazy val contextProvider: ContextWrapper = activityContextWrapper
val LOG_TAG = classOf[WizardActivity].getSimpleName
override def onCreate(savedInstanceState: Bundle): Unit = {
super.onCreate(savedInstanceState)
Log.d(LOG_TAG, "WizardActivity")
val extras = getIntent.getExtras
val tutorialMode = if (extras != null) extras.getBoolean(WizardActivity.tutorialMode, false) else false
if (!(tutorialMode || !persistenceServices.isWizardSeen)) {
finish()
startActivity(new Intent(getApplication, classOf[MainActivity]))
}
setContentView(TR.layout.wizard_layout.id)
runUi(initializeWizard(tutorialMode))
}
}
object WizardActivity {
val tutorialMode = "tutorial_mode"
}
示例6: ConfigView
//设置package包名称以及导入依赖的类
package fr.magistry.taigime2
import Message.Config
import android.content.Context
import android.util.Log
import android.view.{LayoutInflater, View}
import android.view.View.OnClickListener
import android.widget.{Button, CheckBox, Switch}
class ConfigView(context: Context, ime: TaigIME) {
val keyFuzzyLookup = "fuzzyLookup"
val keyPojOrTL = "POJorTL"
val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE).asInstanceOf[LayoutInflater]
val view = inflater.inflate(R.layout.config, null)
val cbFuzzy = view.findViewById(R.id.cbFuzzy).asInstanceOf[CheckBox]
val swRomanization = view.findViewById(R.id.swPOJTL).asInstanceOf[Switch]
setValues()
view
.findViewById(R.id.acceptConfig)
.asInstanceOf[Button]
.setOnClickListener(new OnClickListener {
override def onClick(v: View): Unit = {
context.getSharedPreferences("TaigIME2",0)
.edit()
.putBoolean(keyFuzzyLookup, cbFuzzy.isChecked)
.putBoolean(keyPojOrTL,swRomanization.isChecked)
.apply()
Log.v("IME","validate config")
ime.message(Message.ConfigChanged(Config(cbFuzzy.isChecked, swRomanization.isChecked)))
ime.message(Message.ChangeKeyboard)
}
})
def setValues(): Unit = {
val prefs = context.getSharedPreferences("TaigIME2", 0)
val fuzzy = prefs.getBoolean(keyFuzzyLookup,true)
val pojtr = prefs.getBoolean(keyPojOrTL, false)
cbFuzzy.setChecked(fuzzy)
swRomanization.setChecked(pojtr)
}
}