Rename test->main classes and update the theme.
This commit is contained in:
parent
a961c55407
commit
1f5f9cb8de
@ -13,7 +13,7 @@
|
|||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
<activity android:name=".TestActivity">
|
<activity android:name=".MainActivity">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ import java.io.FileReader;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
class PartCanvasView extends View {
|
class CanvasView extends View {
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
ArrayList<Part> parts = new ArrayList<>();
|
ArrayList<Part> parts = new ArrayList<>();
|
||||||
@ -48,12 +48,12 @@ class PartCanvasView extends View {
|
|||||||
private String name = "default";
|
private String name = "default";
|
||||||
private final static float touchTimeForLongTouchInMillis = 500;
|
private final static float touchTimeForLongTouchInMillis = 500;
|
||||||
|
|
||||||
public PartCanvasView(Context context) {
|
public CanvasView(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PartCanvasView(Context context, AttributeSet attr){
|
public CanvasView(Context context, AttributeSet attr){
|
||||||
super(context, attr);
|
super(context, attr);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
@ -5,12 +5,13 @@ import android.support.design.widget.Snackbar;
|
|||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
public class TestActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
PartCanvasView partCanvasView;
|
CanvasView canvasView;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -23,9 +24,9 @@ public class TestActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Use controled canvas
|
// 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);
|
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||||
fab.setOnClickListener(new View.OnClickListener() {
|
fab.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -39,6 +40,12 @@ public class TestActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent event) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,7 +4,7 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="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
|
<android.support.design.widget.AppBarLayout
|
||||||
@ -22,7 +22,7 @@
|
|||||||
</android.support.design.widget.AppBarLayout>
|
</android.support.design.widget.AppBarLayout>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<com.codigoparallevar.minicards.PartCanvasView
|
<com.codigoparallevar.minicards.CanvasView
|
||||||
android:id="@+id/canvasView"
|
android:id="@+id/canvasView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="colorPrimary">#3F51B5</color>
|
<color name="colorPrimary">#066996</color>
|
||||||
<color name="colorPrimaryDark">#303F9F</color>
|
<color name="colorPrimaryDark">#044563</color>
|
||||||
<color name="colorAccent">#FF4081</color>
|
<color name="colorAccent">#b2ff59</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user