Review
This commit is contained in:
parent
7015e8d25b
commit
a0ce545636
1 changed files with 26 additions and 15 deletions
|
@ -776,25 +776,36 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
MapInfoLayer mapInfoLayer = activity.getMapLayers().getMapInfoLayer();
|
MapInfoLayer mapInfoLayer = activity.getMapLayers().getMapInfoLayer();
|
||||||
if (mapInfoLayer != null) {
|
if (mapInfoLayer != null) {
|
||||||
recordControl = new TextInfoWidget(activity) {
|
recordControl = new TextInfoWidget(activity) {
|
||||||
|
|
||||||
|
private Integer cachedAction;
|
||||||
|
private Boolean cachedRecording;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updateInfo(DrawSettings drawSettings) {
|
public boolean updateInfo(DrawSettings drawSettings) {
|
||||||
|
boolean recording = isRecording();
|
||||||
Integer action = AV_DEFAULT_ACTION.get();
|
Integer action = AV_DEFAULT_ACTION.get();
|
||||||
boolean isVideoAction = action.equals(AV_DEFAULT_ACTION_VIDEO);
|
if (!Algorithms.objectEquals(recording, cachedAction) || !Algorithms.objectEquals(action, cachedRecording)) {
|
||||||
boolean isTakePictureAction = action.equals(AV_DEFAULT_ACTION_TAKEPICTURE);
|
cachedAction = action;
|
||||||
boolean isAudioAction = action.equals(AV_DEFAULT_ACTION_AUDIO);
|
cachedRecording = recording;
|
||||||
if (isRecording()) {
|
if (recording) {
|
||||||
setText(app.getString(R.string.shared_string_control_stop), null);
|
setText(app.getString(R.string.shared_string_control_stop), null);
|
||||||
setIcons(R.drawable.widget_icon_av_active, R.drawable.widget_icon_av_active_night);
|
setIcons(R.drawable.widget_icon_av_active, R.drawable.widget_icon_av_active_night);
|
||||||
} else {
|
} else {
|
||||||
setText(app.getString(R.string.shared_string_control_start), null);
|
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);
|
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);
|
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);
|
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);
|
setIcons(R.drawable.widget_icon_av_inactive_day, R.drawable.widget_icon_av_inactive_night);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue