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
cb77bd4e
Commit
cb77bd4e
authored
Mar 20, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ContactViewerFragment: data field made selectable and clickable (links, phones, emails etc)
parent
bd1a56be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
15 deletions
+17
-15
ContactViewerFragment.java
...ain/java/com/xabber/android/ui/ContactViewerFragment.java
+16
-15
contact_info_item.xml
app/src/main/res/layout/contact_info_item.xml
+1
-0
No files found.
app/src/main/java/com/xabber/android/ui/ContactViewerFragment.java
View file @
cb77bd4e
...
...
@@ -4,6 +4,7 @@ import android.app.Activity;
import
android.app.Fragment
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.text.util.Linkify
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
...
...
@@ -102,7 +103,13 @@ public class ContactViewerFragment extends Fragment {
xmppItems
.
removeAllViews
();
addXmppItem
(
getString
(
R
.
string
.
contact_viewer_jid
),
bareAddress
,
R
.
drawable
.
ic_xmpp_24dp
);
View
jabberIdView
=
createItemView
(
xmppItems
,
getString
(
R
.
string
.
contact_viewer_jid
),
bareAddress
,
R
.
drawable
.
ic_xmpp_24dp
);
if
(
jabberIdView
!=
null
)
{
xmppItems
.
addView
(
jabberIdView
);
}
RosterContact
rosterContact
=
RosterManager
.
getInstance
().
getRosterContact
(
account
,
bareAddress
);
if
(
rosterContact
==
null
||
!
rosterContact
.
isConnected
())
{
...
...
@@ -164,21 +171,21 @@ public class ContactViewerFragment extends Fragment {
LayoutInflater
inflater
=
(
LayoutInflater
)
getActivity
().
getSystemService
(
Activity
.
LAYOUT_INFLATER_SERVICE
);
View
contactInfoItem
=
inflater
.
inflate
(
R
.
layout
.
contact_info_item
,
xmppItems
,
false
);
View
resourceView
=
inflater
.
inflate
(
R
.
layout
.
contact_info_item
,
xmppItems
,
false
);
((
TextView
)
contactInfoItem
.
findViewById
(
R
.
id
.
contact_info_item_secondary
)).
setText
(
label
);
((
TextView
)
contactInfoItem
.
findViewById
(
R
.
id
.
contact_info_item_main
)).
setText
(
status
);
((
TextView
)
resourceView
.
findViewById
(
R
.
id
.
contact_info_item_secondary
)).
setText
(
label
);
((
TextView
)
resourceView
.
findViewById
(
R
.
id
.
contact_info_item_main
)).
setText
(
status
);
((
TextView
)
contactInfoItem
.
findViewById
(
R
.
id
.
contact_info_item_secondary_second_line
)).
setText
(
resource
);
contactInfoItem
.
findViewById
(
R
.
id
.
contact_info_item_secondary_second_line
).
setVisibility
(
View
.
VISIBLE
);
((
TextView
)
resourceView
.
findViewById
(
R
.
id
.
contact_info_item_secondary_second_line
)).
setText
(
resource
);
resourceView
.
findViewById
(
R
.
id
.
contact_info_item_secondary_second_line
).
setVisibility
(
View
.
VISIBLE
);
ImageView
statusIcon
=
(
ImageView
)
contactInfoItem
.
findViewById
(
R
.
id
.
contact_info_right_icon
);
ImageView
statusIcon
=
(
ImageView
)
resourceView
.
findViewById
(
R
.
id
.
contact_info_right_icon
);
statusIcon
.
setVisibility
(
View
.
VISIBLE
);
statusIcon
.
setImageDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
ic_status
));
statusIcon
.
setImageLevel
(
resourceItem
.
getStatusMode
().
getStatusLevel
());
resourcesList
.
add
(
contactInfoItem
);
resourcesList
.
add
(
resourceView
);
}
addItemGroup
(
resourcesList
,
xmppItems
,
R
.
drawable
.
ic_jabber_24dp
);
...
...
@@ -323,6 +330,7 @@ public class ContactViewerFragment extends Fragment {
private
void
addItem
(
List
<
View
>
nameList
,
ViewGroup
rootView
,
String
label
,
String
value
)
{
View
itemView
=
createItemView
(
rootView
,
label
,
value
,
null
);
if
(
itemView
!=
null
)
{
Linkify
.
addLinks
((
TextView
)
itemView
.
findViewById
(
R
.
id
.
contact_info_item_main
),
Linkify
.
ALL
);
nameList
.
add
(
itemView
);
}
}
...
...
@@ -332,13 +340,6 @@ public class ContactViewerFragment extends Fragment {
rootView
.
addView
(
inflater
.
inflate
(
R
.
layout
.
contact_info_separator
,
rootView
,
false
));
}
private
void
addXmppItem
(
String
label
,
String
value
,
Integer
iconResource
)
{
View
contactInfoItem
=
createItemView
(
xmppItems
,
label
,
value
,
iconResource
);
if
(
contactInfoItem
!=
null
)
{
xmppItems
.
addView
(
contactInfoItem
);
}
}
private
View
createItemView
(
ViewGroup
rootView
,
String
label
,
String
value
,
Integer
iconResource
)
{
if
(
value
==
null
||
value
.
isEmpty
()
)
{
return
null
;
...
...
app/src/main/res/layout/contact_info_item.xml
View file @
cb77bd4e
...
...
@@ -35,6 +35,7 @@
android:text=
"(650) 555-1234"
android:id=
"@+id/contact_info_item_main"
android:textIsSelectable=
"true"
android:textSize=
"@dimen/abc_text_size_medium_material"
/>
<TextView
...
...
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