}
_commit =
new MenuItem(new StringProvider("Commit recording"), 0x230010,
0);
_commit.setCommand(new Command(new CommandHandler() {
/**
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public void execute(final ReadOnlyCommandMetadata metadata,
final Object context) {
commitRecording();
}
}));
_playRecording =
new MenuItem(new StringProvider("Play recording"), 0x230020, 0);
_playRecording.setCommand(new Command(new CommandHandler() {
/**
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public void execute(final ReadOnlyCommandMetadata metadata,
final Object context) {
// Create the playback screen from the chosen video source
VideoPlaybackScreen playbackScreen;
if (_recordToStream) {
playbackScreen =
new VideoPlaybackScreen(new ByteArrayInputStream(
_outStream.toByteArray()));
} else {
playbackScreen = new VideoPlaybackScreen(_videoFile);
}
// Hide the video feed since we cannot display video from the
// camera
// and video from a file at the same time.
_videoControl.setVisible(false);
_displayVisible = false;
UiApplication.getUiApplication().pushScreen(playbackScreen);
}
}));
_reset =
new MenuItem(new StringProvider("Reset recording"), 0x230030, 0);
_reset.setCommand(new Command(new CommandHandler() {
/**
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public void execute(final ReadOnlyCommandMetadata metadata,
final Object context) {
try {
_recordControl.reset();
} catch (final Exception e) {
VideoRecordingDemo.errorDialog("RecordControl#reset threw "
+ e.toString());
}
}
}));
_showDisplay =
new MenuItem(new StringProvider("Show display"), 0x230040, 0);
_showDisplay.setCommand(new Command(new CommandHandler() {
/**
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public void execute(final ReadOnlyCommandMetadata metadata,
final Object context) {
_videoControl.setVisible(true);
_displayVisible = true;
}
}));
_hideDisplay =
new MenuItem(new StringProvider("Hide display"), 0x230050, 0);
_hideDisplay.setCommand(new Command(new CommandHandler() {
/**
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public void execute(final ReadOnlyCommandMetadata metadata,
final Object context) {
_videoControl.setVisible(false);
_displayVisible = false;
}
}));
_startRecord =
new MenuItem(new StringProvider("Start recording"), 0x230060, 0);
_startRecord.setCommand(new Command(new CommandHandler() {
/**
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public void execute(final ReadOnlyCommandMetadata metadata,
final Object context) {
startRecord();
}
}));
_stopRecord =
new MenuItem(new StringProvider("Stop recording"), 0x230070, 0);
_stopRecord.setCommand(new Command(new CommandHandler() {
/**
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public void execute(final ReadOnlyCommandMetadata metadata,
final Object context) {
stopRecord();
}
}));
_toggleFlash =
new MenuItem(new StringProvider("Toggle flash"), 0x230080, 0);
_toggleFlash.setCommand(new Command(new CommandHandler() {
/**
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public void execute(final ReadOnlyCommandMetadata metadata,
final Object context) {
int newMode;
switch (_flashControl.getMode()) {
case FlashControl.OFF:
newMode = FlashControl.FORCE;
break;
default:
newMode = FlashControl.OFF;
}
try {
_flashControl.setMode(newMode);
} catch (final Exception e) {
}
}
}));
_chooseImageEffect =
new MenuItem(new StringProvider("Choose effect"), 0x230090, 0);
_chooseImageEffect.setCommand(new Command(new CommandHandler() {
/**
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public void execute(final ReadOnlyCommandMetadata metadata,