Merge pull request #11129 from osmandapp/wrong-recording-note

wrong recording note button is shown on profile change
This commit is contained in:
Vitaliy 2021-03-15 10:37:51 +02:00 committed by GitHub
commit fc5440120b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -777,19 +777,21 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
if (mapInfoLayer != null) {
recordControl = new TextInfoWidget(activity) {
private Integer cachedAction;
private Boolean cachedRecording;
@Override
public boolean updateInfo(DrawSettings drawSettings) {
boolean recording = isRecording();
if (!Algorithms.objectEquals(recording, cachedRecording)) {
Integer action = AV_DEFAULT_ACTION.get();
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);
Integer action = AV_DEFAULT_ACTION.get();
switch (action) {
case AV_DEFAULT_ACTION_VIDEO:
setIcons(R.drawable.widget_av_video_day, R.drawable.widget_av_video_night);
@ -807,7 +809,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
}
}
return false;
};
}
};
recordControl.setOnClickListener(new View.OnClickListener() {
@Override