Edward Wong
Edward Wong
I think the similar to what @dovahkiin98 suggest, the same can be done to `OnGestureListener`
I usually use IntenFilter with Boardcast receiver to observe network state changes, but I rarely need to add multiple actions to a single IntentFilter
Recently found one use case of multiple action in one IntentFilter, which is when you need to use the WifiP2P features. Seems like this extension is kind of useful.
``` val receiver = WifiP2PBoardcastReceiver(...) fun onResume() { super.onResume() val filter = IntentFilter().apply { addAction(WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION) addAction(WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION) addAction(WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION) addAction(WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION) } registerReceiver(p2pReceiver, filter) } ``` I don't know if there is a...
Then a set of builder-like extension function could be better? For example in `Anko`, you can have `val intent = Intent().newTask().clearTask()`. Although something similar for `IntentFilter` could be too much...
I usually have `View.showKeyboard()` instead of `Context.showKeyboard(view)` in my projects
``` Window.setFullScreen(): Window = this.apply { decorView.systemUiVisibility = decorView.systemUiVisibility or View.SYSTEM_UI_FLAG_FULLSCREEN } ``` This approach allows chaining of flag application
It is because your Success class takes the raw Response.data as its member. I will make the Success class into a Generic class Success, where T is your data's actual...
Instead of `Success`, try `Success`?