PageRenderTime 28ms CodeModel.GetById 15ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/Code/src/com/game/ViewData/HowViewData.java

https://bitbucket.org/DeveloperUX/behaviortree
Java | 55 lines | 35 code | 9 blank | 11 comment | 0 complexity | 6e79491c7102cbdf2f0f9f8d5470898e MD5 | raw file
 1package com.game.ViewData;
 2
 3import com.game.MessageHandler;
 4import com.game.MsgType;
 5import com.game.R;
 6import com.game.MessageHandler.MsgReceiver;
 7
 8import android.app.Activity;
 9import android.content.Context;
10import android.util.Log;
11import android.view.LayoutInflater;
12import android.view.View;
13import android.view.View.OnClickListener;
14import android.widget.Button;
15import android.widget.LinearLayout;
16
17/**
18 * Specific view data class for the "How to play" screen.
19 * @author Ying
20 *
21 */
22public class HowViewData extends ViewData 
23{
24
25	/**
26	 * @see ViewData createXMLView(Activity activity) 
27	 */
28	@Override
29	public View createXMLView(Activity activity) 
30	{
31		Log.i("HowViewData", "createXMLView");
32		
33		// Access xml layout
34		LayoutInflater li = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
35        View xmlLayout = (View) li.inflate(R.layout.how, null);        
36        
37        // Centers the text and makes it fit inside the column width        
38        LinearLayout centerLinerarLayout = (LinearLayout)xmlLayout.findViewById(R.id.how_layout_inner_scroll);
39        this.Set80PercentWidth(activity, centerLinerarLayout);        
40        
41        // Callback for the buttons
42        Button okButton = (Button) xmlLayout.findViewById(R.id.ok_how_but);
43        okButton.setOnClickListener(new OnClickListener() 
44        {
45          @Override
46          public void onClick(View v) {
47            Log.i("ViewData", " Clicked OK button");
48            MessageHandler.Get().Send(MsgReceiver.LOGIC,MsgType.BUTTON_CLICK, R.id.ok_how_but);
49          }
50        });
51        
52		return xmlLayout;
53	}
54
55}