package Ġcom . example . shop app . utils Ċ Ċ import Ġandroid . app . Activity Ċ import Ġandroid . content . Intent Ċ import Ġandroid . net . Uri Ċ import Ġandroid . provider . Media Store Ċ import Ġandroid . webkit . MimeType Map Ċ Ċ object ĠConstants Ġ{ ĊĊĠĠĠ Ġconst Ġval ĠUSER S : ĠString = Ġ" users " ĊĠĠĠ Ġconst Ġval ĠMY SH OP PAL _ PREFER ENCES : String = Ġ" My Shop Pal Prefs " ĊĠĠĠ Ġconst Ġval ĠLOG GED _ IN _ USERNAME : String =" logged _ in _ username " ĊĠĠĠ Ġconst Ġval ĠEX TRA _ USERS _ DETAILS : String = Ġ" extra _ user _ details " ĊĠĠĠ Ġconst Ġval ĠREAD _ STORAGE _ PERMISSION _ CODE : Int = Ġ 2 ĊĠĠĠ Ġconst Ġval ĠP ICK _ IMAGE _ REQUEST _ CODE = 1 ĊĊĠĠĠ Ġconst Ġval ĠM ALE : String =" Male " ĊĠĠĠ Ġconst Ġval ĠF EM ALE : String =" Female " ĊĠĠĠ Ġconst Ġval ĠFIRST _ NAME : String =" firstName " ĊĠĠĠ Ġconst Ġval ĠLAST _ NAME : String =" lastName " ĊĠĠĠ Ġconst Ġval ĠM OB ILE : String =" mobile " ĊĠĠĠ Ġconst Ġval ĠG ENDER : String =" gender " ĊĊĠĠĠ Ġconst Ġval ĠUSER _ PROFILE _ IMAGE : String =" User _ Profile _ Image " ĊĠĠĠ Ġconst Ġval ĠIMAGE : String =" image " ĊĠĠĠ Ġconst Ġval ĠCOMP LETE _ PROFILE : String = Ġ" profile Completed " ĊĊĠĠĠ Ġ// ĠFirebase ĠConstants ĊĠĠĠ Ġ// ĠThis Ġis Ġused Ġfor Ġthe Ġcollection Ġname Ġfor ĠUSER S . ĊĊĠĠĠ Ġconst Ġval ĠPRODUCT S : ĠString Ġ= Ġ" products " ĊĠĠĠ Ġconst Ġval ĠC ART _ ITEMS : ĠString Ġ= Ġ" cart _ items " ĊĠĠĠ Ġconst Ġval ĠADD RES SES : ĠString Ġ= Ġ" addresses " ĊĠĠĠ Ġconst Ġval ĠORDER S : ĠString Ġ= Ġ" orders " ĊĠĠĠ Ġconst Ġval ĠS OLD _ PRODUCT S : ĠString Ġ= Ġ" sold _ products " ĊĊĊĠĠĠ Ġ// ĠIntent Ġextra Ġconstants . ĊĠĠĠ Ġconst Ġval ĠEX TRA _ USER _ DETAILS : ĠString Ġ= Ġ" extra _ user _ details " ĊĠĠĠ Ġconst Ġval ĠEX TRA _ PRODUCT _ ID : ĠString Ġ= Ġ" extra _ product _ id " ĊĠĠĠ Ġconst Ġval ĠEX TRA _ PRODUCT _ OWNER _ ID : ĠString Ġ= Ġ" extra _ product _ owner _ id " ĊĠĠĠ Ġconst Ġval ĠEX TRA _ ADDRESS _ DETAILS : ĠString Ġ= Ġ" Address Details " ĊĠĠĠ Ġconst Ġval ĠEX TRA _ SELECT _ ADDRESS : ĠString Ġ= Ġ" extra _ select _ address " ĊĠĠĠ Ġconst Ġval ĠEX TRA _ SELECTED _ ADDRESS : ĠString Ġ= Ġ" extra _ selected _ address " ĊĠĠĠ Ġconst Ġval ĠEX TRA _ MY _ ORDER _ DETAILS : ĠString Ġ= Ġ" extra _ my _ order _ details " ĊĠĠĠ Ġconst Ġval ĠEX TRA _ S OLD _ PRODUCT _ DETAILS : ĠString Ġ= Ġ" extra _ sold _ product _ details " ĊĊĠĠĠ Ġ// ĠA Ġunique Ġcode Ġof Ġimage Ġselection Ġfrom ĠPhone ĠStorage . ĊĠĠĠ Ġconst Ġval ĠADD _ ADDRESS _ REQUEST _ CODE : ĠInt Ġ= Ġ 1 2 1 ĊĠĠĠ Ġconst Ġval ĠDEFAULT _ C ART _ QU ANT ITY : ĠString Ġ= Ġ" 1 " ĊĊĠĠĠ Ġ// ĠFirebase Ġdatabase Ġfield Ġnames ĊĠĠĠ Ġconst Ġval ĠUSER _ ID : ĠString Ġ= Ġ" user _ id " ĊĠĠĠ Ġconst Ġval ĠPRODUCT _ ID : ĠString Ġ= Ġ" product _ id " ĊĠĠĠ Ġconst Ġval ĠPRODUCT _ IMAGE : ĠString Ġ= Ġ" Product _ Image " ĊĠĠĠ Ġconst Ġval ĠC ART _ QU ANT ITY : ĠString Ġ= Ġ" cart _ quantity " ĊĠĠĠ Ġconst Ġval ĠSTO CK _ QU ANT ITY : ĠString Ġ= Ġ" stock _ quantity " ĊĠĠĠ Ġconst Ġval ĠHOME : ĠString Ġ= Ġ" Home " ĊĠĠĠ Ġconst Ġval ĠOFF ICE : ĠString Ġ= Ġ" Office " ĊĠĠĠ Ġconst Ġval ĠOTHER : ĠString Ġ= Ġ" Other " ĊĊĊĠĠĠ Ġfun Ġshow Image Chooser ( activity : ĠActivity ){ ĊĠĠĠĠĠĠĠ Ġ// An Ġintent Ġfor Ġlaunch ing Ġthe Ġimage Ġselection Ġof Ġphone Ġstorage ĊĠĠĠĠĠĠĠ Ġval Ġgallery Intent = Intent ( Intent . ACTION _ P ICK , ĠMedia Store . Images . Media . EXTERNAL _ CONTENT _ URI ) ĊĠĠĠĠĠĠĠ Ġactivity . startActivity For Result ( gallery Intent , ĠP ICK _ IMAGE _ REQUEST _ CODE ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun ĠgetFile Extension ( activity : Activity , Ġuri : ĠUri ?): String ? Ġ{ ĊĊĠĠĠĠĠĠĠ Ġ/* ĊĠĠĠĠĠĠĠ ĠMime TypeMap : Ġtwo Ġway Ġmap Ġthat Ġmaps ĠMIME - types Ġto Ġfile Ġextensions Ġand Ġvice Ġvers a ĊĊĠĠĠĠĠĠĠ ĠGet Singleton (): ĠGet Ġthe Ġsingleton Ġinstance Ġof ĠMime TypeMap ĊĊĠĠĠĠĠĠĠ Ġget Extension From MimeType : ĠReturn Ġthe Ġregistered Ġextension Ġfor Ġthe Ġgiven ĠMIME Ġtype . ĊĊĠĠĠĠĠĠĠ Ġcontent Resolver . getType : ĠReturn Ġthe ĠMIME Ġtype Ġof Ġthe Ġgiven Ġcontent ĠURL . ĊĠĠĠĠĠĠĠĠ Ġ*/ ĊĊĠĠĠĠĠĠĠ Ġ// Ob ti ene Ġla Ġextension Ġ( jpg , Ġpng ) Ġde Ġla Ġimagen Ġque Ġten emos Ġen Ġn uest ro Ġdispositivo ĊĠĠĠĠĠĠĠ Ġreturn ĠMime TypeMap . get Singleton (). getExtension From MimeType ( activity . content Resolver . getType ( uri !! )) ĊĠĠĠ Ġ} Ċ }