Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-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
AloqaIM-Android
Commits
4a7aaf7d
Commit
4a7aaf7d
authored
Jan 15, 2019
by
dev-ritik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix app close on back button press
parent
9ecc0442
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
MainActivity.kt
...src/main/java/chat/rocket/android/main/ui/MainActivity.kt
+16
-0
No files found.
app/src/main/java/chat/rocket/android/main/ui/MainActivity.kt
View file @
4a7aaf7d
...
...
@@ -13,6 +13,7 @@ import androidx.fragment.app.Fragment
import
androidx.recyclerview.widget.LinearLayoutManager
import
chat.rocket.android.BuildConfig
import
chat.rocket.android.R
import
chat.rocket.android.chatrooms.ui.ChatRoomsFragment
import
chat.rocket.android.main.adapter.AccountsAdapter
import
chat.rocket.android.main.adapter.Selector
import
chat.rocket.android.main.presentation.MainPresenter
...
...
@@ -98,6 +99,21 @@ class MainActivity : AppCompatActivity(), MainView, HasActivityInjector,
}
}
override
fun
onBackPressed
()
{
if
(
drawer_layout
.
isDrawerOpen
(
GravityCompat
.
START
))
closeDrawer
()
else
supportFragmentManager
.
findFragmentById
(
R
.
id
.
fragment_container
)
?.
let
{
if
(
it
!
is
ChatRoomsFragment
&&
supportFragmentManager
.
backStackEntryCount
==
0
)
{
presenter
.
toChatList
(
chatRoomId
)
setCheckedNavDrawerItem
(
R
.
id
.
menu_action_chats
)
}
else
{
super
.
onBackPressed
()
}
}
}
override
fun
activityInjector
():
AndroidInjector
<
Activity
>
=
activityDispatchingAndroidInjector
override
fun
supportFragmentInjector
():
AndroidInjector
<
Fragment
>
=
...
...
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