Android Open Source - FallingBall Border View






From Project

Back to project page FallingBall.

License

The source code is released under:

GNU General Public License

If you think the Android project FallingBall listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package edu.fmi.android.brickpong.view;
//w ww. ja  va 2  s .  co m
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Point;
import android.util.AttributeSet;
import android.view.View;
import edu.fmi.android.brickpong.R;
import edu.fmi.android.brickpong.utils.ScreenUtil;

public class BorderView extends View {

  /**
   * {@value}
   */
  private static final int WIDTH_BORDER = 6;

  private final Paint borderPaint;

  private final Point screenSize;

  public BorderView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    borderPaint = new Paint();
    borderPaint.setColor(getResources().getColor(R.color.light_grey_1));
    borderPaint.setStrokeWidth(WIDTH_BORDER);
    borderPaint.setDither(false);

    screenSize = ScreenUtil.getScreenSize(context);
  }

  public BorderView(Context context, AttributeSet attrs) {
    this(context, attrs, 0);
  }

  public BorderView(Context context) {
    this(context, null);
  }

  @Override
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    canvas.drawLine(0, 0, screenSize.x, 0, borderPaint);
    canvas.drawLine(0, 0, 0, screenSize.y, borderPaint);
    canvas.drawLine(screenSize.x, 0, screenSize.x, screenSize.y,
        borderPaint);
  }
}




Java Source Code List

edu.fmi.android.brickpong.GameActivity.java
edu.fmi.android.brickpong.GameItem.java
edu.fmi.android.brickpong.HomeActivity.java
edu.fmi.android.brickpong.SplashActivity.java
edu.fmi.android.brickpong.listeners.OnGameEventsListener.java
edu.fmi.android.brickpong.listeners.OnPositionChangedListener.java
edu.fmi.android.brickpong.utils.Direction.java
edu.fmi.android.brickpong.utils.ScreenUtil.java
edu.fmi.android.brickpong.utils.Vector.java
edu.fmi.android.brickpong.view.BallView.java
edu.fmi.android.brickpong.view.BorderView.java
edu.fmi.android.brickpong.view.CellView.java
edu.fmi.android.brickpong.view.FinishedGameView.java
edu.fmi.android.brickpong.view.GameLayout.java
edu.fmi.android.brickpong.view.PadView.java
edu.fmi.android.brickpong.view.ResultsView.java