Skip to content

Commit afdfbe0

Browse files
authored
refactor: use lambda instead of Runnable (#107)
1 parent 066d2bc commit afdfbe0

File tree

1 file changed

+3
-29
lines changed

1 file changed

+3
-29
lines changed

Diff for: android/src/main/java/com/getcapacitor/community/audio/NativeAudio.java

+3-29
Original file line numberDiff line numberDiff line change
@@ -123,29 +123,12 @@ public void configure(PluginCall call) {
123123

124124
@PluginMethod
125125
public void preload(final PluginCall call) {
126-
new Thread(
127-
new Runnable() {
128-
@Override
129-
public void run() {
130-
preloadAsset(call);
131-
}
132-
}
133-
)
134-
.start();
126+
new Thread(() -> preloadAsset(call)).start();
135127
}
136128

137129
@PluginMethod
138130
public void play(final PluginCall call) {
139-
getBridge()
140-
.getActivity()
141-
.runOnUiThread(
142-
new Runnable() {
143-
@Override
144-
public void run() {
145-
playOrLoop("play", call);
146-
}
147-
}
148-
);
131+
getBridge().getActivity().runOnUiThread(() -> playOrLoop("play", call));
149132
}
150133

151134
@PluginMethod
@@ -200,16 +183,7 @@ public void getDuration(final PluginCall call) {
200183

201184
@PluginMethod
202185
public void loop(final PluginCall call) {
203-
getBridge()
204-
.getActivity()
205-
.runOnUiThread(
206-
new Runnable() {
207-
@Override
208-
public void run() {
209-
playOrLoop("loop", call);
210-
}
211-
}
212-
);
186+
getBridge().getActivity().runOnUiThread(() -> playOrLoop("loop", call));
213187
}
214188

215189
@PluginMethod

0 commit comments

Comments
 (0)