package Ġcom . ys . sun ny weather . logic . dao Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroidx . core . content . edit Ċ import Ġcom . google . gson . Gson Ċ import Ġcom . ys . sun ny weather . base . My Application Ċ import Ġcom . ys . sun ny weather . logic . model . Place Ċ Ċ object ĠPlace Dao Ġ{ ĊĠĠĠ Ġfun Ġsave Place ( place : ĠPlace ) Ġ{ ĊĠĠĠĠĠĠĠ Ġshare Preferences (). edit Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġput String (" place ", ĠGson (). toJson ( place )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġget Save Place (): ĠPlace Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġplace json Ġ= Ġshare Preferences (). getString (" place ", Ġ"") ĊĠĠĠĠĠĠĠ Ġreturn ĠGson (). fromJson ( place json , ĠPlace :: class . java ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġis Place Saved () Ġ= Ġshare Preferences (). contains (" place ") ĊĠĠĠ Ġprivate Ġfun Ġshare Preferences () Ġ= ĊĠĠĠĠĠĠĠ ĠMy Application . context . get SharedPreferences (" sun ny _ weather ", ĠContext . MODE _ PRIVATE ) Ċ }