Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xabber-android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
xabber-android
Commits
c1b15137
Commit
c1b15137
authored
Apr 07, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Contact item layout changed, png offline shadow removed (transparent view used).
parent
2f5fb2d2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
104 deletions
+96
-104
BaseContactInflater.java
...va/com/xabber/android/ui/adapter/BaseContactInflater.java
+4
-28
contact_shadow.png
app/src/main/res/drawable/contact_shadow.png
+0
-0
base_contact_item.xml
app/src/main/res/layout/base_contact_item.xml
+91
-75
styles.xml
app/src/main/res/values/styles.xml
+1
-1
No files found.
app/src/main/java/com/xabber/android/ui/adapter/BaseContactInflater.java
View file @
c1b15137
...
...
@@ -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
.
s
hadow
.
setVisibility
(
View
.
GONE
);
viewHolder
.
offlineS
hadow
.
setVisibility
(
View
.
GONE
);
}
else
{
viewHolder
.
s
hadow
.
setVisibility
(
View
.
VISIBLE
);
viewHolder
.
offlineS
hadow
.
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
s
hadow
;
final
ImageView
offlineS
hadow
;
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
);
}
}
}
app/src/main/res/drawable/contact_shadow.png
deleted
100644 → 0
View file @
2f5fb2d2
175 Bytes
app/src/main/res/layout/base_contact_item.xml
View file @
c1b15137
...
...
@@ -12,97 +12,113 @@
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"
>
<ImageView
android:id=
"@+id/color"
android:layout_width=
"4dp"
android:layout_height=
"@dimen/avatar_size_toolbar"
android:layout_marginLeft=
"2dp"
android:layout_marginStart=
"2dp"
android:layout_marginRight=
"2dp"
android:layout_marginEnd=
"2dp"
android:src=
"@color/green_500"
/>
>
<ImageView
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/avatar"
android:layout_width=
"@dimen/avatar_size_toolbar"
android:layout_height=
"@dimen/avatar_size_toolbar"
android:layout_toRightOf=
"@id/color"
android:src=
"@drawable/ic_avatar_1"
/>
<RelativeLayout
android:id=
"@+id/panel"
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:
paddingLeft=
"@dimen/active_chat_padding_left
"
android:
paddingTop=
"@dimen/active_chat_padding_top
"
android:
orientation=
"horizontal
"
android:
gravity=
"center_vertical
"
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"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentBottom=
"true"
android:layout_alignParentRight=
"true"
android:paddingRight=
"@dimen/client_software_margin_left"
android:src=
"@drawable/ic_client"
android:alpha=
"0.05"
/>
<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:gravity=
"bottom"
android:singleLine=
"true"
android:ellipsize=
"marquee"
android:text=
"name"
android:textColor=
"?android:attr/textColorPrimary"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textStyle=
"bold"
android:id=
"@+id/color"
android:layout_width=
"4dp"
android:layout_height=
"@dimen/avatar_size_toolbar"
android:layout_marginLeft=
"2dp"
android:layout_marginStart=
"2dp"
android:layout_marginRight=
"2dp"
android:layout_marginEnd=
"2dp"
android:src=
"@color/green_500"
/>
<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:gravity=
"top"
android:singleLine=
"true"
android:ellipsize=
"marquee"
android:text=
"status"
android:visibility=
"visible"
android:layout_below=
"@id/name"
android:textColor=
"?android:attr/textColorSecondary"
<ImageView
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/avatar"
android:layout_width=
"@dimen/avatar_size_toolbar"
android:layout_height=
"@dimen/avatar_size_toolbar"
android:layout_toRightOf=
"@id/color"
android:src=
"@drawable/ic_avatar_1"
/>
<RelativeLayout
android:id=
"@+id/panel"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:paddingLeft=
"@dimen/active_chat_padding_left"
>
<ImageView
android:id=
"@+id/client_software"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentBottom=
"true"
android:layout_alignParentRight=
"true"
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=
"wrap_content"
android:gravity=
"bottom"
android:singleLine=
"true"
android:ellipsize=
"marquee"
android:text=
"name"
android:textColor=
"?android:attr/textColorPrimary"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textStyle=
"bold"
/>
<TextView
android:id=
"@+id/status"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"top"
android:singleLine=
"true"
android:ellipsize=
"marquee"
android:text=
"status"
android:visibility=
"visible"
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"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/contact_list_item_height"
android:background=
"@drawable/contact_shadow"
android:visibility=
"gone"
/>
</RelativeLayout>
</LinearLayout>
<ImageView
android:id=
"@+id/offline_shadow"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:src=
"@color/black"
android:alpha=
"0.7"
android:visibility=
"gone"
/>
</FrameLayout>
\ No newline at end of file
app/src/main/res/values/styles.xml
View file @
c1b15137
...
...
@@ -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"
>
5
2
dip
</dimen>
<dimen
name=
"contact_list_item_height"
>
5
6
dip
</dimen>
<!-- = avatar_size + contact_list_item_padding_top + contact_list_item_padding_bottom -->
<dimen
name=
"contact_list_status_mode_width"
>
44dip
</dimen>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment