Merge pull request #8 from adnio/master

Added clear canvas functionality
This commit is contained in:
Tibor Kaputa 2016-07-26 19:04:13 +02:00 committed by GitHub
commit 0cb1d29776
4 changed files with 15 additions and 0 deletions

View file

@ -85,6 +85,13 @@ public class MyCanvas extends View {
canvas.drawPath(mPath, mPaint);
}
public void clearCanvas(){
mPath = new Path();
mPaths = new LinkedHashMap<>();
pathsUpdated();
invalidate();
}
private void actionDown(float x, float y) {
mPath.reset();
mPath.moveTo(x, y);

View file

@ -84,6 +84,9 @@ public class MainActivity extends SimpleActivity implements MyCanvas.PathsChange
case R.id.settings:
startActivity(new Intent(getApplicationContext(), SettingsActivity.class));
return true;
case R.id.clear:
mMyCanvas.clearCanvas();
return true;
case R.id.about:
startActivity(new Intent(getApplicationContext(), AboutActivity.class));
return true;

View file

@ -15,6 +15,10 @@
android:id="@+id/settings"
android:title="@string/settings"
app:showAsAction="never"/>
<item
android:id="@+id/clear"
android:title="@string/clear"
app:showAsAction="never"/>
<item
android:id="@+id/about"
android:title="@string/about"

View file

@ -12,6 +12,7 @@
<!-- Settings -->
<string name="settings">Settings</string>
<string name="clear">Clear</string>
<string name="dark_theme">Dark theme</string>
<!-- About -->