package Ġru . surf studio . android . picture provider . sample . ui . screen . main Ċ Ċ import Ġio . reactivex . Single Ċ import Ġru . surf studio . android . core . mvp . presenter . Base Presenter Ċ import Ġru . surf studio . android . core . mvp . presenter . Base Presenter Dependency Ċ import Ġru . surf studio . android . core . ui . permission . Permission Manager Ċ import Ġru . surf studio . android . d agger . scope . Per Screen Ċ import Ġru . surf studio . android . message . Message Controller Ċ import Ġru . surf studio . android . picture cho oser . Camera Storage Permission Request Ċ import Ġru . surf studio . android . picture cho oser . Picture Permission Checker Ċ import Ġru . surf studio . android . picture cho oser . Picture Provider Ċ import Ġru . surf studio . android . picture provider . sample . R Ċ import Ġru . surf studio . android . sample . d agger . ui . base . Strings Provider Ċ import Ġjavax . inject . Inject Ċ Ċ /** Ċ Ġ* ĠÐŁ ÑĢ ÐµÐ· ÐµÐ½ÑĤ ÐµÑĢ ĠÐ³ Ð» Ð°Ð² Ð½Ð¾Ð³Ð¾ ĠÑįÐº ÑĢÐ°Ð½ Ð° Ċ Ġ*/ Ċ @ Per Screen Ċ internal Ġclass ĠMain Presenter Ġ@ Inject Ġconstructor ( ĊĠĠĠĠĠĠĠ Ġbase Presenter Dependency : ĠBase Presenter Dependency , ĊĠĠĠĠĠĠĠ Ġstrings Provider : ĠStrings Provider , ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġpermission Manager : ĠPermission Manager , ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġpicture Permission Checker : ĠPicture Permission Checker , ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġphoto Provider : ĠPicture Provider , ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġmessage Controller : ĠMessage Controller Ċ ) Ġ: ĠBase Presenter < MainActivity View >( base Presenter Dependency ) Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġsm : ĠMain Screen Model Ġ= ĠMain Screen Model () ĊĠĠĠ Ġprivate Ġval Ġimage Chooser Message Ġ= Ġstrings Provider . getString ( R . string . image _ cho oser _ message ) ĊĊĠĠĠ Ġoverride Ġfun ĠonLoad ( view Re created : ĠBoolean ) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Load ( view Re created ) ĊĠĠĠĠĠĠĠ Ġview . render ( sm ) ĊĠĠĠĠĠĠĠ Ġsubscribe Io Handle Error ( picture Permission Checker . check Camera Storage Permission ()) Ġ{ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġopen Camera () Ġ= Ġperform Action ( photo Provider . open Camera And Take Photo ()) ĊĊĠĠĠ Ġfun Ġopen Gallery Single () Ġ= Ġperform Action ( photo Provider . open Gallery AndGet Photo Uri Wrapper ()) ĊĊĠĠĠ Ġfun Ġopen Gallery Multiple () Ġ= Ġperform Action ( photo Provider . open Gallery AndGet F ew Photo Uri Wrapper ()) ĊĊĠĠĠ Ġfun Ġopen Chooser Single () Ġ{ ĊĠĠĠĠĠĠĠ Ġperform Action ( photo Provider . open Image Chooser AndGet Photo Uri Wrapper ( image Chooser Message )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġopen Chooser Multiple () Ġ{ ĊĠĠĠĠĠĠĠ Ġperform Action ( photo Provider . open Image Chooser AndGet F ew Photo Uri Wrapper ( image Chooser Message )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġopen Chooser And Save Photo () Ġ{ ĊĠĠĠĠĠĠĠ Ġperform Action ( photo Provider . open Image Chooser And Save Photo ( image Chooser Message )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġ< T > Ġperform Action ( single : ĠSingle < T >) Ġ{ ĊĠĠĠĠĠĠĠ Ġsubscribe Io Handle Error ( single ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmessage Controller . show ( it . toString ()) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Resume () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Resume () ĊĠĠĠĠĠĠĠ Ġif Ġ( check Permission ()) Ġview . start Camera () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Pause () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Pause () ĊĠĠĠĠĠĠĠ Ġif Ġ( check Permission ()) Ġview . stop Camera () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġcheck Permission (): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġpermission Manager . check ( Camera Storage Permission Request ()). is Granted ĊĠĠĠ Ġ} Ċ }