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


C++ AndroidBridge类代码示例

本文整理汇总了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);
}
开发者ID:marshall,项目名称:mozilla-central,代码行数:30,代码来源:AndroidHal.cpp

示例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);
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:35,代码来源:AndroidHal.cpp

示例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);
}
开发者ID:almet,项目名称:mozilla-central,代码行数:30,代码来源:AndroidHal.cpp

示例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;
}
开发者ID:Type-of-Tool,项目名称:ExMail,代码行数:25,代码来源:nsAndroidHistory.cpp

示例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;
}
开发者ID:at13,项目名称:mozilla-central,代码行数:25,代码来源:nsAndroidHistory.cpp

示例6: CancelVibrate

void
CancelVibrate(const WindowIdentifier &)
{
  // Ignore WindowIdentifier parameter.

  AndroidBridge* b = AndroidBridge::Bridge();
  if (b)
    b->CancelVibrate();
}
开发者ID:almet,项目名称:mozilla-central,代码行数:9,代码来源:AndroidHal.cpp

示例7: DisableNetworkNotifications

void
DisableNetworkNotifications()
{
  AndroidBridge* bridge = AndroidBridge::Bridge();
  if (!bridge) {
    return;
  }

  bridge->DisableNetworkNotifications();
}
开发者ID:almet,项目名称:mozilla-central,代码行数:10,代码来源:AndroidHal.cpp

示例8: EnableScreenConfigurationNotifications

void
EnableScreenConfigurationNotifications()
{
  AndroidBridge* bridge = AndroidBridge::Bridge();
  if (!bridge) {
    return;
  }

  bridge->EnableScreenOrientationNotifications();
}
开发者ID:marshall,项目名称:mozilla-central,代码行数:10,代码来源:AndroidHal.cpp

示例9: UnlockScreenOrientation

void
UnlockScreenOrientation()
{
  AndroidBridge* bridge = AndroidBridge::Bridge();
  if (!bridge) {
    return;
  }

  bridge->UnlockScreenOrientation();
}
开发者ID:almet,项目名称:mozilla-central,代码行数:10,代码来源:AndroidHal.cpp

示例10: EnableBatteryNotifications

void
EnableBatteryNotifications()
{
  AndroidBridge* bridge = AndroidBridge::Bridge();
  if (!bridge) {
    return;
  }

  bridge->EnableBatteryNotifications();
}
开发者ID:almet,项目名称:mozilla-central,代码行数:10,代码来源:AndroidHal.cpp

示例11: DisableScreenOrientationNotifications

void
DisableScreenOrientationNotifications()
{
  AndroidBridge* bridge = AndroidBridge::Bridge();
  if (!bridge) {
    return;
  }

  bridge->DisableScreenOrientationNotifications();
}
开发者ID:almet,项目名称:mozilla-central,代码行数:10,代码来源:AndroidHal.cpp

示例12: GetCurrentNetworkInformation

void
GetCurrentNetworkInformation(hal::NetworkInformation* aNetworkInfo)
{
  AndroidBridge* bridge = AndroidBridge::Bridge();
  if (!bridge) {
    return;
  }

  bridge->GetCurrentNetworkInformation(aNetworkInfo);
}
开发者ID:almet,项目名称:mozilla-central,代码行数:10,代码来源:AndroidHal.cpp

示例13: GetCurrentBatteryInformation

void
GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInfo)
{
  AndroidBridge* bridge = AndroidBridge::Bridge();
  if (!bridge) {
    return;
  }

  bridge->GetCurrentBatteryInformation(aBatteryInfo);
}
开发者ID:almet,项目名称:mozilla-central,代码行数:10,代码来源:AndroidHal.cpp

示例14: LockScreenOrientation

bool
LockScreenOrientation(const dom::ScreenOrientation& aOrientation)
{
  AndroidBridge* bridge = AndroidBridge::Bridge();
  if (!bridge) {
    return false;
  }

  bridge->LockScreenOrientation(dom::ScreenOrientationWrapper(aOrientation));
  return true;
}
开发者ID:almet,项目名称:mozilla-central,代码行数:11,代码来源:AndroidHal.cpp

示例15: GetCurrentScreenOrientation

void
GetCurrentScreenOrientation(dom::ScreenOrientation* aScreenOrientation)
{
  AndroidBridge* bridge = AndroidBridge::Bridge();
  if (!bridge) {
    return;
  }

  dom::ScreenOrientationWrapper orientationWrapper;
  bridge->GetScreenOrientation(orientationWrapper);
  *aScreenOrientation = orientationWrapper.orientation;
}
开发者ID:almet,项目名称:mozilla-central,代码行数:12,代码来源:AndroidHal.cpp


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