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