diff --git a/res/layout/about_dialog.xml b/res/layout/about_dialog.xml new file mode 100644 index 0000000..937edc5 --- /dev/null +++ b/res/layout/about_dialog.xml @@ -0,0 +1,24 @@ + + + + + + + + \ No newline at end of file diff --git a/res/menu/calculation_list_options.xml b/res/menu/calculation_list_options.xml index 6e40c34..a413553 100644 --- a/res/menu/calculation_list_options.xml +++ b/res/menu/calculation_list_options.xml @@ -3,4 +3,7 @@ + \ No newline at end of file diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 032d150..45fdeca 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -4,6 +4,7 @@ Abrechnung Speichern Löschen + Über MoneyBalance Entfernen Bist Du sicher, dass diese Abrechnung gelöscht werden soll? diff --git a/res/values/strings.xml b/res/values/strings.xml index 1d11cad..d71a81d 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -4,6 +4,7 @@ MoneyBalance Save Delete + About MoneyBalance minus Are you sure you want to delete this calculation? diff --git a/src/ivl/android/moneybalance/AboutDialog.java b/src/ivl/android/moneybalance/AboutDialog.java new file mode 100644 index 0000000..0d4adac --- /dev/null +++ b/src/ivl/android/moneybalance/AboutDialog.java @@ -0,0 +1,43 @@ +package ivl.android.moneybalance; + +import android.app.Dialog; +import android.content.Context; +import android.os.Bundle; +import android.text.Html; +import android.text.method.LinkMovementMethod; +import android.widget.TextView; + +public class AboutDialog extends Dialog { + + private static String INFO_HTML = + "Copyright (C) 2012 Ingo van Lil
" + + "https://github.com/inguin/moneybalance

" + + "Icons created by VisualPharm, " + + "used under a CC BY-ND 3.0 license."; + + private static String LICENSE_HTML = + "Licensed under the Apache License, Version 2.0 (the \"License\"). " + + "You may not use this program except in compliance with the License.
" + + "You may obtain a copy of the License at " + + "http://www.apache.org/licenses/LICENSE-2.0."; + + public AboutDialog(Context context) { + super(context); + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.about_dialog); + setTitle(R.string.app_name); + + TextView info = (TextView) findViewById(R.id.about_info); + info.setText(Html.fromHtml(INFO_HTML)); + info.setMovementMethod(LinkMovementMethod.getInstance()); + + TextView license = (TextView) findViewById(R.id.about_license); + license.setText(Html.fromHtml(LICENSE_HTML)); + license.setMovementMethod(LinkMovementMethod.getInstance()); + } + +} diff --git a/src/ivl/android/moneybalance/CalculationListActivity.java b/src/ivl/android/moneybalance/CalculationListActivity.java index 7ae65cc..7136108 100644 --- a/src/ivl/android/moneybalance/CalculationListActivity.java +++ b/src/ivl/android/moneybalance/CalculationListActivity.java @@ -140,15 +140,18 @@ public boolean onCreateOptionsMenu(Menu menu) { } @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case R.id.new_calculation: - startActivity(new Intent(this, CalculationEditorActivity.class)); - return true; - default: - return super.onOptionsItemSelected(item); - } - } + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case R.id.new_calculation: + startActivity(new Intent(this, CalculationEditorActivity.class)); + return true; + case R.id.about: + showAboutDialog(); + return true; + default: + return super.onOptionsItemSelected(item); + } + } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { @@ -197,6 +200,11 @@ public void onClick(DialogInterface dialog, int which) { dialog.show(); } + private void showAboutDialog() { + AboutDialog about = new AboutDialog(this); + about.show(); + } + @Override protected void onPause() { super.onPause();