android.app.Activity.isInMultiWindowMode()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(656)

本文整理了Java中android.app.Activity.isInMultiWindowMode()方法的一些代码示例,展示了Activity.isInMultiWindowMode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.isInMultiWindowMode()方法的具体详情如下:
包路径:android.app.Activity
类名称:Activity
方法名:isInMultiWindowMode

Activity.isInMultiWindowMode介绍

暂无

代码示例

代码示例来源:origin: hidroh/materialistic

@SuppressLint("InlinedApi")
public static Intent multiWindowIntent(Activity activity, Intent intent) {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && activity.isInMultiWindowMode()) {
    intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT |
        Intent.FLAG_ACTIVITY_NEW_TASK |
        Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
  }
  return intent;
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public void onCreateOptionsMenu(Menu menu,
                MenuInflater inflater) {
 inflater.inflate(R.menu.editor_actions, menu);
 if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.N) {
  launchItem=menu.findItem(R.id.launch);
  launchItem.setVisible(getActivity().isInMultiWindowMode());
 }
 super.onCreateOptionsMenu(menu, inflater);
}

代码示例来源:origin: iqiyi/Neptune

@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public boolean isInMultiWindowMode() {
  return mOriginActivity.isInMultiWindowMode();
}

代码示例来源:origin: milosmns/silly-android

/**
 * Checks whether the given activity is in multi-window (split-screen) mode.
 */
public static boolean isInMultiWindowMode(@Nullable final Activity activity) {
  return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && activity != null && activity.isInMultiWindowMode();
}

代码示例来源:origin: morogoku/MTweaks-KernelAdiutorMOD

public static int getOrientation(Activity activity) {
  return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && activity.isInMultiWindowMode() ?
      Configuration.ORIENTATION_PORTRAIT : activity.getResources().getConfiguration().orientation;
}

代码示例来源:origin: cemrich/zapp

/**
 * This function can be used with any API level and will return
 * false if the multi window feature is not supported.
 *
 * @param activity to get access to multi window api
 * @return true if activity is currently displayed in multi window mode
 */
@TargetApi(24)
public static boolean isInsideMultiWindow(Activity activity) {
  return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N &&
    (activity.isInMultiWindowMode() || activity.isInPictureInPictureMode());
}

代码示例来源:origin: ywwynm/EverythingDone

public static boolean isInMultiWindow(Activity activity) {
  if (DeviceUtil.hasNougatApi()) {
    return activity.isInMultiWindowMode();
  }
  return false;
}

代码示例来源:origin: pranavpandey/dynamic-support

/**
 * Checks whether the app is in multi-window mode.
 *
 * @param context The context to get configuration.
 *
 * @return {@code true} if the app is in multi-window mode.
 */
@TargetApi(Build.VERSION_CODES.N)
public static boolean isInMultiWindowMode(@NonNull Context context) {
  try {
    return (DynamicVersionUtils.isNougat()
        && ((Activity) context).isInMultiWindowMode());
  } catch (Exception ignored) {
    return false;
  }
}

代码示例来源:origin: zendesk/belvedere

@Override
public boolean shouldShowFullScreen() {
  // Show full screen image stream if the app is in multi window or picture in picture mode
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
    if (activity.isInMultiWindowMode() || activity.isInPictureInPictureMode()) {
      return true;
    }
  }
  // If there's a hardware keyboard attached show the picker in full screen mode
  final boolean hasHardwareKeyboard =
      activity.getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS;
  if (hasHardwareKeyboard) {
    return true;
  }
  // If there's an accessibility service enabled, show in full screen mode
  // Exclude AccessibilityServiceInfo.FEEDBACK_GENRICE this is used by password mangers.
  final AccessibilityManager manager = (AccessibilityManager) activity.getSystemService(Context.ACCESSIBILITY_SERVICE);
  if (manager != null) {
    int flags = AccessibilityServiceInfo.FEEDBACK_AUDIBLE | AccessibilityServiceInfo.FEEDBACK_SPOKEN
        | AccessibilityServiceInfo.FEEDBACK_VISUAL | AccessibilityServiceInfo.FEEDBACK_BRAILLE
        | AccessibilityServiceInfo.FEEDBACK_HAPTIC;
    final List<AccessibilityServiceInfo> enabledAccessibilityServiceList = manager.getEnabledAccessibilityServiceList(flags);
    if (enabledAccessibilityServiceList != null && enabledAccessibilityServiceList.size() > 0) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: Simon-Leeeeeeeee/SLWidget

boolean isInMultiWindowMode = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && mSwipeBackActivity.isInMultiWindowMode();

代码示例来源:origin: stackoverflow.com

case Configuration.ORIENTATION_LANDSCAPE:
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N &&
    context.isInMultiWindowMode()) { break; }
  v.setPadding(v.getPaddingLeft(), v.getPaddingTop(),
         v.getPaddingRight() + size, v.getPaddingBottom());

相关文章

Activity类方法