mirror of
https://github.com/SimpleMobileTools/Simple-Draw.git
synced 2025-04-04 05:41:10 +02:00
Merge pull request #8 from adnio/master
Added clear canvas functionality
This commit is contained in:
commit
0cb1d29776
@ -85,6 +85,13 @@ public class MyCanvas extends View {
|
|||||||
canvas.drawPath(mPath, mPaint);
|
canvas.drawPath(mPath, mPaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearCanvas(){
|
||||||
|
mPath = new Path();
|
||||||
|
mPaths = new LinkedHashMap<>();
|
||||||
|
pathsUpdated();
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
private void actionDown(float x, float y) {
|
private void actionDown(float x, float y) {
|
||||||
mPath.reset();
|
mPath.reset();
|
||||||
mPath.moveTo(x, y);
|
mPath.moveTo(x, y);
|
||||||
|
@ -84,6 +84,9 @@ public class MainActivity extends SimpleActivity implements MyCanvas.PathsChange
|
|||||||
case R.id.settings:
|
case R.id.settings:
|
||||||
startActivity(new Intent(getApplicationContext(), SettingsActivity.class));
|
startActivity(new Intent(getApplicationContext(), SettingsActivity.class));
|
||||||
return true;
|
return true;
|
||||||
|
case R.id.clear:
|
||||||
|
mMyCanvas.clearCanvas();
|
||||||
|
return true;
|
||||||
case R.id.about:
|
case R.id.about:
|
||||||
startActivity(new Intent(getApplicationContext(), AboutActivity.class));
|
startActivity(new Intent(getApplicationContext(), AboutActivity.class));
|
||||||
return true;
|
return true;
|
||||||
|
@ -15,6 +15,10 @@
|
|||||||
android:id="@+id/settings"
|
android:id="@+id/settings"
|
||||||
android:title="@string/settings"
|
android:title="@string/settings"
|
||||||
app:showAsAction="never"/>
|
app:showAsAction="never"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/clear"
|
||||||
|
android:title="@string/clear"
|
||||||
|
app:showAsAction="never"/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/about"
|
android:id="@+id/about"
|
||||||
android:title="@string/about"
|
android:title="@string/about"
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
<!-- Settings -->
|
<!-- Settings -->
|
||||||
<string name="settings">Settings</string>
|
<string name="settings">Settings</string>
|
||||||
|
<string name="clear">Clear</string>
|
||||||
<string name="dark_theme">Dark theme</string>
|
<string name="dark_theme">Dark theme</string>
|
||||||
|
|
||||||
<!-- About -->
|
<!-- About -->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user