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