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
91e9bc2d
Commit
91e9bc2d
authored
Feb 27, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ChatViewerFragment: send button color is set according to text input readiness.
parent
89532e64
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
3 deletions
+28
-3
ChatViewerFragment.java
...c/main/java/com/xabber/android/ui/ChatViewerFragment.java
+28
-3
No files found.
app/src/main/java/com/xabber/android/ui/ChatViewerFragment.java
View file @
91e9bc2d
...
@@ -45,6 +45,9 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl
...
@@ -45,6 +45,9 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl
private
String
account
;
private
String
account
;
private
String
user
;
private
String
user
;
boolean
isInputEmpty
=
true
;
private
ImageButton
sendButton
;
public
static
ChatViewerFragment
newInstance
(
String
account
,
String
user
)
{
public
static
ChatViewerFragment
newInstance
(
String
account
,
String
user
)
{
ChatViewerFragment
fragment
=
new
ChatViewerFragment
();
ChatViewerFragment
fragment
=
new
ChatViewerFragment
();
...
@@ -70,8 +73,8 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl
...
@@ -70,8 +73,8 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl
View
view
=
inflater
.
inflate
(
R
.
layout
.
chat_viewer_item
,
container
,
false
);
View
view
=
inflater
.
inflate
(
R
.
layout
.
chat_viewer_item
,
container
,
false
);
((
ImageButton
)
view
.
findViewById
(
R
.
id
.
button_send_message
))
sendButton
=
(
ImageButton
)
view
.
findViewById
(
R
.
id
.
button_send_message
);
.
setImageLevel
(
AccountManager
.
getInstance
().
getColorLevel
(
account
)
);
sendButton
.
setImageResource
(
R
.
drawable
.
ic_button_send_inactive_24dp
);
chatMessageAdapter
=
new
ChatMessageAdapter
(
getActivity
(),
account
,
user
);
chatMessageAdapter
=
new
ChatMessageAdapter
(
getActivity
(),
account
,
user
);
...
@@ -135,7 +138,9 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl
...
@@ -135,7 +138,9 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl
return
;
return
;
}
}
ChatStateManager
.
getInstance
().
onComposing
(
account
,
user
,
text
);
ChatStateManager
.
getInstance
().
onComposing
(
account
,
user
,
text
);
}
setSendButtonColor
();
}
});
});
...
@@ -144,6 +149,22 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl
...
@@ -144,6 +149,22 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl
}
}
private
void
setSendButtonColor
()
{
boolean
empty
=
inputView
.
getText
().
toString
().
isEmpty
();
if
(
empty
!=
isInputEmpty
)
{
isInputEmpty
=
empty
;
if
(
isInputEmpty
)
{
sendButton
.
setImageResource
(
R
.
drawable
.
ic_button_send_inactive_24dp
);
}
else
{
sendButton
.
setImageResource
(
R
.
drawable
.
ic_button_send
);
sendButton
.
setImageLevel
(
AccountManager
.
getInstance
().
getColorLevel
(
account
));
}
}
}
@Override
@Override
public
void
onResume
()
{
public
void
onResume
()
{
super
.
onResume
();
super
.
onResume
();
...
@@ -157,6 +178,7 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl
...
@@ -157,6 +178,7 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl
inputView
.
setText
(
ChatManager
.
getInstance
().
getTypedMessage
(
account
,
user
));
inputView
.
setText
(
ChatManager
.
getInstance
().
getTypedMessage
(
account
,
user
));
inputView
.
setSelection
(
ChatManager
.
getInstance
().
getSelectionStart
(
account
,
user
),
inputView
.
setSelection
(
ChatManager
.
getInstance
().
getSelectionStart
(
account
,
user
),
ChatManager
.
getInstance
().
getSelectionEnd
(
account
,
user
));
ChatManager
.
getInstance
().
getSelectionEnd
(
account
,
user
));
setSendButtonColor
();
skipOnTextChanges
=
false
;
skipOnTextChanges
=
false
;
...
@@ -198,6 +220,7 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl
...
@@ -198,6 +220,7 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl
skipOnTextChanges
=
true
;
skipOnTextChanges
=
true
;
inputView
.
getText
().
clear
();
inputView
.
getText
().
clear
();
setSendButtonColor
();
skipOnTextChanges
=
false
;
skipOnTextChanges
=
false
;
sendMessage
(
text
);
sendMessage
(
text
);
...
@@ -291,6 +314,8 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl
...
@@ -291,6 +314,8 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl
}
}
inputView
.
setText
(
before
+
additional
+
after
);
inputView
.
setText
(
before
+
additional
+
after
);
inputView
.
setSelection
(
selection
+
additional
.
length
());
inputView
.
setSelection
(
selection
+
additional
.
length
());
setSendButtonColor
();
}
}
public
String
getAccount
()
{
public
String
getAccount
()
{
...
...
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