2017-07-03 18:26:38 +00:00
|
|
|
package com.codigoparallevar.minicards;
|
|
|
|
|
2017-07-09 14:46:47 +00:00
|
|
|
import android.support.design.widget.FloatingActionButton;
|
|
|
|
import android.support.design.widget.Snackbar;
|
2017-07-08 18:52:16 +00:00
|
|
|
import android.support.v7.app.ActionBar;
|
2017-07-03 18:26:38 +00:00
|
|
|
import android.support.v7.app.AppCompatActivity;
|
|
|
|
import android.os.Bundle;
|
2017-07-09 15:00:08 +00:00
|
|
|
import android.util.Log;
|
2017-07-03 21:55:32 +00:00
|
|
|
import android.view.MotionEvent;
|
2017-07-09 14:46:47 +00:00
|
|
|
import android.view.View;
|
2017-07-03 18:26:38 +00:00
|
|
|
|
2017-07-09 15:00:08 +00:00
|
|
|
public class MainActivity extends AppCompatActivity {
|
2017-07-03 18:26:38 +00:00
|
|
|
|
2017-07-09 15:00:08 +00:00
|
|
|
CanvasView canvasView;
|
2017-07-03 21:55:32 +00:00
|
|
|
|
2017-07-03 18:26:38 +00:00
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
2017-07-08 18:52:16 +00:00
|
|
|
// Hide action bar
|
|
|
|
ActionBar actionBar = getSupportActionBar();
|
|
|
|
if (actionBar != null) {
|
|
|
|
actionBar.hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Use controled canvas
|
2017-07-09 15:00:08 +00:00
|
|
|
setContentView(R.layout.activity_main);
|
2017-07-09 14:46:47 +00:00
|
|
|
|
2017-07-09 15:00:08 +00:00
|
|
|
canvasView = (CanvasView) findViewById(R.id.canvasView);
|
2017-07-09 14:46:47 +00:00
|
|
|
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
|
|
|
fab.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View view) {
|
|
|
|
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
|
|
|
.setAction("Action", null).show();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2017-07-03 18:26:38 +00:00
|
|
|
}
|
2017-07-03 21:55:32 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onTouchEvent(MotionEvent event) {
|
2017-07-09 15:00:08 +00:00
|
|
|
if (canvasView != null){
|
|
|
|
return canvasView.onTouchEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
Log.e("MainActivity", "CanvasView is null");
|
|
|
|
|
|
|
|
return super.onTouchEvent(event);
|
2017-07-03 21:55:32 +00:00
|
|
|
}
|
2017-07-03 18:26:38 +00:00
|
|
|
}
|