package Ġorg . wikipedia . feed . suggest eded its Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . net . Uri Ċ import Ġandroid . view . View Ċ import Ġio . reactivex . annotations . NonNull Ċ import Ġkotlinx . android . synt hetic . main . view _ suggest ed _ edit _ card . view .* Ċ import Ġorg . wikipedia . R Ċ import Ġorg . wikipedia . W ikipedia App Ċ import Ġorg . wikipedia . datac lient . Wiki Site Ċ import Ġorg . wikipedia . descriptions . Description Edit Activity . Action .* Ċ import Ġorg . wikipedia . feed . view . Default Feed Card View Ċ import Ġorg . wikipedia . feed . view . Feed Adapter Ċ import Ġorg . wikipedia . util . StringUtil Ċ import Ġorg . wikipedia . views . Item Touch Helper Swipe Adapter Ċ Ċ class ĠSuggest ed Ed its Card View ( context : ĠContext ) Ġ: ĠDefault Feed Card View < Suggest ed Ed its Card >( context ), ĠItem Touch Helper Swipe Adapter . Swipe ableView , ĠSuggest ed Ed its Feed Client . Callback Ġ{ ĊĠĠĠ Ġinterface ĠCallback Ġ{ ĊĠĠĠĠĠĠĠ Ġfun Ġon Suggest ed Ed its Card Click ( view : ĠSuggest ed Ed its Card View ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġvar Ġsource Description : ĠString Ġ= Ġ"" ĊĠĠĠ Ġprivate Ġval Ġapp Ġ= ĠW ikipedia App . getInstance () ĊĠĠĠ Ġprivate Ġvar Ġcard : ĠSuggest ed Ed its Card ? Ġ= Ġnull ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ Ġinf late ( getContext (), ĠR . layout . view _ suggest ed _ edit _ card , Ġthis ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġis Translation (): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġcard !!. action Ġ== ĠTRAN SL ATE _ DESCRIPTION Ġ|| Ġcard !!. action Ġ== ĠTRAN SL ATE _ CAP TION ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġset Card (@ NonNull Ġcard : ĠSuggest ed Ed its Card ) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . set Card ( card ) ĊĠĠĠĠĠĠĠ Ġthis . card Ġ= Ġcard ĊĊĠĠĠĠĠĠĠ Ġset Layout Direction By Wiki Site ( Wiki Site . for Language Code ( card . source Summary !!. lang ), Ġthis ) ĊĊĠĠĠĠĠĠĠ Ġcard View . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( callback Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcallback !!. on Suggest ed Ed its Card Click ( this ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġheader ( card ) ĊĠĠĠĠĠĠĠ Ġupdate Contents () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġset Callback ( callback : ĠFeed Adapter . Callback ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . set Callback ( callback ) ĊĠĠĠĠĠĠĠ Ġheader View . set Callback ( callback ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġupdate Contents () Ġ{ ĊĠĠĠĠĠĠĠ Ġview Article Subtitle . visibility Ġ= ĠView . GONE ĊĠĠĠĠĠĠĠ Ġwhen Ġ( card !!. action ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTRAN SL ATE _ DESCRIPTION Ġ-> Ġshow Translate Description UI () ĊĠĠĠĠĠĠĠĠĠĠĠ ĠADD _ CAP TION Ġ-> Ġshow Add Image Caption UI () ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTRAN SL ATE _ CAP TION Ġ-> Ġshow Translate Image Caption UI () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġelse Ġ-> Ġshow Add Description UI () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġshow Add Description UI () Ġ{ ĊĠĠĠĠĠĠĠ Ġview Article Title . text Ġ= ĠString Util . from Html ( card !!. source Summary !!. display Title !! ) ĊĠĠĠĠĠĠĠ Ġcall ToAction Text . text Ġ= Ġif Ġ( card !!. action Ġ== ĠTRAN SL ATE _ DESCRIPTION ) Ġcontext . getString ( R . string . suggest ed _ ed its _ feed _ card _ add _ translation _ in _ language _ button , Ġapp . language (). getApp Language Canonical Name ( card !!. target Summary !!. lang )) Ġelse Ġcontext . getString ( R . string . suggest ed _ ed its _ feed _ card _ add _ description _ button ) ĊĠĠĠĠĠĠĠ Ġshow Image Or Extract () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġshow Translate Description UI () Ġ{ ĊĠĠĠĠĠĠĠ Ġsource Description Ġ= Ġcard !!. source Summary !!. description !! ĊĠĠĠĠĠĠĠ Ġview Article Subtitle . visibility Ġ= ĠView . VISIBLE ĊĠĠĠĠĠĠĠ Ġview Article Subtitle . text Ġ= Ġsource Description ĊĠĠĠĠĠĠĠ Ġshow Add Description UI () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġshow Add Image Caption UI () Ġ{ ĊĠĠĠĠĠĠĠ Ġview Article Image . visibility Ġ= ĠView . VISIBLE ĊĠĠĠĠĠĠĠ Ġview Article Extract . visibility Ġ= ĠView . GONE ĊĠĠĠĠĠĠĠ Ġdivider . visibility Ġ= ĠView . GONE ĊĠĠĠĠĠĠĠ Ġview Article Image . load Image ( Uri . parse ( card !!. source Summary !!. thumbnail Url )) ĊĠĠĠĠĠĠĠ Ġview Article Title . text Ġ= ĠString Util . remove Namespace ( card !!. source Summary !!. display Title !! ) ĊĠĠĠĠĠĠĠ Ġcall ToAction Text . text Ġ= Ġif Ġ( card !!. action Ġ== ĠTRAN SL ATE _ CAP TION ) Ġcontext . getString ( R . string . suggest ed _ ed its _ feed _ card _ translate _ image _ caption , Ġapp . language (). getApp Language Canonical Name ( card !!. target Summary !!. lang )) Ġelse Ġcontext . getString ( R . string . suggest ed _ ed its _ feed _ card _ add _ image _ caption ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġshow Translate Image Caption UI () Ġ{ ĊĠĠĠĠĠĠĠ Ġsource Description Ġ= Ġcard !!. source Summary !!. description !! ĊĠĠĠĠĠĠĠ Ġview Article Subtitle . visibility Ġ= ĠView . VISIBLE ĊĠĠĠĠĠĠĠ Ġview Article Subtitle . text Ġ= Ġsource Description ĊĠĠĠĠĠĠĠ Ġshow Add Image Caption UI () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġshow Image Or Extract () Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( card !!. source Summary !!. thumbnail Url . isNull Or Blank ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġview Article Image . visibility Ġ= ĠView . GONE ĊĠĠĠĠĠĠĠĠĠĠĠ Ġview Article Extract . visibility Ġ= ĠView . VISIBLE ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdivider . visibility Ġ= ĠView . VISIBLE ĊĠĠĠĠĠĠĠĠĠĠĠ Ġview Article Extract . text Ġ= ĠString Util . from Html ( card !!. source Summary !!. extract Html ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġview Article Extract . max Lines Ġ= ĠA RT IC LE _ EXTRACT _ MAX _ LINE _ WITHOUT _ IMAGE ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġview Article Image . visibility Ġ= ĠView . VISIBLE ĊĠĠĠĠĠĠĠĠĠĠĠ Ġview Article Extract . visibility Ġ= ĠView . GONE ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdivider . visibility Ġ= ĠView . GONE ĊĠĠĠĠĠĠĠĠĠĠĠ Ġview Article Image . load Image ( Uri . parse ( card !!. source Summary !!. thumbnail Url )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġheader ( card : ĠSuggest ed Ed its Card ) Ġ{ ĊĠĠĠĠĠĠĠ Ġheader View !!. setTitle ( card . title ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. setImage ( R . drawable . ic _ mode _ edit _ white _ 2 4 dp ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. setImage Circle Color ( R . color . base 3 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Lang Code ( if Ġ( card . action Ġ== ĠTRAN SL ATE _ CAP TION Ġ|| Ġcard . action Ġ== ĠTRAN SL ATE _ DESCRIPTION ) Ġcard . wiki Site (). language Code () Ġelse Ġ"") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Card ( card ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Callback ( callback ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġrefresh Card Content () Ġ{ ĊĠĠĠĠĠĠĠ ĠSuggest ed Ed its Feed Client ( card !!. action ). fetch Suggest ed Edit ForType ( null , Ġthis ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġupdate Card Content ( card : ĠSuggest ed Ed its Card ) Ġ{ ĊĠĠĠĠĠĠĠ Ġset Card ( card ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġconst Ġval ĠA RT IC LE _ EXTRACT _ MAX _ LINE _ WITHOUT _ IMAGE Ġ= Ġ 6 ĊĠĠĠ Ġ} Ċ } Ċ