OSDN Git Service

2f98f334e04519a865e496c9f672645a80269824
[gokigen/MeMoMa.git] / app / src / main / java / jp / sourceforge / gokigen / memoma / dialogs / CreditDialog.java
1 package jp.sourceforge.gokigen.memoma.dialogs;
2
3 import android.app.Activity;
4 import android.app.AlertDialog;
5 import android.app.Dialog;
6 import android.content.Context;
7 import android.view.LayoutInflater;
8 import android.view.View;
9 import android.widget.TextView;
10
11 import jp.sourceforge.gokigen.memoma.R;
12
13 /**
14  *  クレジットを表示する
15  * 
16  * @author MRSa
17  *
18  */
19 public class CreditDialog
20 {
21         private Activity context;
22
23         /**
24          *   コンストラクタ
25          *
26          */
27         public CreditDialog(Activity arg)
28         {
29                 context = arg;
30         }
31
32     /**
33      *   ダイアログを応答する
34      *
35      */
36     public Dialog getDialog()
37     {
38         LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
39         if (inflater == null)
40                 {
41                         return (null);
42                 }
43         View layout = inflater.inflate(R.layout.creditdialog, null);  //  ?? http://www.mail-archive.com/android-developers@googlegroups.com/msg162003.html より
44         //View layout = inflater.inflate(R.layout.creditdialog,  context.findViewById(R.id.layout_root));
45
46         TextView text = layout.findViewById(R.id.creditmessage);
47         text.setText(context.getString(R.string.app_credit));
48  //     ImageView image = (ImageView) layout.findViewById(R.id.crediticon);
49  //     image.setImageResource(R.drawable.icon);
50
51         AlertDialog.Builder builder = new AlertDialog.Builder(context);
52         builder.setTitle(context.getString(R.string.app_name));
53         builder.setIcon(R.drawable.icon);
54         builder.setView(layout);
55         builder.setCancelable(true);
56         return (builder.create());
57     }
58 }