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
89532e64
Commit
89532e64
authored
Feb 27, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ChatViewer: debug dialog on wrong fragment selection added.
parent
8953703c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
4 deletions
+41
-4
ChatViewer.java
app/src/main/java/com/xabber/android/ui/ChatViewer.java
+41
-4
No files found.
app/src/main/java/com/xabber/android/ui/ChatViewer.java
View file @
89532e64
...
...
@@ -14,8 +14,10 @@
*/
package
com
.
xabber
.
android
.
ui
;
import
android.app.AlertDialog
;
import
android.app.Fragment
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.support.v4.view.ViewPager
;
...
...
@@ -692,14 +694,49 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
Fragment
currentFragment
=
chatViewerAdapter
.
getCurrentFragment
();
if
(
isChatSelected
)
{
if
(!(
currentFragment
instanceof
ChatViewerFragment
)
||
!((
ChatViewerFragment
)
currentFragment
).
isEqual
(
actionWithAccount
,
actionWithUser
))
{
throw
new
RuntimeException
(
"Wrong chat fragment selected!"
);
if
(!(
currentFragment
instanceof
ChatViewerFragment
))
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
this
);
builder
.
setTitle
(
"Debug message"
)
.
setMessage
(
"Recent chats selected, but contact chat expected. Reselecting..."
)
.
setPositiveButton
(
"ok"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
selectPage
(
actionWithAccount
,
actionWithUser
,
false
);
}
});
builder
.
create
().
show
();
}
else
if
(!((
ChatViewerFragment
)
currentFragment
).
isEqual
(
actionWithAccount
,
actionWithUser
))
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
this
);
builder
.
setTitle
(
"Debug message"
)
.
setMessage
(
"Wrong contact chat selected. Reselecting..."
)
.
setPositiveButton
(
"ok"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
selectPage
(
actionWithAccount
,
actionWithUser
,
false
);
}
});
builder
.
create
().
show
();
}
}
else
{
if
(!(
currentFragment
instanceof
RecentChatFragment
))
{
throw
new
RuntimeException
(
"RecentChatFragment selected by mistake!"
);
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
this
);
builder
.
setTitle
(
"Debug message"
)
.
setMessage
(
"Contact chat selected, but recent chats expected. Reselecting..."
)
.
setPositiveButton
(
"ok"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
selectPage
(
null
,
null
,
false
);
}
});
builder
.
create
().
show
();
}
}
}
...
...
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