Rename test->main classes and update the theme.

This commit is contained in:
kenkeiras 2017-07-09 11:00:08 -04:00
parent a961c55407
commit 1f5f9cb8de
5 changed files with 21 additions and 14 deletions

View File

@ -13,7 +13,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".TestActivity">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View File

@ -27,7 +27,7 @@ import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
class PartCanvasView extends View {
class CanvasView extends View {
@NonNull
ArrayList<Part> parts = new ArrayList<>();
@ -48,12 +48,12 @@ class PartCanvasView extends View {
private String name = "default";
private final static float touchTimeForLongTouchInMillis = 500;
public PartCanvasView(Context context) {
public CanvasView(Context context) {
super(context);
init();
}
public PartCanvasView(Context context, AttributeSet attr){
public CanvasView(Context context, AttributeSet attr){
super(context, attr);
init();
}

View File

@ -5,12 +5,13 @@ import android.support.design.widget.Snackbar;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
public class TestActivity extends AppCompatActivity {
public class MainActivity extends AppCompatActivity {
PartCanvasView partCanvasView;
CanvasView canvasView;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -23,9 +24,9 @@ public class TestActivity extends AppCompatActivity {
}
// Use controled canvas
setContentView(R.layout.activity_test);
setContentView(R.layout.activity_main);
partCanvasView = (PartCanvasView) findViewById(R.id.canvasView);
canvasView = (CanvasView) findViewById(R.id.canvasView);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
@ -39,6 +40,12 @@ public class TestActivity extends AppCompatActivity {
@Override
public boolean onTouchEvent(MotionEvent event) {
return partCanvasView.onTouchEvent(event);
if (canvasView != null){
return canvasView.onTouchEvent(event);
}
Log.e("MainActivity", "CanvasView is null");
return super.onTouchEvent(event);
}
}

View File

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.codigoparallevar.minicards.parts.buttons.MainActivity">
tools:context="com.codigoparallevar.minicards.MainActivity">
<!--
<android.support.design.widget.AppBarLayout
@ -22,7 +22,7 @@
</android.support.design.widget.AppBarLayout>
-->
<com.codigoparallevar.minicards.PartCanvasView
<com.codigoparallevar.minicards.CanvasView
android:id="@+id/canvasView"
android:layout_width="match_parent"
android:layout_height="match_parent" />

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="colorPrimary">#066996</color>
<color name="colorPrimaryDark">#044563</color>
<color name="colorAccent">#b2ff59</color>
</resources>