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
1acecf64
Commit
1acecf64
authored
Apr 23, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ChatViewer: initial chat and selected chat stored separately - some chat selection bugs fixed.
parent
60fa6221
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
112 additions
and
83 deletions
+112
-83
AttentionManager.java
...er/android/data/extension/attention/AttentionManager.java
+3
-2
MessageManager.java
.../java/com/xabber/android/data/message/MessageManager.java
+4
-7
ChatViewer.java
app/src/main/java/com/xabber/android/ui/ChatViewer.java
+94
-59
ChatViewerFragment.java
...c/main/java/com/xabber/android/ui/ChatViewerFragment.java
+3
-5
ContactList.java
app/src/main/java/com/xabber/android/ui/ContactList.java
+2
-2
ChatViewerAdapter.java
...java/com/xabber/android/ui/adapter/ChatViewerAdapter.java
+5
-7
ContextMenuHelper.java
.../java/com/xabber/android/ui/helper/ContextMenuHelper.java
+1
-1
No files found.
app/src/main/java/com/xabber/android/data/extension/attention/AttentionManager.java
View file @
1acecf64
...
...
@@ -27,6 +27,7 @@ import com.xabber.android.data.connection.ConnectionItem;
import
com.xabber.android.data.connection.ConnectionManager
;
import
com.xabber.android.data.connection.ConnectionThread
;
import
com.xabber.android.data.connection.OnPacketListener
;
import
com.xabber.android.data.entity.BaseEntity
;
import
com.xabber.android.data.extension.capability.CapabilitiesManager
;
import
com.xabber.android.data.extension.capability.ClientInfo
;
import
com.xabber.android.data.message.AbstractChat
;
...
...
@@ -201,8 +202,8 @@ public class AttentionManager implements OnPacketListener, OnLoadListener {
chat
.
newAction
(
null
,
null
,
ChatAction
.
attention_called
);
}
public
void
removeAccountNotifications
(
String
account
,
String
user
)
{
attentionRequestProvider
.
remove
(
account
,
user
);
public
void
removeAccountNotifications
(
BaseEntity
chat
)
{
attentionRequestProvider
.
remove
(
chat
.
getAccount
(),
chat
.
getUser
()
);
}
}
app/src/main/java/com/xabber/android/data/message/MessageManager.java
View file @
1acecf64
...
...
@@ -289,15 +289,12 @@ public class MessageManager implements OnLoadListener, OnPacketListener, OnDisco
/**
* Sets currently visible chat.
*
* @param account
* @param user
*/
public
void
setVisibleChat
(
String
account
,
String
user
)
{
final
boolean
remove
=
!
AccountManager
.
getInstance
().
getArchiveMode
(
account
).
saveLocally
();
AbstractChat
chat
=
getChat
(
account
,
user
);
public
void
setVisibleChat
(
BaseEntity
visibleChat
)
{
final
boolean
remove
=
!
AccountManager
.
getInstance
().
getArchiveMode
(
visibleChat
.
getAccount
()
).
saveLocally
();
AbstractChat
chat
=
getChat
(
visibleChat
.
getAccount
(),
visibleChat
.
getUser
()
);
if
(
chat
==
null
)
{
chat
=
createChat
(
account
,
user
);
chat
=
createChat
(
visibleChat
.
getAccount
(),
visibleChat
.
getUser
()
);
}
else
{
// Mark messages as read and them delete from db if necessary.
final
ArrayList
<
MessageItem
>
messageItems
=
new
ArrayList
<
MessageItem
>();
...
...
app/src/main/java/com/xabber/android/ui/ChatViewer.java
View file @
1acecf64
This diff is collapsed.
Click to expand it.
app/src/main/java/com/xabber/android/ui/ChatViewerFragment.java
View file @
1acecf64
...
...
@@ -28,10 +28,10 @@ import android.widget.ImageButton;
import
android.widget.PopupMenu
;
import
com.xabber.android.data.Application
;
import
com.xabber.android.data.LogManager
;
import
com.xabber.android.data.NetworkException
;
import
com.xabber.android.data.SettingsManager
;
import
com.xabber.android.data.account.AccountManager
;
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.cs.ChatStateManager
;
...
...
@@ -212,8 +212,6 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
@Override
public
void
afterTextChanged
(
Editable
text
)
{
LogManager
.
i
(
this
,
"afterTextChanged"
);
setSendButtonColor
();
if
(!
skipOnTextChanges
)
{
...
...
@@ -426,8 +424,8 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
securityButton
.
setImageLevel
(
securityLevel
.
getImageLevel
());
}
public
boolean
isEqual
(
String
account
,
String
user
)
{
return
this
.
account
.
equals
(
account
)
&&
this
.
user
.
equals
(
user
);
public
boolean
isEqual
(
BaseEntity
chat
)
{
return
chat
!=
null
&&
this
.
account
.
equals
(
chat
.
getAccount
())
&&
this
.
user
.
equals
(
chat
.
getUser
()
);
}
public
void
setInputText
(
String
additional
)
{
...
...
app/src/main/java/com/xabber/android/ui/ContactList.java
View file @
1acecf64
...
...
@@ -442,7 +442,7 @@ public class ContactList extends ManagedActivity implements OnAccountChangedList
@Override
public
void
onContactClick
(
AbstractContact
abstractContact
)
{
if
(
action
==
null
)
{
startActivity
(
ChatViewer
.
createIntent
(
this
,
startActivity
(
ChatViewer
.
create
SpecificChat
Intent
(
this
,
abstractContact
.
getAccount
(),
abstractContact
.
getUser
()));
return
;
}
...
...
@@ -474,7 +474,7 @@ public class ContactList extends ManagedActivity implements OnAccountChangedList
break
;
}
default
:
startActivity
(
ChatViewer
.
createIntent
(
this
,
startActivity
(
ChatViewer
.
create
SpecificChat
Intent
(
this
,
abstractContact
.
getAccount
(),
abstractContact
.
getUser
()));
break
;
}
...
...
app/src/main/java/com/xabber/android/ui/adapter/ChatViewerAdapter.java
View file @
1acecf64
...
...
@@ -6,6 +6,7 @@ import android.app.FragmentManager;
import
android.support.v13.app.FragmentStatePagerAdapter
;
import
android.view.ViewGroup
;
import
com.xabber.android.data.entity.BaseEntity
;
import
com.xabber.android.data.message.AbstractChat
;
import
com.xabber.android.data.message.MessageManager
;
import
com.xabber.android.ui.ChatViewerFragment
;
...
...
@@ -34,16 +35,13 @@ public class ChatViewerAdapter extends FragmentStatePagerAdapter {
private
Fragment
currentFragment
;
public
ChatViewerAdapter
(
FragmentManager
fragmentManager
,
String
account
,
String
user
,
FinishUpdateListener
finishUpdateListener
)
{
public
ChatViewerAdapter
(
FragmentManager
fragmentManager
,
BaseEntity
chat
,
FinishUpdateListener
finishUpdateListener
)
{
super
(
fragmentManager
);
this
.
finishUpdateListener
=
finishUpdateListener
;
activeChats
=
new
ArrayList
<>(
MessageManager
.
getInstance
().
getActiveChats
());
intent
=
MessageManager
.
getInstance
().
getOrCreateChat
(
account
,
Jid
.
getBareAddress
(
user
));
intent
=
MessageManager
.
getInstance
().
getOrCreateChat
(
chat
.
getAccount
(),
Jid
.
getBareAddress
(
chat
.
getUser
()
));
if
(!
activeChats
.
contains
(
intent
))
{
intent
.
updateCreationTime
();
}
updateChats
();
}
...
...
@@ -121,11 +119,11 @@ public class ChatViewerAdapter extends FragmentStatePagerAdapter {
return
true
;
}
public
int
getPageNumber
(
String
account
,
String
user
)
{
public
int
getPageNumber
(
BaseEntity
chat
)
{
int
realPosition
=
0
;
for
(
int
chatIndex
=
0
;
chatIndex
<
activeChats
.
size
();
chatIndex
++)
{
if
(
activeChats
.
get
(
chatIndex
).
equals
(
account
,
user
))
{
if
(
activeChats
.
get
(
chatIndex
).
equals
(
chat
))
{
realPosition
=
chatIndex
+
1
;
break
;
}
...
...
app/src/main/java/com/xabber/android/ui/helper/ContextMenuHelper.java
View file @
1acecf64
...
...
@@ -72,7 +72,7 @@ public class ContextMenuHelper {
@Override
public
boolean
onMenuItemClick
(
MenuItem
item
)
{
MessageManager
.
getInstance
().
openChat
(
account
,
user
);
activity
.
startActivity
(
ChatViewer
.
createIntent
(
activity
.
startActivity
(
ChatViewer
.
create
SpecificChat
Intent
(
activity
,
account
,
user
));
return
true
;
}
...
...
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