<commit_before>/*
 * Copyright 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.android.horologist.mediasample.ui

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.lifecycle.viewmodel.CreationExtras
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavHostController
import com.google.android.horologist.audio.BluetoothSettings.launchBluetoothSettings
import com.google.android.horologist.audio.ui.VolumeScreen
import com.google.android.horologist.audio.ui.VolumeViewModel
import com.google.android.horologist.compose.layout.StateUtils.rememberStateWithLifecycle
import com.google.android.horologist.compose.navscaffold.WearNavScaffold
import com.google.android.horologist.compose.navscaffold.wearNavComposable
import com.google.android.horologist.mediasample.ui.debug.MediaInfoTimeText

@Composable
fun WearApp(
    navController: NavHostController,
    creationExtras: () -> CreationExtras
) {
    val appViewModel: MediaPlayerAppViewModel = viewModel(factory = MediaPlayerAppViewModel.Factory)

    UampTheme {
        WearNavScaffold(
            modifier = Modifier.fillMaxSize(),
            startDestination = Navigation.MediaPlayer.route,
            navController = navController,
            timeText = {
                val networkUsage by rememberStateWithLifecycle(appViewModel.networkUsage)
                val networkStatus by rememberStateWithLifecycle(appViewModel.networkStatus)
                val offloadState by rememberStateWithLifecycle(appViewModel.offloadState)

                MediaInfoTimeText(
                    showData = appViewModel.showTimeTextInfo,
                    networkStatus = networkStatus,
                    networkUsage = networkUsage,
                    offloadState = offloadState
                )
            }
        ) {
            wearNavComposable(Navigation.Volume.route) { _, viewModel ->
                VolumeScreen(focusRequester = viewModel.focusRequester)
            }
            wearNavComposable(Navigation.MediaPlayer.route) { _, viewModel ->
                val context = LocalContext.current

                MediaPlayerScreen(
                    mediaPlayerScreenViewModel = viewModel(
                        factory = MediaPlayerScreenViewModel.Factory,
                        extras = creationExtras()
                    ),
                    volumeViewModel = viewModel(factory = VolumeViewModel.Factory),
                    onVolumeClick = {
                        navController.navigate(Navigation.Volume.route)
                    },
                    onOutputClick = {
                        context.launchBluetoothSettings()
                    },
                    playerFocusRequester = viewModel.focusRequester
                )
            }
        }
    }
}<commit_msg>Hide time text from Volume Screen. (#268)<commit_after>/*
 * Copyright 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.android.horologist.mediasample.ui

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.lifecycle.viewmodel.CreationExtras
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavHostController
import com.google.android.horologist.audio.BluetoothSettings.launchBluetoothSettings
import com.google.android.horologist.audio.ui.VolumeScreen
import com.google.android.horologist.audio.ui.VolumeViewModel
import com.google.android.horologist.compose.layout.StateUtils.rememberStateWithLifecycle
import com.google.android.horologist.compose.navscaffold.NavScaffoldViewModel
import com.google.android.horologist.compose.navscaffold.WearNavScaffold
import com.google.android.horologist.compose.navscaffold.wearNavComposable
import com.google.android.horologist.mediasample.ui.debug.MediaInfoTimeText

@Composable
fun WearApp(
    navController: NavHostController,
    creationExtras: () -> CreationExtras
) {
    val appViewModel: MediaPlayerAppViewModel = viewModel(factory = MediaPlayerAppViewModel.Factory)

    UampTheme {
        WearNavScaffold(
            modifier = Modifier.fillMaxSize(),
            startDestination = Navigation.MediaPlayer.route,
            navController = navController,
            timeText = {
                val networkUsage by rememberStateWithLifecycle(appViewModel.networkUsage)
                val networkStatus by rememberStateWithLifecycle(appViewModel.networkStatus)
                val offloadState by rememberStateWithLifecycle(appViewModel.offloadState)

                MediaInfoTimeText(
                    showData = appViewModel.showTimeTextInfo,
                    networkStatus = networkStatus,
                    networkUsage = networkUsage,
                    offloadState = offloadState
                )
            }
        ) {
            wearNavComposable(Navigation.MediaPlayer.route) { _, viewModel ->
                val context = LocalContext.current

                MediaPlayerScreen(
                    mediaPlayerScreenViewModel = viewModel(
                        factory = MediaPlayerScreenViewModel.Factory,
                        extras = creationExtras()
                    ),
                    volumeViewModel = viewModel(factory = VolumeViewModel.Factory),
                    onVolumeClick = {
                        navController.navigate(Navigation.Volume.route)
                    },
                    onOutputClick = {
                        context.launchBluetoothSettings()
                    },
                    playerFocusRequester = viewModel.focusRequester
                )
            }
            wearNavComposable(Navigation.Volume.route) { _, viewModel ->
                viewModel.timeTextMode = NavScaffoldViewModel.TimeTextMode.Off

                VolumeScreen(focusRequester = viewModel.focusRequester)
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.06648426812585499, 'fraction_numerical': 0.0025991792065663474, 'mean_word_length': 2.5335911068148866, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '143389', 'n_tokens_mistral': 1837, 'n_tokens_neox': 1731, 'n_words': 380}