package Ġcom . wx z eng . sun ny weather . logic . dao Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroidx . core . content . edit Ċ import Ġcom . google . gson . Gson Ċ import Ġcom . wx z eng . sun ny weather . Sun ny Weather Application Ċ import Ġcom . wx z eng . sun ny weather . logic . model . Place Ċ Ċ /** Ċ Ġ* Ġ Ġ@ author : Ġwe ix ing z eng Ċ Ġ* Ġ Ġ@ e - mail : Ġ 3 3 0 4 4 6 9 6 2 @ qq . com Ċ Ġ* Ġ Ġ@ date Ġ 2 0 2 1 / 0 1 / 2 0 Ġ 5 : 2 4 ĠPM Ċ Ġ* Ġ Ġ@ desc : Ġæķ°æį® å±Ĥ dao ç±» Ċ Ġ* Ġ Ġ@ version : Ċ Ġ*/ Ċ object ĠPlace Dao Ġ{ ĊĠĠĠ Ġfun Ġsave Place ( place : ĠPlace ) Ġ{ ĊĠĠĠĠĠĠĠ Ġshared Preferences (). edit Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġput String (" place ", Gson (). toJson ( place )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġget Sv ae Place (): Place { ĊĠĠĠĠĠĠĠ Ġval Ġplace Json Ġ= Ġshared Preferences (). getString (" place "," ") ĊĠĠĠĠĠĠĠ Ġreturn ĠGson (). fromJson ( place Json , Place :: class . java ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġis Place Saved () Ġ= Ġshared Preferences (). contains (" place ") ĊĊĠĠĠ Ġprivate Ġfun Ġshared Preferences () Ġ= ĊĠĠĠĠĠĠĠ ĠSun ny Weather Application . context . get SharedPreferences (" sun ny _ weather ", ĠContext . MODE _ PRIVATE ) Ċ } Ċ