本文整理汇总了Java中android.app.Activity.isInMultiWindowMode方法的典型用法代码示例。如果您正苦于以下问题:Java Activity.isInMultiWindowMode方法的具体用法?Java Activity.isInMultiWindowMode怎么用?Java Activity.isInMultiWindowMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.Activity
的用法示例。
在下文中一共展示了Activity.isInMultiWindowMode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fitSystemWindow
import android.app.Activity; //导入方法依赖的package包/类
public Builder fitSystemWindow() {
Activity activity = (Activity) mContext;
Window window = activity.getWindow();
if (window == null) {
LogUtil.d("fitSystemWindow() window is null");
return this;
}
WindowManager.LayoutParams params = window.getAttributes();
int navigationBarHeight = CafeBarUtil.getNavigationBarHeight(mContext);
boolean isInMultiWindowMode = false;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
isInMultiWindowMode = activity.isInMultiWindowMode();
}
if ((params.flags & WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION) ==
WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION) {
mFitSystemWindow = navigationBarHeight > 0 && !isInMultiWindowMode;
}
return this;
}
示例2: getScreenWidth
import android.app.Activity; //导入方法依赖的package包/类
/**
* Finds and returns the TRUE width of the screen
* @return
*/
public static int getScreenWidth(Activity activity) {
if (activity != null) {
Display display = activity.getWindowManager().getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
Point size = new Point();
int width, height;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && activity.isInMultiWindowMode()) {
display.getMetrics(metrics);
} else {
display.getRealMetrics(metrics);
}
width = metrics.widthPixels;
height = metrics.heightPixels;
} else {
display.getSize(size);
width = size.x;
height = size.y;
}
return Math.max(width, height);
}
return 0;
}
示例3: isInMultiWindowMode
import android.app.Activity; //导入方法依赖的package包/类
/**
* 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();
}
示例4: getOrientation
import android.app.Activity; //导入方法依赖的package包/类
public static int getOrientation(Activity activity) {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && activity.isInMultiWindowMode() ?
Configuration.ORIENTATION_PORTRAIT : activity.getResources().getConfiguration().orientation;
}