Example usage for android.widget LinearLayout getHeight

List of usage examples for android.widget LinearLayout getHeight

Introduction

In this page you can find the example usage for android.widget LinearLayout getHeight.

Prototype

@ViewDebug.ExportedProperty(category = "layout")
public final int getHeight() 

Source Link

Document

Return the height of your view.

Usage

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   ww w  . ja  va2  s .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: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();// ww w. j  a  v  a 2  s  .  c  o m
}

From source file:com.yamin.kk.fragment.AudioMiniPlayer.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.audio_player_mini, container, false);

    // Initialize the children
    mCover = (ImageView) v.findViewById(R.id.cover);
    mTitle = (TextView) v.findViewById(R.id.title);
    mArtist = (TextView) v.findViewById(R.id.artist);
    mPlayPause = (ImageButton) v.findViewById(R.id.play_pause);
    mForward = (ImageButton) v.findViewById(R.id.forward);
    mBackward = (ImageButton) v.findViewById(R.id.backward);
    mPlayPause.setOnClickListener(onMediaControlClickListener);
    mForward.setOnClickListener(onMediaControlClickListener);
    mBackward.setOnClickListener(onMediaControlClickListener);
    mProgressBar = (ProgressBar) v.findViewById(R.id.timeline);

    final LinearLayout root = (LinearLayout) v.findViewById(R.id.root_node);

    root.setOnTouchListener(new View.OnTouchListener() {
        @Override/*  www  . java 2 s .  c om*/
        public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                mTouchX = event.getRawX();
                mTouchY = event.getRawY();
                break;
            case MotionEvent.ACTION_UP:
                if (mTouchY - event.getRawY() > root.getHeight()) {
                    Toast.makeText(AudioMiniPlayer.this.getActivity(), "AudioMiniPlayer swipe up",
                            Toast.LENGTH_SHORT).show();
                    return true;
                } else if (Math.abs(mTouchY - event.getRawY()) < 5 && Math.abs(mTouchX - event.getRawX()) < 5) {
                    // effectively a click
                    AudioPlayerFragment.start(getActivity());
                    return true;
                } else
                    return false;
            }
            return true;
        }
    });

    registerForContextMenu(v);
    return v;
}

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 .  jav a 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 used to show the reveal effect to the edit text
 *//*ww w. j  av a2  s . 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:com.example.volunteerhandbook.MainActivity.java

void loopNewBox(LinearLayout iBox) {
    if (lastone <= 1) {
        show_what_I_thought();/*from   w w  w .  j a  v a 2s .co m*/
        return;
    }
    if (iTh > 3 * thoughts.length + 2) {
        lastone--;
        return;
    }
    float bH = (int) (1.2 * iBox.getHeight());
    iBox.removeAllViews();
    for (int i = 0; i < thoughts.length / 4; i++) {
        iBox.addView(toMove[iTh++ % thoughts.length]);
    }
    //toMove.setTranslationY(600);
    //container.addView(textBox);
    iBox.setX(20);
    iBox.setY(2 * bH);
    //hBox += iBox.getHeight();
    float startY = iBox.getY();
    endY = (-1) * bH;
    int duration = 20000;
    ValueAnimator bounceAnim = ObjectAnimator.ofFloat(iBox, "y", startY, endY);
    bounceAnim.setDuration(duration);
    bounceAnim.setInterpolator(new LinearInterpolator());
    final LinearLayout fBox = iBox;
    bounceAnim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            loopNewBox(fBox);
        }
    });
    bounceAnim.start();
}

From source file:info.johannblake.shutterstockdemo.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mContext = this;
    mAppTerminating = false;/*from  w  w  w . j  a  v a 2  s .  c  o  m*/

    // Create a cache to store downloaded images.
    CacheSupport.createCache(mContext);

    restoreAppState();

    NavigationDrawerFragment navigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager()
            .findFragmentById(R.id.navigation_drawer);

    // Set up the drawer.
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    navigationDrawerFragment.setUp(R.id.navigation_drawer, mDrawerLayout);

    if (!INCLUDE_NAV_DRAWER)
        mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle(getString(R.string.app_name));
    toolbar.inflateMenu(R.menu.options_menu);

    mMenuItemSearch = toolbar.getMenu().findItem(R.id.search);
    mSearchView = (SearchView) mMenuItemSearch.getActionView();

    mSearchView.setOnQueryTextListener(queryTextListener);

    // Note: Calling mSearchView.setQuery doesn't set the SearchView's input field
    // probably because the SearchView's layout is inflated each time the search
    // icon is tapped. To set the input field, it has to be done after the
    // button has been tapped. Presumably, the SearchView's layout is inflated at that
    // moment.
    mSearchView.setOnSearchClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mSearchView.setQuery(mQuery, false);
        }
    });

    if (INCLUDE_NAV_DRAWER) {
        // Display the hamburger icon.
        toolbar.setNavigationIcon(R.drawable.ic_hamburger);
    }

    // Handle the user tapping on the hamburger icon.
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (INCLUDE_NAV_DRAWER)
                mDrawerLayout.openDrawer(Gravity.START);
        }
    });

    // Move the toolbar up/down as the user scrolls the recyclerview.
    final LinearLayout llHeader = (LinearLayout) findViewById(R.id.llHeader);

    llHeader.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            final CustomRecyclerView rvImages = (CustomRecyclerView) findViewById(R.id.rvImages);
            rvImages.setOverScrollMode(ScrollView.OVER_SCROLL_NEVER);

            rvImages.setY(llHeader.getHeight());
            mJBHeaderScroll = new JBHeaderScroll(llHeader, 0);
            mJBHeaderScroll.registerScroller(rvImages, new JBHeaderScroll.IJBHeaderScroll() {
                @Override
                public void onResize(float top) {
                    ViewGroup.LayoutParams rlLayoutParams = new ViewGroup.LayoutParams(
                            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
                    rvImages.setLayoutParams(rlLayoutParams);
                    rvImages.setY(top);
                    llHeader.bringToFront();
                }

                @Override
                public int onHeaderBeforeAnimation(boolean scrollingUp, float scrollDelta) {
                    return JBHeaderScroll.ANIMATE_HEADER_USE_DEFAULT;
                }

                @Override
                public void onHeaderAfterAnimation(boolean animatedUp, float scrollDelta) {
                }
            });

            rvImages.setJBHeaderRef(mJBHeaderScroll);
            llHeader.getViewTreeObserver().removeOnGlobalLayoutListener(this);
        }
    });
}

From source file:com.cloverstudio.spika.CameraCropActivity.java

public void scaleView() {
    // instantiate the views
    View top_view = findViewById(R.id.topView);
    View bottom_view = findViewById(R.id.bottomView);
    LinearLayout footer = (LinearLayout) findViewById(R.id.llFooter);
    LinearLayout crop_frame = (LinearLayout) findViewById(R.id.llCropFrame);
    Display display = getWindowManager().getDefaultDisplay();
    int width = display.getWidth();
    int height = display.getHeight();

    // 90% of width
    crop_container_size = (int) ((float) width * (1f - (10f / 100f)));

    // 10% margins
    float margin = ((float) width * (1f - (90f / 100f)));

    // Parameters for white crop border
    LinearLayout.LayoutParams par = new LinearLayout.LayoutParams(crop_container_size, crop_container_size);
    par.gravity = Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL;
    par.setMargins((int) (margin / 2f), 0, (int) (margin / 2f), 0);
    crop_frame.setLayoutParams(par);/*from   w  w w  .j  a va 2 s  .  com*/

    // Margins for other transparent views
    float top_view_height = ((float) (height - crop_container_size - footer.getHeight())) / (float) 2;
    top_view.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, (int) top_view_height));
    bottom_view
            .setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, (int) top_view_height));

    // Image container
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(crop_container_size,
            crop_container_size);
    params.setMargins((int) (margin / 2f), (int) top_view_height, (int) (margin / 2f), 0);
    mImageView.setLayoutParams(params);
    mImageView.setImageBitmap(mBitmap);
    mImageView.setMaxZoom(4f);
}