1
0
mirror of https://github.com/danog/termux-api.git synced 2024-12-12 09:29:46 +01:00
Commit Graph

214 Commits

Author SHA1 Message Date
Nenad Ilic
8ae61a3e33 Revert the Dialog Activity to FLAG_ACTIVITY_NEW_TASK
The fix relates to issue #228
2019-02-05 22:52:06 +01:00
Fredrik Fornwall
7631220fc1 Bump version to 0.30 2019-01-25 02:43:24 +01:00
饺子w
3cf36400e2 add brightness mode (#234) 2019-01-25 01:08:40 +01:00
tomty89
3bfb11fe0f MicRecoderAPI: a few enhancements (#248)
* MicRecorderAPI: allow duration limit to be disabled with zero or negative

* MicRecorderAPI: avoid unnecessary MediaRecorder parameter in RecorderCommandHandler.handle()

* MicRecorderAPI: allow encoder and format to be set by user

All supported encoders can be set with their names. Unless a format
is set explicitly with its corresponding integer, a suitable format
would be chosen automatically for the chosen encoder.

* MicRecorderAPI: allow AudioSource to be set by user

Just in case, so it can only be set with the source's corresponding
integer.

* MicRecorderAPI: allow bit rate, sampling rate and number of channels to be set by user

* MicRecorderAPI: a couple of fixes

Have year before month and day in the default file name for better
sorting. Also fix the extension name in it for automatic format
selection. As we want the file to have extension name by default,
we have to pick a default format/encoder. AAC is chosen because it
is probably the most compatible one among different platforms.

* MicRecorderAPI: replace all getAbsoluteFile() with getAbsolutePath()

None of them were used in places where it should be a File.

* MicRecorderAPI: properly report unlimited MaxDuration

* MicRecorderAPI: make sure the recorder is released when not used

* MicRecorderAPI: remove aac_eld/he_aac/vorbis support

They are at least problematic on my phone. They either fail to work
or crash the API app. Sometimes the crash is even unrecoverable.
2019-01-25 01:07:53 +01:00
Fredrik Fornwall
8b33bba7dc Bump version to 0.29 2019-01-10 23:59:20 +01:00
Fredrik Fornwall
7cbf86407b Use vector icon 2019-01-10 23:58:06 +01:00
Fredrik Fornwall
515ada5a6a Update android design support library 2019-01-10 23:57:58 +01:00
Ben Moran
d3e9f14d23 Add JobSchedulerAPI (#235) 2019-01-03 02:06:19 +01:00
Fredrik Fornwall
7462684498 Bump version to 0.28 2018-09-27 21:29:50 +02:00
Kaan Karaagacli
e3a02a5a85 Add KeystoreAPI (#224) 2018-09-27 20:16:53 +02:00
Fredrik Fornwall
033e4dfdd2 Cleanup some Android Studio lint warnings 2018-08-28 03:00:48 +02:00
Fredrik Fornwall
75c48ad6d5 Do not trim input when setting clipboard content
See #195.
2018-08-28 02:59:57 +02:00
Fredrik Fornwall
6b7b98179b Remove unused imports 2018-08-27 22:05:13 +02:00
Kieran Coldron
9c6f99df8e Notification Improvements (#209)
* Persistent notifications and disable alerts on edits

* Add images, add media style, refactor PendingIntent code

* Make styletype check null safe
2018-08-26 01:33:46 +02:00
Kieran Coldron
82bc794826 Added values array and indexs (#212)
Add index of values


Added index for other dialogs
2018-08-26 01:32:34 +02:00
Fredrik Fornwall
3eea604ff9 Remove outdated comment 2018-08-26 01:31:13 +02:00
Fredrik Fornwall
043d69bb7b Compile for and target android-28 2018-08-26 01:19:05 +02:00
Greg Burch
297a752eb8 Changed provider to scope to all messages. (#214)
* Changed provider to scope to all messages. Future update should be able to provide a flag on which scope the user would like to request. All, Sent, Draft, Inbox, Outbox

* Add ability to specify the type of message to query for
2018-08-26 01:14:12 +02:00
Kieran Coldron
9192c60088 Add date format option (#203) 2018-08-26 01:13:32 +02:00
Fredrik Fornwall
6906960c20 Bump version to 0.27 2018-08-26 01:05:27 +02:00
Kieran Coldron
f29350a842 NotificationList API (#210) 2018-08-26 00:56:15 +02:00
Sean Fern
5b3f31bf14 Print clipboard text without appending a newline (#213)
Pasting in vim/neovim is busted when termux-clipboard-get appends a newline to the clipboard text.
2018-08-26 00:49:16 +02:00
Fredrik Fornwall
c7841ee515 Bump version to 0.26 2018-07-26 13:02:22 +02:00
cvirostek
da5b9111d0 Fix scenario causing termux-dialog to hang (#200)
If termux-dialog is called while Termux already has a dialog open, the new dialog fails to open and the command will hang until it is manually terminated. This fix allows multiple dialogs to be open at once, ensuring that termux-dialog will not hang.
2018-07-26 13:00:27 +02:00
David Kramer
fc8daead89 Fix intermittent scroll not working in BottomSheet (#192) 2018-07-26 13:00:20 +02:00
David Kramer
ec2c1efc58 Add limit option for SensorAPI (#190) 2018-06-26 10:57:24 +02:00
David Kramer
ead4893285 Add legacy support to TorchAPI for Pre-Marshmallow devices / fix crash (#189) 2018-06-26 10:57:04 +02:00
Fredrik Fornwall
ad111f549a Bump version to 0.25 2018-06-24 01:34:48 +02:00
tomty89
0da7e68c10 AudioAPI: a few updates (#184)
* AudioAPI: simplify code

* AudioAPI: remove volume info

Redundunt with the introduction of VolumeAPI

* AudioAPI: remove PROPERTY_SUPPORT_AUDIO_SOURCE_UNPROCESSED

It does not seem to have a point for us to get this property as
it is not very clear what it actually reflects.

We have not been getting PROPERTY_SUPPORT_MIC_NEAR_ULTRASOUND and
PROPERTY_SUPPORT_SPEAKER_NEAR_ULTRASOUND either.

In fact, properties from getProperty() tend to be rather useless.
PROPERTY_OUTPUT_FRAMES_PER_BUFFER and PROPERTY_OUTPUT_SAMPLE_RATE
are kept only to show that, they should NOT be used to optimize
any player in audio output, as they do not change as per the
current sink, not like the values from the AudioTrack methods do.

* AudioAPI: order output

* AudioAPI: check info in PERFORMANCE_MODE_POWER_SAVING

When setPerformanceMode was introduced in Android O, it was
introduced with three possible modes, namely:

PERFORMANCE_MODE_NONE (default)
PERFORMANCE_MODE_LOW_LATENCY
PERFORMANCE_MODE_POWER_SAVING

While PERFORMANCE_MODE_NONE essentially causes tracks to be routed
to the deep buffer mixer path on my phone (as
PERFORMANCE_MODE_POWER_SAVING does), it may not be the case on
every single device.

Therefore, check info with track in PERFORMANCE_MODE_POWER_SAVING,
compare it against that of the default PERFORMANCE_MODE_NONE, and
print it out if they are not the same.

Note: shouldEnablePowerSaving for PERFORMANCE_MODE_NONE always
returns false for SAMPLE_RATE_UNSPECIFIED as of the current
AudioTrack.java.
2018-06-24 01:33:46 +02:00
David Kramer
dc8a7157b5 Fix bottom sheet not scrolling for large value list (#187) 2018-06-24 01:31:52 +02:00
David Kramer
10733fb0f6 Allow toast color / gravity to be changed (#186) 2018-06-24 01:31:33 +02:00
David Kramer
c4fbbf1bf2 DialogAPI Improvements / Enhancements (#172)
* 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
2018-06-22 00:25:47 +02:00
Fredrik Fornwall
a96abbbe14 Bump version to 0.24 2018-06-15 00:44:14 +02:00
David Kramer
04b76c4b58 Add missing 'break' in TermuxApiReceiver to prevent fallthrough to Clipboard from CallLog (#183) 2018-06-15 00:43:07 +02:00
Fredrik Fornwall
8250000e56 Guard against possible leak pre android-24
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(...).
2018-06-15 00:00:15 +02:00
Fredrik Fornwall
905650d8ad Bump version to 0.23 2018-06-14 23:59:06 +02:00
Fredrik Fornwall
6af4751d6e Minor cleanups 2018-06-14 23:58:11 +02:00
Fredrik Fornwall
6db81bfb7a Check platform level before accessing field 2018-06-14 23:57:08 +02:00
Cem
1689cfec08 Wifi API additions (#177)
* Added Wifi turn on/off methods

* Added Wifi toggle method
2018-06-14 23:42:53 +02:00
David Kramer
875d6ec4d5 Add BrightnessAPI (#180) 2018-06-14 23:41:50 +02:00
David Kramer
dbf3e5dba2 Reset postedResult flag when resetFingerprintResult is called 2018-06-14 23:39:40 +02:00
David Kramer
6ba6b841fb Add FingerprintAPI 2018-06-14 23:39:40 +02:00
David Kramer
b4475c5d12 Add VolumeAPI 2018-06-14 23:37:52 +02:00
Fredrik Fornwall
4dd189507c Bump version to 0.22 2018-06-06 01:12:28 +02:00
Fredrik Fornwall
de8d68a64e termux-wifi-scaninfo needs Location enabled
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.
2018-06-06 01:09:27 +02:00
David Kramer
0ead304e4b Add CallLogAPI (#170) 2018-06-06 00:20:40 +02:00
Fredrik Fornwall
9bf693380d Show which permissions are required 2018-06-06 00:20:09 +02:00
Auxilus
c179e18d99 Update TermuxApiPermissionActivity.java (#109) 2018-06-06 00:10:19 +02:00
David Kramer
05ed7b750b Fix possible crash in SensorAPI due to null command (#171) 2018-06-06 00:06:11 +02:00
Cem
30b21b2fe2 Added 'data_enabled' and 'sim_subscriber_id' fields to 'termux-telephony-deviceinfo' (#175) 2018-06-06 00:04:36 +02:00
Cem
4de411b720 Fixed notifications not displaying on Oreo (#173) 2018-06-05 23:14:11 +02:00
Fredrik Fornwall
50230df060 Bump version from 0.20 to 0.21 2018-04-12 01:38:29 +02:00
tomty89
6b5122c2ba MediaPlayerAPI: Some more minor improvements (#160)
* 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)
2018-04-12 01:36:41 +02:00
David Kramer
fa9373ab1e Fix possible crash in NotificationAPI from invalid LED color value (#164) 2018-04-12 01:21:06 +02:00
Fredrik Fornwall
19acd1d54a Bump version from 0.19 to 0.20 2018-04-09 01:12:53 +02:00
David Kramer
efcafdf579 Fixes incorrect error message being displayed when playing track / (#157)
possible crash when playing another track after other finished
2018-04-09 01:04:45 +02:00
David Kramer
0aeb960680 Add MicRecorderAPI (#158) 2018-04-09 01:04:37 +02:00
David Kramer
e7fa1d2498 Add WallpaperAPI 2018-04-09 01:03:10 +02:00
Fredrik Fornwall
56b5e9a935 Bump version from 0.18 to 0.19 2018-04-07 01:54:10 +02:00
landfillbaby
d4660a3ce9 MediaPlayerApi playHandler: prepare synchronously, don't always print failure
the isPlaying() call was completing before the prepareAsync() call, always returning "Failed to play: "
2018-04-07 01:53:26 +02:00
Fredrik Fornwall
a5b2a01d96 Bump version from 0.17 to 0.18 2018-04-07 00:42:31 +02:00
Tom Yan
34c6841a05 AudioAPI: updates for AudioTrack methods
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.
2018-04-07 00:41:37 +02:00
Tom Yan
299d55789b MediaPlayerAPI: check whether playback has been successfully started 2018-04-07 00:38:55 +02:00
Tom Yan
7bdd53008a MediaPlayerAPI: eliminate pointless toUpperCase()
Fixes #154.
2018-04-07 00:38:55 +02:00
Tom Yan
9c104aac36 MediaPlayerAPI: prevent NullPointerException
Fixes #154.
2018-04-07 00:38:55 +02:00
Tom Yan
1be62a5c91 MediaPlayerAPI: remove extension pattern check
There are way more possibilities and extension doesn't guarantee
anything about the file.
2018-04-07 00:38:55 +02:00
David Kramer
89e2b1ed95 Add MediaPlayerAPI (#146) 2018-04-02 01:27:13 +02:00
Fredrik Fornwall
bf9577e23a Bump version to 0.17 2018-04-02 00:59:10 +02:00
Fredrik Fornwall
b7cc2a3dd1 Update gradle configuration 2018-04-02 00:58:32 +02:00
Fredrik Fornwall
efc06c4a32 Remove unused import 2018-04-02 00:55:13 +02:00
David Kramer
eab70c318f Add SensorAPI (#147) 2018-04-02 00:51:14 +02:00
tomty89
11b84d9f9c AudioAPI: fix build-time error (#145) 2018-04-02 00:49:35 +02:00
tomty89
9552c418ba AudioAPI: avoid redundant code (#134) 2018-03-23 00:41:42 +01:00
David Kramer
91b8ed4249 Adds TorchAPI implementation (#137) 2018-03-23 00:22:43 +01:00
Fredrik Fornwall
adfc184011 Fix typo 2018-02-05 01:03:35 +01:00
Fredrik Fornwall
46201ae981 Bump version to 0.16 2018-02-05 01:01:03 +01:00
Fredrik Fornwall
1f3eee8e2e Format code 2018-02-05 00:53:01 +01:00
its-pointless
7d54c4d629 Update Audiotrack API (#129) 2018-02-05 00:46:01 +01:00
Ian Brunelli
32c2781664 Add MediaScannerAPI (#123) 2018-02-05 00:41:27 +01:00
Fredrik Fornwall
720daae952 Update build tools version 2018-02-01 22:23:12 +01:00
its-pointless
a544de8c1b gets info for fast_mixer (#126) 2018-02-01 22:22:07 +01:00
Fredrik Fornwall
d57169a97a Update gradle configuration 2017-11-26 23:27:07 +01:00
Fredrik Fornwall
bace70c37d Update gradle configuration 2017-10-31 19:26:33 +01:00
Fredrik Fornwall
21d6b973f9 Update gradle configuration 2017-09-24 22:54:15 +02:00
Fredrik Fornwall
e4bf7b94c0 Bump version to 0.15 2017-04-09 23:27:03 +02:00
Fredrik Fornwall
9e67ca2a57 termux-dialog: Make sure to close client 2017-04-09 23:26:12 +02:00
Fredrik Fornwall
ee5ed49fd7 Suport termux-telephony-call 2017-04-09 19:36:33 +02:00
Fredrik Fornwall
b72a223b4c termux-notification: Support --on-delete action
This makes it possible to act on the notification being dismissed.

Server side part of https://github.com/termux/termux-api/issues/81
2017-04-09 19:13:24 +02:00
Fredrik Fornwall
d4a91451cb Bump version to 0.14 2017-04-07 00:18:35 +02:00
Fredrik Fornwall
3e1bbea265 termux-dialog: Exit when back is pressed
This treats pressing the back button the same as pressing cancel.

Fixes #78.
2017-04-07 00:17:43 +02:00
Fredrik Fornwall
2c62ab229a Update gradle 2017-04-06 10:45:34 +02:00
Fredrik Fornwall
d6b176ccbb Bump version to 0.13 2017-02-20 03:23:49 +01:00
Fredrik Fornwall
341e5f395a Add comment about default tts audio stream 2017-02-20 02:03:48 +01:00
Alain Kalker
56b5a1257c termux-tts-speak: Use STREAM_MUSIC as default stream (#67)
This fixes #66.
2017-02-20 01:59:02 +01:00
Wetitpig
cff02a5614 Correct Typo (#57)
"Overhead" changed to "Overheat"
2017-01-26 07:54:19 +01:00
Fredrik Fornwall
3d2ff5fe60 Hack to make led work without vibrating
It seems that led coloring does not work without vibration. So if
the led color has been specified but not vibration, default to a
dummy vibrate={0}.
2017-01-10 00:39:52 +01:00
Fredrik Fornwall
25e6f00bef Bump version to 0.12 2017-01-06 02:16:05 +01:00
Fredrik Fornwall
adc9b4eccc Update the NotificationAPI 2017-01-05 03:47:52 +01:00
Fredrik Fornwall
fe51705dde Add WifiAPI 2017-01-05 03:46:46 +01:00
Fredrik Fornwall
79a2c03676 Update to new Termux icon 2017-01-05 02:33:20 +01:00