diff --git a/app/build.gradle b/app/build.gradle index b63a610..90332bf 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -27,4 +27,5 @@ dependencies { implementation 'com.android.support:appcompat-v7:25.4.0' testImplementation 'junit:junit:4.12' implementation 'com.android.support.constraint:constraint-layout:1.0.2' + implementation 'com.android.support:design:25.4.0' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 693f631..eb2be73 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,8 +13,6 @@ 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/PartCanvasView.java index fce5cb6..90caa15 100644 --- a/app/src/main/java/com/codigoparallevar/minicards/PartCanvasView.java +++ b/app/src/main/java/com/codigoparallevar/minicards/PartCanvasView.java @@ -6,6 +6,7 @@ import android.graphics.Color; import android.graphics.Paint; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.View; @@ -21,13 +22,9 @@ import org.json.JSONException; import org.json.JSONObject; import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; -import java.io.OutputStream; -import java.io.UnsupportedEncodingException; import java.util.ArrayList; class PartCanvasView extends View { @@ -53,6 +50,15 @@ class PartCanvasView extends View { public PartCanvasView(Context context) { super(context); + init(); + } + + public PartCanvasView(Context context, AttributeSet attr){ + super(context, attr); + init(); + } + + private void init() { this.setBackgroundColor(Color.rgb(4, 69, 99)); if (!loadState()){ diff --git a/app/src/main/java/com/codigoparallevar/minicards/TestActivity.java b/app/src/main/java/com/codigoparallevar/minicards/TestActivity.java index 14f1820..86ad18c 100644 --- a/app/src/main/java/com/codigoparallevar/minicards/TestActivity.java +++ b/app/src/main/java/com/codigoparallevar/minicards/TestActivity.java @@ -1,9 +1,12 @@ package com.codigoparallevar.minicards; +import android.support.design.widget.FloatingActionButton; +import android.support.design.widget.Snackbar; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.MotionEvent; +import android.view.View; public class TestActivity extends AppCompatActivity { @@ -20,8 +23,18 @@ public class TestActivity extends AppCompatActivity { } // Use controled canvas - partCanvasView = new PartCanvasView(this); - setContentView(partCanvasView); + setContentView(R.layout.activity_test); + + partCanvasView = (PartCanvasView) findViewById(R.id.canvasView); + 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(); + } + }); + } @Override diff --git a/app/src/main/res/layout/activity_test.xml b/app/src/main/res/layout/activity_test.xml index ef2448d..3576abe 100644 --- a/app/src/main/res/layout/activity_test.xml +++ b/app/src/main/res/layout/activity_test.xml @@ -1,18 +1,40 @@ - + tools:context="com.codigoparallevar.minicards.parts.buttons.MainActivity"> - + + + + + --> + + + + + + + android:layout_gravity="bottom|end" + android:layout_margin="@dimen/fab_margin" + app:srcCompat="@android:drawable/ic_dialog_email" /> - + \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..59a0b0c --- /dev/null +++ b/app/src/main/res/values/dimens.xml @@ -0,0 +1,3 @@ + + 16dp + diff --git a/build.gradle b/build.gradle index 01b4799..a377c55 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.0.0-alpha4' + classpath 'com.android.tools.build:gradle:3.0.0-alpha5' // NOTE: Do not place your application dependencies here; they belong