本文整理汇总了Java中com.playuav.android.fragments.SettingsFragment类的典型用法代码示例。如果您正苦于以下问题:Java SettingsFragment类的具体用法?Java SettingsFragment怎么用?Java SettingsFragment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SettingsFragment类属于com.playuav.android.fragments包,在下文中一共展示了SettingsFragment类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onReceive
import com.playuav.android.fragments.SettingsFragment; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if (SettingsFragment.ACTION_UPDATED_STATUS_PERIOD.equals(action)) {
scheduleWatchdog();
} else if (ACTION_SPEAK_MESSAGE.equals(action)) {
String msg = intent.getStringExtra(EXTRA_MESSAGE_TO_SPEAK);
if (msg != null) {
speak(msg);
}
}
}
示例2: onInit
import com.playuav.android.fragments.SettingsFragment; //导入依赖的package包/类
@Override
public void onInit(int status) {
if (status == TextToSpeech.SUCCESS) {
// TODO: check if the language is available
Locale ttsLanguage;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
ttsLanguage = tts.getDefaultLanguage();
} else {
ttsLanguage = tts.getLanguage();
}
if (ttsLanguage == null) {
ttsLanguage = Locale.US;
}
int supportStatus = tts.setLanguage(ttsLanguage);
switch (supportStatus) {
case TextToSpeech.LANG_MISSING_DATA:
case TextToSpeech.LANG_NOT_SUPPORTED:
tts.shutdown();
tts = null;
Log.e(TAG, "TTS Language data is not available.");
Toast.makeText(context, "Unable to set 'Text to Speech' language!",
Toast.LENGTH_LONG).show();
break;
}
if (tts != null) {
tts.setOnUtteranceCompletedListener(mSpeechCompleteListener);
// Register the broadcast receiver
final IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(ACTION_SPEAK_MESSAGE);
intentFilter.addAction(SettingsFragment.ACTION_UPDATED_STATUS_PERIOD);
LocalBroadcastManager.getInstance(context).registerReceiver(
mSpeechIntervalUpdateReceiver, intentFilter);
}
} else {
// Notify the user that the tts engine is not available.
Log.e(TAG, "TextToSpeech initialization failed.");
Toast.makeText(
context,
"Please make sure 'Text to Speech' is enabled in the "
+ "system accessibility settings.", Toast.LENGTH_LONG).show();
}
}