Java Code Examples for android.widget.FrameLayout#setFitsSystemWindows()
The following examples show how to use
android.widget.FrameLayout#setFitsSystemWindows() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PreviewActivity.java From EasyPhotos with Apache License 2.0 | 5 votes |
private void initView() { setClick(R.id.iv_back, R.id.tv_edit, R.id.tv_selector); mToolBar = findViewById(R.id.m_top_bar_layout); if (!SystemUtils.getInstance().hasNavigationBar(this)) { FrameLayout mRootView = findViewById(R.id.m_root_view); mRootView.setFitsSystemWindows(true); mToolBar.setPadding(0, SystemUtils.getInstance().getStatusBarHeight(this), 0, 0); if (ColorUtils.isWhiteColor(statusColor)) { SystemUtils.getInstance().setStatusDark(this, true); } } mBottomBar = findViewById(R.id.m_bottom_bar); ivSelector = findViewById(R.id.iv_selector); tvNumber = findViewById(R.id.tv_number); tvDone = findViewById(R.id.tv_done); tvOriginal = findViewById(R.id.tv_original); flFragment = findViewById(R.id.fl_fragment); previewFragment = (PreviewFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_preview); if (Setting.showOriginalMenu) { processOriginalMenu(); } else { tvOriginal.setVisibility(View.GONE); } setClick(tvOriginal, tvDone, ivSelector); initRecyclerView(); shouldShowMenuDone(); if (hasExternalPhotos) { tvOriginal.setVisibility(View.GONE); tvDone.setVisibility(View.GONE); ivSelector.setVisibility(View.GONE); findViewById(R.id.tv_edit).setVisibility(View.GONE); findViewById(R.id.tv_selector).setVisibility(View.GONE); } }
Example 2
Source File: PreviewActivity.java From imsdk-android with MIT License | 5 votes |
private void initView() { setClick(R.id.iv_back, R.id.tv_edit, R.id.tv_selector); mToolBar = (FrameLayout) findViewById(R.id.m_top_bar_layout); if (!SystemUtils.getInstance().hasNavigationBar(this)) { FrameLayout mRootView = (FrameLayout) findViewById(R.id.m_root_view); mRootView.setFitsSystemWindows(true); mToolBar.setPadding(0, SystemUtils.getInstance().getStatusBarHeight(this), 0, 0); if (ColorUtils.isWhiteColor(statusColor)) { SystemUtils.getInstance().setStatusDark(this, true); } } mBottomBar = (RelativeLayout) findViewById(R.id.m_bottom_bar); ivSelector = (ImageView) findViewById(R.id.iv_selector); tvNumber = (TextView) findViewById(R.id.tv_number); tvDone = (PressedTextView) findViewById(R.id.tv_done); tvOriginal = (TextView) findViewById(R.id.tv_original); flFragment = (FrameLayout) findViewById(R.id.fl_fragment); previewFragment = (PreviewFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_preview); if (Setting.showOriginalMenu) { processOriginalMenu(); } else { tvOriginal.setVisibility(View.GONE); } setClick(tvOriginal, tvDone, ivSelector); initRecyclerView(); shouldShowMenuDone(); }
Example 3
Source File: ReactModalHostView.java From react-native-GPay with MIT License | 5 votes |
/** * Returns the view that will be the root view of the dialog. We are wrapping this in a * FrameLayout because this is the system's way of notifying us that the dialog size has changed. * This has the pleasant side-effect of us not having to preface all Modals with * "top: statusBarHeight", since that margin will be included in the FrameLayout. */ private View getContentView() { FrameLayout frameLayout = new FrameLayout(getContext()); frameLayout.addView(mHostView); frameLayout.setFitsSystemWindows(true); return frameLayout; }
Example 4
Source File: StickerPreviewViewer.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
public void setParentActivity(Activity activity) { currentAccount = UserConfig.selectedAccount; centerImage.setCurrentAccount(currentAccount); if (parentActivity == activity) { return; } parentActivity = activity; windowView = new FrameLayout(activity); windowView.setFocusable(true); windowView.setFocusableInTouchMode(true); if (Build.VERSION.SDK_INT >= 23) { windowView.setFitsSystemWindows(true); } containerView = new FrameLayoutDrawer(activity); containerView.setFocusable(false); windowView.addView(containerView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT)); containerView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_POINTER_UP || event.getAction() == MotionEvent.ACTION_CANCEL) { close(); } return true; } }); windowLayoutParams = new WindowManager.LayoutParams(); windowLayoutParams.height = WindowManager.LayoutParams.MATCH_PARENT; windowLayoutParams.format = PixelFormat.TRANSLUCENT; windowLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; windowLayoutParams.gravity = Gravity.TOP; windowLayoutParams.type = WindowManager.LayoutParams.LAST_APPLICATION_WINDOW; if (Build.VERSION.SDK_INT >= 21) { windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; } else { windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; } centerImage.setAspectFit(true); centerImage.setInvalidateAll(true); centerImage.setParentView(containerView); }
Example 5
Source File: StickerPreviewViewer.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
public void setParentActivity(Activity activity) { currentAccount = UserConfig.selectedAccount; centerImage.setCurrentAccount(currentAccount); if (parentActivity == activity) { return; } parentActivity = activity; windowView = new FrameLayout(activity); windowView.setFocusable(true); windowView.setFocusableInTouchMode(true); if (Build.VERSION.SDK_INT >= 23) { windowView.setFitsSystemWindows(true); } containerView = new FrameLayoutDrawer(activity); containerView.setFocusable(false); windowView.addView(containerView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT)); containerView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_POINTER_UP || event.getAction() == MotionEvent.ACTION_CANCEL) { close(); } return true; } }); windowLayoutParams = new WindowManager.LayoutParams(); windowLayoutParams.height = WindowManager.LayoutParams.MATCH_PARENT; windowLayoutParams.format = PixelFormat.TRANSLUCENT; windowLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; windowLayoutParams.gravity = Gravity.TOP; windowLayoutParams.type = WindowManager.LayoutParams.LAST_APPLICATION_WINDOW; if (Build.VERSION.SDK_INT >= 21) { windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; } else { windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; } centerImage.setAspectFit(true); centerImage.setInvalidateAll(true); centerImage.setParentView(containerView); }
Example 6
Source File: ContentPreviewViewer.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public void setParentActivity(Activity activity) { currentAccount = UserConfig.selectedAccount; centerImage.setCurrentAccount(currentAccount); centerImage.setLayerNum(7); if (parentActivity == activity) { return; } parentActivity = activity; slideUpDrawable = parentActivity.getResources().getDrawable(R.drawable.preview_arrow); windowView = new FrameLayout(activity); windowView.setFocusable(true); windowView.setFocusableInTouchMode(true); if (Build.VERSION.SDK_INT >= 21) { windowView.setFitsSystemWindows(true); windowView.setOnApplyWindowInsetsListener((v, insets) -> { lastInsets = insets; return insets; }); } containerView = new FrameLayoutDrawer(activity); containerView.setFocusable(false); windowView.addView(containerView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT)); containerView.setOnTouchListener((v, event) -> { if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_POINTER_UP || event.getAction() == MotionEvent.ACTION_CANCEL) { close(); } return true; }); windowLayoutParams = new WindowManager.LayoutParams(); windowLayoutParams.height = WindowManager.LayoutParams.MATCH_PARENT; windowLayoutParams.format = PixelFormat.TRANSLUCENT; windowLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; windowLayoutParams.gravity = Gravity.TOP; windowLayoutParams.type = WindowManager.LayoutParams.LAST_APPLICATION_WINDOW; if (Build.VERSION.SDK_INT >= 21) { windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN; } else { windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; } centerImage.setAspectFit(true); centerImage.setInvalidateAll(true); centerImage.setParentView(containerView); }
Example 7
Source File: ContentPreviewViewer.java From Telegram with GNU General Public License v2.0 | 4 votes |
public void setParentActivity(Activity activity) { currentAccount = UserConfig.selectedAccount; centerImage.setCurrentAccount(currentAccount); centerImage.setLayerNum(7); if (parentActivity == activity) { return; } parentActivity = activity; slideUpDrawable = parentActivity.getResources().getDrawable(R.drawable.preview_arrow); windowView = new FrameLayout(activity); windowView.setFocusable(true); windowView.setFocusableInTouchMode(true); if (Build.VERSION.SDK_INT >= 21) { windowView.setFitsSystemWindows(true); windowView.setOnApplyWindowInsetsListener((v, insets) -> { lastInsets = insets; return insets; }); } containerView = new FrameLayoutDrawer(activity); containerView.setFocusable(false); windowView.addView(containerView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT)); containerView.setOnTouchListener((v, event) -> { if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_POINTER_UP || event.getAction() == MotionEvent.ACTION_CANCEL) { close(); } return true; }); windowLayoutParams = new WindowManager.LayoutParams(); windowLayoutParams.height = WindowManager.LayoutParams.MATCH_PARENT; windowLayoutParams.format = PixelFormat.TRANSLUCENT; windowLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; windowLayoutParams.gravity = Gravity.TOP; windowLayoutParams.type = WindowManager.LayoutParams.LAST_APPLICATION_WINDOW; if (Build.VERSION.SDK_INT >= 21) { windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN; } else { windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; } centerImage.setAspectFit(true); centerImage.setInvalidateAll(true); centerImage.setParentView(containerView); }