This repository was archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathBottomNavigationActivity.kt
69 lines (58 loc) · 2.63 KB
/
BottomNavigationActivity.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
package com.microsoft.officeuifabricdemo.demos
import android.os.Bundle
import android.support.design.bottomnavigation.LabelVisibilityMode
import com.microsoft.officeuifabricdemo.DemoActivity
import com.microsoft.officeuifabricdemo.R
import kotlinx.android.synthetic.main.activity_bottom_navigation.*
// TODO Replace outlined icons with fill icons when selected.
class BottomNavigationActivity : DemoActivity() {
override val contentLayoutId: Int
get() = R.layout.activity_bottom_navigation
override val contentNeedsScrollableContainer: Boolean
get() = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
toggle_label_button.setOnClickListener {
// You can also achieve unlabeled items via @style/Widget.UIFabric.BottomNavigation.Unlabeled
bottom_navigation.labelVisibilityMode =
if (bottom_navigation.labelVisibilityMode == LabelVisibilityMode.LABEL_VISIBILITY_UNLABELED)
LabelVisibilityMode.LABEL_VISIBILITY_LABELED
else
LabelVisibilityMode.LABEL_VISIBILITY_UNLABELED
}
three_menu_items_button.setOnClickListener {
bottom_navigation.menu.removeItem(R.id.action_calendar)
bottom_navigation.menu.removeItem(R.id.action_team)
}
four_menu_items_button.setOnClickListener {
bottom_navigation.menu.removeItem(R.id.action_calendar)
bottom_navigation.menu.removeItem(R.id.action_team)
bottom_navigation.menu.add(
R.id.bottom_navigation,
R.id.action_calendar,
3,
resources.getString(R.string.bottom_navigation_menu_item_calendar)
).setIcon(R.drawable.ic_calendar_28_regular)
}
five_menu_items_button.setOnClickListener {
bottom_navigation.menu.removeItem(R.id.action_calendar)
bottom_navigation.menu.removeItem(R.id.action_team)
bottom_navigation.menu.add(
R.id.bottom_navigation,
R.id.action_calendar,
3,
resources.getString(R.string.bottom_navigation_menu_item_calendar)
).setIcon(R.drawable.ic_calendar_28_regular)
bottom_navigation.menu.add(
R.id.bottom_navigation,
R.id.action_team,
4,
resources.getString(R.string.bottom_navigation_menu_item_team)
).setIcon(R.drawable.ic_people_team_28_regular)
}
}
}