From 1f5f9cb8deab547e8a3070d06c362640324c7cff Mon Sep 17 00:00:00 2001 From: kenkeiras Date: Sun, 9 Jul 2017 11:00:08 -0400 Subject: [PATCH] Rename test->main classes and update the theme. --- app/src/main/AndroidManifest.xml | 2 +- .../{PartCanvasView.java => CanvasView.java} | 6 +++--- .../{TestActivity.java => MainActivity.java} | 17 ++++++++++++----- .../{activity_test.xml => activity_main.xml} | 4 ++-- app/src/main/res/values/colors.xml | 6 +++--- 5 files changed, 21 insertions(+), 14 deletions(-) rename app/src/main/java/com/codigoparallevar/minicards/{PartCanvasView.java => CanvasView.java} (98%) rename app/src/main/java/com/codigoparallevar/minicards/{TestActivity.java => MainActivity.java} (72%) rename app/src/main/res/layout/{activity_test.xml => activity_main.xml} (91%) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index eb2be73..ae36000 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,7 +13,7 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> - + diff --git a/app/src/main/java/com/codigoparallevar/minicards/PartCanvasView.java b/app/src/main/java/com/codigoparallevar/minicards/CanvasView.java similarity index 98% rename from app/src/main/java/com/codigoparallevar/minicards/PartCanvasView.java rename to app/src/main/java/com/codigoparallevar/minicards/CanvasView.java index 90caa15..d576b06 100644 --- a/app/src/main/java/com/codigoparallevar/minicards/PartCanvasView.java +++ b/app/src/main/java/com/codigoparallevar/minicards/CanvasView.java @@ -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 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(); } diff --git a/app/src/main/java/com/codigoparallevar/minicards/TestActivity.java b/app/src/main/java/com/codigoparallevar/minicards/MainActivity.java similarity index 72% rename from app/src/main/java/com/codigoparallevar/minicards/TestActivity.java rename to app/src/main/java/com/codigoparallevar/minicards/MainActivity.java index 86ad18c..a25d52d 100644 --- a/app/src/main/java/com/codigoparallevar/minicards/TestActivity.java +++ b/app/src/main/java/com/codigoparallevar/minicards/MainActivity.java @@ -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); } } diff --git a/app/src/main/res/layout/activity_test.xml b/app/src/main/res/layout/activity_main.xml similarity index 91% rename from app/src/main/res/layout/activity_test.xml rename to app/src/main/res/layout/activity_main.xml index 3576abe..4c4dde7 100644 --- a/app/src/main/res/layout/activity_test.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -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"> - diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 3ab3e9c..60b47b3 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,6 +1,6 @@ - #3F51B5 - #303F9F - #FF4081 + #066996 + #044563 + #b2ff59