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

Commit 784b193f authored by gaurav sharma's avatar gaurav sharma Committed by Josh Guilfoyle
Browse files

Added a new list widget for contact list. Changed the filmstrip layout for...

Added a new list widget for contact list. Changed the filmstrip layout for carousel according to red line document.
parent db91007f
Loading
Loading
Loading
Loading
+33 −11
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ import java.util.ArrayList;

import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.Typeface;
@@ -29,7 +30,10 @@ public class Filmstrip extends RelativeLayout {

	// The max label length is defined in the style guide
	private static final int MAX_LABEL_LENGTH = 16;
	private static final int TITLE_TEXT_FIELD_WIDTH = 110;
	private static final int SELECTED_TITLE_TEXT_FIELD_WIDTH = 110;
	//Made the variable non final as the value need to be changed for Landscape mode, for landscape it is 75
	private static int UNSELECTED_TITLE_TEXT_FIELD_WIDTH_PORTRAIT = 78;
	private static int UNSELECTED_TITLE_TEXT_FIELD_WIDTH_LANDSCAPE = 75;

	private static final int TITLE_TEXT_SIZE_SELECTED = 14;
	private static final int TITLE_TEXT_SIZE_UNSELECTED = 13;
@@ -103,8 +107,12 @@ public class Filmstrip extends RelativeLayout {
					mTitleView.setId(position);
					mTitleView.setTextColor(Color.WHITE);
					mTitleView.setGravity(Gravity.CENTER);
					mTitleView.setWidth(TITLE_TEXT_FIELD_WIDTH);
					mTitleView.setPadding(10, 5, 10, 5);
					if(isPortrait) {
						mTitleView.setWidth(UNSELECTED_TITLE_TEXT_FIELD_WIDTH_PORTRAIT);
					} else {
						mTitleView.setWidth(UNSELECTED_TITLE_TEXT_FIELD_WIDTH_LANDSCAPE);	
					}
//					mTitleView.setPadding(10, 5, 10, 5);
					mTitleView.setSingleLine(true);
					mTitleView.setEllipsize(TextUtils.TruncateAt.END);
				}
@@ -179,7 +187,11 @@ public class Filmstrip extends RelativeLayout {
					if (null != oldTextView) {
						// make the unselected button look unselected
						// oldText.setBackgroundDrawable(null);
						oldTextView.setWidth(TITLE_TEXT_FIELD_WIDTH);
						if(isPortrait) {
							oldTextView.setWidth(UNSELECTED_TITLE_TEXT_FIELD_WIDTH_PORTRAIT);
						} else {
							oldTextView.setWidth(UNSELECTED_TITLE_TEXT_FIELD_WIDTH_LANDSCAPE);	
						}
						oldTextView.setTextSize(TITLE_TEXT_SIZE_UNSELECTED);
						oldTextView.setTypeface(TITLE_TYPEFACE, Typeface.NORMAL);
						oldTextView.setGravity(Gravity.CENTER);
@@ -203,9 +215,10 @@ public class Filmstrip extends RelativeLayout {
				// make the selected button look selected
				// newText.setBackgroundDrawable(mCarouselSelectionTitleBackground);
				// newText.setBackgroundResource(R.drawable.element_carousel_highlight_dark);
				newTextView.setWidth(TITLE_TEXT_FIELD_WIDTH);
				newTextView.setWidth(SELECTED_TITLE_TEXT_FIELD_WIDTH);
				newTextView.setTextSize(TITLE_TEXT_SIZE_SELECTED);
				newTextView.setTypeface(TITLE_TYPEFACE, Typeface.BOLD);
				newTextView.setPadding(10, 5, 10, 5);
				newTextView.setGravity(Gravity.CENTER);
				setBackgroundResource(position, newTextView);
			} else if (view instanceof ImageView) {
@@ -236,7 +249,7 @@ public class Filmstrip extends RelativeLayout {
	private Gallery mFilmstripSelector;
	private ImageView mLeftArrow;
	private ImageView mRightArrow;
	
	private boolean isPortrait;
	public Filmstrip(Context context) {
		this(context, null);
	}
@@ -249,7 +262,11 @@ public class Filmstrip extends RelativeLayout {
		super(context, attrs, defStyle);
		setFocusable(true);
		setFocusableInTouchMode(true);
		
		//Fix: To change the unselected textview width to 75 in the Landscape mode
		Configuration config = getResources().getConfiguration();
		int mOrientation = config.orientation;
		isPortrait = mOrientation == Configuration.ORIENTATION_PORTRAIT? true : false;
		//Fix End
		TypedArray a = 
            context.obtainStyledAttributes(attrs, R.styleable.Filmstrip, defStyle, 0);
				
@@ -325,9 +342,14 @@ public class Filmstrip extends RelativeLayout {
				
			}
		});

		mFilmstripSelector.setPadding(13, 0, 13, 0);
		mFilmstripSelector.setSpacing(4);
		//According to Red Line document there should be margin of 21px from the edge 
		mFilmstripSelector.setPadding(21, 0, 21, 0);
		//Space between the two filmstrip elements should be 6px
		if (isPortrait) {
			mFilmstripSelector.setSpacing(6);
		} else {
			mFilmstripSelector.setSpacing(8);
		}
				
		mFilmstripSelector.setAnimationDuration(500);
		
+127 −0
Original line number Diff line number Diff line
package com.tmobile.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.android.internal.R;

public class ListItemIconTwinLabelSecondaryText extends LinearLayout {

	private TextView mItemLabel;
	private TextView mItemLabel2;
	private ImageView mImage1;
	private ImageView mImage2;
	private ImageView mImage3;
	private ImageView mImage4;
	
	public ListItemIconTwinLabelSecondaryText(Context context) {
		this(context, null);
	}

	public ListItemIconTwinLabelSecondaryText(Context context, AttributeSet attrs) {
		this(context, attrs, R.attr.listItemIconTwinLabelSecondryText);
	}
	
	public ListItemIconTwinLabelSecondaryText(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		
		LayoutInflater.from(context).inflate(R.layout.tmobile_list_item_icon_twin_label_secondary_text, this, true);

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

		mItemLabel = (TextView)findViewById(R.id.itemLabelText);
		String labelText = a.getString(R.styleable.ListItemLayout_itemLabelText);
        if (labelText != null) {
        	mItemLabel.setText(labelText);
        }
        
        mItemLabel2 = (TextView)findViewById(R.id.itemLabel2Text);
		String item1Text = a.getString(R.styleable.ListItemLayout_itemLabel2Text);
        if (item1Text != null) {
        	mItemLabel2.setText(labelText);
        }
        
        mImage1 = (ImageView)findViewById(R.id.icon1);
        Drawable imageSrc = a.getDrawable(R.styleable.ListItemLayout_itemIconSrc);
        if (imageSrc != null) {
        	mImage1.setImageDrawable(imageSrc);
        }
        
        mImage2 = (ImageView)findViewById(R.id.icon2);
        imageSrc = a.getDrawable(R.styleable.ListItemLayout_itemIcon2Src);
        if (imageSrc != null) {
        	mImage2.setImageDrawable(imageSrc);
        }
        
        mImage3 = (ImageView)findViewById(R.id.icon3);
        imageSrc = a.getDrawable(R.styleable.ListItemLayout_itemIcon3Src);
        if (imageSrc != null) {
        	mImage3.setImageDrawable(imageSrc);
        }
        
        mImage4 = (ImageView)findViewById(R.id.icon4);
        imageSrc = a.getDrawable(R.styleable.ListItemLayout_itemIcon4Src);
        if (imageSrc != null) {
        	mImage4.setImageDrawable(imageSrc);
        }
        
        a.recycle();
	}

	public CharSequence getItemLabelText() {
		return mItemLabel.getText();
	}
	
	public void setItemLabelText(CharSequence text) {
		mItemLabel.setText(text);
	}
	
	public CharSequence getItemLabel2Text() {
		return mItemLabel2.getText();
	}

	public void setItemLabel2Text(CharSequence text2) {
		mItemLabel2.setText(text2);
	}
	
	public Drawable getIcon1() {
		return mImage1.getDrawable();
	}

	public void setIcon1(Drawable image1) {
		mImage1.setImageDrawable(image1);
	}

	public Drawable getIcon2() {
		return mImage2.getDrawable();
	}

	public void setIcon2(Drawable image2) {
		mImage2.setImageDrawable(image2);
	}
	
	
	public Drawable getIcon3() {
		return mImage3.getDrawable();
	}

	public void setIcon3(Drawable image3) {
		mImage3.setImageDrawable(image3);
	}

	public Drawable getIcon4() {
		return mImage4.getDrawable();
	}

	public void setIcon4(Drawable image4) {
		mImage4.setImageDrawable(image4);
	}
	
}
+72 −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">
	<!-- Column 1 -->
    <RelativeLayout
        android:id="@+id/row_column_1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        >
        <ImageView
            android:id="@+id/icon1"
            android:layout_width="48sp"
            android:layout_height="48sp" />
        <ImageView
            android:id="@+id/icon2"
            android:layout_height="16sp"
            android:layout_width="16sp"
            android:layout_marginBottom="9sp"
            android:layout_marginRight="9sp"
            android:layout_alignBottom="@id/icon1"
            android:layout_alignRight="@id/icon1">
        </ImageView>
    </RelativeLayout>
	<!-- Column 2 (RelativeLayout) -->
    <RelativeLayout
        android:id="@+id/row_column_2"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginLeft="10sp"
        android:layout_toRightOf="@id/row_column_1"
        android:layout_marginRight="10sp">
        <TextView
            android:id="@+id/itemLabelText"
            android:layout_height="wrap_content"
            android:layout_width="fill_parent"
            android:textAppearance="?android:attr/textAppearanceLabelListItemTextSmall"
            android:layout_marginBottom="0sp"
            android:gravity="left"
            android:lines="1"
            android:scrollHorizontally="false"
            android:ellipsize="end" />
        <ImageView
            android:id="@+id/icon4"
            android:layout_alignParentRight="true"
            android:layout_alignTop="@id/itemLabelText"
            android:layout_height="16sp"
            android:layout_width="16sp" />
        <ImageView
            android:id="@+id/icon3"
            android:layout_alignLeft="@id/itemLabelText"
            android:layout_below="@id/itemLabelText"
            android:layout_height="16sp"
            android:layout_width="16sp"
            android:layout_marginTop="3sp"
            android:layout_marginRight="3sp" 
            />
        <TextView
            android:id="@+id/itemLabel2Text"
            android:layout_height="wrap_content"
            android:layout_width="fill_parent"
            android:textAppearance="?android:attr/textAppearanceLabelListItemSecondaryText"
            android:layout_below="@id/itemLabelText"
            android:layout_toRightOf="@id/icon3"
            android:layout_marginTop="1sp"
            android:gravity="left"
            android:scrollHorizontally="true"
            android:ellipsize="end"
            android:lines="1" />
    </RelativeLayout>
</merge>
 No newline at end of file
+5 −1
Original line number Diff line number Diff line
@@ -417,6 +417,7 @@
        <attr name="listItemLabelSecondaryText" format="reference" />
        <attr name="listItemTwinLabelSecondaryText" format="reference" />
        <attr name="listItemHeaderTwinLabelSecondaryText" format="reference" />
        <attr name="listItemIconTwinLabelSecondryText" format="reference" />
        <attr name="listItemTwinIconLayout" format="reference" />
        
        <!-- =================== -->
@@ -1530,6 +1531,7 @@
        <attr name="iconSrc" format="reference|integer" />
        <attr name="icon2Src" format="reference|integer" />
        <attr name="icon3Src" format="reference|integer" />
        <attr name="icon4Src" format="reference|integer" />
    </declare-styleable>
    <declare-styleable name="ProgressOverlayLayout">
        <attr name="progressType">
@@ -1546,6 +1548,8 @@
        <attr name="item2Text" format="string" />
        <attr name="itemIconSrc" format="reference|integer" />
        <attr name="itemIcon2Src" format="reference|integer" />
        <attr name="itemIcon3Src" format="reference|integer" />
        <attr name="itemIcon4Src" format="reference|integer" />
    </declare-styleable>
    <declare-styleable name="GridView">
        <attr name="horizontalSpacing" format="dimension" />
+19 −20
Original line number Diff line number Diff line
@@ -1089,26 +1089,25 @@
<!-- ===============================================================
     Resources added in tmobile version of the platform.
     =============================================================== -->
  <public type="attr" name="headerText" id="0x01010258" />
  <public type="attr" name="subHeaderText" id="0x01010259" />
  <public type="attr" name="subHeader2Text" id="0x0101025a" />
  <public type="attr" name="subLabelText" id="0x0101025b" />
  <public type="attr" name="buttonText" id="0x0101025c" />
  <public type="attr" name="button2Text" id="0x0101025d" />
  <public type="attr" name="iconSrc" id="0x0101025e" />
  <public type="attr" name="icon2Src" id="0x0101025f" />
  <public type="attr" name="icon3Src" id="0x01010260" />
  <public type="attr" name="itemLabelText" id="0x01010261" />
  <public type="attr" name="itemLabel2Text" id="0x01010262" />
  <public type="attr" name="itemText" id="0x01010263" />
  <public type="attr" name="item2Text" id="0x01010264" />

  <public type="attr" name="buttonStyleSplitLeft" id="0x01010265" />
  <public type="attr" name="buttonStyleSplitRight" id="0x01010266" />
  
  <public type="attr" name="labelText" id="0x01010267" />
  <public type="attr" name="labelPosition" id="0x01010268" />
  <public type="attr" name="progressType" id="0x01010269" />
  <public type="attr" name="headerText" id="0x0101026b" />
  <public type="attr" name="subHeaderText" id="0x0101026c" />
  <public type="attr" name="subHeader2Text" id="0x0101026d" />
  <public type="attr" name="subLabelText" id="0x0101026e" />
  <public type="attr" name="buttonText" id="0x0101026f" />
  <public type="attr" name="button2Text" id="0x01010270" />
  <public type="attr" name="iconSrc" id="0x01010271" />
  <public type="attr" name="icon2Src" id="0x01010272" />
  <public type="attr" name="icon3Src" id="0x01010273" />
  <public type="attr" name="icon4Src" id="0x0101028a" />
  <public type="attr" name="itemLabelText" id="0x01010274" />
  <public type="attr" name="itemLabel2Text" id="0x01010275" />
  <public type="attr" name="itemText" id="0x01010276" />
  <public type="attr" name="item2Text" id="0x01010277" />
  <public type="attr" name="buttonStyleSplitLeft" id="0x01010278" />
  <public type="attr" name="buttonStyleSplitRight" id="0x01010279" />
  <public type="attr" name="labelText" id="0x0101027a" />
  <public type="attr" name="labelPosition" id="0x0101027b" />
  <public type="attr" name="progressType" id="0x0101027c" />

  <public type="attr" name="textFieldStyle" id="0x0101026a" />

Loading