This commit is contained in:
androiddevkotlin 2021-03-15 10:36:28 +02:00
parent 7015e8d25b
commit a0ce545636

View file

@ -776,25 +776,36 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
MapInfoLayer mapInfoLayer = activity.getMapLayers().getMapInfoLayer();
if (mapInfoLayer != null) {
recordControl = new TextInfoWidget(activity) {
private Integer cachedAction;
private Boolean cachedRecording;
@Override
public boolean updateInfo(DrawSettings drawSettings) {
boolean recording = isRecording();
Integer action = AV_DEFAULT_ACTION.get();
boolean isVideoAction = action.equals(AV_DEFAULT_ACTION_VIDEO);
boolean isTakePictureAction = action.equals(AV_DEFAULT_ACTION_TAKEPICTURE);
boolean isAudioAction = action.equals(AV_DEFAULT_ACTION_AUDIO);
if (isRecording()) {
if (!Algorithms.objectEquals(recording, cachedAction) || !Algorithms.objectEquals(action, cachedRecording)) {
cachedAction = action;
cachedRecording = recording;
if (recording) {
setText(app.getString(R.string.shared_string_control_stop), null);
setIcons(R.drawable.widget_icon_av_active, R.drawable.widget_icon_av_active_night);
} else {
setText(app.getString(R.string.shared_string_control_start), null);
if (isVideoAction) {
switch (action) {
case AV_DEFAULT_ACTION_VIDEO:
setIcons(R.drawable.widget_av_video_day, R.drawable.widget_av_video_night);
} else if (isTakePictureAction) {
break;
case AV_DEFAULT_ACTION_TAKEPICTURE:
setIcons(R.drawable.widget_av_photo_day, R.drawable.widget_av_photo_night);
} else if (isAudioAction) {
break;
case AV_DEFAULT_ACTION_AUDIO:
setIcons(R.drawable.widget_av_audio_day, R.drawable.widget_av_audio_night);
} else {
break;
default:
setIcons(R.drawable.widget_icon_av_inactive_day, R.drawable.widget_icon_av_inactive_night);
break;
}
}
}
return false;