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
Hide 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,54 +5,56 @@ import android.view.MenuItem
...
@@ -5,54 +5,56 @@ import android.view.MenuItem
import
chat.rocket.android.R
import
chat.rocket.android.R
internal
fun
MainActivity
.
setupMenu
(
menu
:
Menu
)
{
internal
fun
MainActivity
.
setupMenu
(
menu
:
Menu
)
{
menu
.
add
(
with
(
menu
)
{
R
.
id
.
menu_section_one
,
add
(
R
.
id
.
menu_action_chats
,
R
.
id
.
menu_section_one
,
Menu
.
NONE
,
R
.
id
.
menu_action_chats
,
R
.
string
.
title_chats
Menu
.
NONE
,
).
setIcon
(
R
.
drawable
.
ic_chat_bubble_black_24dp
)
R
.
string
.
title_chats
.
isChecked
=
true
).
setIcon
(
R
.
drawable
.
ic_chat_bubble_black_24dp
)
.
isChecked
=
true
menu
.
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_section_one
,
R
.
id
.
menu_action_profile
,
R
.
id
.
menu_action_create_channel
,
Menu
.
NONE
,
Menu
.
NONE
,
R
.
string
.
title_profile
R
.
string
.
action_create_channel
).
setIcon
(
R
.
drawable
.
ic_person
_black_24dp
)
).
setIcon
(
R
.
drawable
.
ic_create
_black_24dp
)
menu
.
add
(
add
(
R
.
id
.
menu_section_two
,
R
.
id
.
menu_section_two
,
R
.
id
.
menu_action_settings
,
R
.
id
.
menu_action_profile
,
Menu
.
NONE
,
Menu
.
NONE
,
R
.
string
.
title_settings
R
.
string
.
title_profile
).
setIcon
(
R
.
drawable
.
ic_settings
_black_24dp
)
).
setIcon
(
R
.
drawable
.
ic_person
_black_24dp
)
if
(
permissions
.
canSeeTheAdminPanel
())
{
add
(
menu
.
add
(
R
.
id
.
menu_section_two
,
R
.
id
.
menu_section_two
,
R
.
id
.
menu_action_
admin_panel
,
R
.
id
.
menu_action_
settings
,
Menu
.
NONE
,
Menu
.
NONE
,
R
.
string
.
title_
admin_panel
R
.
string
.
title_
settings
).
setIcon
(
R
.
drawable
.
ic_settings_black_24dp
)
).
setIcon
(
R
.
drawable
.
ic_settings_black_24dp
)
}
menu
.
add
(
if
(
permissions
.
canSeeTheAdminPanel
())
{
R
.
id
.
menu_section_three
,
add
(
R
.
id
.
menu_action_logout
,
R
.
id
.
menu_section_two
,
Menu
.
NONE
,
R
.
id
.
menu_action_admin_panel
,
R
.
string
.
action_logout
Menu
.
NONE
,
).
setIcon
(
R
.
drawable
.
ic_logout_black_24dp
)
R
.
string
.
title_admin_panel
).
setIcon
(
R
.
drawable
.
ic_settings_black_24dp
)
}
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
)
setGroupCheckable
(
R
.
id
.
menu_section_one
,
true
,
true
)
menu
.
setGroupCheckable
(
R
.
id
.
menu_section_two
,
true
,
true
)
setGroupCheckable
(
R
.
id
.
menu_section_two
,
true
,
true
)
menu
.
setGroupCheckable
(
R
.
id
.
menu_section_three
,
true
,
true
)
setGroupCheckable
(
R
.
id
.
menu_section_three
,
true
,
true
)
}
}
}
internal
fun
MainActivity
.
onNavDrawerItemSelected
(
menuItem
:
MenuItem
)
{
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