import android.support.v4.app.DialogFragment;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
+import android.view.Menu;
+import android.view.MenuItem;
import android.view.View;
import java.util.Objects;
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
}
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.new_transaction, menu);
+
+ return true;
+ }
+
public void pickTransactionDate(View view) {
DialogFragment picker = new DatePickerFragment();
picker.show(getSupportFragmentManager(), "datePicker");
// .setAction("Action", null).show();
}
+ public void addTransactionAccountFromMenu(MenuItem item) {
+ Snackbar.make(getCurrentFocus(), "Not implemented yet", Snackbar.LENGTH_LONG)
+ .setAction("Action", null).show();
+ }
+
}
app:backgroundTint="@color/colorPrimary"
app:srcCompat="@android:drawable/ic_menu_send" />
- <android.support.design.widget.FloatingActionButton
- android:id="@+id/fab_add_account"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="top|end"
- android:layout_marginBottom="80dp"
- android:clickable="true"
- android:focusable="auto"
- app:layout_anchor="@id/fab"
- app:layout_anchorGravity="top"
- app:srcCompat="@drawable/svg_thick_plus_white" />
-
</android.support.design.widget.CoordinatorLayout>
\ No newline at end of file
--- /dev/null
+<?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/action_add_account"
+ android:icon="@drawable/svg_thick_plus_white"
+ android:onClick="addTransactionAccountFromMenu"
+ android:orderInCategory="100"
+ android:title="@string/menu_add_account"
+ app:showAsAction="never|ifRoom" />
+</menu>
\ No newline at end of file
<string name="new_transaction_account_label">Account</string>
<string name="new_transaction_date_hint">Transaction date</string>
<string name="new_transaction_amount_hint">amount</string>
+ <string name="menu_add_account">Add another acount</string>
</resources>