Skip to content
This repository has been archived by the owner on Jul 13, 2020. It is now read-only.

Commit

Permalink
Fix test data
Browse files Browse the repository at this point in the history
  • Loading branch information
yanex committed May 29, 2015
1 parent 51afc52 commit 2e113e0
Show file tree
Hide file tree
Showing 13 changed files with 871 additions and 753 deletions.
2 changes: 1 addition & 1 deletion dsl/src/org/jetbrains/android/anko/Renderer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ class Renderer(private val generator: Generator) : Configurable(generator.config
line("override fun ${method.name}($arguments) = _$varName?.invoke($argumentNames)$returnDefaultValue").nl()
line("public fun ${method.name}(listener: ($argumentTypes) -> ${method.returnType}) {")
line("_$varName = listener")
line("}").nl()
line("}")
}.getLines()
}

Expand Down
26 changes: 26 additions & 0 deletions dsl/testData/functional/15/ComplexListenerClassTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,25 @@ class __GestureOverlayView_OnGestureListener : android.gesture.GestureOverlayVie
public fun onGestureStarted(listener: (android.gesture.GestureOverlayView?, android.view.MotionEvent?) -> Unit) {
_onGestureStarted = listener
}

override fun onGesture(overlay: android.gesture.GestureOverlayView?, event: android.view.MotionEvent?) = _onGesture?.invoke(overlay, event)

public fun onGesture(listener: (android.gesture.GestureOverlayView?, android.view.MotionEvent?) -> Unit) {
_onGesture = listener
}

override fun onGestureEnded(overlay: android.gesture.GestureOverlayView?, event: android.view.MotionEvent?) = _onGestureEnded?.invoke(overlay, event)

public fun onGestureEnded(listener: (android.gesture.GestureOverlayView?, android.view.MotionEvent?) -> Unit) {
_onGestureEnded = listener
}

override fun onGestureCancelled(overlay: android.gesture.GestureOverlayView?, event: android.view.MotionEvent?) = _onGestureCancelled?.invoke(overlay, event)

public fun onGestureCancelled(listener: (android.gesture.GestureOverlayView?, android.view.MotionEvent?) -> Unit) {
_onGestureCancelled = listener
}

}

class __GestureOverlayView_OnGesturingListener : android.gesture.GestureOverlayView.OnGesturingListener {
Expand All @@ -35,11 +39,13 @@ class __GestureOverlayView_OnGesturingListener : android.gesture.GestureOverlayV
public fun onGesturingStarted(listener: (android.gesture.GestureOverlayView?) -> Unit) {
_onGesturingStarted = listener
}

override fun onGesturingEnded(overlay: android.gesture.GestureOverlayView?) = _onGesturingEnded?.invoke(overlay)

public fun onGesturingEnded(listener: (android.gesture.GestureOverlayView?) -> Unit) {
_onGesturingEnded = listener
}

}

class __View_OnAttachStateChangeListener : android.view.View.OnAttachStateChangeListener {
Expand All @@ -51,11 +57,13 @@ class __View_OnAttachStateChangeListener : android.view.View.OnAttachStateChange
public fun onViewAttachedToWindow(listener: (android.view.View) -> Unit) {
_onViewAttachedToWindow = listener
}

override fun onViewDetachedFromWindow(v: android.view.View) = _onViewDetachedFromWindow?.invoke(v)

public fun onViewDetachedFromWindow(listener: (android.view.View) -> Unit) {
_onViewDetachedFromWindow = listener
}

}

class __ViewGroup_OnHierarchyChangeListener : android.view.ViewGroup.OnHierarchyChangeListener {
Expand All @@ -67,11 +75,13 @@ class __ViewGroup_OnHierarchyChangeListener : android.view.ViewGroup.OnHierarchy
public fun onChildViewAdded(listener: (android.view.View?, android.view.View?) -> Unit) {
_onChildViewAdded = listener
}

override fun onChildViewRemoved(parent: android.view.View?, child: android.view.View?) = _onChildViewRemoved?.invoke(parent, child)

public fun onChildViewRemoved(listener: (android.view.View?, android.view.View?) -> Unit) {
_onChildViewRemoved = listener
}

}

class __AbsListView_OnScrollListener : android.widget.AbsListView.OnScrollListener {
Expand All @@ -83,11 +93,13 @@ class __AbsListView_OnScrollListener : android.widget.AbsListView.OnScrollListen
public fun onScrollStateChanged(listener: (android.widget.AbsListView?, Int) -> Unit) {
_onScrollStateChanged = listener
}

override fun onScroll(view: android.widget.AbsListView, firstVisibleItem: Int, visibleItemCount: Int, totalItemCount: Int) = _onScroll?.invoke(view, firstVisibleItem, visibleItemCount, totalItemCount)

public fun onScroll(listener: (android.widget.AbsListView, Int, Int, Int) -> Unit) {
_onScroll = listener
}

}

class __AdapterView_OnItemSelectedListener : android.widget.AdapterView.OnItemSelectedListener {
Expand All @@ -99,11 +111,13 @@ class __AdapterView_OnItemSelectedListener : android.widget.AdapterView.OnItemSe
public fun onItemSelected(listener: (android.widget.AdapterView<*>?, android.view.View?, Int, Long) -> Unit) {
_onItemSelected = listener
}

override fun onNothingSelected(p0: android.widget.AdapterView<*>?) = _onNothingSelected?.invoke(p0)

public fun onNothingSelected(listener: (android.widget.AdapterView<*>?) -> Unit) {
_onNothingSelected = listener
}

}

class __SearchView_OnQueryTextListener : android.widget.SearchView.OnQueryTextListener {
Expand All @@ -115,11 +129,13 @@ class __SearchView_OnQueryTextListener : android.widget.SearchView.OnQueryTextLi
public fun onQueryTextSubmit(listener: (String?) -> Boolean) {
_onQueryTextSubmit = listener
}

override fun onQueryTextChange(newText: String?) = _onQueryTextChange?.invoke(newText) ?: false

public fun onQueryTextChange(listener: (String?) -> Boolean) {
_onQueryTextChange = listener
}

}

class __SearchView_OnSuggestionListener : android.widget.SearchView.OnSuggestionListener {
Expand All @@ -131,11 +147,13 @@ class __SearchView_OnSuggestionListener : android.widget.SearchView.OnSuggestion
public fun onSuggestionSelect(listener: (Int) -> Boolean) {
_onSuggestionSelect = listener
}

override fun onSuggestionClick(position: Int) = _onSuggestionClick?.invoke(position) ?: false

public fun onSuggestionClick(listener: (Int) -> Boolean) {
_onSuggestionClick = listener
}

}

class __SeekBar_OnSeekBarChangeListener : android.widget.SeekBar.OnSeekBarChangeListener {
Expand All @@ -148,16 +166,19 @@ class __SeekBar_OnSeekBarChangeListener : android.widget.SeekBar.OnSeekBarChange
public fun onProgressChanged(listener: (android.widget.SeekBar, Int, Boolean) -> Unit) {
_onProgressChanged = listener
}

override fun onStartTrackingTouch(seekBar: android.widget.SeekBar?) = _onStartTrackingTouch?.invoke(seekBar)

public fun onStartTrackingTouch(listener: (android.widget.SeekBar?) -> Unit) {
_onStartTrackingTouch = listener
}

override fun onStopTrackingTouch(seekBar: android.widget.SeekBar) = _onStopTrackingTouch?.invoke(seekBar)

public fun onStopTrackingTouch(listener: (android.widget.SeekBar) -> Unit) {
_onStopTrackingTouch = listener
}

}

class __SlidingDrawer_OnDrawerScrollListener : android.widget.SlidingDrawer.OnDrawerScrollListener {
Expand All @@ -169,11 +190,13 @@ class __SlidingDrawer_OnDrawerScrollListener : android.widget.SlidingDrawer.OnDr
public fun onScrollStarted(listener: () -> Unit) {
_onScrollStarted = listener
}

override fun onScrollEnded() = _onScrollEnded?.invoke()

public fun onScrollEnded(listener: () -> Unit) {
_onScrollEnded = listener
}

}

class __TextWatcher : android.text.TextWatcher {
Expand All @@ -186,15 +209,18 @@ class __TextWatcher : android.text.TextWatcher {
public fun beforeTextChanged(listener: (CharSequence?, Int, Int, Int) -> Unit) {
_beforeTextChanged = listener
}

override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) = _onTextChanged?.invoke(s, start, before, count)

public fun onTextChanged(listener: (CharSequence, Int, Int, Int) -> Unit) {
_onTextChanged = listener
}

override fun afterTextChanged(s: android.text.Editable?) = _afterTextChanged?.invoke(s)

public fun afterTextChanged(listener: (android.text.Editable?) -> Unit) {
_afterTextChanged = listener
}

}

Loading

0 comments on commit 2e113e0

Please sign in to comment.