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
e1903067
Commit
e1903067
authored
Aug 10, 2018
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using with to avoid repeating menu lots of time.
parent
728f4011
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
40 deletions
+42
-40
Menu.kt
app/src/main/java/chat/rocket/android/main/ui/Menu.kt
+42
-40
No files found.
app/src/main/java/chat/rocket/android/main/ui/Menu.kt
View file @
e1903067
...
...
@@ -5,7 +5,8 @@ import android.view.MenuItem
import
chat.rocket.android.R
internal
fun
MainActivity
.
setupMenu
(
menu
:
Menu
)
{
menu
.
add
(
with
(
menu
)
{
add
(
R
.
id
.
menu_section_one
,
R
.
id
.
menu_action_chats
,
Menu
.
NONE
,
...
...
@@ -13,21 +14,21 @@ internal fun MainActivity.setupMenu(menu: Menu) {
).
setIcon
(
R
.
drawable
.
ic_chat_bubble_black_24dp
)
.
isChecked
=
true
menu
.
add
(
add
(
R
.
id
.
menu_section_one
,
R
.
id
.
menu_action_create_channel
,
Menu
.
NONE
,
R
.
string
.
action_create_channel
).
setIcon
(
R
.
drawable
.
ic_create_black_24dp
)
menu
.
add
(
add
(
R
.
id
.
menu_section_two
,
R
.
id
.
menu_action_profile
,
Menu
.
NONE
,
R
.
string
.
title_profile
).
setIcon
(
R
.
drawable
.
ic_person_black_24dp
)
menu
.
add
(
add
(
R
.
id
.
menu_section_two
,
R
.
id
.
menu_action_settings
,
Menu
.
NONE
,
...
...
@@ -35,7 +36,7 @@ internal fun MainActivity.setupMenu(menu: Menu) {
).
setIcon
(
R
.
drawable
.
ic_settings_black_24dp
)
if
(
permissions
.
canSeeTheAdminPanel
())
{
menu
.
add
(
add
(
R
.
id
.
menu_section_two
,
R
.
id
.
menu_action_admin_panel
,
Menu
.
NONE
,
...
...
@@ -43,16 +44,17 @@ internal fun MainActivity.setupMenu(menu: Menu) {
).
setIcon
(
R
.
drawable
.
ic_settings_black_24dp
)
}
menu
.
add
(
add
(
R
.
id
.
menu_section_three
,
R
.
id
.
menu_action_logout
,
Menu
.
NONE
,
R
.
string
.
action_logout
).
setIcon
(
R
.
drawable
.
ic_logout_black_24dp
)
menu
.
setGroupCheckable
(
R
.
id
.
menu_section_one
,
true
,
true
)
menu
.
setGroupCheckable
(
R
.
id
.
menu_section_two
,
true
,
true
)
menu
.
setGroupCheckable
(
R
.
id
.
menu_section_three
,
true
,
true
)
setGroupCheckable
(
R
.
id
.
menu_section_one
,
true
,
true
)
setGroupCheckable
(
R
.
id
.
menu_section_two
,
true
,
true
)
setGroupCheckable
(
R
.
id
.
menu_section_three
,
true
,
true
)
}
}
internal
fun
MainActivity
.
onNavDrawerItemSelected
(
menuItem
:
MenuItem
)
{
...
...
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