1 /*
<lambda>null2  * Copyright (C) 2019 The Android Open Source Project
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *       http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 package com.example.android.bubbles
17 
18 import android.widget.ImageView
19 import android.widget.TextView
20 import androidx.annotation.DrawableRes
21 import androidx.fragment.app.Fragment
22 
23 /**
24  * Common interface between [MainActivity] and [BubbleActivity].
25  */
26 interface NavigationController {
27 
28     fun openChat(id: Long)
29 
30     fun openPhoto(@DrawableRes photo: Int)
31 
32     /**
33      * Updates the appearance and functionality of the app bar.
34      *
35      * @param showContact Whether to show contact information instead the screen title.
36      * @param hidden Whether to hide the app bar.
37      * @param body Provide this function to update the content of the app bar.
38      */
39     fun updateAppBar(
40         showContact: Boolean = true,
41         hidden: Boolean = false,
42         body: (name: TextView, icon: ImageView) -> Unit = { _, _ -> }
43     )
44 }
45 
Fragmentnull46 fun Fragment.getNavigationController() = requireActivity() as NavigationController
47