本文整理匯總了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;
}