Skip to content

Commit

Permalink
add help page option in drawer as well
Browse files Browse the repository at this point in the history
  • Loading branch information
shalzz committed Nov 18, 2019
1 parent 9198079 commit 3fca9a0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/src/main/java/com/shalzz/attendance/ui/main/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import com.android.billingclient.api.BillingClient.BillingResponse
import com.bugsnag.android.Bugsnag
import com.github.amlcurran.showcaseview.ShowcaseView
import com.google.android.material.navigation.NavigationView
import com.shalzz.attendance.MyApplication
import com.shalzz.attendance.R
import com.shalzz.attendance.billing.BillingManager
import com.shalzz.attendance.billing.BillingProvider
Expand Down Expand Up @@ -170,15 +171,20 @@ class MainActivity : BaseActivity(), MainMvpView, BillingProvider {
navController: NavController
) {
navigationView.setNavigationItemSelectedListener { item ->
if (navController.currentDestination!!.id != item.itemId)
NavigationUI.onNavDestinationSelected(item, navController)
if (navController.currentDestination!!.id != item.itemId) {
if (item.itemId == R.id.helpNSupport) {
MyApplication.deskInstance.startDeskHomeScreen(this)
} else
NavigationUI.onNavDestinationSelected(item, navController)
}
val parent = navigationView.parent
(parent as DrawerLayout).closeDrawer(navigationView)
true
}
val weakReference = WeakReference(navigationView)
navController.addOnDestinationChangedListener(object : NavController.OnDestinationChangedListener {


override fun onDestinationChanged(controller: NavController,
destination: NavDestination,
arguments: Bundle?) {
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/menu/drawer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
android:id="@+id/settingsFragment"
android:orderInCategory="3"
android:title="@string/navigation_item_3"/>
<item
android:id="@+id/helpNSupport"
android:orderInCategory="4"
android:title="@string/navigation_item_4"/>
</group>

</menu>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
<string name="navigation_item_1">Attendance</string>
<string name="navigation_item_2">Timetable</string>
<string name="navigation_item_3">Settings</string>
<string name="navigation_item_4">Help and Support</string>
<string name="proxy_settings_title">Proxy</string>
<string name="about_settings_title">About</string>

Expand Down

0 comments on commit 3fca9a0

Please sign in to comment.