|
|
# Práca so zoznamami
|
|
|
# TODO nazov
|
|
|
|
|
|
## Hra
|
|
|
|
|
|
### 1. Dotyk obrazovky
|
|
|
|
|
|
- Spravte layout, ktorý bude obsahovať _TextView_ s nápisom Welcome.
|
|
|
- Layoutu nastavíme _setOnTouchListener__:
|
|
|
|
|
|
```java
|
|
|
/**
|
|
|
* Interface definition for a callback to be invoked when a touch event is
|
|
|
* dispatched to this view. The callback will be invoked before the touch
|
|
|
* event is given to the view.
|
|
|
*/
|
|
|
public interface OnTouchListener {
|
|
|
/**
|
|
|
* Called when a touch event is dispatched to a view. This allows listeners to
|
|
|
* get a chance to respond before the target view.
|
|
|
*
|
|
|
* @param v The view the touch event has been dispatched to.
|
|
|
* @param event The MotionEvent object containing full information about
|
|
|
* the event.
|
|
|
* @return True if the listener has consumed the event, false otherwise.
|
|
|
*/
|
|
|
boolean onTouch(View v, MotionEvent event);
|
|
|
}
|
|
|
```
|
|
|
|
|
|
- _View_ nás nezaujíma, dôležitý je _MotionEvent_, konkrétne _MotionEvent.ACTION_DOWN_ (dal som prst na obrazovku)
|
|
|
- Pri každom dotyku nastavím text na `"[${event.x}, ${event.y}]"`
|
|
|
|
|
|
### 2. Fullscreen
|
|
|
|
|
|
Sakra, zavazdia vrchná časť, tzv. _ActonBar_: _res/values/styles_:
|
|
|
```xml
|
|
|
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
|
|
<!-- Replace with -->
|
|
|
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
|
|
```
|
|
|
|
|
|
[Skryjeme spodné tlačítka a nastavíme fullscreen mód](https://developer.android.com/training/system-ui/navigation):
|
|
|
|
|
|
```
|
|
|
window.decorView.apply {
|
|
|
systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_FULLSCREEN
|
|
|
}
|
|
|
```
|
|
|
|
|
|
### 3. Zobrazenie kruhu
|
|
|
|
|
|
- https://book.droidboy.cz/4-seznamy.html |
|
|
\ No newline at end of file |