本文整理汇总了C++中AndroidBridge类的典型用法代码示例。如果您正苦于以下问题:C++ AndroidBridge类的具体用法?C++ AndroidBridge怎么用?C++ AndroidBridge使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AndroidBridge类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCurrentScreenConfiguration
void
GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return;
}
nsresult rv;
nsCOMPtr<nsIScreenManager> screenMgr =
do_GetService("@mozilla.org/gfx/screenmanager;1", &rv);
if (NS_FAILED(rv)) {
NS_ERROR("Can't find nsIScreenManager!");
return;
}
nsIntRect rect;
PRInt32 colorDepth, pixelDepth;
ScreenOrientation orientation;
nsCOMPtr<nsIScreen> screen;
screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
screen->GetRect(&rect.x, &rect.y, &rect.width, &rect.height);
screen->GetColorDepth(&colorDepth);
screen->GetPixelDepth(&pixelDepth);
orientation = static_cast<ScreenOrientation>(bridge->GetScreenOrientation());
*aScreenConfiguration =
hal::ScreenConfiguration(rect, orientation, colorDepth, pixelDepth);
}
示例2: GetCurrentScreenConfiguration
void
GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return;
}
nsresult rv;
nsCOMPtr<nsIScreenManager> screenMgr =
do_GetService("@mozilla.org/gfx/screenmanager;1", &rv);
if (NS_FAILED(rv)) {
NS_ERROR("Can't find nsIScreenManager!");
return;
}
int32_t colorDepth, pixelDepth;
int16_t angle;
ScreenOrientationInternal orientation;
nsCOMPtr<nsIScreen> screen;
int32_t rectX, rectY, rectWidth, rectHeight;
screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
screen->GetRect(&rectX, &rectY, &rectWidth, &rectHeight);
screen->GetColorDepth(&colorDepth);
screen->GetPixelDepth(&pixelDepth);
orientation = static_cast<ScreenOrientationInternal>(bridge->GetScreenOrientation());
angle = bridge->GetScreenAngle();
*aScreenConfiguration =
hal::ScreenConfiguration(nsIntRect(rectX, rectY, rectWidth, rectHeight),
orientation, angle, colorDepth, pixelDepth);
}
示例3: Vibrate
void
Vibrate(const nsTArray<uint32> &pattern, const WindowIdentifier &)
{
// Ignore the WindowIdentifier parameter; it's here only because hal::Vibrate,
// hal_sandbox::Vibrate, and hal_impl::Vibrate all must have the same
// signature.
// Strangely enough, the Android Java API seems to treat vibrate([0]) as a
// nop. But we want to treat vibrate([0]) like CancelVibrate! (Note that we
// also need to treat vibrate([]) as a call to CancelVibrate.)
bool allZero = true;
for (uint32 i = 0; i < pattern.Length(); i++) {
if (pattern[i] != 0) {
allZero = false;
break;
}
}
if (allZero) {
hal_impl::CancelVibrate(WindowIdentifier());
return;
}
AndroidBridge* b = AndroidBridge::Bridge();
if (!b) {
return;
}
b->Vibrate(pattern);
}
示例4: uriString
NS_IMETHODIMP
nsAndroidHistory::RegisterVisitedCallback(nsIURI *aURI, Link *aContent)
{
if (!aContent || !aURI)
return NS_OK;
nsCAutoString uri;
nsresult rv = aURI->GetSpec(uri);
if (NS_FAILED(rv)) return rv;
NS_ConvertUTF8toUTF16 uriString(uri);
nsTArray<Link*>* list = mListeners.Get(uriString);
if (! list) {
list = new nsTArray<Link*>();
mListeners.Put(uriString, list);
}
list->AppendElement(aContent);
AndroidBridge *bridge = AndroidBridge::Bridge();
if (bridge) {
bridge->CheckURIVisited(uriString);
}
return NS_OK;
}
示例5: uriString
NS_IMETHODIMP
nsAndroidHistory::VisitURI(nsIURI *aURI, nsIURI *aLastVisitedURI, uint32_t aFlags)
{
if (!aURI)
return NS_OK;
if (!(aFlags & VisitFlags::TOP_LEVEL))
return NS_OK;
if (aFlags & VisitFlags::REDIRECT_SOURCE)
return NS_OK;
if (aFlags & VisitFlags::UNRECOVERABLE_ERROR)
return NS_OK;
AndroidBridge *bridge = AndroidBridge::Bridge();
if (bridge) {
nsAutoCString uri;
nsresult rv = aURI->GetSpec(uri);
if (NS_FAILED(rv)) return rv;
NS_ConvertUTF8toUTF16 uriString(uri);
bridge->MarkURIVisited(uriString);
}
return NS_OK;
}
示例6: CancelVibrate
void
CancelVibrate(const WindowIdentifier &)
{
// Ignore WindowIdentifier parameter.
AndroidBridge* b = AndroidBridge::Bridge();
if (b)
b->CancelVibrate();
}
示例7: DisableNetworkNotifications
void
DisableNetworkNotifications()
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return;
}
bridge->DisableNetworkNotifications();
}
示例8: EnableScreenConfigurationNotifications
void
EnableScreenConfigurationNotifications()
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return;
}
bridge->EnableScreenOrientationNotifications();
}
示例9: UnlockScreenOrientation
void
UnlockScreenOrientation()
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return;
}
bridge->UnlockScreenOrientation();
}
示例10: EnableBatteryNotifications
void
EnableBatteryNotifications()
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return;
}
bridge->EnableBatteryNotifications();
}
示例11: DisableScreenOrientationNotifications
void
DisableScreenOrientationNotifications()
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return;
}
bridge->DisableScreenOrientationNotifications();
}
示例12: GetCurrentNetworkInformation
void
GetCurrentNetworkInformation(hal::NetworkInformation* aNetworkInfo)
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return;
}
bridge->GetCurrentNetworkInformation(aNetworkInfo);
}
示例13: GetCurrentBatteryInformation
void
GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInfo)
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return;
}
bridge->GetCurrentBatteryInformation(aBatteryInfo);
}
示例14: LockScreenOrientation
bool
LockScreenOrientation(const dom::ScreenOrientation& aOrientation)
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return false;
}
bridge->LockScreenOrientation(dom::ScreenOrientationWrapper(aOrientation));
return true;
}
示例15: GetCurrentScreenOrientation
void
GetCurrentScreenOrientation(dom::ScreenOrientation* aScreenOrientation)
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return;
}
dom::ScreenOrientationWrapper orientationWrapper;
bridge->GetScreenOrientation(orientationWrapper);
*aScreenOrientation = orientationWrapper.orientation;
}