Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit be6ca15a authored by Amit Kohli's avatar Amit Kohli Committed by Josh Guilfoyle
Browse files

added list item widget

parent 7f4a5822
Loading
Loading
Loading
Loading
+108 −0
Original line number Diff line number Diff line
package com.tmobile.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.android.internal.R;

public class ListItemHeaderTwinLabelSecondaryText extends LinearLayout {

	private TextView mItemHeaderLabel;
	private TextView mItemLabel;
	private TextView mItemLabel2Text;
	private TextView mItemText;
	private TextView mItem2Text;
	
	
	public ListItemHeaderTwinLabelSecondaryText(Context context) {
		this(context, null);
	}

	public ListItemHeaderTwinLabelSecondaryText(Context context, AttributeSet attrs) {
		this(context, attrs, R.attr.listItemHeaderTwinLabelSecondaryText);
	}
	
	public ListItemHeaderTwinLabelSecondaryText(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		
		LayoutInflater.from(context).inflate(R.layout.tmobile_list_item_header_twin_label_secondary_text, this, true);

		TypedArray a = 
            context.obtainStyledAttributes(attrs, R.styleable.ListItemLayout, defStyle, 0);

		mItemHeaderLabel = (TextView)findViewById(R.id.itemHeaderLabelText);
		String text = a.getString(R.styleable.ListItemLayout_itemHeaderLabelText);
        if (text != null) {
        	mItemHeaderLabel.setText(text);
        }
        
		mItemLabel = (TextView)findViewById(R.id.itemLabelText);
		text = a.getString(R.styleable.ListItemLayout_itemLabelText);
        if (text != null) {
        	mItemLabel.setText(text);
        }
        
        mItemText = (TextView)findViewById(R.id.itemText);
        text = a.getString(R.styleable.ListItemLayout_itemText);
        if (text != null) {
        	mItemText.setText(text);
        }
        
        mItemLabel2Text = (TextView)findViewById(R.id.itemLabel2Text);
		text = a.getString(R.styleable.ListItemLayout_itemLabel2Text);
        if (text != null) {
        	mItemLabel2Text.setText(text);
        }
        
        mItem2Text = (TextView)findViewById(R.id.item2Text);
        text = a.getString(R.styleable.ListItemLayout_item2Text);
        if (text != null) {
        	mItem2Text.setText(text);
        }
        a.recycle();
	}

	public CharSequence getItemHeaderLabelText() {
		return mItemHeaderLabel.getText();
	}
	
	public void setItemHeaderLabelText(CharSequence text) {
		mItemHeaderLabel.setText(text);
	}
	
	public CharSequence getItemLabelText() {
		return mItemLabel.getText();
	}
	
	public void setItemLabelText(CharSequence text) {
		mItemLabel.setText(text);
	}
	
	public CharSequence getItemText() {
		return mItemText.getText();
	}
	
	public void setItemText(CharSequence text) {
		mItemText.setText(text);
	}
	
	public CharSequence getItemLabel2Text() {
		return mItemLabel2Text.getText();
	}
	
	public void setItemLabel2Text(CharSequence text) {
		mItemLabel2Text.setText(text);
	}
	
	public CharSequence getItem2Text() {
		return mItem2Text.getText();
	}
	
	public void setItem2Text(CharSequence text) {
		mItem2Text.setText(text);
	}
}
+61 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<merge
	xmlns:android="http://schemas.android.com/apk/res/android">

	<LinearLayout
		android:layout_width="fill_parent"
		android:layout_height="wrap_content"
		android:orientation="horizontal">
		<TextView
			android:layout_width="fill_parent"
			android:layout_height="wrap_content"
			android:textAppearance="?android:attr/textAppearanceLabelListItem"
			android:singleLine="true"
			android:gravity="center|left"
			android:paddingRight="10dp"
			android:id="@+id/itemHeaderLabelText" />
	</LinearLayout>
	<LinearLayout
		android:layout_width="fill_parent"
		android:layout_height="wrap_content"
		android:orientation="horizontal">
		<TextView
			android:layout_width="0dp"
			android:layout_height="wrap_content"
			android:textAppearance="?android:attr/textAppearanceLabelListItem"
			android:singleLine="true"
			android:gravity="center|left"
			android:layout_weight="1.0"
			android:paddingRight="10dp"
			android:id="@+id/itemLabelText" />
		<TextView
			android:layout_width="85dp"
			android:layout_height="wrap_content"
			android:gravity="center|right"
			android:textAppearance="?android:attr/textAppearanceLabelListItemText"
			android:singleLine="true"
			android:id="@+id/itemText" />

	</LinearLayout>
	<LinearLayout
		android:layout_width="fill_parent"
		android:layout_height="wrap_content"
		android:orientation="horizontal">
		<TextView
			android:layout_width="0dp"
			android:layout_height="wrap_content"
			android:textAppearance="?android:attr/textAppearanceLabelListItem"
			android:singleLine="true"
			android:gravity="center|left"
			android:layout_weight="1.0"
			android:paddingRight="10dp"
			android:id="@+id/itemLabel2Text" />
		<TextView
			android:layout_width="85dp"
			android:layout_height="wrap_content"
			android:gravity="center|right"
			android:textAppearance="?android:attr/textAppearanceLabelListItemText"
			android:singleLine="true"
			android:id="@+id/item2Text" />
	</LinearLayout>
</merge>