summaryrefslogtreecommitdiff
path: root/SDL_Android/LivioSdlUtilities/src/com/livio/sdl/dialogs/TextViewOkCancelDialog.java
blob: 8d4fadc1553050a6895568e381a24308b46e96a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.livio.sdl.dialogs;

import android.content.Context;
import android.content.DialogInterface;
import android.view.View;
import android.widget.TextView;

import com.livio.sdl.R;

/**
 * A simple dialog that contains a single, scrollable TextView.  The textview
 * is initialized with a the title and message in the constructor.
 *
 * @author Mike Burke
 *
 */
public class TextViewOkCancelDialog extends BaseOkCancelDialog {

	protected TextView tv;
	
	public TextViewOkCancelDialog(Context context, String dialogTitle, String message){
		super(context, dialogTitle, R.layout.textview);
		tv.setText(message);
		setPositiveButton(okListener);
		setNegativeButton(cancelListener);
		createDialog();
	}

	@Override
	protected void findViews(View parent) {
		tv = (TextView) parent.findViewById(R.id.textview);
	}
	
	private DialogInterface.OnClickListener okListener = new DialogInterface.OnClickListener() {
		@Override
		public void onClick(DialogInterface dialog, int which) {
			notifyListener(true);
		}
	};
	
	private DialogInterface.OnClickListener cancelListener = new DialogInterface.OnClickListener() {
		@Override
		public void onClick(DialogInterface dialog, int which) {
			notifyListener(false);
		}
	};

}