Rename DrawView to PartCanvasView.
This commit is contained in:
parent
cb2ca6c47c
commit
5e71d29a39
@ -4,22 +4,21 @@ import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
import com.codigoparallevar.minicards.parts.Part;
|
||||
import com.codigoparallevar.minicards.parts.Placeholder;
|
||||
import com.codigoparallevar.minicards.parts.buttons.RoundButton;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
class DrawView extends View {
|
||||
class PartCanvasView extends View {
|
||||
|
||||
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
ArrayList<Part> parts = new ArrayList<>();
|
||||
|
||||
public DrawView(Context context) {
|
||||
public PartCanvasView(Context context) {
|
||||
super(context);
|
||||
this.setBackgroundColor(Color.rgb(4, 69, 99));
|
||||
parts.add(new RoundButton(500, 1200, 80, 100));
|
||||
@ -73,6 +72,7 @@ class DrawView extends View {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Part getPartOn(int x, int y) {
|
||||
// Look in the list, in reverse so top-most elements are checked before
|
||||
for (int i = parts.size() - 1; i >= 0; i--){
|
@ -1,24 +1,23 @@
|
||||
package com.codigoparallevar.minicards;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
public class TestActivity extends AppCompatActivity {
|
||||
|
||||
DrawView drawView;
|
||||
PartCanvasView partCanvasView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
drawView = new DrawView(this);
|
||||
setContentView(drawView);
|
||||
partCanvasView = new PartCanvasView(this);
|
||||
setContentView(partCanvasView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
return drawView.onTouchEvent(event);
|
||||
return partCanvasView.onTouchEvent(event);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user