]> git.zerfleddert.de Git - ms2-fixes/blame - MS2Debounce/src/de/rmdir/ms2debounce/MS2Debounce.java
about dialog
[ms2-fixes] / MS2Debounce / src / de / rmdir / ms2debounce / MS2Debounce.java
CommitLineData
7bcde8d7
MG
1package de.rmdir.ms2debounce;
2
3import android.app.Activity;
fd8f8652
MG
4import android.app.Dialog;
5import android.app.AlertDialog;
7bcde8d7 6import android.os.Bundle;
ae569a50 7import android.content.Intent;
fd8f8652 8import android.content.DialogInterface;
ee6322a1 9import android.widget.TextView;
fd8f8652
MG
10import android.view.Menu;
11import android.view.MenuInflater;
12import android.view.MenuItem;
7bcde8d7
MG
13
14public class MS2Debounce extends Activity
15{
226a7d4d
MG
16 @Override
17 public void onCreate(Bundle savedInstanceState)
18 {
19 super.onCreate(savedInstanceState);
ae569a50 20
5738a32f 21 DebounceModuleHelper module = new DebounceModuleHelper(this);
226a7d4d
MG
22
23 if (!module.isLoaded()) {
24 module.loadModule();
25 }
ae569a50 26
226a7d4d 27 setContentView(R.layout.main);
ee6322a1
MG
28
29 TextView text = (TextView)findViewById(R.id.text);
08fec0be 30 text.setText("You will soon be able to set the debounce_delay here.\nModule loaded: " + module.isLoaded() + "\ndebounce_delay: " + module.getDelay() + "ms\nsafe_to_load: " + module.is_safe_to_load());
226a7d4d 31 }
fd8f8652
MG
32
33 @Override
34 public boolean onCreateOptionsMenu(Menu menu) {
35 MenuInflater inflater = getMenuInflater();
36 inflater.inflate(R.menu.main, menu);
37 return true;
38 }
39
40 @Override
41 public boolean onOptionsItemSelected(MenuItem item) {
42 switch (item.getItemId()) {
43 case R.id.about:
44 showDialog(42);
45 return true;
46 default:
47 return super.onOptionsItemSelected(item);
48 }
49 }
50
51 protected Dialog onCreateDialog(int id) {
52 Dialog dlg = null;
53
54 AlertDialog.Builder about = new AlertDialog.Builder(this);
55 about.setMessage("Milestone 2 Debounce\n\n(C) 2011 Michael Gernoth <michael@gernoth.net>\n\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA")
56 .setCancelable(true)
57 .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
58 public void onClick(DialogInterface dialog, int id) {
59 dialog.cancel();
60 }
61 });
62 dlg = about.create();
63
64 return dlg;
65 }
7bcde8d7 66}
Impressum, Datenschutz