@@ -85,19 +85,20 @@ class CodeView : RelativeLayout {
8585 /* *
8686 * Public getter for accessing view state.
8787 * It may be useful if code view state is unknown.
88- * If code view was built rhis is not safe to use operations chaining.
88+ * If code view was built it is not safe to use operations chaining.
8989 */
9090 fun getState () = state
9191
9292 /* *
93- * Accessor/mutator to reduce frequently used actions
93+ * Accessor/mutator to reduce frequently used actions.
9494 */
9595 var adapter: CodeContentAdapter
9696 get() {
9797 return rvCodeContent.adapter as CodeContentAdapter
9898 }
9999 set(adapter) {
100100 rvCodeContent.adapter = adapter
101+ state = ViewState .PRESENTED
101102 }
102103
103104 // - Build processor
@@ -122,7 +123,7 @@ class CodeView : RelativeLayout {
122123 }
123124
124125 /* *
125- * Process build tasks queue to build view
126+ * Process build tasks queue to build view.
126127 */
127128 private fun processBuildTasks () {
128129 while (tasks.isNotEmpty())
@@ -172,6 +173,16 @@ class CodeView : RelativeLayout {
172173 adapter.codeListener = listener
173174 }
174175
176+ /* *
177+ * Control shadows visibility to provide more sensitive UI.
178+ */
179+ fun setShadowsVisible (isVisible : Boolean = true) = addTask {
180+ val visibility = if (isVisible) View .VISIBLE else GONE
181+ vShadowRight.visibility = visibility
182+ vShadowBottomLine.visibility = visibility
183+ vShadowBottomContent.visibility = visibility
184+ }
185+
175186 /* *
176187 * Update code content if view was built or, finally, build code view.
177188 */
@@ -205,7 +216,7 @@ class CodeView : RelativeLayout {
205216 Thread .delayed {
206217 rvCodeContent.adapter = CodeContentAdapter (context, content)
207218 processBuildTasks()
208- setupShortcutShadows ()
219+ setupShadows ()
209220 hidePlaceholder()
210221 state = ViewState .PRESENTED
211222 }
@@ -214,15 +225,10 @@ class CodeView : RelativeLayout {
214225 // - Setup actions
215226
216227 /* *
217- * Border shadows will shown if presented listing shortcut .
218- * It helps user to what parts of content are scrolled & hidden.
228+ * Border shadows will shown if presented full code listing .
229+ * It helps user to see what part of content are scrolled & hidden.
219230 */
220- private fun setupShortcutShadows () {
221- val visibility = if (adapter.isFullShowing) GONE else VISIBLE
222- vShadowRight.visibility = visibility
223- vShadowBottomLine.visibility = visibility
224- vShadowBottomContent.visibility = visibility
225- }
231+ private fun setupShadows () = setShadowsVisible(! adapter.isFullShowing)
226232
227233 /* *
228234 * Placeholder fills space at start and stretched to marked up view size
0 commit comments