* DialogAPI Improvements / Enhancements
* New Widgets: Date, Time, Spinner, Text-To-Speech, Confirmation
* Results are returned as JSON including code of button pressed
* Fix typo
* Add BottomSheet InputMethod type
* Change DialogActivity to AppCompatActivity
* Add support library dependency to gradle
* Change theme to be compatible with AppCompatActivity
* Refactor getSpinnerItems to getInputValues so BottomSheet can use
as well
* Add Radio InputMethod
* Better touch outside dialog cancellation behavior
* Prevent speech InputMethod from being cancelled on touch outside
* Add Counter InputMethod
* Add CheckBox InputMethod
* Change FrameLayout to be NestedScrollView to handle scrolling
large dialogs as necessary
* Add custom range for CounterInputMethod
* Set text for ConfirmInputMethod
* Add numeric option / other minor tweaks
* change password type to a boolean option instead of string
* allow multiline password (text only not numeric)
* Allow text hint to be set for SpeechInputMethod
From Android Studio lint:
On versions prior to Android N (24), initializing the WifiManager via
Context#getSystemService can cause a memory leak if the context is not
the application context.
In many cases, it's not obvious from the code where the Context is coming
from (e.g. it might be a parameter to a method, or a field initialized
from various method calls). It's possible that the context being passed in
is the application context, but to be on the safe side, you should consider
changing context.getSystemService(...) to
context.getApplicationContext().getSystemService(...).
Due to https://issuetracker.google.com/issues/37060483:
WifiManager#getScanResults() returns an empty array list
if GPS is turned off
the user needs to enable Location on the device for termux-wifi-scaninfo
to work. So show "Location needs to be enabled on the device" if necessary.
* MediaPlayerAPI: revert commit 299d557
The error message won't be displayed anyway:
$ touch empty
$ dd if=/dev/urandom of=random count=2048
2048+0 records in
2048+0 records out
1048576 bytes (1.0MB) copied, 0.190185 seconds, 5.3MB/s
$ termux-media-player play empty
setDataSourceFD failed.: status=0x80000000
$ termux-media-player play random
Prepare failed.: status=0x1
$
* MediaPlayerAPI: catch NullPointerException for -a play
* MediaPlayerAPI: use getCanonicalPath() instead
* MediaPlayerAPI: use proper values for setVolume()
* MediaPlayerAPI: fix play and stop from pause
* MediaPlayerAPI: add trackName for info and resume
Suggested by Auxilus (#162)
There are several changes in the commit:
1. Use instance methods to get sample rate and buffer size info
on Android N or above only instead of Android M, since both
AudioAttributes.FLAG_LOW_LATENCY (256) and the implicitly used
AudioFormat.SAMPLE_RATE_UNSPECIFIED (0) are available only since
API 24 (N).
2. Use setPerformanceMode() on Android O, as FLAG_LOW_LATENCY is
deprecated since API 26 (O).
3. Create AudioTrack instance of both the fast (LOW_LATENCY) and
deep buffer (POWER_SAVING) mixer path. The two paths can be using
different subdevices on different rate and buffer size (or same
subdevice on same rate but different buffer size). For example on
my phone:
AUDIOTRACK_SAMPLE_RATE: 192000
AUDIOTRACK_BUFFER_SIZE_IN_FRAMES: 23046
AUDIOTRACK_SAMPLE_RATE_LOW_LATENCY: 48000
AUDIOTRACK_BUFFER_SIZE_IN_FRAMES_LOW_LATENCY: 192
4. Get info on sample rate with the getNativeOutputSampleRate()
static method (static in Java's sense; the value is still sink-
based) on builds older than N only. The rate appears to be of the
fast (LOW_LATENCY) mixer path if it is available.
5. A note on the static method getMinBufferSize(). The reason it
is not used even for older devices is, it returns buffer size info
of the deep buffer (POWER_SAVING) mixer path, while NOSR is the
rate of the fast (LOW_LATENCY) mixer path, so the value we can get
with it is not always sensical.