aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/miz_hi/smileessence/dialog/ContentDialog.java
blob: 0428129f591c7c699479ef1ae802234bd2537b1c (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
49
50
51
52
53
54
55
56
57
58
package net.miz_hi.smileessence.dialog;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface.OnClickListener;
import android.view.View;

public class ContentDialog
{

	private Activity activity;
	private String title;
	private View content;
	private String positive = "決定";
	private String negative = "キャンセル";
	private OnClickListener listener;

	public ContentDialog(Activity activity, String title)
	{
		this.activity = activity;
		this.title = title;
	}

	public void setTitle(String title)
	{
		this.title = title;
	}

	public void setTextPositive(String textPositive)
	{
		this.positive = textPositive;
	}

	public void setTextNegative(String textNegative)
	{
		this.negative = textNegative;
	}
	
	public void setContentView(View content)
	{
		this.content = content;
	}

	public void setOnClickListener(OnClickListener listener)
	{
		this.listener = listener;
	}
	
	public AlertDialog create()
	{
		AlertDialog.Builder ad = new AlertDialog.Builder(activity);
		ad.setTitle(title);	
		ad.setView(content);
		ad.setPositiveButton(positive, listener);
		ad.setNegativeButton(negative, listener);
		return ad.create();
	}
}