add a Share button

This commit is contained in:
tibbi 2016-02-26 23:01:07 +01:00
parent 0aeeac2dda
commit bb16867d8e
3 changed files with 33 additions and 1 deletions

View File

@ -3,6 +3,8 @@ package com.simplemobiletools.draw;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import butterknife.Bind;
@ -24,6 +26,27 @@ public class MainActivity extends AppCompatActivity {
setColor(Color.BLACK);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_share:
shareImage();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private void shareImage() {
}
@OnClick(R.id.undo)
public void undo() {
myCanvas.undo();

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu_share"
android:icon="@android:drawable/ic_menu_share"
android:title="Share"
app:showAsAction="always"/>
</menu>