/[zanavi_public1]/navit/navit/android/src/com/retain/dialog/RenameDialog.java
ZANavi

Contents of /navit/navit/android/src/com/retain/dialog/RenameDialog.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 28 - (show annotations) (download)
Sun Jun 17 08:12:47 2012 UTC (11 years, 10 months ago) by zoff99
File size: 2079 byte(s)
lots of new stuff and fixes
1 /**
2 * from:
3 * http://code.google.com/p/retain-android/
4 *
5 * http://www.apache.org/licenses/LICENSE-2.0
6 *
7 */
8
9 /**
10 * ZANavi, Zoff Android Navigation system.
11 * Copyright (C) 2011 Zoff <zoff@zoff.cc>
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * version 2 as published by the Free Software Foundation.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the
24 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 * Boston, MA 02110-1301, USA.
26 */
27
28 package com.retain.dialog;
29
30 import android.app.Activity;
31 import android.app.AlertDialog;
32 import android.content.DialogInterface;
33 import android.widget.EditText;
34
35 import com.retain.dialog.RenameHandlerInterface.OnRenameItemListener;
36
37 public class RenameDialog extends AlertDialog
38 {
39
40 private EditText mET;
41 private long mRowId;
42 private OnRenameItemListener mRenameListener;
43 private Activity mActivity;
44
45 public RenameDialog(Activity activity, String title, String name, OnRenameItemListener renameListener)
46 {
47 super(activity);
48
49 mET = new EditText(activity);
50 mET.setText(name);
51 mRenameListener = renameListener;
52 mActivity = activity;
53
54 setView(mET);
55 setCancelable(true);
56 setTitle(title);
57
58 setButton("Ok", new DialogInterface.OnClickListener()
59 {
60 @Override
61 public void onClick(DialogInterface dialog, int which)
62 {
63 String title = mET.getText().toString();
64 mRenameListener.onRenameItem(title);
65 return;
66 }
67 });
68 setButton2("Cancel", new DialogInterface.OnClickListener()
69 {
70 @Override
71 public void onClick(DialogInterface dialog, int which)
72 {
73 dialog.dismiss();
74 }
75 });
76
77 }
78
79 }

   
Visit the ZANavi Wiki