List of usage examples for android.view View NO_ID
int NO_ID
To view the source code for android.view View NO_ID.
Click Source Link
From source file:despotoski.nikola.github.com.bottomnavigationlayout.BottomTabLayout.java
private void selectTabView() { boolean callListener = false; if (mSelectedItemPosition == View.NO_ID) { return;/*from w ww .j av a 2s . c o m*/ } View bottomNavigationTextView = mBottomTabViews.get(mSelectedItemPosition); bottomNavigationTextView.requestFocus(); bottomNavigationTextView.setSelected(true); mCurrentNavigationItem = bottomNavigationTextView; if (callListener) { mBottomTabSelectionClickListener.onClick(mCurrentNavigationItem); } }
From source file:android.support.v7ox.app.AppCompatDelegateImplV7.java
private ViewGroup createSubDecor() { TypedArray a = mContext.obtainStyledAttributes(R.styleable.AppCompatTheme); if (!a.hasValue(R.styleable.AppCompatTheme_windowActionBar_ox)) { a.recycle();/*from w ww . j a v a 2s . c o m*/ throw new IllegalStateException( "You need to use a Theme.AppCompat theme (or descendant) with this activity."); } if (a.getBoolean(R.styleable.AppCompatTheme_windowNoTitle_ox, false)) { requestWindowFeature(Window.FEATURE_NO_TITLE); } else if (a.getBoolean(R.styleable.AppCompatTheme_windowActionBar_ox, false)) { // Don't allow an action bar if there is no title. requestWindowFeature(FEATURE_SUPPORT_ACTION_BAR); } if (a.getBoolean(R.styleable.AppCompatTheme_windowActionBarOverlay_ox, false)) { requestWindowFeature(FEATURE_SUPPORT_ACTION_BAR_OVERLAY); } if (a.getBoolean(R.styleable.AppCompatTheme_windowActionModeOverlay_ox, false)) { requestWindowFeature(FEATURE_ACTION_MODE_OVERLAY); } mIsFloating = a.getBoolean(R.styleable.AppCompatTheme_android_windowIsFloating, false); a.recycle(); final LayoutInflater inflater = LayoutInflater.from(mContext); ViewGroup subDecor = null; if (!mWindowNoTitle) { if (mIsFloating) { // If we're floating, inflate the dialog title decor subDecor = (ViewGroup) inflater.inflate(R.layout.abc_dialog_title_material, null); // Floating windows can never have an action bar, reset the flags mHasActionBar = mOverlayActionBar = false; } else if (mHasActionBar) { /** * This needs some explanation. As we can not use the android:theme attribute * pre-L, we emulate it by manually creating a LayoutInflater using a * ContextThemeWrapper pointing to actionBarTheme. */ TypedValue outValue = new TypedValue(); mContext.getTheme().resolveAttribute(R.attr.actionBarTheme_ox, outValue, true); Context themedContext; if (outValue.resourceId != 0) { themedContext = new ContextThemeWrapper(mContext, outValue.resourceId); } else { themedContext = mContext; } // Now inflate the view using the themed context and set it as the content view subDecor = (ViewGroup) LayoutInflater.from(themedContext).inflate(R.layout.abc_screen_toolbar, null); mDecorContentParent = (DecorContentParent) subDecor.findViewById(R.id.decor_content_parent); mDecorContentParent.setWindowCallback(getWindowCallback()); /** * Propagate features to DecorContentParent */ if (mOverlayActionBar) { mDecorContentParent.initFeature(FEATURE_SUPPORT_ACTION_BAR_OVERLAY); } if (mFeatureProgress) { mDecorContentParent.initFeature(Window.FEATURE_PROGRESS); } if (mFeatureIndeterminateProgress) { mDecorContentParent.initFeature(Window.FEATURE_INDETERMINATE_PROGRESS); } } } else { if (mOverlayActionMode) { subDecor = (ViewGroup) inflater.inflate(R.layout.abc_screen_simple_overlay_action_mode, null); } else { subDecor = (ViewGroup) inflater.inflate(R.layout.abc_screen_simple, null); } if (Build.VERSION.SDK_INT >= 21) { // If we're running on L or above, we can rely on ViewCompat's // setOnApplyWindowInsetsListener ViewCompat.setOnApplyWindowInsetsListener(subDecor, new OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { final int top = insets.getSystemWindowInsetTop(); final int newTop = updateStatusGuard(top); if (top != newTop) { insets = insets.replaceSystemWindowInsets(insets.getSystemWindowInsetLeft(), newTop, insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()); } // Now apply the insets on our view return ViewCompat.onApplyWindowInsets(v, insets); } }); } else { // Else, we need to use our own FitWindowsViewGroup handling ((FitWindowsViewGroup) subDecor) .setOnFitSystemWindowsListener(new FitWindowsViewGroup.OnFitSystemWindowsListener() { @Override public void onFitSystemWindows(Rect insets) { insets.top = updateStatusGuard(insets.top); } }); } } if (subDecor == null) { throw new IllegalArgumentException("AppCompat does not support the current theme features: { " + "windowActionBar: " + mHasActionBar + ", windowActionBarOverlay: " + mOverlayActionBar + ", android:windowIsFloating: " + mIsFloating + ", windowActionModeOverlay: " + mOverlayActionMode + ", windowNoTitle: " + mWindowNoTitle + " }"); } if (mDecorContentParent == null) { mTitleView = (TextView) subDecor.findViewById(R.id.title); } // Make the decor optionally fit system windows, like the window's decor ViewUtils.makeOptionalFitsSystemWindows(subDecor); final ViewGroup decorContent = (ViewGroup) mWindow.findViewById(android.R.id.content); final ContentFrameLayout abcContent = (ContentFrameLayout) subDecor .findViewById(R.id.action_bar_activity_content); // There might be Views already added to the Window's content view so we need to // migrate them to our content view while (decorContent.getChildCount() > 0) { final View child = decorContent.getChildAt(0); decorContent.removeViewAt(0); abcContent.addView(child); } // Now set the Window's content view with the decor mWindow.setContentView(subDecor); // Change our content FrameLayout to use the android.R.id.content id. // Useful for fragments. decorContent.setId(View.NO_ID); abcContent.setId(android.R.id.content); // The decorContent may have a foreground drawable set (windowContentOverlay). // Remove this as we handle it ourselves if (decorContent instanceof FrameLayout) { decorContent.setForeground(null); } abcContent.setAttachListener(new ContentFrameLayout.OnAttachListener() { @Override public void onAttachedFromWindow() { } @Override public void onDetachedFromWindow() { dismissPopups(); } }); return subDecor; }
From source file:android.support.transition.TransitionPort.java
/** * Recursive method which captures values for an entire view hierarchy, * starting at some root view. Transitions without targetIDs will use this * method to capture values for all possible views. * * @param view The view for which to capture values. Children of this View * will also be captured, recursively down to the leaf nodes. * @param start true if values are being captured in the start scene, false * otherwise./* ww w. j a v a 2 s . c o m*/ */ private void captureHierarchy(View view, boolean start) { if (view == null) { return; } boolean isListViewItem = false; if (view.getParent() instanceof ListView) { isListViewItem = true; } if (isListViewItem && !((ListView) view.getParent()).getAdapter().hasStableIds()) { // ignore listview children unless we can track them with stable IDs return; } int id = View.NO_ID; long itemId = View.NO_ID; if (!isListViewItem) { id = view.getId(); } else { ListView listview = (ListView) view.getParent(); int position = listview.getPositionForView(view); itemId = listview.getItemIdAtPosition(position); // view.setHasTransientState(true); } if (mTargetIdExcludes != null && mTargetIdExcludes.contains(id)) { return; } if (mTargetExcludes != null && mTargetExcludes.contains(view)) { return; } if (mTargetTypeExcludes != null && view != null) { int numTypes = mTargetTypeExcludes.size(); for (int i = 0; i < numTypes; ++i) { if (mTargetTypeExcludes.get(i).isInstance(view)) { return; } } } TransitionValues values = new TransitionValues(); values.view = view; if (start) { captureStartValues(values); } else { captureEndValues(values); } if (start) { if (!isListViewItem) { mStartValues.viewValues.put(view, values); if (id >= 0) { mStartValues.idValues.put((int) id, values); } } else { mStartValues.itemIdValues.put(itemId, values); } } else { if (!isListViewItem) { mEndValues.viewValues.put(view, values); if (id >= 0) { mEndValues.idValues.put((int) id, values); } } else { mEndValues.itemIdValues.put(itemId, values); } } if (view instanceof ViewGroup) { // Don't traverse child hierarchy if there are any child-excludes on this view if (mTargetIdChildExcludes != null && mTargetIdChildExcludes.contains(id)) { return; } if (mTargetChildExcludes != null && mTargetChildExcludes.contains(view)) { return; } if (mTargetTypeChildExcludes != null && view != null) { int numTypes = mTargetTypeChildExcludes.size(); for (int i = 0; i < numTypes; ++i) { if (mTargetTypeChildExcludes.get(i).isInstance(view)) { return; } } } ViewGroup parent = (ViewGroup) view; for (int i = 0; i < parent.getChildCount(); ++i) { captureHierarchy(parent.getChildAt(i), start); } } }
From source file:com.rbware.github.androidcouchpotato.widget.GridLayoutManager.java
int getSubPositionByView(View view, View childView) { if (view == null || childView == null) { return 0; }//from w ww .j a v a 2 s . c om final LayoutParams lp = (LayoutParams) view.getLayoutParams(); final ItemAlignmentFacet facet = lp.getItemAlignmentFacet(); if (facet != null) { final ItemAlignmentFacet.ItemAlignmentDef[] defs = facet.getAlignmentDefs(); if (defs.length > 1) { while (childView != view) { int id = childView.getId(); if (id != View.NO_ID) { for (int i = 1; i < defs.length; i++) { if (defs[i].getItemAlignmentFocusViewId() == id) { return i; } } } childView = (View) childView.getParent(); } } } return 0; }
From source file:android.support.v17.leanback.widget.GridLayoutManager.java
private int getSubPositionByView(View view, View childView) { if (view == null || childView == null) { return 0; }/*from www . ja v a 2 s. c o m*/ final LayoutParams lp = (LayoutParams) view.getLayoutParams(); final ItemAlignmentFacet facet = lp.getItemAlignmentFacet(); if (facet != null) { final ItemAlignmentFacet.ItemAlignmentDef[] defs = facet.getAlignmentDefs(); if (defs.length > 1) { while (childView != view) { int id = childView.getId(); if (id != View.NO_ID) { for (int i = 1; i < defs.length; i++) { if (defs[i].getItemAlignmentFocusViewId() == id) { return i; } } } childView = (View) childView.getParent(); } } } return 0; }
From source file:com.facebook.react.ReactInstanceManager.java
/** * Attach given {@param rootView} to a catalyst instance manager and start JS application using * JS module provided by {@link ReactRootView#getJSModuleName}. If the react context is currently * being (re)-created, or if react context has not been created yet, the JS application associated * with the provided root view will be started asynchronously, i.e this method won't block. * This view will then be tracked by this manager and in case of catalyst instance restart it will * be re-attached./*from w ww .ja v a 2s . com*/ */ @ThreadConfined(UI) public void attachRootView(ReactRootView rootView) { UiThreadUtil.assertOnUiThread(); mAttachedRootViews.add(rootView); // Reset view content as it's going to be populated by the application content from JS. rootView.removeAllViews(); rootView.setId(View.NO_ID); // If react context is being created in the background, JS application will be started // automatically when creation completes, as root view is part of the attached root view list. ReactContext currentContext = getCurrentReactContext(); if (mCreateReactContextThread == null && currentContext != null) { attachRootViewToInstance(rootView); } }
From source file:com.wit.and.dialog.internal.BaseDialog.java
/** * Builds dialog view as relative layout. This adds the base dialog views * (title, body, buttons) in correct order into dialog view. Adding views * into relative layout is a little bit more complicated as into linear * layout so we need to create some layout parameters and use vies * identifiers to place them correctly.//from w ww .j av a 2 s . c o m */ private void buildAsRelativeLayout(View dialogView, LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { this.mTitleView = performCreateTitleView(inflater, container, savedInstanceState); this.mButtonsView = performCreateButtonsView(mOptions.getButtonsType(), inflater, container, savedInstanceState); this.mBodyView = performCreateBodyView(inflater, container, savedInstanceState); // Check valid body view. if (mBodyView == null) throw new IllegalStateException("Missing body view. Dialog must have at least body view."); // Check if the view has the id to identify it in relative layout // hierarchy. if (mTitleView != null && mTitleView.getId() == View.NO_ID) { mTitleView.setId(TITLE_VIEW_DEFAULT_ID); } if (mBodyView.getId() == View.NO_ID) { mBodyView.setId(BODY_VIEW_DEFAULT_ID); } if (mButtonsView != null && mButtonsView.getId() == View.NO_ID) { mButtonsView.setId(BUTTONS_VIEW_DEFAULT_ID); } // Correct layout parameters. performCorrectLayout(DialogLayoutCorrection.WITH_TITLE_AND_BUTTONS, dialogView); // Build dialog view. this.addView(dialogView, mTitleView); this.addView(dialogView, mButtonsView); this.addView(dialogView, mBodyView); }
From source file:com.android.calculator2.Calculator.java
/** * Add input characters to the end of the expression. * Map them to the appropriate button pushes when possible. Leftover characters * are added to mUnprocessedChars, which is presumed to immediately precede the newly * added characters./*from w w w.j ava 2 s . c o m*/ * @param moreChars Characters to be added. * @param explicit These characters were explicitly typed by the user, not pasted. */ private void addChars(String moreChars, boolean explicit) { if (mUnprocessedChars != null) { moreChars = mUnprocessedChars + moreChars; } int current = 0; int len = moreChars.length(); boolean lastWasDigit = false; if (mCurrentState == CalculatorState.RESULT && len != 0) { // Clear display immediately for incomplete function name. switchToInput(KeyMaps.keyForChar(moreChars.charAt(current))); } while (current < len) { char c = moreChars.charAt(current); int k = KeyMaps.keyForChar(c); if (!explicit) { int expEnd; if (lastWasDigit && current != (expEnd = Evaluator.exponentEnd(moreChars, current))) { // Process scientific notation with 'E' when pasting, in spite of ambiguity // with base of natural log. // Otherwise the 10^x key is the user's friend. mEvaluator.addExponent(moreChars, current, expEnd); current = expEnd; lastWasDigit = false; continue; } else { boolean isDigit = KeyMaps.digVal(k) != KeyMaps.NOT_DIGIT; if (current == 0 && (isDigit || k == R.id.dec_point) && mEvaluator.getExpr().hasTrailingConstant()) { // Refuse to concatenate pasted content to trailing constant. // This makes pasting of calculator results more consistent, whether or // not the old calculator instance is still around. addKeyToExpr(R.id.op_mul); } lastWasDigit = (isDigit || lastWasDigit && k == R.id.dec_point); } } if (k != View.NO_ID) { mCurrentButton = findViewById(k); if (explicit) { addExplicitKeyToExpr(k); } else { addKeyToExpr(k); } if (Character.isSurrogate(c)) { current += 2; } else { ++current; } continue; } int f = KeyMaps.funForString(moreChars, current); if (f != View.NO_ID) { mCurrentButton = findViewById(f); if (explicit) { addExplicitKeyToExpr(f); } else { addKeyToExpr(f); } if (f == R.id.op_sqrt) { // Square root entered as function; don't lose the parenthesis. addKeyToExpr(R.id.lparen); } current = moreChars.indexOf('(', current) + 1; continue; } // There are characters left, but we can't convert them to button presses. mUnprocessedChars = moreChars.substring(current); redisplayAfterFormulaChange(); return; } mUnprocessedChars = null; redisplayAfterFormulaChange(); }
From source file:org.sufficientlysecure.keychain.ui.keyview.ViewKeyActivity.java
/** * Helper to hide Fab, from http://stackoverflow.com/a/31047038 *//* www. ja v a 2 s. co m*/ private void hideFab() { CoordinatorLayout.LayoutParams p = (CoordinatorLayout.LayoutParams) mFab.getLayoutParams(); p.setBehavior(null); //should disable default animations p.setAnchorId(View.NO_ID); //should let you set visibility mFab.setLayoutParams(p); mFab.setVisibility(View.GONE); }
From source file:com.actionbarsherlock.internal.ActionBarSherlockCompat.java
private ViewGroup generateLayout() { if (DEBUG)/* w ww. ja v a2s . c o m*/ Log.d(TAG, "[generateLayout]"); // Apply data from current theme. TypedArray a = mActivity.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme); mIsFloating = a.getBoolean(R.styleable.SherlockTheme_android_windowIsFloating, false); if (!a.hasValue(R.styleable.SherlockTheme_windowActionBar)) { throw new IllegalStateException( "You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative."); } if (a.getBoolean(R.styleable.SherlockTheme_windowNoTitle, false)) { requestFeature(Window.FEATURE_NO_TITLE); } else if (a.getBoolean(R.styleable.SherlockTheme_windowActionBar, false)) { // Don't allow an action bar if there is no title. requestFeature(Window.FEATURE_ACTION_BAR); } if (a.getBoolean(R.styleable.SherlockTheme_windowActionBarOverlay, false)) { requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY); } if (a.getBoolean(R.styleable.SherlockTheme_windowActionModeOverlay, false)) { requestFeature(Window.FEATURE_ACTION_MODE_OVERLAY); } a.recycle(); int layoutResource; if (!hasFeature(Window.FEATURE_NO_TITLE)) { if (mIsFloating) { //Trash original dialog LinearLayout mDecor = (ViewGroup) mDecor.getParent(); mDecor.removeAllViews(); layoutResource = R.layout.abs__dialog_title_holo; } else { if (hasFeature(Window.FEATURE_ACTION_BAR_OVERLAY)) { layoutResource = R.layout.abs__screen_action_bar_overlay; } else { layoutResource = R.layout.abs__screen_action_bar; } } } else if (hasFeature(Window.FEATURE_ACTION_MODE_OVERLAY) && !hasFeature(Window.FEATURE_NO_TITLE)) { layoutResource = R.layout.abs__screen_simple_overlay_action_mode; } else { layoutResource = R.layout.abs__screen_simple; } if (DEBUG) Log.d(TAG, "[generateLayout] using screen XML " + mActivity.getResources().getString(layoutResource)); View in = mActivity.getLayoutInflater().inflate(layoutResource, null); mDecor.addView(in, new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT)); ViewGroup contentParent = (ViewGroup) mDecor.findViewById(R.id.abs__content); if (contentParent == null) { throw new RuntimeException("Couldn't find content container view"); } //Make our new child the true content view (for fragments). VERY VOLATILE! mDecor.setId(View.NO_ID); contentParent.setId(android.R.id.content); if (hasFeature(Window.FEATURE_INDETERMINATE_PROGRESS)) { IcsProgressBar progress = getCircularProgressBar(false); if (progress != null) { progress.setIndeterminate(true); } } return contentParent; }