List of usage examples for android.view View getY
@ViewDebug.ExportedProperty(category = "drawing") public float getY()
From source file:com.mvcoding.financius.feature.ActivityStarter.java
@NonNull public ActivityStarter expandFrom(@NonNull View view) { final int startX = (int) (view.getX() + view.getWidth() / 2); final int startY = (int) (view.getY() + view.getHeight() / 2); final ActivityOptionsCompat options = ActivityOptionsCompat.makeScaleUpAnimation(view, startX, startY, 0, 0);/*ww w . j av a 2 s. co m*/ if (mOptions == null) { mOptions = options; } else { mOptions.update(options); } return this; }
From source file:com.example.kent_zheng.sdk_fragmenttransition.FragmentTransitionFragment.java
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Meat meat = mAdapter.getItem(position); Log.i(TAG, meat.title + " clicked. Replacing fragment."); Log.d(TAG, "onItemClick: view.getX() = " + view.getX() + ", view.getY() = " + view.getY() + ", view.getWidth() = " + view.getWidth() + ", view.getHeight() = " + view.getHeight()); // We start the fragment transaction here. It is just an ordinary fragment transaction. getActivity().getSupportFragmentManager().beginTransaction() .replace(R.id.sample_content_fragment, DetailFragment.newInstance(meat.resourceId, meat.title, (int) view.getX(), (int) view.getY(), view.getWidth(), view.getHeight())) // We push the fragment transaction to back stack. User can go back to the // previous fragment by pressing back button. .addToBackStack("detail").commit(); }
From source file:it.vibin.sideswipe.drag.SwipeMenuManager.java
@Override public void onViewPagerReady(VerticalViewPager viewPager) { Log.d(TAG, "@@@@@@@@@@@@@@@@@@@@@"); Log.d(TAG, "@@@@@@@@ READY! @@@@@"); Log.d(TAG, "@@@@@@@@@@@@@@@@@@@@@"); mViewPager.setCurrentItem(0);/*from ww w . ja v a 2 s . c o m*/ View v = mViewPager.getChildAt(0); mY = (int) v.getY(); setCurrentCard(mViewPager.getChildAt(0), View.VISIBLE); }
From source file:com.chartiq.chartiqsample.ui.StickyHeaderDecoration.java
private int getHeaderTop(RecyclerView parent, View child, View header, int adapterPos, int layoutPos) { int headerHeight = header.getHeight(); int top = ((int) child.getY()) - headerHeight; if (layoutPos == 0) { final int count = parent.getChildCount(); final long currentId = mAdapter.getHeaderId(adapterPos); // find next view with header and compute the offscreen push if needed for (int i = 1; i < count; i++) { int adapterPosHere = parent.getChildAdapterPosition(parent.getChildAt(i)); if (adapterPosHere != RecyclerView.NO_POSITION) { long nextId = mAdapter.getHeaderId(adapterPosHere); if (nextId != currentId) { final View next = parent.getChildAt(i); final int offset = ((int) next.getY()) - (headerHeight + getItemHeight(parent, adapterPosHere)); if (offset < 0) { return offset; } else { break; }// ww w . j a v a 2s .c om } } } top = Math.max(0, top); } return top; }
From source file:com.shiqkuangsan.mycustomviews.adapter.itemdecoration.StickyHeaderDecoration.java
private int getHeaderTop(RecyclerView parent, View child, View header, int adapterPos, int layoutPos) { int headerHeight = getHeaderHeightForLayout(header); int top = ((int) child.getY()) - headerHeight; if (layoutPos == 0) { final int count = parent.getChildCount(); final long currentId = stickyHeader.getHeaderId(adapterPos); // find next view with header and compute the offscreen push if needed for (int i = 1; i < count; i++) { int adapterPosHere = parent.getChildAdapterPosition(parent.getChildAt(i)); if (adapterPosHere != RecyclerView.NO_POSITION) { long nextId = stickyHeader.getHeaderId(adapterPosHere); if (nextId != currentId) { final View next = parent.getChildAt(i); final int offset = ((int) next.getY()) - (headerHeight + getHeader(parent, adapterPosHere).itemView.getHeight()); if (offset < 0) { return offset; } else { break; }/*from www . jav a2s . co m*/ } } } top = Math.max(0, top); } return top; }
From source file:de.grobox.transportr.settings.SettingsFragment.java
@Override public void onCreatePreferences(Bundle savedInstanceState, String s) { // Load the preferences from an XML resource addPreferencesFromResource(R.xml.preferences); // Fill in current transport network if available network_pref = findPreference("pref_key_network"); manager.getTransportNetwork().observe(this, this::onTransportNetworkChanged); network_pref.setOnPreferenceClickListener(preference -> { Intent intent = new Intent(getActivity(), PickTransportNetworkActivity.class); View view = getView(); if (view != null) view = view.findFocus();//from ww w. j a v a2 s.c o m ActivityOptionsCompat options = ActivityOptionsCompat.makeScaleUpAnimation(view, (int) view.getX(), (int) view.getY(), 0, 0); ActivityCompat.startActivity(getActivity(), intent, options.toBundle()); return true; }); }
From source file:ca.barrenechea.widget.recyclerview.decoration.StickyHeaderDecoration.java
private int getHeaderTop(RecyclerView parent, View child, View header, int adapterPos, int layoutPos) { int headerHeight = getHeaderHeightForLayout(header); int top = ((int) child.getY()) - headerHeight; if (layoutPos == 0) { final int count = parent.getChildCount(); final long currentId = mAdapter.getHeaderId(adapterPos); // find next view with header and compute the offscreen push if needed for (int i = 1; i < count; i++) { int adapterPosHere = parent.getChildAdapterPosition(parent.getChildAt(i)); if (adapterPosHere != RecyclerView.NO_POSITION) { long nextId = mAdapter.getHeaderId(adapterPosHere); if (nextId != currentId) { final View next = parent.getChildAt(i); final int offset = ((int) next.getY()) - (headerHeight + getHeader(parent, adapterPosHere).itemView.getHeight()); if (offset < 0) { return offset; } else { break; }/* w w w.j a va 2 s .c o m*/ } } } top = Math.max(0, top); } return top; }
From source file:in.zollet.abhilash.materialdesign.BezelImageView.java
@Override public boolean onDependentViewChanged(CoordinatorLayout parent, CircleImageView child, View dependency) { maybeInitProperties(child, dependency); final int maxScrollDistance = (int) (mStartToolbarPosition); float expandedPercentageFactor = dependency.getY() / maxScrollDistance; if (expandedPercentageFactor < mChangeBehaviorPoint) { float heightFactor = (mChangeBehaviorPoint - expandedPercentageFactor) / mChangeBehaviorPoint; float distanceXToSubtract = ((mStartXPosition - mFinalXPosition) * heightFactor) + (child.getHeight() / 2); float distanceYToSubtract = ((mStartYPosition - mFinalYPosition) * (1f - expandedPercentageFactor)) + (child.getHeight() / 2); child.setX(mStartXPosition - distanceXToSubtract); child.setY(mStartYPosition - distanceYToSubtract); float heightToSubtract = ((mStartHeight - mCustomFinalHeight) * heightFactor); CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) child.getLayoutParams(); lp.width = (int) (mStartHeight - heightToSubtract); lp.height = (int) (mStartHeight - heightToSubtract); child.setLayoutParams(lp);//from ww w .ja v a 2 s .c o m } else { float distanceYToSubtract = ((mStartYPosition - mFinalYPosition) * (1f - expandedPercentageFactor)) + (mStartHeight / 2); child.setX(mStartXPosition - child.getWidth() / 2); child.setY(mStartYPosition - distanceYToSubtract); CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) child.getLayoutParams(); lp.width = (int) (mStartHeight); lp.height = (int) (mStartHeight); child.setLayoutParams(lp); } return true; }
From source file:cn.lanmei.com.dingdong_2.ItemDecoration.StickyHeaderDecoration.java
private int getHeaderTop(RecyclerView parent, View child, View header, int adapterPos, int layoutPos) { int headerHeight = getHeaderHeightForLayout(header); int top = ((int) child.getY()) - headerHeight; if (layoutPos == 0) { final int count = parent.getChildCount(); // L.MyLog("sticky","getHeaderTop:"+adapterPos+"getChildCount"+count); final long currentId = mAdapter.getHeaderId(adapterPos); // find next view with header and compute the offscreen push if needed for (int i = 1; i < count; i++) { int adapterPosHere = parent.getChildAdapterPosition(parent.getChildAt(i)); if (adapterPosHere != RecyclerView.NO_POSITION) { // L.MyLog("sticky","getHeaderTop:adapterPosHere:"+adapterPosHere+"getChildCount"+count); long nextId = mAdapter.getHeaderId(adapterPosHere); if (nextId != currentId) { final View next = parent.getChildAt(i); final int offset = ((int) next.getY()) - (headerHeight + getHeader(parent, adapterPosHere).itemView.getHeight()); if (offset < 0) { return offset; } else { break; }// w w w . j a v a2 s . co m } } } top = Math.max(0, top); } return top; }
From source file:com.beesham.beerac.ui.ScrollAwareFABBehavior.java
@Override public boolean onDependentViewChanged(CoordinatorLayout parent, FloatingActionButton fab, View dependency) { if (dependency instanceof AppBarLayout) { CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) fab.getLayoutParams(); int fabBottomMargin = lp.bottomMargin; int distanceToScroll = fab.getHeight() + fabBottomMargin; float ratio = (float) dependency.getY() / (float) toolbarHeight; fab.setTranslationY(-distanceToScroll * ratio); }/*from w ww.j a v a 2 s . c o m*/ return true; }