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
9d903829
Commit
9d903829
authored
Apr 16, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Chat incoming animation returned. Some small simplifications.
parent
70556309
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
70 deletions
+20
-70
ChatViewer.java
app/src/main/java/com/xabber/android/ui/ChatViewer.java
+9
-32
ChatViewerFragment.java
...c/main/java/com/xabber/android/ui/ChatViewerFragment.java
+10
-7
ContactTitleActionBarInflater.java
...bber/android/ui/helper/ContactTitleActionBarInflater.java
+1
-31
No files found.
app/src/main/java/com/xabber/android/ui/ChatViewer.java
View file @
9d903829
...
...
@@ -32,7 +32,6 @@ import com.xabber.android.data.account.OnAccountChangedListener;
import
com.xabber.android.data.entity.BaseEntity
;
import
com.xabber.android.data.extension.archive.MessageArchiveManager
;
import
com.xabber.android.data.extension.attention.AttentionManager
;
import
com.xabber.android.data.extension.muc.MUCManager
;
import
com.xabber.android.data.intent.EntityIntentBuilder
;
import
com.xabber.android.data.message.AbstractChat
;
import
com.xabber.android.data.message.MessageManager
;
...
...
@@ -56,10 +55,8 @@ import java.util.HashSet;
*/
public
class
ChatViewer
extends
ManagedActivity
implements
OnChatChangedListener
,
OnContactChangedListener
,
OnAccountChangedListener
,
ViewPager
.
OnPageChangeListener
,
ChatViewerAdapter
.
FinishUpdateListener
,
RecentChatFragment
.
RecentChatFragmentInteractionListener
,
View
.
OnClickListener
,
ChatViewerFragment
.
ChatViewerFragmentListener
{
ChatViewerAdapter
.
FinishUpdateListener
,
RecentChatFragment
.
RecentChatFragmentInteractionListener
,
ChatViewerFragment
.
ChatViewerFragmentListener
{
/**
* Attention request.
...
...
@@ -154,7 +151,7 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
}
if
(
actionWithAccount
!=
null
&&
actionWithUser
!=
null
)
{
updateActionBar
(
actionWithAccount
,
actionWithUser
);
updateActionBar
(
actionWithAccount
);
}
}
...
...
@@ -191,7 +188,6 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
}
selectPage
(
account
,
user
,
false
);
}
private
void
selectPage
(
String
account
,
String
user
,
boolean
smoothScroll
)
{
...
...
@@ -265,7 +261,6 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
@Override
public
void
onChatChanged
(
final
String
account
,
final
String
user
,
final
boolean
incoming
)
{
String
currentAccount
=
null
;
String
currentUser
=
null
;
AbstractChat
chatByPageNumber
=
chatViewerAdapter
.
getChatByPageNumber
(
viewPager
.
getCurrentItem
());
...
...
@@ -285,17 +280,14 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
for
(
ChatViewerFragment
chat
:
registeredChats
)
{
if
(
chat
.
isEqual
(
account
,
user
))
{
chat
.
updateChat
();
chat
.
playIncomingAnimation
();
}
}
}
if
(
actionWithAccount
!=
null
&&
actionWithAccount
.
equals
(
account
)
&&
actionWithUser
!=
null
&&
actionWithUser
.
equals
(
user
))
{
updateActionBar
(
account
,
user
);
if
(
incoming
)
{
// contactTitleActionBarInflater.playIncomingAnimation();
}
updateActionBar
(
account
);
}
}
...
...
@@ -305,7 +297,7 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
updateRegisteredRecentChatsFragments
();
if
(
actionWithAccount
!=
null
&&
actionWithUser
!=
null
)
{
updateActionBar
(
actionWithAccount
,
actionWithUser
);
updateActionBar
(
actionWithAccount
);
}
}
...
...
@@ -315,7 +307,7 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
updateRegisteredRecentChatsFragments
();
if
(
actionWithAccount
!=
null
&&
actionWithUser
!=
null
)
{
updateActionBar
(
actionWithAccount
,
actionWithUser
);
updateActionBar
(
actionWithAccount
);
}
}
...
...
@@ -363,7 +355,7 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
return
;
}
updateActionBar
(
actionWithAccount
,
actionWithUser
);
updateActionBar
(
actionWithAccount
);
MessageManager
.
getInstance
().
setVisibleChat
(
actionWithAccount
,
actionWithUser
);
...
...
@@ -374,7 +366,7 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
NotificationManager
.
getInstance
().
removeMessageNotification
(
actionWithAccount
,
actionWithUser
);
}
private
void
updateActionBar
(
String
account
,
String
user
)
{
private
void
updateActionBar
(
String
account
)
{
statusBarPainter
.
updateWithAccountName
(
account
);
}
...
...
@@ -499,21 +491,6 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
}
}
@Override
public
void
onClick
(
View
v
)
{
if
(
v
.
getId
()
==
R
.
id
.
avatar
)
{
showContactInfo
();
}
}
private
void
showContactInfo
()
{
if
(
MUCManager
.
getInstance
().
hasRoom
(
actionWithAccount
,
actionWithUser
))
{
startActivity
(
ContactViewer
.
createIntent
(
this
,
actionWithAccount
,
actionWithUser
));
}
else
{
startActivity
(
ContactEditor
.
createIntent
(
this
,
actionWithAccount
,
actionWithUser
));
}
}
@Override
public
void
onCloseChat
()
{
close
();
...
...
app/src/main/java/com/xabber/android/ui/ChatViewerFragment.java
View file @
9d903829
...
...
@@ -19,6 +19,8 @@ import android.view.MenuInflater;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.animation.Animation
;
import
android.view.animation.AnimationUtils
;
import
android.widget.AdapterView
;
import
android.widget.EditText
;
import
android.widget.ImageButton
;
...
...
@@ -75,6 +77,7 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl
private
Toolbar
toolbar
;
private
ChatViewerFragmentListener
listener
;
private
Animation
shakeAnimation
=
null
;
public
static
ChatViewerFragment
newInstance
(
String
account
,
String
user
)
{
ChatViewerFragment
fragment
=
new
ChatViewerFragment
();
...
...
@@ -449,13 +452,6 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl
skipOnTextChanges
=
false
;
}
public
void
scrollChat
()
{
int
size
=
listView
.
getCount
();
if
(
size
>
0
)
{
listView
.
setSelection
(
size
-
1
);
}
}
@Override
public
void
onItemClick
(
AdapterView
<?>
parent
,
View
view
,
int
position
,
long
id
)
{
registerForContextMenu
(
listView
);
...
...
@@ -620,4 +616,11 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl
public
interface
ChatViewerFragmentListener
{
void
onCloseChat
();
}
public
void
playIncomingAnimation
()
{
if
(
shakeAnimation
==
null
)
{
shakeAnimation
=
AnimationUtils
.
loadAnimation
(
getActivity
(),
R
.
anim
.
shake
);
}
toolbar
.
findViewById
(
R
.
id
.
name_holder
).
startAnimation
(
shakeAnimation
);
}
}
app/src/main/java/com/xabber/android/ui/helper/ContactTitleActionBarInflater.java
View file @
9d903829
...
...
@@ -4,8 +4,6 @@ import android.support.v7.app.ActionBar;
import
android.support.v7.app.ActionBarActivity
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.animation.Animation
;
import
android.view.animation.AnimationUtils
;
import
android.widget.TextView
;
import
com.xabber.android.data.roster.AbstractContact
;
...
...
@@ -16,7 +14,7 @@ public class ContactTitleActionBarInflater {
private
final
ActionBarActivity
activity
;
private
View
actionBarView
;
private
Animation
shakeAnimation
=
null
;
private
ActionBarPainter
actionBarPainter
;
...
...
@@ -48,34 +46,6 @@ public class ContactTitleActionBarInflater {
ContactTitleInflater
.
updateTitle
(
actionBarView
,
activity
,
abstractContact
);
}
public
void
restoreDefaultTitleView
(
String
title
)
{
actionBarPainter
.
restore
();
activity
.
getSupportActionBar
().
setDisplayShowCustomEnabled
(
false
);
activity
.
getSupportActionBar
().
setDisplayShowTitleEnabled
(
true
);
actionBarView
.
setVisibility
(
View
.
GONE
);
activity
.
setTitle
(
title
);
}
public
void
playIncomingAnimation
()
{
if
(
shakeAnimation
==
null
)
{
shakeAnimation
=
AnimationUtils
.
loadAnimation
(
activity
,
R
.
anim
.
shake
);
}
actionBarView
.
findViewById
(
R
.
id
.
name_holder
).
startAnimation
(
shakeAnimation
);
}
public
void
setOnClickListener
(
View
.
OnClickListener
onClickListener
)
{
actionBarView
.
setOnClickListener
(
onClickListener
);
}
public
void
setOnAvatarClickListener
(
View
.
OnClickListener
onClickListener
)
{
actionBarView
.
findViewById
(
R
.
id
.
avatar
).
setOnClickListener
(
onClickListener
);
}
public
void
setName
(
String
name
)
{
((
TextView
)
actionBarView
.
findViewById
(
R
.
id
.
name
)).
setText
(
name
);
}
public
void
setStatusText
(
String
user
)
{
((
TextView
)
actionBarView
.
findViewById
(
R
.
id
.
status_text
)).
setText
(
user
);
}
...
...
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