@Override public void onGlobalLayout() { int heightDiff = rootLayout.getRootView().getHeight() - rootLayout.getHeight(); int contentViewTop = getWindow().findViewById(Window.ID_ANDROID_CONTENT).getTop();
private int getImeInset() { return Math.max(0, mBottomInset - (mStackScrollLayout.getRootView().getHeight() - mStackScrollLayout.getHeight())); }
private View createFullscreenTool(int toolId) { // Create full screen effect tool on top of photo-view and place it within the same // view group that contains photo-view. View photoView = effectToolPanel.getRootView().findViewById(R.id.photo_view); ViewGroup parent = (ViewGroup) photoView.getParent(); FullscreenToolView view = (FullscreenToolView) inflater.inflate(toolId, parent, false); view.setPhotoBounds(((PhotoView) photoView).getPhotoBounds()); parent.addView(view, parent.indexOfChild(photoView) + 1); return view; }
private void showUndoBar(final ViewGroup parent, final View mCheckableLine, final int index) { View snackBarContainer = undoBarContainerView != null ? undoBarContainerView : parent.getRootView() .findViewById(android.R.id.content); Snackbar.make(snackBarContainer, R.string.item_deleted, Snackbar.LENGTH_LONG) .setAction(R.string.undo, new OnClickListener() { @Override public void onClick(View v) { parent.addView(mCheckableLine, index); deletionUndone = true; } }) .setCallback(new Snackbar.Callback() { @Override public void onDismissed(Snackbar snackbar, int event) { if (!deletionUndone) { mCheckListEventListener.onLineDeleted((CheckListViewItem) mCheckableLine); } } }).show(); }
@Override public View getView(int index, View view, ViewGroup parent) { if (view == null) { LayoutInflater inflater = LayoutInflater.from(parent.getContext()); view = inflater.inflate(R.layout.list_view_item , parent, false); } final OnClickListener editRecordHandler = new OnClickListener() { @override public void onClick(View v) { View v2 = parent.getRootView(); TextView phone = (TextView) v2.findViewById(R.id.phoneText); phone.setText("ABC"); } } ImageView deleteView = (ImageView) view.findViewById(R.id.deleteButton); deleteView.setOnClickListener(deleteRecordHandler); deleteView.setTag(contact.id); ImageView editView = (ImageView) view.findViewById(R.id.editButton); editView.setOnClickListener(editRecordHandler); editView.setTag(contact.id); return view; }
@Override public void onGlobalLayout() { final int statusBarHeight = UI.getStatusBarHeight(context); final int navigationBarHeight = UI.getNavigationBarHeight(context); // check the display window size for the app layout final Rect rect = new Rect(); context.getWindow().getDecorView().getWindowVisibleDisplayFrame(rect); // screen height - (user app height + status + nav) -> if non-zero, then there is a soft keyboard final ViewGroup layout = SillyAndroid.getContentView(context); if (layout == null) { throw new IllegalArgumentException("Passed Activity needs to have its content view set before attaching this listener"); } final int keyboardHeight = layout.getRootView().getHeight() - (statusBarHeight + navigationBarHeight + rect.height()); if (keyboardHeight <= 0) { if (isKeyboardVisible) { with.onKeyboardHidden(); isKeyboardVisible = false; } } else { if (!isKeyboardVisible) { with.onKeyboardShown(keyboardHeight); isKeyboardVisible = true; } } } };
View rootView = contentView.getRootView();
viewGroup.getRootView().getWindowVisibleDisplayFrame(currentBounds); return currentBounds.height() / SCALE;