本文整理汇总了Java中org.appcelerator.titanium.util.Log类的典型用法代码示例。如果您正苦于以下问题:Java Log类的具体用法?Java Log怎么用?Java Log使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Log类属于org.appcelerator.titanium.util包,在下文中一共展示了Log类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pause
import org.appcelerator.titanium.util.Log; //导入依赖的package包/类
public void pause()
{
try {
if (mp != null) {
am.setMode(AudioManager.USE_DEFAULT_STREAM_TYPE);
am.setSpeakerphoneOn(true);
if(mp.isPlaying()) {
if (DBG) {
Log.d(LCAT,"audio is playing, pause");
}
//if (remote) {
stopProgressTimer();
//}
mp.pause();
paused = true;
setState(STATE_PAUSED);
}
}
} catch (Throwable t) {
Log.w(LCAT, "Issue while pausing : " , t);
}
}
示例2: reset
import org.appcelerator.titanium.util.Log; //导入依赖的package包/类
public void reset()
{
try {
if (mp != null) {
//if (remote) {
stopProgressTimer();
//}
setState(STATE_STOPPING);
mp.stop();
mp.seekTo(0);
looping = false;
paused = false;
setState(STATE_STOPPED);
}
} catch (Throwable t) {
Log.w(LCAT, "Issue while resetting : " , t);
}
}
示例3: setVolume
import org.appcelerator.titanium.util.Log; //导入依赖的package包/类
public void setVolume(float volume)
{
try {
if (volume < 0.0f) {
this.volume = 0.0f;
Log.w(LCAT, "Attempt to set volume less than 0.0. Volume set to 0.0");
} else if (volume > 1.0) {
this.volume = 1.0f;
proxy.setProperty(PROPERTY_VOLUME, volume);
Log.w(LCAT, "Attempt to set volume greater than 1.0. Volume set to 1.0");
} else {
this.volume = volume; // Store in 0.0 to 1.0, scale when setting hw
}
if (mp != null) {
float scaledVolume = this.volume;
mp.setVolume(scaledVolume, scaledVolume);
}
} catch (Throwable t) {
Log.w(LCAT, "Issue while setting volume : " , t);
}
}
示例4: handleCreationDict
import org.appcelerator.titanium.util.Log; //导入依赖的package包/类
@Override
public void handleCreationDict(KrollDict options) {
super.handleCreationDict(options);
if (options.containsKey(TiC.PROPERTY_URL)) {
setProperty(TiC.PROPERTY_URL, resolveUrl(null, TiConvert.toString(options, TiC.PROPERTY_URL)));
}
if (options.containsKey(TiC.PROPERTY_ALLOW_BACKGROUND)) {
setProperty(TiC.PROPERTY_ALLOW_BACKGROUND, options.get(TiC.PROPERTY_ALLOW_BACKGROUND));
}
if(options.containsKey("speakerphone")) {
setProperty("speakerphone", TiConvert.toBoolean(options.get("speakerphone")));
}
if (DBG) {
Log.i(LCAT, "Creating audio player proxy for url: " + TiConvert.toString(getProperty("url")));
}
}
示例5: startRecognize
import org.appcelerator.titanium.util.Log; //导入依赖的package包/类
protected void startRecognize() {
Log.d(LCAT, "startRecognize");
Intent intent = null;
switch (this.getAction()) {
case SpeechrecognizerModule.RECOGNIZE:
intent = getRecognizeSpeechIntent();
break;
case SpeechrecognizerModule.WEBSERACH:
intent = getWebSearchIntent();
break;
case SpeechrecognizerModule.HANDSFREE:
intent = getVoiceSearchHandsFree();
break;
}
if (intent != null) {
mSpeechRecognizer.startListening(intent);
}
}
示例6: getRecognizeSpeechIntent
import org.appcelerator.titanium.util.Log; //导入依赖的package包/类
private Intent getRecognizeSpeechIntent() {
Log.d(LCAT, "getRecognizeSpeechIntent");
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
if (getLangmodel() == SpeechrecognizerModule.FREEFORM) {
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
} else if (this.getLangmodel() == SpeechrecognizerModule.WEBSEARCH) {
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
}else{
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
}
/*
* if (getPrompt() != null) {
* intent.putExtra(RecognizerIntent.EXTRA_PROMPT, getPrompt()); }
*/
if (getLangtag() != null) {
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, getLangtag());
}
intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, getMaxresult());
intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, TiApplication
.getInstance().getPackageName());
return intent;
}
示例7: onResults
import org.appcelerator.titanium.util.Log; //导入依赖的package包/类
@Override
public void onResults(Bundle results) {
Log.v(LCAT, "onResults");
String[] heard = null;
float[] scores = null;
if (results != null) {
if (results.containsKey(SpeechRecognizer.RESULTS_RECOGNITION)) {
ArrayList<String> resultsrecog = results
.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
if (resultsrecog != null) {
heard = results.getStringArrayList(
SpeechRecognizer.RESULTS_RECOGNITION).toArray(
new String[0]);
if (Build.VERSION.SDK_INT >= 14) {
scores = results
.getFloatArray(SpeechRecognizer.CONFIDENCE_SCORES);
}
}
}
}
KrollDict data = getResultKrollDict(heard, scores);
data.put(TiC.EVENT_PROPERTY_SOURCE, SpeechRecognizerProxy.this);
data.put(TiC.PROPERTY_TYPE, SpeechrecognizerModule.RESULTS);
fireEvent(SpeechrecognizerModule.RESULTS, data);
}
示例8: release
import org.appcelerator.titanium.util.Log; //导入依赖的package包/类
public void release()
{
try {
if (mp != null) {
mp.setOnCompletionListener(null);
mp.setOnErrorListener(null);
mp.setOnBufferingUpdateListener(null);
mp.setOnInfoListener(null);
mp.setOnPreparedListener(null);
/*
* Restore default stream type
*/
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.KITKAT) {
am.setMode(AudioManager.USE_DEFAULT_STREAM_TYPE);
am.setSpeakerphoneOn(true);
}
mp.release();
mp = null;
if (DBG) {
Log.d(LCAT, "Native resources released.");
}
remote = false;
}
} catch (Throwable t) {
Log.w(LCAT, "Issue while releasing : " , t);
}
}
示例9: setLooping
import org.appcelerator.titanium.util.Log; //导入依赖的package包/类
public void setLooping(boolean loop)
{
try {
if(loop != looping) {
if (mp != null) {
mp.setLooping(loop);
}
looping = loop;
}
} catch (Throwable t) {
Log.w(LCAT, "Issue while configuring looping : " , t);
}
}
示例10: onInfo
import org.appcelerator.titanium.util.Log; //导入依赖的package包/类
@Override
public boolean onInfo(MediaPlayer mp, int what, int extra)
{
String msg = "OnInfo Unknown media issue.";
switch(what)
{
case MediaPlayer.MEDIA_INFO_BAD_INTERLEAVING :
msg = "Stream not interleaved or interleaved improperly.";
break;
case MediaPlayer.MEDIA_INFO_NOT_SEEKABLE :
msg = "Stream does not support seeking";
break;
case MediaPlayer.MEDIA_INFO_UNKNOWN :
msg = "Unknown media issue";
break;
case MediaPlayer.MEDIA_INFO_VIDEO_TRACK_LAGGING :
msg = "Video is too complex for decoder, video lagging."; // shouldn't occur, but covering bases.
break;
case MediaPlayer.MEDIA_INFO_METADATA_UPDATE:
msg = "Video metadata update.";
break;
}
Log.d(LCAT, "Error " + msg);
KrollDict data = new KrollDict();
data.put(TiC.PROPERTY_CODE, 0);
data.put(TiC.PROPERTY_MESSAGE, msg);
proxy.fireEvent(EVENT_ERROR, data);
return true;
}
示例11: onBufferingUpdate
import org.appcelerator.titanium.util.Log; //导入依赖的package包/类
@Override
public void onBufferingUpdate(MediaPlayer mp, int percent)
{
if (DBG)
{
Log.d(LCAT, "Buffering: " + percent + "%");
}
KrollDict data = new KrollDict();
data.put("percent", percent);
proxy.fireEvent(EVENT_BUFFERING, data);
}
示例12: startProgressTimer
import org.appcelerator.titanium.util.Log; //导入依赖的package包/类
private void startProgressTimer()
{
if (progressTimer == null)
{
progressTimer = new Timer(true);
}
else
{
progressTimer.cancel();
progressTimer = new Timer(true);
}
progressTimer.schedule(new TimerTask()
{
@Override
public void run()
{
if (mp != null && mp.isPlaying())
{
int position = mp.getCurrentPosition();
if (DBG)
{
Log.d(LCAT, "Progress: " + position);
}
KrollDict event = new KrollDict();
event.put("progress", position);
proxy.fireEvent(EVENT_PROGRESS, event);
}
}
}, 1000, 1000);
}
示例13: onPrepared
import org.appcelerator.titanium.util.Log; //导入依赖的package包/类
@Override
public void onPrepared(MediaPlayer arg0) {
Log.d(LCAT, "In onPrepared");
// TODO Auto-generated method stub
//this.setState(STATE_INITIALIZED);
//startPlay();
}
示例14: handleCreationDict
import org.appcelerator.titanium.util.Log; //导入依赖的package包/类
@Override
public void handleCreationDict(KrollDict options)
{
super.handleCreationDict(options);
if (options.containsKey("message")) {
Log.d(LCAT, "example created with message: " + options.get("message"));
}
}
示例15: handleEvent
import org.appcelerator.titanium.util.Log; //导入依赖的package包/类
@Override
public void handleEvent(DownloadEvent event) {
// TODO Auto-generated method stub
Log.d(LCAT, "Download Paused ");
KrollDict dict = createDict(event.getDownloadInformation());
self.fireEvent(EVENT_PAUSED, dict);
//TiMessenger.sendBlockingMainMessage(handler.obtainMessage(MSG_FIRE_PAUSED, dict));
}