package Ġcom . planes . android . preferences Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . util . Log Ċ import Ġcom . planes . android . preferences . IP references Service ĊĊ Ċ class ĠPreferences Service Ġinternal Ġconstructor ( private Ġval Ġm _ Context : ĠContext ): ĠIP references Service Ġ{ ĊĠĠĠ Ġprivate Ġvar Ġm _ Computer Skill Ġ= Ġ 2 ĊĠĠĠ Ġoverride Ġvar Ġshow Plane After Kill Ġ= Ġfalse ĊĊĠĠĠ Ġoverride Ġvar Ġcomputer Skill : ĠInt ĊĠĠĠĠĠĠĠ Ġget () Ġ= Ġm _ Computer Skill ĊĠĠĠĠĠĠĠ Ġset ( skill ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( skill Ġ< Ġ 0 Ġ|| Ġskill Ġ> Ġ 2 ) Ġm _ Computer Skill Ġ= Ġ 2 ĊĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Computer Skill Ġ= Ġskill ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġread Preferences () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġsp Ġ= Ġm _ Context . get SharedPreferences (" game difficulty ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠContext . MODE _ PRIVATE ) ĊĠĠĠĠĠĠĠ Ġcomputer Skill Ġ= Ġsp . getInt (" comp ut ers kill ", Ġ 2 ) ĊĠĠĠĠĠĠĠ Ġshow Plane After Kill Ġ= Ġsp . getBoolean (" show k illed plane ", Ġfalse ) ĊĠĠĠĠĠĠĠ ĠLog . d (" Planes ", Ġ" read Preferences Ġ" Ġ+ Ġcomputer Skill Ġ+ Ġ" Ġ" Ġ+ Ġshow Plane After Kill ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġread From Saved InstanceState ( savedInstanceState : ĠBundle ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcomputer Skill Ġ= ĠsavedInstanceState . getInt (" game difficulty / comp ut ers kill ") ĊĠĠĠĠĠĠĠ Ġshow Plane After Kill Ġ= ĠsavedInstanceState . getBoolean (" game difficulty / show k illed plane ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġwrite Preferences () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġsp Ġ= Ġm _ Context . get SharedPreferences (" game difficulty ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠContext . MODE _ PRIVATE ). edit () ĊĠĠĠĠĠĠĠ Ġsp . put Int (" comp ut ers kill ", Ġcomputer Skill ) ĊĠĠĠĠĠĠĠ Ġsp . put Boolean (" show k illed plane ", Ġshow Plane After Kill ) ĊĠĠĠĠĠĠĠ Ġsp . commit () ĊĠĠĠĠĠĠĠ ĠLog . d (" Planes ", Ġ" write Preferences Ġ" Ġ+ Ġm _ Computer Skill Ġ+ Ġ" Ġ" Ġ+ Ġshow Plane After Kill ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠwriteTo Saved InstanceState ( savedInstanceState : ĠBundle ) Ġ{ ĊĠĠĠĠĠĠĠ ĠsavedInstanceState . put Int (" game difficulty / comp ut ers kill ", Ġcomputer Skill ) ĊĠĠĠĠĠĠĠ ĠsavedInstanceState . put Boolean (" game difficulty / show k illed plane ", Ġshow Plane After Kill ) ĊĠĠĠ Ġ} Ċ }