package Ġcom . rl s . pick file . android . helper Ċ Ċ import Ġandroid . Manifest Ċ import Ġandroid . app . Activity Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . pm . PackageManager Ċ import Ġandroid . view . Context Theme Wrapper Ċ import Ġandroidx . core . app . Activity Compat Ċ import Ġandroidx . core . content . Context Compat Ċ import Ġandroidx . fragment . app . Fragment Ċ Ċ object ĠAndroid Permissions Helper Ġ{ ĊĊĠĠĠ Ġconst Ġval ĠWRITE _ EXTERNAL _ STORAGE _ CODE _ IMAGE Ġ= Ġ 1 ĊĠĠĠ Ġconst Ġval ĠWRITE _ EXTERNAL _ STORAGE _ CODE _ PH OTO Ġ= Ġ 2 ĊĠĠĠ Ġconst Ġval ĠCAM ERA _ CODE Ġ= Ġ 2 ĊĠĠĠ Ġconst Ġval ĠREAD _ EXTERNAL _ CODE Ġ= Ġ 3 ĊĊĠĠĠ Ġprivate Ġfun Ġcheck Permission ( context : ĠContext , Ġpermission : ĠString ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠContext Compat . check Self Permission ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcontext , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġpermission ĊĠĠĠĠĠĠĠ Ġ) Ġ== ĠPackage Manager . PERMISSION _ GRAN TED ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġrequest Permission ( context : ĠActivity , Ġpermission : ĠString , Ġrequest Code : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ ĠActivity Compat . request Permissions ( context , ĠarrayOf ( permission ), Ġrequest Code ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġhas Camera Permission ( context : ĠContext ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġcheck Permission ( context , ĠManifest . permission . CAMERA ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġget Camera Permission ( activity : ĠActivity ) Ġ{ ĊĠĠĠĠĠĠĠ Ġrequest Permission ( activity , ĠManifest . permission . CAMERA , ĠCAM ERA _ CODE ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġhas Write External Storage Permission ( context : ĠContext ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġcheck Permission ( context , ĠManifest . permission . WRITE _ EXTERNAL _ STORAGE ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġhas Read External Storage Permission ( context : ĠContext ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġcheck Permission ( context , ĠManifest . permission . READ _ EXTERNAL _ STORAGE ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġget Read External Storage Permission ( activity : ĠActivity ) Ġ{ ĊĠĠĠĠĠĠĠ Ġrequest Permission ( activity , ĠManifest . permission . READ _ EXTERNAL _ STORAGE , ĠREAD _ EXTERNAL _ CODE ) ĊĠĠĠ Ġ} Ċ }