本文整理汇总了C++中AndroidBridge::SetSelectedLocale方法的典型用法代码示例。如果您正苦于以下问题:C++ AndroidBridge::SetSelectedLocale方法的具体用法?C++ AndroidBridge::SetSelectedLocale怎么用?C++ AndroidBridge::SetSelectedLocale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AndroidBridge
的用法示例。
在下文中一共展示了AndroidBridge::SetSelectedLocale方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
nsresult
nsAppShell::Init()
{
#ifdef PR_LOGGING
if (!gWidgetLog)
gWidgetLog = PR_NewLogModule("Widget");
#endif
mObserversHash.Init();
nsresult rv = nsBaseAppShell::Init();
AndroidBridge* bridge = AndroidBridge::Bridge();
nsCOMPtr<nsIObserverService> obsServ =
mozilla::services::GetObserverService();
if (obsServ) {
obsServ->AddObserver(this, "xpcom-shutdown", false);
}
if (sPowerManagerService)
sPowerManagerService->AddWakeLockListener(sWakeLockListener);
if (!bridge)
return rv;
Preferences::AddStrongObservers(this, kObservedPrefs);
bool match;
rv = Preferences::GetBool(PREFNAME_MATCH_OS, &match);
NS_ENSURE_SUCCESS(rv, rv);
if (match) {
bridge->SetSelectedLocale(EmptyString());
return NS_OK;
}
nsAutoString locale;
rv = Preferences::GetLocalizedString(PREFNAME_UA_LOCALE, &locale);
if (NS_FAILED(rv)) {
rv = Preferences::GetString(PREFNAME_UA_LOCALE, &locale);
}
bridge->SetSelectedLocale(locale);
mAllowCoalescingTouches = Preferences::GetBool(PREFNAME_COALESCE_TOUCHES, true);
return rv;
}
示例2: Observe
NS_IMETHODIMP
nsAppShell::Observe(nsISupports* aSubject,
const char* aTopic,
const PRUnichar* aData)
{
if (!strcmp(aTopic, "xpcom-shutdown")) {
// We need to ensure no observers stick around after XPCOM shuts down
// or we'll see crashes, as the app shell outlives XPConnect.
mObserversHash.Clear();
return nsBaseAppShell::Observe(aSubject, aTopic, aData);
} else if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) && aData && (
nsDependentString(aData).Equals(
NS_LITERAL_STRING(PREFNAME_UA_LOCALE)) ||
nsDependentString(aData).Equals(
NS_LITERAL_STRING(PREFNAME_COALESCE_TOUCHES)) ||
nsDependentString(aData).Equals(
NS_LITERAL_STRING(PREFNAME_MATCH_OS)))) {
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return NS_OK;
}
bool match;
nsresult rv = Preferences::GetBool(PREFNAME_MATCH_OS, &match);
NS_ENSURE_SUCCESS(rv, rv);
if (match) {
bridge->SetSelectedLocale(EmptyString());
return NS_OK;
}
nsAutoString locale;
if (NS_FAILED(Preferences::GetLocalizedString(PREFNAME_UA_LOCALE,
&locale))) {
locale = Preferences::GetString(PREFNAME_UA_LOCALE);
}
bridge->SetSelectedLocale(locale);
mAllowCoalescingTouches = Preferences::GetBool(PREFNAME_COALESCE_TOUCHES, true);
return NS_OK;
}
return NS_OK;
}