List of usage examples for android.widget LinearLayout getWidth
@ViewDebug.ExportedProperty(category = "layout") public final int getWidth()
From source file:com.ridhofkr.hanacaraka.LetterCardActivity.java
private void applyRotation(float start, float end, LinearLayout front, LinearLayout back, boolean flag) { final float centerX = front.getWidth() / 2.0f; final float centerY = front.getHeight() / 2.0f; final Rotate3dAnimation rotation = new Rotate3dAnimation(start, end, centerX, centerY, 310.0f, true); rotation.setDuration(300);//from w ww.ja va 2s.co m rotation.setFillAfter(true); rotation.setInterpolator(new AccelerateInterpolator()); rotation.setAnimationListener(new DisplayNextView(flag, front, back)); LinearLayout inside = (LinearLayout) back.findViewById(R.id.backcardinside); if (flag) { String text = ((String) ((TextView) front.findViewById(R.id.cardinfotitle)).getText()); front.startAnimation(rotation); removeSoundListener(front); inside.addView(ctrl.playAnimation(LetterCardActivity.this, text, category)); } else { back.startAnimation(rotation); addSoundListener(front); inside.removeViewAt(2); } }
From source file:com.todoroo.astrid.activity.TaskEditFragment.java
public static void setViewHeightBasedOnChildren(LinearLayout view) { int totalHeight = 0; int desiredWidth = MeasureSpec.makeMeasureSpec(view.getWidth(), MeasureSpec.AT_MOST); for (int i = 0; i < view.getChildCount(); i++) { View listItem = view.getChildAt(i); listItem.measure(desiredWidth, MeasureSpec.UNSPECIFIED); totalHeight += listItem.getMeasuredHeight(); }/*from w ww .j av a 2 s . co m*/ ViewGroup.LayoutParams params = view.getLayoutParams(); if (params == null) return; params.height = totalHeight; view.setLayoutParams(params); view.requestLayout(); }
From source file:shetye.prathamesh.notifyme.Utilities.java
public void showView(LinearLayout lview) { // get the center for the clipping circle int cx = (lview.getLeft() + lview.getRight()) / 2; int cy = (lview.getTop() + lview.getBottom()) / 2; // get the final radius for the clipping circle int finalRadius = Math.max(lview.getWidth(), lview.getHeight()); // create the animator for this view (the start radius is zero) Animator anim = ViewAnimationUtils.createCircularReveal(lview, cx, cy, 0, finalRadius); // make the view visible and start the animation lview.setVisibility(View.VISIBLE); anim.start();//from ww w. j a v a 2s.c o m }
From source file:shetye.prathamesh.notifyme.Utilities.java
public void hideView(final LinearLayout lview) { // get the center for the clipping circle int cx = (lview.getLeft() + lview.getRight()) / 2; int cy = (lview.getTop() + lview.getBottom()) / 2; // get the initial radius for the clipping circle int initialRadius = lview.getWidth(); // create the animation (the final radius is zero) Animator anim = ViewAnimationUtils.createCircularReveal(lview, cx, cy, initialRadius, 0); // make the view invisible when the animation is done anim.addListener(new AnimatorListenerAdapter() { @Override/*from w ww . j a v a2s .c o m*/ public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); lview.setVisibility(View.INVISIBLE); } }); anim.start(); }
From source file:com.numix.calculator.EventListener.java
private void deleteAnimation(View view) { final TextView colorLayout = (TextView) view.getRootView().findViewById(R.id.deleteColor); final LinearLayout displayView = (LinearLayout) view.getRootView().findViewById(R.id.displayLayout); final CalculatorDisplay calculatorDisplay = (CalculatorDisplay) view.getRootView() .findViewById(R.id.display); int finalRadius = Math.max(displayView.getWidth(), displayView.getHeight()); // create the animator for this view (the start radius is zero) Animator colorAnim;//w w w . j a va 2 s .c o m colorAnim = ViewAnimationUtils.createCircularReveal(colorLayout, (int) displayView.getRight(), (int) displayView.getBottom(), 0, finalRadius); final AlphaAnimation fadeAnim = new AlphaAnimation(1.0f, 0.0f); final AlphaAnimation fadeDisplay = new AlphaAnimation(1.0f, 0.0f); fadeAnim.setDuration(250); fadeAnim.setInterpolator(new AccelerateInterpolator()); fadeAnim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { colorLayout.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); fadeDisplay.setDuration(250); fadeDisplay.setInterpolator(new AccelerateInterpolator()); fadeDisplay.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { mHandler.onClear(); displayView.setAlpha(1.0f); } @Override public void onAnimationRepeat(Animation animation) { } }); colorAnim.setInterpolator(new AccelerateInterpolator()); colorAnim.addListener(new android.animation.Animator.AnimatorListener() { @Override public void onAnimationStart(android.animation.Animator animation) { calculatorDisplay.startAnimation(fadeDisplay); } @Override public void onAnimationRepeat(android.animation.Animator animation) { } @Override public void onAnimationEnd(android.animation.Animator animation) { colorLayout.startAnimation(fadeAnim); } @Override public void onAnimationCancel(android.animation.Animator animation) { } }); colorLayout.setVisibility(View.VISIBLE); colorAnim.start(); }
From source file:com.example.mego.adas.directions.ui.DirectionsFragment.java
/** * method to hide edit text with animation */// w ww .j a v a2s.co m private void hideEditText(final LinearLayout view) { int cx = view.getRight() - 30; int cy = view.getBottom() - 60; int initialRadius = view.getWidth(); Animator anim = null; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, initialRadius, 0); } if (anim != null) { anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); view.setVisibility(View.INVISIBLE); } }); } isEditTextVisible = false; if (anim != null) { anim.start(); } }
From source file:com.example.mego.adas.directions.ui.DirectionsFragment.java
/** * method used to show the reveal effect to the edit text *//*w w w .j a va 2s . co m*/ private void revealEditText(LinearLayout view) { int centerX = view.getRight() - 30; int centerY = view.getBottom() - 60; int finalRadius = Math.max(view.getWidth(), view.getHeight()); //work with api 21 or above Animator animator = null; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { animator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, 0, finalRadius); } view.setVisibility(View.VISIBLE); isEditTextVisible = true; if (animator != null) { animator.start(); } }
From source file:it.angrydroids.epub3reader.MainActivity.java
public int getWidth() { LinearLayout main = (LinearLayout) findViewById(R.id.MainLayout); return main.getWidth(); }
From source file:com.mobicage.rogerthat.plugins.friends.ServiceSearchActivity.java
private void displayTab(int tab) { final int childCount = mSearchCategoryViewFlipper.getChildCount(); if (childCount == 0) { return;/* www . j a v a 2 s. c om*/ } while (tab < 0) tab += childCount; tab = tab % childCount; mSearchCategoryViewFlipper.setDisplayedChild(tab); for (int i = 0; i < childCount; i++) { SearchInfo si = mSearchInfoByListView.get(mSearchCategoryViewFlipper.getChildAt(i)); if (si == null) { L.bug("Could not find list view!"); return; } final boolean selected = tab == i; final LinearLayout v = si.label; setCatorySelected(v, selected); if (selected) { final HorizontalScrollView sv = (HorizontalScrollView) findViewById( R.id.search_category_scroll_container); sv.post(new SafeRunnable() { @Override public void safeRun() { int vLeft = v.getLeft(); int vRight = v.getRight(); int width = v.getWidth(); sv.smoothScrollTo(((vLeft + vRight) / 2) - (width), 0); } }); } } }
From source file:cz.metaverse.android.bilingualreader.ReaderActivity.java
/** * @return width of the display area//from w w w . j ava 2 s .c om */ public int getWidth() { LinearLayout main = (LinearLayout) findViewById(R.id.PanelsLayout); return main.getWidth(); }