Commit c1b15137 authored by Grigory Fedorov's avatar Grigory Fedorov

Contact item layout changed, png offline shadow removed (transparent view used).

parent 2f5fb2d2
...@@ -16,10 +16,6 @@ package com.xabber.android.ui.adapter; ...@@ -16,10 +16,6 @@ package com.xabber.android.ui.adapter;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Shader.TileMode;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
...@@ -27,7 +23,6 @@ import android.view.View; ...@@ -27,7 +23,6 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import com.xabber.android.data.SettingsManager; import com.xabber.android.data.SettingsManager;
...@@ -45,12 +40,6 @@ public abstract class BaseContactInflater { ...@@ -45,12 +40,6 @@ public abstract class BaseContactInflater {
final LayoutInflater layoutInflater; final LayoutInflater layoutInflater;
/**
* Repeated shadow for drawable.
*/
final BitmapDrawable shadowDrawable;
/** /**
* Managed adapter. * Managed adapter.
*/ */
...@@ -61,10 +50,6 @@ public abstract class BaseContactInflater { ...@@ -61,10 +50,6 @@ public abstract class BaseContactInflater {
this.activity = activity; this.activity = activity;
layoutInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); layoutInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
Bitmap bitmap = BitmapFactory.decodeResource(activity.getResources(), R.drawable.contact_shadow);
shadowDrawable = new BitmapDrawable(activity.getResources(), bitmap);
shadowDrawable.setTileModeXY(TileMode.REPEAT, TileMode.REPEAT);
accountColors = activity.getResources().getIntArray(R.array.account_action_bar); accountColors = activity.getResources().getIntArray(R.array.account_action_bar);
} }
...@@ -114,9 +99,9 @@ public abstract class BaseContactInflater { ...@@ -114,9 +99,9 @@ public abstract class BaseContactInflater {
public void getView(View view, AbstractContact abstractContact) { public void getView(View view, AbstractContact abstractContact) {
final ViewHolder viewHolder = (ViewHolder) view.getTag(); final ViewHolder viewHolder = (ViewHolder) view.getTag();
if (abstractContact.isConnected()) { if (abstractContact.isConnected()) {
viewHolder.shadow.setVisibility(View.GONE); viewHolder.offlineShadow.setVisibility(View.GONE);
} else { } else {
viewHolder.shadow.setVisibility(View.VISIBLE); viewHolder.offlineShadow.setVisibility(View.VISIBLE);
} }
int colorLevel = abstractContact.getColorLevel(); int colorLevel = abstractContact.getColorLevel();
...@@ -125,12 +110,8 @@ public abstract class BaseContactInflater { ...@@ -125,12 +110,8 @@ public abstract class BaseContactInflater {
if (SettingsManager.contactsShowAvatars()) { if (SettingsManager.contactsShowAvatars()) {
viewHolder.avatar.setVisibility(View.VISIBLE); viewHolder.avatar.setVisibility(View.VISIBLE);
viewHolder.avatar.setImageDrawable(abstractContact.getAvatarForContactList()); viewHolder.avatar.setImageDrawable(abstractContact.getAvatarForContactList());
((RelativeLayout.LayoutParams) viewHolder.panel.getLayoutParams())
.addRule(RelativeLayout.RIGHT_OF, R.id.avatar);
} else { } else {
viewHolder.avatar.setVisibility(View.GONE); viewHolder.avatar.setVisibility(View.GONE);
((RelativeLayout.LayoutParams) viewHolder.panel.getLayoutParams())
.addRule(RelativeLayout.RIGHT_OF, R.id.color);
} }
viewHolder.name.setText(abstractContact.getName()); viewHolder.name.setText(abstractContact.getName());
...@@ -147,8 +128,6 @@ public abstract class BaseContactInflater { ...@@ -147,8 +128,6 @@ public abstract class BaseContactInflater {
viewHolder.status.setText(statusText); viewHolder.status.setText(statusText);
viewHolder.status.setVisibility(View.VISIBLE); viewHolder.status.setVisibility(View.VISIBLE);
} }
viewHolder.shadow.setBackgroundDrawable(shadowDrawable);
} }
/** /**
...@@ -158,20 +137,17 @@ public abstract class BaseContactInflater { ...@@ -158,20 +137,17 @@ public abstract class BaseContactInflater {
final ImageView color; final ImageView color;
final ImageView avatar; final ImageView avatar;
final RelativeLayout panel;
final TextView name; final TextView name;
final TextView status; final TextView status;
final ImageView shadow; final ImageView offlineShadow;
public ViewHolder(View view) { public ViewHolder(View view) {
color = (ImageView) view.findViewById(R.id.color); color = (ImageView) view.findViewById(R.id.color);
avatar = (ImageView) view.findViewById(R.id.avatar); avatar = (ImageView) view.findViewById(R.id.avatar);
panel = (RelativeLayout) view.findViewById(R.id.panel);
name = (TextView) view.findViewById(R.id.name); name = (TextView) view.findViewById(R.id.name);
status = (TextView) view.findViewById(R.id.status); status = (TextView) view.findViewById(R.id.status);
shadow = (ImageView) view.findViewById(R.id.shadow); offlineShadow = (ImageView) view.findViewById(R.id.offline_shadow);
} }
} }
} }
...@@ -12,14 +12,21 @@ ...@@ -12,14 +12,21 @@
You should have received a copy of the GNU General Public License, You should have received a copy of the GNU General Public License,
along with this program. If not, see http://www.gnu.org/licenses/. along with this program. If not, see http://www.gnu.org/licenses/.
--> -->
<RelativeLayout
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/contact_list_item_height" android:layout_height="@dimen/contact_list_item_height"
android:paddingTop="@dimen/contact_list_item_padding_top"
android:paddingBottom="@dimen/contact_list_item_padding_bottom"
android:elevation="1dp" android:elevation="1dp"
android:background="@color/grey_300" android:background="@color/grey_300"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="center_vertical"
android:paddingRight="@dimen/active_chat_padding_right"
> >
<ImageView <ImageView
android:id="@+id/color" android:id="@+id/color"
...@@ -45,13 +52,10 @@ ...@@ -45,13 +52,10 @@
<RelativeLayout <RelativeLayout
android:id="@+id/panel" android:id="@+id/panel"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1"
android:paddingLeft="@dimen/active_chat_padding_left" android:paddingLeft="@dimen/active_chat_padding_left"
android:paddingTop="@dimen/active_chat_padding_top"
android:paddingRight="@dimen/active_chat_padding_right"
android:paddingBottom="@dimen/active_chat_padding_bottom"
android:layout_toRightOf="@id/avatar"
> >
<ImageView <ImageView
android:id="@+id/client_software" android:id="@+id/client_software"
...@@ -59,15 +63,24 @@ ...@@ -59,15 +63,24 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:paddingRight="@dimen/client_software_margin_left" android:layout_alignParentEnd="true"
android:paddingRight="16dp"
android:paddingEnd="16dp"
android:src="@drawable/ic_client" android:src="@drawable/ic_client"
android:alpha="0.05" android:alpha="0.05"
/> />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_vertical"
>
<TextView <TextView
android:id="@+id/name" android:id="@+id/name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/contact_name_height_show_status" android:layout_height="wrap_content"
android:layout_marginRight="@dimen/status_icon_width"
android:gravity="bottom" android:gravity="bottom"
android:singleLine="true" android:singleLine="true"
android:ellipsize="marquee" android:ellipsize="marquee"
...@@ -79,30 +92,33 @@ ...@@ -79,30 +92,33 @@
<TextView <TextView
android:id="@+id/status" android:id="@+id/status"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/contact_name_height_show_status" android:layout_height="wrap_content"
android:layout_marginRight="@dimen/status_icon_width"
android:gravity="top" android:gravity="top"
android:singleLine="true" android:singleLine="true"
android:ellipsize="marquee" android:ellipsize="marquee"
android:text="status" android:text="status"
android:visibility="visible" android:visibility="visible"
android:layout_below="@id/name"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
/> />
</LinearLayout>
</RelativeLayout>
<ImageView <ImageView
android:id="@+id/status_icon" android:id="@+id/status_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:src="@drawable/ic_status" android:src="@drawable/ic_status"
/> />
</RelativeLayout> </LinearLayout>
<ImageView
android:id="@+id/shadow" <ImageView
android:id="@+id/offline_shadow"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/contact_list_item_height" android:layout_height="match_parent"
android:background="@drawable/contact_shadow" android:src="@color/black"
android:alpha="0.7"
android:visibility="gone" android:visibility="gone"
/> />
</RelativeLayout>
</FrameLayout>
\ No newline at end of file
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
<dimen name="contact_list_item_padding_top">2dip</dimen> <dimen name="contact_list_item_padding_top">2dip</dimen>
<dimen name="contact_list_item_padding_bottom">2dip</dimen> <dimen name="contact_list_item_padding_bottom">2dip</dimen>
<dimen name="contact_list_item_height">52dip</dimen> <dimen name="contact_list_item_height">56dip</dimen>
<!-- = avatar_size + contact_list_item_padding_top + contact_list_item_padding_bottom --> <!-- = avatar_size + contact_list_item_padding_top + contact_list_item_padding_bottom -->
<dimen name="contact_list_status_mode_width">44dip</dimen> <dimen name="contact_list_status_mode_width">44dip</dimen>
......
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