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
008f9df4
Commit
008f9df4
authored
Aug 10, 2018
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moves menu actions and sections ids to ids.xml
parent
5b0a4075
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
39 deletions
+41
-39
CreateChannelFragment.kt
.../rocket/android/createchannel/ui/CreateChannelFragment.kt
+1
-2
MainActivity.kt
...src/main/java/chat/rocket/android/main/ui/MainActivity.kt
+5
-5
Menu.kt
app/src/main/java/chat/rocket/android/main/ui/Menu.kt
+21
-32
ids.xml
app/src/main/res/values/ids.xml
+14
-0
No files found.
app/src/main/java/chat/rocket/android/createchannel/ui/CreateChannelFragment.kt
View file @
008f9df4
...
...
@@ -17,7 +17,6 @@ import androidx.recyclerview.widget.RecyclerView
import
chat.rocket.android.R
import
chat.rocket.android.createchannel.presentation.CreateChannelPresenter
import
chat.rocket.android.createchannel.presentation.CreateChannelView
import
chat.rocket.android.main.ui.MENU_ACTION_CHATS
import
chat.rocket.android.main.ui.MainActivity
import
chat.rocket.android.members.adapter.MembersAdapter
import
chat.rocket.android.members.uimodel.MemberUiModel
...
...
@@ -162,7 +161,7 @@ class CreateChannelFragment : Fragment(), CreateChannelView, ActionMode.Callback
override
fun
prepareToShowChatList
()
{
with
(
activity
as
MainActivity
)
{
setCheckedNavDrawerItem
(
MENU_ACTION_CHATS
)
setCheckedNavDrawerItem
(
R
.
id
.
menu_action_chats
)
openDrawer
()
getDrawerLayout
().
postDelayed
(
1000
)
{
closeDrawer
()
...
...
app/src/main/java/chat/rocket/android/main/ui/MainActivity.kt
View file @
008f9df4
...
...
@@ -5,9 +5,9 @@ import android.app.Activity
import
android.app.AlertDialog
import
android.app.ProgressDialog
import
android.os.Bundle
import
android.view.Gravity
import
androidx.annotation.IdRes
import
androidx.appcompat.app.AppCompatActivity
import
androidx.core.view.GravityCompat
import
androidx.drawerlayout.widget.DrawerLayout
import
androidx.fragment.app.Fragment
import
androidx.recyclerview.widget.LinearLayoutManager
...
...
@@ -174,9 +174,9 @@ class MainActivity : AppCompatActivity(), MainView, HasActivityInjector,
}
headerLayout
.
image_avatar
.
setOnClickListener
{
view_navigation
.
menu
.
findItem
(
MENU_ACTION_PROFILE
).
isChecked
=
true
view_navigation
.
menu
.
findItem
(
R
.
id
.
menu_action_profile
).
isChecked
=
true
presenter
.
toUserProfile
()
drawer_layout
.
closeDrawer
(
Gravity
.
START
)
drawer_layout
.
closeDrawer
(
Gravity
Compat
.
START
)
}
}
...
...
@@ -248,9 +248,9 @@ class MainActivity : AppCompatActivity(), MainView, HasActivityInjector,
fun
getDrawerLayout
():
DrawerLayout
=
drawer_layout
fun
openDrawer
()
=
drawer_layout
.
openDrawer
(
Gravity
.
START
)
fun
openDrawer
()
=
drawer_layout
.
openDrawer
(
Gravity
Compat
.
START
)
fun
closeDrawer
()
=
drawer_layout
.
closeDrawer
(
Gravity
.
START
)
fun
closeDrawer
()
=
drawer_layout
.
closeDrawer
(
Gravity
Compat
.
START
)
fun
setCheckedNavDrawerItem
(
@IdRes
item
:
Int
)
=
view_navigation
.
setCheckedItem
(
item
)
...
...
app/src/main/java/chat/rocket/android/main/ui/Menu.kt
View file @
008f9df4
...
...
@@ -4,75 +4,64 @@ import android.view.Menu
import
android.view.MenuItem
import
chat.rocket.android.R
private
const
val
MENU_SECTION_ONE
=
1
private
const
val
MENU_SECTION_TWO
=
2
private
const
val
MENU_SECTION_THREE
=
3
const
val
MENU_ACTION_CHATS
=
1
private
const
val
MENU_ACTION_CREATE_CHANNEL
=
2
const
val
MENU_ACTION_PROFILE
=
3
private
const
val
MENU_ACTION_SETTINGS
=
4
private
const
val
MENU_ACTION_ADMIN_PANEL
=
5
private
const
val
MENU_ACTION_LOGOUT
=
6
internal
fun
MainActivity
.
setupMenu
(
menu
:
Menu
)
{
menu
.
add
(
MENU_SECTION_ONE
,
MENU_ACTION_CHATS
,
R
.
id
.
menu_section_one
,
R
.
id
.
menu_action_chats
,
Menu
.
NONE
,
R
.
string
.
title_chats
).
setIcon
(
R
.
drawable
.
ic_chat_bubble_black_24dp
)
.
isChecked
=
true
menu
.
add
(
MENU_SECTION_ONE
,
MENU_ACTION_CREATE_CHANNEL
,
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
(
MENU_SECTION_TWO
,
MENU_ACTION_PROFILE
,
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
(
MENU_SECTION_TWO
,
MENU_ACTION_SETTINGS
,
R
.
id
.
menu_section_two
,
R
.
id
.
menu_action_settings
,
Menu
.
NONE
,
R
.
string
.
title_settings
).
setIcon
(
R
.
drawable
.
ic_settings_black_24dp
)
if
(
permissions
.
canSeeTheAdminChannel
())
{
menu
.
add
(
MENU_SECTION_TWO
,
MENU_ACTION_ADMIN_PANEL
,
R
.
id
.
menu_section_two
,
R
.
id
.
menu_action_admin_panel
,
Menu
.
NONE
,
R
.
string
.
title_admin_panel
).
setIcon
(
R
.
drawable
.
ic_settings_black_24dp
)
}
menu
.
add
(
MENU_SECTION_THREE
,
MENU_ACTION_LOGOUT
,
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
(
MENU_SECTION_ONE
,
true
,
true
)
menu
.
setGroupCheckable
(
MENU_SECTION_TWO
,
true
,
true
)
menu
.
setGroupCheckable
(
MENU_SECTION_THREE
,
true
,
true
)
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
)
}
internal
fun
MainActivity
.
onNavDrawerItemSelected
(
menuItem
:
MenuItem
)
{
when
(
menuItem
.
itemId
)
{
MENU_ACTION_CHATS
->
presenter
.
toChatList
()
MENU_ACTION_CREATE_CHANNEL
->
presenter
.
toCreateChannel
()
MENU_ACTION_PROFILE
->
presenter
.
toUserProfile
()
MENU_ACTION_SETTINGS
->
presenter
.
toSettings
()
MENU_ACTION_ADMIN_PANEL
->
presenter
.
toAdminPanel
()
MENU_ACTION_LOGOUT
->
presenter
.
logout
()
R
.
id
.
menu_action_chats
->
presenter
.
toChatList
()
R
.
id
.
menu_action_create_channel
->
presenter
.
toCreateChannel
()
R
.
id
.
menu_action_profile
->
presenter
.
toUserProfile
()
R
.
id
.
menu_action_settings
->
presenter
.
toSettings
()
R
.
id
.
menu_action_admin_panel
->
presenter
.
toAdminPanel
()
R
.
id
.
menu_action_logout
->
presenter
.
logout
()
}
}
app/src/main/res/values/ids.xml
0 → 100644
View file @
008f9df4
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item
name=
"menu_section_one"
type=
"id"
/>
<item
name=
"menu_section_two"
type=
"id"
/>
<item
name=
"menu_section_three"
type=
"id"
/>
<item
name=
"menu_action_chats"
type=
"id"
/>
<item
name=
"menu_action_create_channel"
type=
"id"
/>
<item
name=
"menu_action_profile"
type=
"id"
/>
<item
name=
"menu_action_settings"
type=
"id"
/>
<item
name=
"menu_action_admin_panel"
type=
"id"
/>
<item
name=
"menu_action_logout"
type=
"id"
/>
</resources>
\ No newline at end of file
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