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:com.andremion.floatingnavigationview.FloatingNavigationView.java
private void attachNavigationView() { CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) getLayoutParams(); int gravity = Gravity.LEFT; if (layoutParams.getAnchorId() != View.NO_ID && layoutParams.anchorGravity != Gravity.NO_GRAVITY) { if (Gravity.isHorizontal(layoutParams.anchorGravity)) { gravity = layoutParams.anchorGravity; }//w w w. j av a 2 s. c om } else if (layoutParams.gravity != Gravity.NO_GRAVITY) { if (Gravity.isHorizontal(layoutParams.gravity)) { gravity = layoutParams.gravity; } } // Gravity.START and Gravity.END don't work for views added in WindowManager with RTL. // We need to convert script specific gravity to absolute horizontal value // If horizontal direction is LTR, then START will set LEFT and END will set RIGHT. // If horizontal direction is RTL, then START will set RIGHT and END will set LEFT. gravity = Gravity.getAbsoluteGravity(gravity, getLayoutDirection()); mWindowManager.addView(mNavigationView, createLayoutParams(gravity)); }
From source file:org.appcelerator.titanium.view.TiUIView.java
/** * Sets the nativeView to view./* w ww . j ava 2s.c o m*/ * @param view the view to set * @module.api */ protected void setNativeView(View view) { if (view.getId() == View.NO_ID) { view.setId(idGenerator.incrementAndGet()); } this.nativeView = view; boolean clickable = true; if (proxy.hasProperty(TiC.PROPERTY_TOUCH_ENABLED)) { clickable = TiConvert.toBoolean(proxy.getProperty(TiC.PROPERTY_TOUCH_ENABLED)); } doSetClickable(nativeView, clickable); nativeView.setOnFocusChangeListener(this); applyAccessibilityProperties(); }
From source file:android.support.transition.TransitionPort.java
/** * This method, essentially a wrapper around all calls to createAnimator for all * possible target views, is called with the entire set of start/end * values. The implementation in Transition iterates through these lists * and calls {@link #createAnimator(ViewGroup, TransitionValues, TransitionValues)} * with each set of start/end values on this transition. The * TransitionSet subclass overrides this method and delegates it to * each of its children in succession./*from w w w. j a v a2s . c om*/ * * @hide */ @RestrictTo(GROUP_ID) protected void createAnimators(ViewGroup sceneRoot, TransitionValuesMaps startValues, TransitionValuesMaps endValues) { if (DBG) { Log.d(LOG_TAG, "createAnimators() for " + this); } ArrayMap<View, TransitionValues> endCopy = new ArrayMap<>(endValues.viewValues); SparseArray<TransitionValues> endIdCopy = new SparseArray<>(endValues.idValues.size()); for (int i = 0; i < endValues.idValues.size(); ++i) { int id = endValues.idValues.keyAt(i); endIdCopy.put(id, endValues.idValues.valueAt(i)); } LongSparseArray<TransitionValues> endItemIdCopy = new LongSparseArray<>(endValues.itemIdValues.size()); for (int i = 0; i < endValues.itemIdValues.size(); ++i) { long id = endValues.itemIdValues.keyAt(i); endItemIdCopy.put(id, endValues.itemIdValues.valueAt(i)); } // Walk through the start values, playing everything we find // Remove from the end set as we go ArrayList<TransitionValues> startValuesList = new ArrayList<>(); ArrayList<TransitionValues> endValuesList = new ArrayList<>(); for (View view : startValues.viewValues.keySet()) { TransitionValues start; TransitionValues end = null; boolean isInListView = false; if (view.getParent() instanceof ListView) { isInListView = true; } if (!isInListView) { int id = view.getId(); start = startValues.viewValues.get(view) != null ? startValues.viewValues.get(view) : startValues.idValues.get(id); if (endValues.viewValues.get(view) != null) { end = endValues.viewValues.get(view); endCopy.remove(view); } else if (id != View.NO_ID) { end = endValues.idValues.get(id); View removeView = null; for (View viewToRemove : endCopy.keySet()) { if (viewToRemove.getId() == id) { removeView = viewToRemove; } } if (removeView != null) { endCopy.remove(removeView); } } endIdCopy.remove(id); if (isValidTarget(view, id)) { startValuesList.add(start); endValuesList.add(end); } } else { ListView parent = (ListView) view.getParent(); if (parent.getAdapter().hasStableIds()) { int position = parent.getPositionForView(view); long itemId = parent.getItemIdAtPosition(position); start = startValues.itemIdValues.get(itemId); endItemIdCopy.remove(itemId); // TODO: deal with targetIDs for itemIDs for ListView items startValuesList.add(start); endValuesList.add(end); } } } int startItemIdCopySize = startValues.itemIdValues.size(); for (int i = 0; i < startItemIdCopySize; ++i) { long id = startValues.itemIdValues.keyAt(i); if (isValidTarget(null, id)) { TransitionValues start = startValues.itemIdValues.get(id); TransitionValues end = endValues.itemIdValues.get(id); endItemIdCopy.remove(id); startValuesList.add(start); endValuesList.add(end); } } // Now walk through the remains of the end set for (View view : endCopy.keySet()) { int id = view.getId(); if (isValidTarget(view, id)) { TransitionValues start = startValues.viewValues.get(view) != null ? startValues.viewValues.get(view) : startValues.idValues.get(id); TransitionValues end = endCopy.get(view); endIdCopy.remove(id); startValuesList.add(start); endValuesList.add(end); } } int endIdCopySize = endIdCopy.size(); for (int i = 0; i < endIdCopySize; ++i) { int id = endIdCopy.keyAt(i); if (isValidTarget(null, id)) { TransitionValues start = startValues.idValues.get(id); TransitionValues end = endIdCopy.get(id); startValuesList.add(start); endValuesList.add(end); } } int endItemIdCopySize = endItemIdCopy.size(); for (int i = 0; i < endItemIdCopySize; ++i) { long id = endItemIdCopy.keyAt(i); // TODO: Deal with targetIDs and itemIDs TransitionValues start = startValues.itemIdValues.get(id); TransitionValues end = endItemIdCopy.get(id); startValuesList.add(start); endValuesList.add(end); } ArrayMap<Animator, AnimationInfo> runningAnimators = getRunningAnimators(); for (int i = 0; i < startValuesList.size(); ++i) { TransitionValues start = startValuesList.get(i); TransitionValues end = endValuesList.get(i); // Only bother trying to animate with values that differ between start/end if (start != null || end != null) { if (start == null || !start.equals(end)) { if (DBG) { View view = (end != null) ? end.view : start.view; Log.d(LOG_TAG, " differing start/end values for view " + view); if (start == null || end == null) { Log.d(LOG_TAG, " " + ((start == null) ? "start null, end non-null" : "start non-null, end null")); } else { for (String key : start.values.keySet()) { Object startValue = start.values.get(key); Object endValue = end.values.get(key); if (startValue != endValue && !startValue.equals(endValue)) { Log.d(LOG_TAG, " " + key + ": start(" + startValue + "), end(" + endValue + ")"); } } } } // TODO: what to do about targetIds and itemIds? Animator animator = createAnimator(sceneRoot, start, end); if (animator != null) { // Save animation info for future cancellation purposes View view; TransitionValues infoValues = null; if (end != null) { view = end.view; String[] properties = getTransitionProperties(); if (view != null && properties != null && properties.length > 0) { infoValues = new TransitionValues(); infoValues.view = view; TransitionValues newValues = endValues.viewValues.get(view); if (newValues != null) { for (int j = 0; j < properties.length; ++j) { infoValues.values.put(properties[j], newValues.values.get(properties[j])); } } int numExistingAnims = runningAnimators.size(); for (int j = 0; j < numExistingAnims; ++j) { Animator anim = runningAnimators.keyAt(j); AnimationInfo info = runningAnimators.get(anim); if (info.values != null && info.view == view && ((info.name == null && getName() == null) || info.name.equals(getName()))) { if (info.values.equals(infoValues)) { // Favor the old animator animator = null; break; } } } } } else { view = start.view; } if (animator != null) { AnimationInfo info = new AnimationInfo(view, getName(), WindowIdPort.getWindowId(sceneRoot), infoValues); runningAnimators.put(animator, info); mAnimators.add(animator); } } } } } }
From source file:com.chuhan.privatecalc.fragment.os.FragmentActivity.java
/** * Add support for inflating the <fragment> tag. *///from w ww . j av a 2s .c om @Override public View onCreateView(String name, Context context, AttributeSet attrs) { if (!"fragment".equals(name)) { return super.onCreateView(name, context, attrs); } String fname = attrs.getAttributeValue(null, "class"); TypedArray a = context.obtainStyledAttributes(attrs, FragmentTag.Fragment); if (fname == null) { fname = a.getString(FragmentTag.Fragment_name); } int id = a.getResourceId(FragmentTag.Fragment_id, View.NO_ID); String tag = a.getString(FragmentTag.Fragment_tag); a.recycle(); View parent = null; // NOTE: no way to get parent pre-Honeycomb. int containerId = parent != null ? parent.getId() : 0; if (containerId == View.NO_ID && id == View.NO_ID && tag == null) { throw new IllegalArgumentException(attrs.getPositionDescription() + ": Must specify unique android:id, android:tag, or have a parent with an id for " + fname); } // If we restored from a previous state, we may already have // instantiated this fragment from the state and should use // that instance instead of making a new one. Fragment fragment = id != View.NO_ID ? mFragments.findFragmentById(id) : null; if (fragment == null && tag != null) { fragment = mFragments.findFragmentByTag(tag); } if (fragment == null && containerId != View.NO_ID) { fragment = mFragments.findFragmentById(containerId); } if (FragmentManagerImpl.DEBUG) Log.v(TAG, "onCreateView: id=0x" + Integer.toHexString(id) + " fname=" + fname + " existing=" + fragment); if (fragment == null) { fragment = Fragment.instantiate(this, fname); fragment.mFromLayout = true; fragment.mFragmentId = id != 0 ? id : containerId; fragment.mContainerId = containerId; fragment.mTag = tag; fragment.mInLayout = true; fragment.mFragmentManager = mFragments; fragment.onInflate(this, attrs, fragment.mSavedFragmentState); mFragments.addFragment(fragment, true); } else if (fragment.mInLayout) { // A fragment already exists and it is not one we restored from // previous state. throw new IllegalArgumentException(attrs.getPositionDescription() + ": Duplicate id 0x" + Integer.toHexString(id) + ", tag " + tag + ", or parent id 0x" + Integer.toHexString(containerId) + " with another fragment for " + fname); } else { // This fragment was retained from a previous instance; get it // going now. fragment.mInLayout = true; // If this fragment is newly instantiated (either right now, or // from last saved state), then give it the attributes to // initialize itself. if (!fragment.mRetaining) { fragment.onInflate(this, attrs, fragment.mSavedFragmentState); } mFragments.moveToState(fragment); } if (fragment.mView == null) { throw new IllegalStateException("Fragment " + fname + " did not create a view."); } if (id != 0) { fragment.mView.setId(id); } if (fragment.mView.getTag() == null) { fragment.mView.setTag(tag); } return fragment.mView; }
From source file:monakhv.android.samlib.AuthorListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onCreate(savedInstanceState); emptyText = (TextView) getActivity().findViewById(R.id.id_empty_text); sql = new AuthorController(getActivity()); setEmptyText(R.string.no_authors);//from w w w . ja v a 2 s .com getListView().setEmptyView(emptyText); registerForContextMenu(getListView()); getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); //getListView().setSelector(R.drawable.author_item_bg); getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { selectedAuthorPosition = position; Cursor c = (Cursor) adapter.getItem(position); mCallbacks.onAuthorSelected(c.getInt(c.getColumnIndex(SQLController.COL_ID))); Log.i(DEBUG_TAG, "position: " + position + " view: " + view.getId() + " --- " + View.NO_ID); selectView(view); } }); setDivider(getListView()); EditText editText = (EditText) getActivity().findViewById(R.id.addUrlText); editText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEARCH) { mCallbacks.addAuthorFromText(); return true; } return false; } }); getListView().setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { detector.onTouchEvent(event); return false; } }); }
From source file:com.tencent.tws.assistant.support.v4.app.TwsFragmentActivity.java
/** * Add support for inflating the <fragment> tag. *//*from ww w. jav a2 s.co m*/ @Override public View onCreateView(String name, Context context, AttributeSet attrs) { if (!"fragment".equals(name)) { return super.onCreateView(name, context, attrs); } String fname = attrs.getAttributeValue(null, "class"); TypedArray a = context.obtainStyledAttributes(attrs, FragmentTag.Fragment); if (fname == null) { fname = a.getString(FragmentTag.Fragment_name); } int id = a.getResourceId(FragmentTag.Fragment_id, View.NO_ID); String tag = a.getString(FragmentTag.Fragment_tag); a.recycle(); if (!Fragment.isSupportFragmentClass(this, fname)) { // Invalid support lib fragment; let the device's framework handle it. // This will allow android.app.Fragments to do the right thing. return super.onCreateView(name, context, attrs); } View parent = null; // NOTE: no way to get parent pre-Honeycomb. int containerId = parent != null ? parent.getId() : 0; if (containerId == View.NO_ID && id == View.NO_ID && tag == null) { throw new IllegalArgumentException(attrs.getPositionDescription() + ": Must specify unique android:id, android:tag, or have a parent with an id for " + fname); } // If we restored from a previous state, we may already have // instantiated this fragment from the state and should use // that instance instead of making a new one. Fragment fragment = id != View.NO_ID ? mFragments.findFragmentById(id) : null; if (fragment == null && tag != null) { fragment = mFragments.findFragmentByTag(tag); } if (fragment == null && containerId != View.NO_ID) { fragment = mFragments.findFragmentById(containerId); } if (FragmentManagerImpl.DEBUG) Log.v(TAG, "onCreateView: id=0x" + Integer.toHexString(id) + " fname=" + fname + " existing=" + fragment); if (fragment == null) { fragment = Fragment.instantiate(this, fname); fragment.mFromLayout = true; fragment.mFragmentId = id != 0 ? id : containerId; fragment.mContainerId = containerId; fragment.mTag = tag; fragment.mInLayout = true; fragment.mFragmentManager = mFragments; fragment.onInflate(this, attrs, fragment.mSavedFragmentState); mFragments.addFragment(fragment, true); } else if (fragment.mInLayout) { // A fragment already exists and it is not one we restored from // previous state. throw new IllegalArgumentException(attrs.getPositionDescription() + ": Duplicate id 0x" + Integer.toHexString(id) + ", tag " + tag + ", or parent id 0x" + Integer.toHexString(containerId) + " with another fragment for " + fname); } else { // This fragment was retained from a previous instance; get it // going now. fragment.mInLayout = true; // If this fragment is newly instantiated (either right now, or // from last saved state), then give it the attributes to // initialize itself. if (!fragment.mRetaining) { fragment.onInflate(this, attrs, fragment.mSavedFragmentState); } mFragments.moveToState(fragment); } if (fragment.mView == null) { throw new IllegalStateException("Fragment " + fname + " did not create a view."); } if (id != 0) { fragment.mView.setId(id); } if (fragment.mView.getTag() == null) { fragment.mView.setTag(tag); } return fragment.mView; }
From source file:io.selendroid.server.model.AndroidNativeElement.java
public Integer getAndroidId() { int viewId = getView().getId(); return (viewId == View.NO_ID) ? null : viewId; }
From source file:com.actionbarsherlock.internal.view.MenuItemImpl.java
@Override public View getActionView() { if (mActionView != null) { return mActionView; }/* w w w . j a va 2s.c om*/ if (mActionViewRes != View.NO_ID) { return LayoutInflater.from(mMenu.getContext()).inflate(mActionViewRes, null, false); } return null; }
From source file:com.actionbarsherlock.internal.view.MenuItemImpl.java
@Override public Drawable getIcon() { if (mIcon != null) { return mIcon; }// ww w .j a v a2 s . co m if (mIconRes != View.NO_ID) { return mMenu.getContext().getResources().getDrawable(mIconRes); } return null; }
From source file:com.actionbarsherlock.internal.view.MenuItemImpl.java
@Override public MenuItem setActionView(View view) { mActionView = view;// ww w. ja v a 2s. co m mActionViewRes = View.NO_ID; setActionViewOnViews(mActionView); return this; }