List of usage examples for android.view View toString
public String toString()
From source file:name.teze.layout.lib.SlidingPaneLayout.java
/** * @param x/*from w ww. j a v a 2 s.c o m*/ * @param y * @param view * @return * @author: by Fooyou 201434 ?3:03:42 */ private boolean isPointInsideView(float x, float y, View view) { int location[] = new int[2]; view.getLocationOnScreen(location); int viewX = location[0]; int viewY = location[1]; if ((x > viewX && x < (viewX + view.getWidth())) && (y > viewY && y < (viewY + view.getHeight()))) { if (BuildConfig.DEBUG) Log.w(TAG, "isPointInsideView >>true " + view.toString()); return true; } else { if (BuildConfig.DEBUG) Log.w(TAG, "isPointInsideView >>false " + view.toString()); return false; } }
From source file:androidx.media.widget.VideoView2.java
@Override public void onSurfaceCreated(View view, int width, int height) { if (DEBUG) {/*from w ww .j a v a2s. c o m*/ Log.d(TAG, "onSurfaceCreated(). mCurrentState=" + mCurrentState + ", mTargetState=" + mTargetState + ", width/height: " + width + "/" + height + ", " + view.toString()); } if (needToStart()) { mMediaController.getTransportControls().play(); } }
From source file:com.doubleTwist.drawerlib.ADrawerLayout.java
@Override protected void measureChild(View v, int widthSpec, int heightSpec) { int wMode, hMode, wSpec, hSpec; int maxW = MeasureSpec.getSize(widthSpec); int maxH = MeasureSpec.getSize(heightSpec); LayoutParams params = (LayoutParams) v.getLayoutParams(); if (DEBUG) {/*from w w w . j a v a2 s . c o m*/ Log.d(TAG, " == VIEW == " + v.toString()); Log.d(TAG, "params.width: " + params.width); Log.d(TAG, "params.height: " + params.height); Log.d(TAG, "maxW: " + maxW); Log.d(TAG, "maxH: " + maxH); } if (params.width == LayoutParams.WRAP_CONTENT) { wMode = MeasureSpec.AT_MOST; wSpec = MeasureSpec.makeMeasureSpec(maxW, wMode); } else if (params.width == LayoutParams.MATCH_PARENT) { wMode = MeasureSpec.EXACTLY; wSpec = MeasureSpec.makeMeasureSpec(maxW, wMode); } else { wMode = MeasureSpec.EXACTLY; wSpec = MeasureSpec.makeMeasureSpec(Math.min(maxW, params.width), wMode); } if (params.height == LayoutParams.WRAP_CONTENT) { hMode = MeasureSpec.AT_MOST; hSpec = MeasureSpec.makeMeasureSpec(maxH, hMode); } else if (params.height == LayoutParams.MATCH_PARENT) { hMode = MeasureSpec.EXACTLY; hSpec = MeasureSpec.makeMeasureSpec(maxH, hMode); } else { hMode = MeasureSpec.EXACTLY; hSpec = MeasureSpec.makeMeasureSpec(Math.min(maxH, params.height), hMode); } v.measure(wSpec, hSpec); if (DEBUG) { Log.d(TAG, " == VIEW == " + v.toString()); Log.d(TAG, "mwidth: " + v.getMeasuredWidth()); Log.d(TAG, "mheight: " + v.getMeasuredHeight()); } }
From source file:com.mobicage.rogerthat.util.ui.UIUtils.java
public static void setColors(int color, View... views) { if (Build.VERSION.SDK_INT >= 27) { return;/*from ww w.j a v a2 s. c om*/ } for (View view : views) { if (view instanceof CheckBox) { CheckBox checkbox = (CheckBox) view; CompoundButtonCompat.setButtonTintList(checkbox, ColorStateList.valueOf(color)); } else if (view instanceof FloatingActionButton) { //noinspection RedundantCast ((FloatingActionButton) view).setBackgroundTintList(ColorStateList.valueOf(color)); } else if (view instanceof Button || view instanceof ImageButton) { Drawable background = view.getBackground(); if (background != null) { background.setColorFilter(color, PorterDuff.Mode.SRC_IN); } } else if (view instanceof TextInputLayout) { UIUtils.colorTextInputLayout((TextInputLayout) view, color); // TODO: EditText's who are a child of TextInputLayout their line isn't colored correctly } else if (view instanceof EditText) { EditText editText = (EditText) view; editText.setHighlightColor(color); // When selecting text editText.setHintTextColor(color); // Text for the hint message // Line under the textfield Drawable background = editText.getBackground(); if (background != null) { DrawableCompat.setTint(background, color); editText.setBackground(background); } UIUtils.setCursorColor(editText, color); } else if (view instanceof CheckedTextView) { CheckedTextView ctv = (CheckedTextView) view; Drawable d = ctv.getCheckMarkDrawable(); d.setColorFilter(color, PorterDuff.Mode.SRC_IN); } else if (view instanceof TextView) { ((TextView) view).setLinkTextColor(color); } else if (view instanceof SeekBar) { SeekBar sb = (SeekBar) view; Drawable progress = sb.getProgressDrawable(); if (progress != null) { progress.setColorFilter(color, PorterDuff.Mode.SRC_IN); } Drawable thumb = sb.getThumb(); if (thumb != null) { thumb.setColorFilter(color, PorterDuff.Mode.SRC_IN); } } else if (view instanceof ProgressBar) { ((ProgressBar) view).getIndeterminateDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN); } else { L.d("Not coloring view: " + view.toString()); } } }
From source file:org.brandroid.openmanager.activities.OpenExplorer.java
public boolean showMenu(int menuId, final View from, final boolean fromTouch) { if (!BEFORE_HONEYCOMB && MenuUtils.getMenuLookupSub(menuId) > -1) return false; Logger.LogInfo("showMenu(0x" + Integer.toHexString(menuId) + "," + (from != null ? from.toString() : "NULL") + ")"); //if(mMenuPopup == null) switch (menuId) { //case R.menu.content: case R.id.menu_more: if (showIContextMenu(mMainMenu, from instanceof CheckedTextView ? null : from, fromTouch) != null) return true; return true; }/*from ww w . j a v a 2s . com*/ if (from != null && !(from instanceof CheckedTextView) && showIContextMenu(menuId, from instanceof CheckedTextView ? null : from, fromTouch) != null) return true; if (from.showContextMenu()) return true; //if(IS_DEBUG_BUILD && BEFORE_HONEYCOMB) // showToast("Invalid option (0x" + Integer.toHexString(menuId) + ")" + (from != null ? " under " + from.toString() + " (" + from.getLeft() + "," + from.getTop() + ")" : "")); return false; }
From source file:org.brandroid.openmanager.activities.OpenExplorer.java
public IconContextMenu showIContextMenu(Menu menu, final View from, final boolean fromTouch, int cols) { if (menu.findItem(R.id.menu_context_paste) != null) { if (!OpenExplorer.USE_PRETTY_CONTEXT_MENUS) return null; } else if (!OpenExplorer.USE_PRETTY_MENUS) return null; Logger.LogDebug("Trying to show context menu " + menu.toString() + (from != null ? " under " + from.toString() + " (" + from.getLeft() + "," + from.getTop() + ")" : "") + "."); try {/*from ww w . java2 s . com*/ /* if(mToolbarButtons != null) for(int i = menu.size() - 1; i >= 0; i--) { MenuItem item = menu.getItem(i); if(mToolbarButtons.findViewById(item.getItemId()) != null) menu.removeItemAt(i); }*/ onPrepareOptionsMenu(menu); IconContextMenu mOpenMenu = new IconContextMenu(this, menu, from); if (cols > 1) { mOpenMenu.setTextLayout(R.layout.context_item); mOpenMenu.setNumColumns(cols); } mOpenMenu.setOnIconContextItemSelectedListener(this); mOpenMenu.show(); return mOpenMenu; } catch (Exception e) { Logger.LogWarning("Couldn't show icon context menu.", e); } return null; }
From source file:com.doubleTwist.drawerlib.ADrawerLayout.java
protected void layoutView(View v, int l, int t, int r, int b) { LayoutParams params = (LayoutParams) v.getLayoutParams(); Rect bounds = new Rect(); Rect boundsWithoutPeek = new Rect(); int gravity = params.gravity; switch (gravity) { case Gravity.RIGHT: if (DEBUG) Log.d(TAG, "gravity: right"); bounds.left = r - v.getMeasuredWidth() - mPeekSize.right; bounds.top = t;// www.ja va 2s . c om bounds.right = r - mPeekSize.right; bounds.bottom = t + v.getMeasuredHeight(); v.layout(bounds.left, bounds.top, bounds.right, bounds.bottom); boundsWithoutPeek = new Rect(bounds); boundsWithoutPeek.offset(mPeekSize.right, 0); mMinScrollX = -bounds.width(); break; case Gravity.TOP: if (DEBUG) Log.d(TAG, "gravity: top"); bounds.left = l; bounds.top = t + mPeekSize.top; bounds.right = v.getMeasuredWidth(); bounds.bottom = t + v.getMeasuredHeight() + mPeekSize.top; v.layout(bounds.left, bounds.top, bounds.right, bounds.bottom); boundsWithoutPeek = new Rect(bounds); boundsWithoutPeek.offset(0, -mPeekSize.top); mMaxScrollY = bounds.height(); break; case Gravity.BOTTOM: if (DEBUG) Log.d(TAG, "gravity: bottom"); bounds.left = l; bounds.top = b - v.getMeasuredHeight() - mPeekSize.bottom; bounds.right = l + v.getMeasuredWidth(); bounds.bottom = b - mPeekSize.bottom; v.layout(bounds.left, bounds.top, bounds.right, bounds.bottom); boundsWithoutPeek = new Rect(bounds); boundsWithoutPeek.offset(0, mPeekSize.bottom); mMinScrollY = -bounds.height(); break; case Gravity.LEFT: if (DEBUG) Log.d(TAG, "gravity: left"); bounds.left = l + mPeekSize.left; bounds.top = t; bounds.right = l + v.getMeasuredWidth() + mPeekSize.left; bounds.bottom = t + v.getMeasuredHeight(); v.layout(bounds.left, bounds.top, bounds.right, bounds.bottom); mMaxScrollX = bounds.width(); boundsWithoutPeek = new Rect(bounds); boundsWithoutPeek.offset(-mPeekSize.left, 0); break; default: if (DEBUG) Log.d(TAG, "gravity: default"); bounds.left = l; bounds.top = t; bounds.right = l + v.getMeasuredWidth(); bounds.bottom = t + v.getMeasuredHeight(); v.layout(bounds.left, bounds.top, bounds.right, bounds.bottom); boundsWithoutPeek = new Rect(bounds); break; } if (DEBUG) { Log.d(TAG, " == VIEW LAYOUT == " + v.toString()); Log.d(TAG, "bounds: " + bounds.left + "," + bounds.top + "," + bounds.right + "," + bounds.bottom); } if (mLayoutBounds.containsKey(v)) mLayoutBounds.remove(v); mLayoutBounds.put(v, bounds); if (mLayoutBoundsWithoutPeek.containsKey(v)) mLayoutBoundsWithoutPeek.remove(v); mLayoutBoundsWithoutPeek.put(v, boundsWithoutPeek); }
From source file:com.lb.launcher.Workspace.java
@Override protected OnClickListener getPageIndicatorClickListener() { AccessibilityManager am = (AccessibilityManager) getContext() .getSystemService(Context.ACCESSIBILITY_SERVICE); if (!am.isTouchExplorationEnabled()) { return null; }// w w w .ja v a 2 s.co m OnClickListener listener = new OnClickListener() { @Override public void onClick(View arg0) { Log.v(getClass().toString() + ":anon:onClick:", arg0.toString()); // added by H.Yasui 2016/11/ enterOverviewMode(); } }; return listener; }
From source file:org.brandroid.openmanager.activities.OpenExplorer.java
public IconContextMenu showIContextMenu(int menuId, final View from, final boolean fromTouch) { if (menuId != R.menu.context_file && !OpenExplorer.USE_PRETTY_MENUS) return null; if (menuId == R.menu.context_file && !OpenExplorer.USE_PRETTY_CONTEXT_MENUS) return null; try {/*from w ww. j a v a 2 s . c om*/ if (menuId == R.id.menu_sort || menuId == R.menu.content_sort) menuId = R.menu.content_sort; else if (menuId == R.id.menu_view || menuId == R.menu.content_view) menuId = R.menu.content_view; else if (menuId == R.menu.content) menuId = R.menu.content; else if (menuId == R.menu.content_sort) menuId = R.menu.content_sort; else if (menuId == R.menu.content_view) menuId = R.menu.content_view; else if (menuId == R.menu.text_view) menuId = R.menu.text_view; else if (menuId == R.menu.content_ops) menuId = R.menu.content_ops; else if (Utils.getArrayIndex(MenuUtils.MENU_LOOKUP_IDS, menuId) > -1) menuId = MenuUtils.getMenuLookupSub(menuId); else { Logger.LogWarning("Unknown menuId (0x" + Integer.toHexString(menuId) + ")!"); return null; } Logger.LogDebug("Trying to show context menu 0x" + Integer.toHexString(menuId) + (from != null ? " under " + from.toString() + " (" + ViewUtils.getAbsoluteLeft(from) + "," + ViewUtils.getAbsoluteTop(from) + ")" : "") + "."); if (Utils.getArrayIndex(MenuUtils.MENU_LOOKUP_SUBS, menuId) > -1) { //IconContextMenu icm1 = new IconContextMenu(getApplicationContext(), menu, from, null, null); //MenuBuilder menu = IconContextMenu.newMenu(this, menuId); IconContextMenu mOpenMenu = IconContextMenu.getInstance(this, menuId, from); onPrepareOptionsMenu(mOpenMenu.getMenu()); mOpenMenu.setAnchor(from); if (menuId == R.menu.context_file) { mOpenMenu.setNumColumns(2); //icm.setPopupWidth(getResources().getDimensionPixelSize(R.dimen.popup_width) / 2); mOpenMenu.setTextLayout(R.layout.context_item); } else mOpenMenu.setNumColumns(1); mOpenMenu.setOnIconContextItemSelectedListener(this); /* if(menuId == R.menu.menu_sort || menuId == R.menu.content_sort) mOpenMenu.setTitle(getString(R.string.s_menu_sort) + " (" + getDirContentFragment(false).getPath().getPath() + ")"); else if(menuId == R.menu.menu_view || menuId == R.menu.content_view) mOpenMenu.setTitle(getString(R.string.s_view) + " (" + getDirContentFragment(false).getPath().getPath() + ")"); */ mOpenMenu.show(); return mOpenMenu; } } catch (Exception e) { Logger.LogWarning("Couldn't show icon context menu" + (from != null ? " under " + from.toString() + " (" + from.getLeft() + "," + from.getTop() + ")" : "") + ".", e); if (from != null) return showIContextMenu(menuId, null, fromTouch); } Logger.LogWarning("Not sure what happend with " + menuId + (from != null ? " under " + from.toString() + " (" + from.getLeft() + "," + from.getTop() + ")" : "") + "."); return null; }
From source file:android.app.Activity.java
private void dumpViewHierarchy(String prefix, PrintWriter writer, View view) { writer.print(prefix);/*from www .j a v a 2 s .com*/ if (view == null) { writer.println("null"); return; } writer.println(view.toString()); if (!(view instanceof ViewGroup)) { return; } ViewGroup grp = (ViewGroup) view; final int N = grp.getChildCount(); if (N <= 0) { return; } prefix = prefix + " "; for (int i = 0; i < N; i++) { dumpViewHierarchy(prefix, writer, grp.getChildAt(i)); } }