/* Ċ Ġ* ĠCopyright Ġ 2 0 2 1 ĠP au lo ĠP ere ira Ċ Ġ* Ċ Ġ* Ġ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 . pp . jet weather fy . presentation . forecast Ċ Ċ import Ġandroidx . compose . runtime . Composable Ċ import Ġandroidx . compose . runtime . collect As State Ċ import Ġandroidx . compose . runtime . getValue Ċ import Ġcom . pp . jet weather fy . presentation . forecast . components . content . Forecast Content Ċ import Ġcom . pp . jet weather fy . presentation . forecast . components . surface . Forecast Surface Ċ import Ġcom . pp . jet weather fy . presentation . forecast . components . top bar . Forecast Top Bar Ċ import Ġcom . pp . jet weather fy . presentation . forecast . events . Forecast View Event . Set Selected Daily Forecast Ċ import Ġcom . pp . jet weather fy . presentation . forecast . events . Forecast View Event . Set ViewType Ċ import Ġcom . pp . jet weather fy . presentation . forecast . events . Forecast View Event . Set Weather Unit Ċ import Ġcom . pp . jet weather fy . presentation . forecast . events . Location View Event . Search C ities Ċ import Ġcom . pp . jet weather fy . presentation . forecast . events . Location View Event . Set Location Ċ import Ġcom . pp . jet weather fy . presentation . forecast . state . Forecast ViewState Ċ import Ġcom . pp . jet weather fy . presentation . forecast . state . Location ViewState Ċ import Ġcom . pp . jet weather fy . presentation . forecast . state . ViewType . Detailed Ċ Ċ @ Composable Ċ fun ĠFore cast Screen ( viewModel : ĠFore cast ViewModel , Ġon Location Requested : Ġ() Ġ-> ĠUnit ) Ġ{ ĊĠĠĠ Ġval Ġforecast ViewState Ġby ĠviewModel . forecast ViewState . collect As State ( Forecast ViewState ()) ĊĠĠĠ Ġval Ġlocation ViewState Ġby ĠviewModel . location ViewState . collect As State ( Location ViewState ()) ĊĊĠĠĠ ĠFore cast Surface ( forecast ViewState . selected Daily Forecast ) Ġ{ ĊĠĠĠĠĠĠĠ ĠFore cast Top Bar ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġforecast State Ġ= Ġforecast ViewState , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlocation State Ġ= Ġlocation ViewState , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Weather Unit Toggle d Ġ= Ġ{ Ġweather Unit Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠviewModel . on Forecast Event ( Set Weather Unit ( weather Unit )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon ViewType Toggle d Ġ= Ġ{ Ġview Type Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠviewModel . on Forecast Event ( Set ViewType ( view Type )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Set Location Click Ġ= Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġon Location Requested () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Query Typing Ġ= Ġ{ Ġquery Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠviewModel . on Location Event ( Search C ities ( query )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon City Selected Ġ= Ġ{ Ġcity Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠviewModel . on Location Event ( Set Location ( city )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠFore cast Content ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġforecast State Ġ= Ġforecast ViewState , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Daily Forecast Selected Ġ= Ġ{ Ġdaily Forecast Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠviewModel . on Forecast Event ( Set Selected Daily Forecast ( daily Forecast )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon See More Click Ġ= Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠviewModel . on Forecast Event ( Set ViewType ( Detailed )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} Ċ } Ċ