package Ġcom . l ml . cool weather . logic . dao čĊč Ċ import Ġandroid . content . Context č Ċ import Ġandroidx . core . content . edit č Ċ import Ġcom . google . gson . Gson č Ċ import Ġcom . l ml . cool weather . Cool Weather Application č Ċ import Ġcom . l ml . cool weather . logic . model . Location Response čĊč Ċ object ĠLocation Dao Ġ{ čĊĠĠĠ Ġfun Ġsave Location ( location : ĠLocation Response . Location ){ čĊĠĠĠĠĠĠĠ Ġshared Preferences (). edit Ġ{ čĊĠĠĠĠĠĠĠĠĠĠĠ Ġput String (" location ", Gson (). toJson ( location )) čĊĠĠĠĠĠĠĠ Ġ} čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġfun Ġget Saved Location (): Location Response . Location { čĊĠĠĠĠĠĠĠ Ġval Ġlocation Json = Ġshared Preferences (). getString (" location "," ") čĊĠĠĠĠĠĠĠ Ġreturn ĠGson (). fromJson ( location Json , Location Response . Location :: class . java ) čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġfun Ġis Location Saved () = Ġshared Preferences (). contains (" location ") čĊĠĠĠ Ġprivate Ġfun Ġshared Preferences () = Cool Weather Application čĊĠĠĠĠĠĠĠ Ġ. context . get SharedPreferences (" cool _ weather ", ĠContext . MODE _ PRIVATE ) č Ċ }