Make title changeable. Have email adress and foldername in there.

This commit is contained in:
Sander Bogaert 2012-07-16 14:52:44 -04:00 committed by Andrew Chen
parent 61d93d011f
commit 4de06915ea
3 changed files with 24 additions and 17 deletions

View file

@ -1,28 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- android:gravity="fill_horizontal" -->
<TextView
android:id="@android:id/text1"
android:id="@+id/actionbar_title_first"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="-4dip"
android:text="Inbox"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/actionbar_title_sub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@android:id/text1"
android:text="Refreshing"
android:textAppearance="?android:attr/textAppearanceSmall" />
</RelativeLayout>
</LinearLayout>

View file

@ -539,7 +539,7 @@ public class MessageList
String dispString = mAdapter.mListener.formatHeader(MessageList.this, getString(R.string.message_list_title, mAccount.getDescription(), displayName), mUnreadMessageCount, getTimeFormat());
//setTitle(dispString);
mNavigationSpinner.setTitle(mFolderName);
mNavigationSpinner.setSubTitle(mAccount.getName());
mNavigationSpinner.setSubTitle(mAccount.getEmail());
} else if (mQueryString != null) {
if (mTitle != null) {
String dispString = mAdapter.mListener.formatHeader(MessageList.this, mTitle, mUnreadMessageCount, getTimeFormat());

View file

@ -1,10 +1,13 @@
package com.fsck.k9.helper;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import com.fsck.k9.R;
@ -22,8 +25,7 @@ public class ActionBarNavigationSpinner extends ArrayAdapter<String> implements
private Context mContext;
public ActionBarNavigationSpinner(Context context, String[] objects, Long[] ids) {
super(context, R.layout.actionbar_spinner,
android.R.id.text1, objects);
super(context, R.layout.actionbar_spinner, objects);
setDropDownViewResource(android.R.layout.simple_list_item_1);
mIds = new Long[ids.length];
mIds = ids;
@ -59,8 +61,21 @@ public class ActionBarNavigationSpinner extends ArrayAdapter<String> implements
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
return super.getView(position, convertView, parent);
View row = convertView;
if(row==null){
LayoutInflater inflater = LayoutInflater.from(mContext);
row=inflater.inflate(R.layout.actionbar_spinner, parent, false);
}
TextView title = (TextView) row.findViewById(R.id.actionbar_title_first);
TextView subtitle = (TextView) row.findViewById(R.id.actionbar_title_sub);
title.setText(mTitle);
subtitle.setText(mSubTitle);
return row;
}
@Override