List of usage examples for android.widget HorizontalScrollView getChildAt
public View getChildAt(int index)
From source file:com.retroteam.studio.retrostudio.EditorLandscape.java
/** * Find a measure view object by its coordinates. * @param row// w w w . j a v a2 s . c om * @param column * @return */ private View findMeasureByCoords(int row, int column) { LinearLayout track_layout = (LinearLayout) findViewById(R.id.track_layout); // HorizontalScrollView track_container = (HorizontalScrollView) track_layout.getChildAt(row + 1); GridLayout track = (GridLayout) track_container.getChildAt(0); int numChildren = track.getChildCount(); for (int i = 0; i < numChildren; i++) { View child = track.getChildAt(i); if (child.getTag(R.id.TAG_ROW) == row && child.getTag(R.id.TAG_COLUMN) == column) { return child; } } return null; }
From source file:com.retroteam.studio.retrostudio.EditorLandscape.java
/** * Iterate through all the measures and return a list of measure tag group objects. * The list is serialized out to the .retro project file. * @return ArrayList<MeasureTagGroup> *//*from w w w. j a v a 2 s . c o m*/ private ArrayList<MeasureTagGroup> getMeasureTags() { ArrayList<MeasureTagGroup> mtaglist = new ArrayList<>(); LinearLayout track_layout = (LinearLayout) findViewById(R.id.track_layout); //iterate through all the measures for (int t = 0; t < track_layout.getChildCount(); t++) { //get hscrollview HorizontalScrollView hchild = (HorizontalScrollView) track_layout.getChildAt(t); for (int h = 0; h < hchild.getChildCount(); h++) { //get gridlayout GridLayout gchild = (GridLayout) hchild.getChildAt(h); for (int g = 0; g < gchild.getChildCount(); g++) { //get measure if (gchild.getChildAt(g) instanceof ImageView) { ImageView ivchild = (ImageView) gchild.getChildAt(g); Drawable measureFill = ivchild.getDrawable(); if (measureFill.getConstantState() .equals(ContextCompat .getDrawable(getApplicationContext(), R.drawable.measure_new_empty) .getConstantState())) { mtaglist.add(new MeasureTagGroup((int) ivchild.getTag(R.id.TAG_ROW), (int) ivchild.getTag(R.id.TAG_COLUMN), false, (int) ivchild.getTag(R.id.TAG_GUISNAP), (ArrayList<int[]>) ivchild.getTag(R.id.TAG_FILLED_NOTES))); } else if (measureFill.getConstantState() .equals(ContextCompat .getDrawable(getApplicationContext(), R.drawable.measure_new_filled) .getConstantState())) { mtaglist.add(new MeasureTagGroup((int) ivchild.getTag(R.id.TAG_ROW), (int) ivchild.getTag(R.id.TAG_COLUMN), true, (int) ivchild.getTag(R.id.TAG_GUISNAP), (ArrayList<int[]>) ivchild.getTag(R.id.TAG_FILLED_NOTES))); } } } } } return mtaglist; }
From source file:org.catrobat.paintroid.ui.BottomBar.java
private void startBottomBarAnimation() { final HorizontalScrollView horizontalScrollView = (HorizontalScrollView) mMainActivity .findViewById(R.id.bottom_bar_scroll_view); final ScrollView verticalScrollView = (ScrollView) mMainActivity .findViewById(R.id.bottom_bar_landscape_scroll_view); final int animationDuration = 1000; int orientation = mMainActivity.getResources().getConfiguration().orientation; if (orientation == Configuration.ORIENTATION_PORTRAIT) { horizontalScrollView.post(new Runnable() { public void run() { int scrollToX = (int) (getToolButtonByToolType(mCurrentToolType).getX() - horizontalScrollView.getWidth() / 2.0f + mMainActivity.getResources().getDimension(R.dimen.bottom_bar_button_width) / 2.0f); int scrollFromX = PaintroidApplication.isRTL ? horizontalScrollView.getChildAt(0).getLeft() : horizontalScrollView.getChildAt(0).getRight(); horizontalScrollView.setScrollX(scrollFromX); ObjectAnimator.ofInt(horizontalScrollView, "scrollX", scrollToX).setDuration(animationDuration) .start();//www . j av a 2 s .c om } }); } else if (orientation == Configuration.ORIENTATION_LANDSCAPE) { verticalScrollView.post(new Runnable() { public void run() { int scrollToY = (int) (getToolButtonByToolType(mCurrentToolType).getY() - verticalScrollView.getHeight() / 2.0f + mMainActivity.getResources().getDimension(R.dimen.bottom_bar_landscape_button_height) / 2.0f); int scrollFromY = verticalScrollView.getChildAt(0).getBottom(); verticalScrollView.setScrollY(scrollFromY); ObjectAnimator.ofInt(verticalScrollView, "scrollY", scrollToY).setDuration(animationDuration) .start(); } }); } delayedAnimateSelectedTool(animationDuration); }
From source file:org.mythtv.client.ui.dvr.GuideTimeslotsFragment.java
private void scrollTimeslot() { final HorizontalScrollView hsv = (HorizontalScrollView) getActivity() .findViewById(R.id.program_guide_timeslots_scrollview); if (null != hsv) { hsv.post(new Runnable() { /* (non-Javadoc) * @see java.lang.Runnable#run() *//*from w w w . jav a 2s . co m*/ @Override public void run() { final View child = ((LinearLayout) hsv.getChildAt(0)).getChildAt(startingTimeslot); Log.v(TAG, "onActivityCreated : scroll to timeslot(" + child.getWidth() + ") " + startingTimeslot + " at postion '" + (startingTimeslot * (child.getWidth())) + "'"); hsv.scrollTo((startingTimeslot * (child.getWidth())), 0); } }); } }
From source file:com.youle.gamebox.ui.view.SlidingPaneLayout.java
private boolean isTargetViewOnRight() { boolean result = false; if (mTargetView != null) { if (mTargetView instanceof HorizontalScrollView) { HorizontalScrollView scrollView = (HorizontalScrollView) mTargetView; // ScrollView????View? View child = scrollView.getChildAt(0); if (child != null) { result = child.getMeasuredWidth() <= getWidth() + scrollView.getScrollX(); }// ww w .j a v a2s . c o m } else if (mTargetView instanceof ViewPager) { ViewPager pager = (ViewPager) mTargetView; PagerAdapter adapter = pager.getAdapter(); boolean canTurnRight = adapter != null && adapter.getCount() > 0 && pager.getCurrentItem() < adapter.getCount() - 1; result = !canTurnRight; } } return result; }