/*
 * Copyright (c) 2012, Apptentive, Inc. All Rights Reserved.
 * Please refer to the LICENSE file for the terms and conditions
 * under which redistribution and use of this file is permitted.
 */

package com.apptentive.android.sdk.module.survey;

import android.content.Context;
import android.graphics.Color;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.apptentive.android.sdk.util.Constants;
import com.apptentive.android.sdk.util.Util;

/**
 * @author Sky Kelsey.
 */
public class BaseChoice extends FrameLayout {

	protected Context appContext;
	protected LinearLayout container;
	protected TextView textView;

	public BaseChoice(Context context) {
		super(context);
		appContext = context.getApplicationContext();
		initView();
	}

	protected void initView() {
		setLayoutParams(Constants.ROW_LAYOUT);
		int pad5  = Util.dipsToPixels(appContext, 5);
		int pad10 = Util.dipsToPixels(appContext, 10);
		setPadding(pad10, 0, pad5, 0);
		setClickable(true);

		container = new LinearLayout(appContext);
		container.setLayoutParams(Constants.ROW_LAYOUT);
		addView(container);

		textView = new TextView(appContext);
		textView.setTextColor(Color.BLACK);
		textView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 1f));
		container.addView(textView);
	}

	public void setText(String text) {
		textView.setText(text);
	}
}

@@ -306,16 +306,45 @@
 .Color;%0A
+import android.view.Gravity;%0A
 import a
@@ -362,32 +362,32 @@
 et.FrameLayout;%0A
-
 import android.w
@@ -572,16 +572,25 @@
 %0Apublic 
+abstract 
 class Ba
@@ -910,16 +910,39 @@
 AYOUT);%0A
+%09%09setClickable(true);%0A%0A
 %09%09int pa
@@ -1033,63 +1033,8 @@
 10);
-%0A%09%09setPadding(pad10, 0, pad5, 0);%0A%09%09setClickable(true);
 %0A%0A%09%09
@@ -1126,16 +1126,108 @@
 AYOUT);%0A
+%09%09container.setPadding(pad10, 0, pad5, 0);%0A%09%09container.setGravity(Gravity.CENTER_VERTICAL);%0A
 %09%09addVie
@@ -1318,16 +1318,16 @@
 BLACK);%0A
-
 %09%09textVi
@@ -1434,16 +1434,57 @@
 , 1f));%0A
+%09%09textView.setPadding(0, pad5, 0, pad5);%0A
 %09%09contai

Fix survey choice text so multi-line survey text looks good. [#ANDROID-60]