package Ġcom . new game software . movies app demo . sub views Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . graphics . Color Ċ import Ġandroidx . constraint layout . widget . Constraint Set Ċ import Ġcom . new game software . movies app demo . base . view . Base View Ċ import Ġcom . new game software . movies app demo . models . Movie Ċ import Ġcom . new game software . movies app demo . sub views . image Views . ImageView I mdb Ċ import Ġcom . new game software . movies app demo . sub views . image Views . ImageView Star Ċ import Ġcom . new game software . movies app demo . sub views . text Views . TextView I mdb Ċ import Ġcom . new game software . movies app demo . ui . detail . Detail Layout Ċ import Ġcom . new game software . movies app demo . util . width Ratio Ċ Ċ class ĠI mdb Bar ( context : ĠContext ) Ġ: ĠBase View < Detail Layout >( context ) Ġ{ ĊĊĠĠĠ Ġprivate Ġval ĠimageView I mdb Ġ= ĠImageView I mdb ( context ) ĊĠĠĠ Ġprivate Ġval ĠimageView Star Ġ= ĠImageView Star ( context ) ĊĠĠĠ Ġprivate Ġval ĠtextView Point Ġ= ĠTextView I mdb ( context ) ĊĠĠĠ Ġprivate Ġval ĠtextView Date Ġ= ĠTextView I mdb ( context ) ĊĠĠĠ Ġprivate Ġval ĠtextView Over Ġ= ĠTextView I mdb ( context ). apply Ġ{ ĊĠĠĠĠĠĠĠ Ġtext Ġ= Ġ"/ 1 0 " ĊĠĠĠĠĠĠĠ Ġset TextColor ( Color . GRAY ) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ Ġlayout Params Ġ= ĠLayout Params ( LayoutParams . MATCH _ PARENT , ĠLayout Params . WRAP _ CONTENT ) ĊĊĠĠĠĠĠĠĠ Ġsetup Sub views () ĊĠĠĠĠĠĠĠ Ġset Constraints () ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġprivate Ġfun Ġsetup Sub views () Ġ{ ĊĠĠĠĠĠĠĠ Ġadd View ( imageView I mdb ) ĊĠĠĠĠĠĠĠ Ġadd View ( imageView Star ) ĊĠĠĠĠĠĠĠ Ġadd View ( textView Point ) ĊĠĠĠĠĠĠĠ Ġadd View ( textView Over ) ĊĠĠĠĠĠĠĠ Ġadd View ( textView Date ) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġprivate Ġfun Ġset Constraints () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġspacing Ġ= Ġ 0 . 0 2 f . width Ratio ĊĊĠĠĠĠĠĠĠ Ġset . clone ( this ) ĊĊĠĠĠĠĠĠĠ Ġset . connect ( imageView I mdb . id , ĠConstraint Set . START , ĠConstraint Set . PARENT _ ID , ĠConstraint Set . START ) ĊĠĠĠĠĠĠĠ Ġset . connect ( imageView I mdb . id , ĠConstraint Set . TOP , ĠConstraint Set . PARENT _ ID , ĠConstraint Set . TOP , Ġspacing ) ĊĠĠĠĠĠĠĠ Ġset . connect ( imageView I mdb . id , ĠConstraint Set . BOTTOM , ĠConstraint Set . PARENT _ ID , ĠConstraint Set . BOTTOM , Ġspacing ) ĊĊĠĠĠĠĠĠĠ Ġset . connect ( imageView Star . id , ĠConstraint Set . START , ĠimageView I mdb . id , ĠConstraint Set . END , Ġspacing ) ĊĠĠĠĠĠĠĠ Ġset . center Vert ically ( imageView Star . id , ĠConstraint Set . PARENT _ ID ) ĊĊĠĠĠĠĠĠĠ Ġset . center Vert ically ( textView Point . id , ĠConstraint Set . PARENT _ ID ) ĊĠĠĠĠĠĠĠ Ġset . connect ( textView Point . id , ĠConstraint Set . START , ĠimageView Star . id , ĠConstraint Set . END , Ġspacing ) ĊĊĠĠĠĠĠĠĠ Ġset . center Vert ically ( textView Over . id , ĠConstraint Set . PARENT _ ID ) ĊĠĠĠĠĠĠĠ Ġset . connect ( textView Over . id , ĠConstraint Set . START , ĠtextView Point . id , ĠConstraint Set . END ) ĊĊĠĠĠĠĠĠĠ Ġset . center Vert ically ( textView Date . id , ĠConstraint Set . PARENT _ ID ) ĊĠĠĠĠĠĠĠ Ġset . connect ( textView Date . id , ĠConstraint Set . START , ĠtextView Over . id , ĠConstraint Set . END , Ġ 2 Ġ* Ġspacing ) ĊĊĠĠĠĠĠĠĠ Ġset . apply To ( this ) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġoverride Ġval Ġsuper View : ĠDetail Layout Ġget () Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġparent . parent . parent Ġas ĠDetail Layout ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġfun Ġbind Movie ( movie : ĠMovie ) Ġ{ ĊĠĠĠĠĠĠĠ ĠtextView Point . text Ġ= Ġ"${ movie . vote Average }" ĊĠĠĠĠĠĠĠ ĠtextView Date . text Ġ= Ġmovie . release Date ĊĠĠĠ Ġ} Ċ }