当前位置: 首页>>代码示例>>Java>>正文


Java SettingsFragment类代码示例

本文整理汇总了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);
		}
	}
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:14,代码来源:TTSNotificationProvider.java

示例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();
	}
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:49,代码来源:TTSNotificationProvider.java


注:本文中的com.playuav.android.fragments.SettingsFragment类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。