Java Code Examples for android.widget.RelativeLayout#getLeft()

The following examples show how to use android.widget.RelativeLayout#getLeft() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UIUtil.java    From AwesomeSplash with MIT License 6 votes vote down vote up
public static int getRevealDirection(RelativeLayout rl, int flag){
    int result = 0;
    switch (flag){
        case Flags.REVEAL_BOTTOM:
            result = rl.getBottom();
            break;
        case Flags.REVEAL_TOP:
            result = rl.getTop();
            break;
        case Flags.REVEAL_LEFT:
            result = rl.getLeft();
            break;
        case Flags.REVEAL_RIGHT:
            result = rl.getRight();
            break;
    }

    return result;
}
 
Example 2
Source File: MainActivity.java    From music_player with Open Software License 3.0 4 votes vote down vote up
public void animation_change_color(final int Int) {
    ImageView play_now_back_color = (ImageView) findViewById(R.id.play_now_back_color);
    final RelativeLayout activity_now_play = (RelativeLayout) findViewById(R.id.activity_now_play);
    if (cx == 0) {
        FloatingActionButton play_or_pause = (FloatingActionButton) findViewById(R.id.play_or_pause);
        RelativeLayout seekbar_layout = (RelativeLayout) findViewById(R.id.seekbar_layout);
        RelativeLayout control_layout = (RelativeLayout) findViewById(R.id.control_layout);
        cx = play_or_pause.getLeft() + control_layout.getLeft() + play_or_pause.getWidth() / 2;
        cy = control_layout.getTop() - seekbar_layout.getTop() + play_or_pause.getTop() + play_or_pause.getHeight() / 2;
        finalRadius = Math.max(play_now_back_color.getWidth(), play_now_back_color.getHeight());
    }
    if (cx != 0) {
        Animator anim = ViewAnimationUtils.createCircularReveal(play_now_back_color, cx, cy, 0, finalRadius);
        play_now_back_color.setBackgroundColor(Int);
        anim.setDuration(500);
        anim.start();
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                activity_now_play.setBackgroundColor(Int);
            }
        });
    } else {
        activity_now_play.setBackgroundColor(Int);
    }
    TextView now_on_play_text = (TextView) findViewById(R.id.now_on_play_text);
    now_on_play_text.setTextColor(Int);
    //lrcview字体颜色
    if (ColorUtil.isColorLight(Int)) {
        otherLyricView.setNormalColor(Color.parseColor("#60000000"));
        otherLyricView.setTimelineTextColor(Color.parseColor("#000000"));
        otherLyricView.setCurrentColor(Color.parseColor("#000000"));
    } else {
        otherLyricView.setNormalColor(Color.parseColor("#60FFFFFF"));
        otherLyricView.setTimelineTextColor(Color.parseColor("#FFFFFF"));
        otherLyricView.setCurrentColor(Color.parseColor("#FFFFFF"));
    }

    //歌词背景颜色
    if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
        View bottom = findViewById(R.id.gradient_bottom);
        View top = findViewById(R.id.gradient_top);
        View gradient = findViewById(R.id.gradient);
        top.setBackground(
                ScrimUtil.makeCubicGradientScrimDrawable(Int, //颜色
                        8, //渐变层数
                        Gravity.TOP)); //起始方向
        bottom.setBackground(
                ScrimUtil.makeCubicGradientScrimDrawable(Int, //颜色
                        8, //渐变层数
                        Gravity.BOTTOM)); //起始方向
        gradient.setBackground(
                ScrimUtil.makeCubicGradientScrimDrawable(Int, //颜色
                        8, //渐变层数
                        Gravity.BOTTOM)); //起始方向
    }
}