blob: 871e9c2799332c7aceca5c38b15836cb468f2d86 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
package de.danoeh.antennapod.activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import java.util.concurrent.atomic.AtomicBoolean;
import de.danoeh.antennapod.core.service.playback.PlaybackService;
/**
* Activity for controlling the remote playback on a Cast device.
*/
public class CastplayerActivity extends MediaplayerInfoActivity {
private static final String TAG = "CastPlayerActivity";
private final AtomicBoolean isSetup = new AtomicBoolean(false);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!PlaybackService.isCasting()) {
Intent intent = PlaybackService.getPlayerActivityIntent(this);
if (!intent.getComponent().getClassName().equals(CastplayerActivity.class.getName())) {
finish();
startActivity(intent);
}
}
}
@Override
protected void onReloadNotification(int notificationCode) {
if (notificationCode == PlaybackService.EXTRA_CODE_AUDIO) {
Log.d(TAG, "ReloadNotification received, switching to Audioplayer now");
saveCurrentFragment();
finish();
startActivity(new Intent(this, AudioplayerActivity.class));
} else {
super.onReloadNotification(notificationCode);
}
}
@Override
protected void setupGUI() {
if(isSetup.getAndSet(true)) {
return;
}
super.setupGUI();
if (butPlaybackSpeed != null) {
butPlaybackSpeed.setVisibility(View.GONE);
}
// if (butCastDisconnect != null) {
// butCastDisconnect.setOnClickListener(v -> castManager.disconnect());
// butCastDisconnect.setVisibility(View.VISIBLE);
// }
}
@Override
protected void onResume() {
if (!PlaybackService.isCasting()) {
Intent intent = PlaybackService.getPlayerActivityIntent(this);
if (!intent.getComponent().getClassName().equals(CastplayerActivity.class.getName())) {
saveCurrentFragment();
finish();
startActivity(intent);
}
}
super.onResume();
}
@Override
protected void onBufferStart() {
//sbPosition.setIndeterminate(true);
sbPosition.setEnabled(false);
}
@Override
protected void onBufferEnd() {
//sbPosition.setIndeterminate(false);
sbPosition.setEnabled(true);
}
}
|