Commit 79fd3de0 authored by Grigory Fedorov's avatar Grigory Fedorov

Account choose spinner layout corrected.

parent 2694c9a6
...@@ -77,7 +77,6 @@ public class AccountChooseAdapter extends BaseAdapter { ...@@ -77,7 +77,6 @@ public class AccountChooseAdapter extends BaseAdapter {
final String account = (String) getItem(position); final String account = (String) getItem(position);
int accountColor = accountColors[accountManager.getColorLevel(account)]; int accountColor = accountColors[accountManager.getColorLevel(account)];
((ImageView) view.findViewById(R.id.avatar_background)).setImageDrawable(new ColorDrawable(accountColor));
((ImageView) view.findViewById(R.id.avatar)) ((ImageView) view.findViewById(R.id.avatar))
.setImageDrawable(AvatarManager.getInstance().getAccountAvatar(account)); .setImageDrawable(AvatarManager.getInstance().getAccountAvatar(account));
...@@ -88,21 +87,7 @@ public class AccountChooseAdapter extends BaseAdapter { ...@@ -88,21 +87,7 @@ public class AccountChooseAdapter extends BaseAdapter {
@Override @Override
public View getDropDownView(int position, View convertView, ViewGroup parent) { public View getDropDownView(int position, View convertView, ViewGroup parent) {
final View view; return getView(position, convertView, parent);
final AccountManager accountManager = AccountManager.getInstance();
if (convertView == null) {
view = activity.getLayoutInflater().inflate(
R.layout.account_choose_dropdown, parent, false);
} else {
view = convertView;
}
final String account = (String) getItem(position);
((ImageView) view.findViewById(R.id.avatar))
.setImageDrawable(AvatarManager.getInstance().getAccountAvatar(account));
((TextView) view.findViewById(R.id.name)).setText(accountManager.getVerboseName(account));
return view;
} }
} }
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013, Redsolution LTD. All rights reserved.
This file is part of Xabber project; you can redistribute it and/or
modify it under the terms of the GNU General Public License, Version 3.
Xabber is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License,
along with this program. If not, see http://www.gnu.org/licenses/.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="4dip">
<include layout="@layout/avatar_account" />
<TextView
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="6dip"
android:singleLine="true"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:text="account"
/>
</LinearLayout>
\ No newline at end of file
...@@ -18,25 +18,8 @@ ...@@ -18,25 +18,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="4dip"> android:padding="4dip">
<include layout="@layout/avatar_account" />
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="24dp"
android:layout_height="24dp"
android:id="@+id/avatar_account"
>
<ImageView
android:id="@+id/avatar_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@color/material_deep_teal_500" />
<ImageView
android:id="@+id/avatar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ic_avatar_1" />
</RelativeLayout>
<TextView <TextView
android:id="@+id/name" android:id="@+id/name"
android:layout_width="match_parent" android:layout_width="match_parent"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment