/** * Constructor. */ MainScreen::MainScreen() : TabScreen(), mDisplayNotificationScreen(NULL), mSettingsScreen(NULL), mTCPConnection(NULL), mToken(NULL) { mDisplayNotificationScreen = new DisplayNotificationScreen(); mSettingsScreen = new SettingsScreen(this); mTCPConnection = new TCPConnection(this); this->addTab(mDisplayNotificationScreen); this->addTab(mSettingsScreen); if ( isAndroid() ) { // Store the reg ID, and call registration only once per app. checkStore(); } else { int registerCode = Notification::NotificationManager::getInstance()->registerPushNotification( Notification::PUSH_NOTIFICATION_TYPE_BADGE | Notification::PUSH_NOTIFICATION_TYPE_ALERT | Notification::PUSH_NOTIFICATION_TYPE_SOUND, C2DM_USER_ACCOUNT); if ( MA_NOTIFICATION_RES_UNSUPPORTED == registerCode ) maPanic(0, "This device does not support push notifications"); } NotificationManager::getInstance()->addPushNotificationListener(this); }
/** * Create ListView section properties layout */ void SettingsScreen::createListViewSectionPropertiesLayout() { VerticalLayout* listViewSectionPropertiesVerticalLayout = new VerticalLayout(); listViewSectionPropertiesVerticalLayout->wrapContentVertically(); mListViewSectionLabel = new Label(); mListViewSectionLabel->setText("No section in focus"); mListViewSectionLabel->setFontSize(TITLE_FONT_SIZE); mListViewSectionLabel->setFontColor(0xFF0000); listViewSectionPropertiesVerticalLayout->addChild(mListViewSectionLabel); // create the current section title layout HorizontalLayout* currentSectionTitleLayout = new HorizontalLayout(); currentSectionTitleLayout->wrapContentVertically(); mSetListViewSectionTitleButton = new Button(); mSetListViewSectionTitleButton->setText("Set title"); mSetListViewSectionTitleButton->fillSpaceHorizontally(); currentSectionTitleLayout->addChild(mSetListViewSectionTitleButton); mCurrentListViewSectionTitleEditBox = new EditBox(); mCurrentListViewSectionTitleEditBox->fillSpaceHorizontally(); currentSectionTitleLayout->addChild(mCurrentListViewSectionTitleEditBox); listViewSectionPropertiesVerticalLayout->addChild(currentSectionTitleLayout); // create the current section header text layout HorizontalLayout* currentSectionHeaderTextLayout = new HorizontalLayout(); currentSectionHeaderTextLayout->wrapContentVertically(); mSetListViewSectionHeaderButton = new Button(); mSetListViewSectionHeaderButton->setText("Set header"); mSetListViewSectionHeaderButton->fillSpaceHorizontally(); currentSectionHeaderTextLayout->addChild(mSetListViewSectionHeaderButton); mCurrentListViewSectionHeaderEditBox = new EditBox(); mCurrentListViewSectionHeaderEditBox->fillSpaceHorizontally(); currentSectionHeaderTextLayout->addChild(mCurrentListViewSectionHeaderEditBox); listViewSectionPropertiesVerticalLayout->addChild(currentSectionHeaderTextLayout); // create the current section footer text layout HorizontalLayout* currentSectionFooterTextLayout = new HorizontalLayout(); currentSectionFooterTextLayout->wrapContentVertically(); mSetListViewSectionFooterButton = new Button(); mSetListViewSectionFooterButton->setText("Set footer"); mSetListViewSectionFooterButton->fillSpaceHorizontally(); currentSectionFooterTextLayout->addChild(mSetListViewSectionFooterButton); mCurrentListViewSectionFooterEditBox = new EditBox(); mCurrentListViewSectionFooterEditBox->fillSpaceHorizontally(); currentSectionFooterTextLayout->addChild(mCurrentListViewSectionFooterEditBox); listViewSectionPropertiesVerticalLayout->addChild(currentSectionFooterTextLayout); if (isWindowsPhone() || isAndroid()) { listViewSectionPropertiesVerticalLayout->wrapContentVertically(); createListViewSectionHeaderPropertiesLayout(listViewSectionPropertiesVerticalLayout); createListViewSectionFooterPropertiesLayout(listViewSectionPropertiesVerticalLayout); } ListViewItem* mListSectionPropertiesItem = new ListViewItem(); mListSectionPropertiesItem->setSelectionStyle(LIST_VIEW_ITEM_SELECTION_STYLE_NONE); mListSectionPropertiesItem->addChild(listViewSectionPropertiesVerticalLayout); mPropertiesListView->addChild(mListSectionPropertiesItem); }
/** * Destructor. */ SettingsScreen::~SettingsScreen() { mListViewAllowSelectionCheckbox->removeCheckBoxListener(this); mDisplayCheckBox->removeCheckBoxListener(this); mEditCheckBox->removeCheckBoxListener(this); mSetListViewSectionTitleButton->removeButtonListener(this); mSetListViewSectionHeaderButton->removeButtonListener(this); mSetListViewSectionFooterButton->removeButtonListener(this); mSetListViewItemTextButton->removeButtonListener(this); mSetListViewItemFontColorButton->removeButtonListener(this); mSetListViewItemFontSizeButton->removeButtonListener(this); mCurrentListViewSectionTitleEditBox->removeEditBoxListener(this); mCurrentListViewSectionFooterEditBox->removeEditBoxListener(this); mSetListViewItemTextEditBox->removeEditBoxListener(this); mSetListViewItemFontColorEditBox->removeEditBoxListener(this); mSetListViewItemFontSizeEditBox->removeEditBoxListener(this); if (isIOS()) { mListViewItemEditModeCheckbox->removeCheckBoxListener(this); mSetListViewItemDeleteTitleButton->removeButtonListener(this); mListViewItemSelectedCheckbox->removeCheckBoxListener(this); mListViewItemUnselectedCheckbox->removeCheckBoxListener(this); mListViewItemHighlightedCheckbox->removeCheckBoxListener(this); mListViewItemUnhighlightedCheckbox->removeCheckBoxListener(this); mListViewItemAccessoryTypeIntNoneCheckbox->removeCheckBoxListener(this); mListViewItemAccessoryTypeIntDisclosureCheckbox->removeCheckBoxListener(this); mListViewItemAccessoryTypeIntDetailCheckbox->removeCheckBoxListener(this); mListViewItemAccessoryTypeIntCheckmarkCheckbox->removeCheckBoxListener(this); mListViewItemAccessoryTypeEditModeNoneCheckbox->removeCheckBoxListener(this); mListViewItemAccessoryTypeEditModeDisclosureCheckbox->removeCheckBoxListener(this); mListViewItemAccessoryTypeEditModeDetailCheckbox->removeCheckBoxListener(this); mListViewItemAccessoryTypeEditModeCheckmarkCheckbox->removeCheckBoxListener(this); mListViewItemEditStyleNoneCheckbox->removeCheckBoxListener(this); mListViewItemEditStyleDeleteCheckbox->removeCheckBoxListener(this); mListViewItemEditStyleInsertCheckbox->removeCheckBoxListener(this); mSetSelectionStyle->removeButtonListener(this); mGetSelectionStyle->removeButtonListener(this); mSetListViewItemDeleteTitleEditBox->removeEditBoxListener(this); OptionsBox* optionBox = OptionsBox::getInstance(); optionBox->addOptionsBoxListener(this); OptionsBox::destroyInstance(); } if (isWindowsPhone() || isAndroid()) { mSetSectionHeaderBackgroundColor->removeButtonListener(this); mSetSectionHeaderFontSize->removeButtonListener(this); mSetSectionHeaderFontColor->removeButtonListener(this); mSetSectionFooterBackgroundColor->removeButtonListener(this); mSetSectionFooterFontSize->removeButtonListener(this); mSetSectionFooterFontColor->removeButtonListener(this); mHeaderBackgroundColorEditBox->removeEditBoxListener(this); mHeaderFontSizeEditBox->removeEditBoxListener(this); mHeaderFontColorEditBox->removeEditBoxListener(this); mFooterBackgroundColorEditBox->removeEditBoxListener(this); mFooterFontSizeEditBox->removeEditBoxListener(this); mFooterFontColorEditBox->removeEditBoxListener(this); } }
/** * Creates and adds main layout to the screen. */ void SettingsScreen::createMainLayout() { // Create and add the main layout to the screen. VerticalLayout* mainLayout = new VerticalLayout(); Screen::setMainWidget(mainLayout); ListView* listView = new ListView(); mainLayout->addChild(listView); // Add set duration option row. this->addSetDurationRow(listView); // Add get duration option row. this->addGetDurationRow(listView); // Add options for setting and getting the video quality value. this->addVideoQualityRows(listView); if ( isIOS()) { // Add options for setting and getting the flash mode value. this->addFlashModeRows(listView); // Add option for setting the camera roll flag. this->addCameraRollFlagRow(listView); // Add option for setting the camera controls flag. this->addCameraControlsFlagRow(listView); } // Add take picture button. mTakePictureBtn = new Button(); mTakePictureBtn->setText(TAKE_PICTURE_BTN_TEXT); this->addButtonToListView(mTakePictureBtn, listView); if (isAndroid()) { mTakenPicturePath = new Label(); ListViewItem* listItem = new ListViewItem(); listItem->addChild(mTakenPicturePath); listView->addChild(listItem); } // Add record video button. mRecordVideoBtn = new Button(); mRecordVideoBtn->setText(RECORD_VIDEO_BTN_TEXT); this->addButtonToListView(mRecordVideoBtn, listView); // Add show image button. mShowImageScreen = new Button(); mShowImageScreen->setText(SHOW_IMAGE_SCREEN_TEXT); this->addButtonToListView(mShowImageScreen, listView); // Add show video screen button. mShowVideoScreen = new Button(); mShowVideoScreen->setText(SHOW_VIDEO_SCREEN_TEXT); this->addButtonToListView(mShowVideoScreen, listView); }
/** * Called when the server has received the authorization key. */ void MainScreen::messageSent() { connectionEstablished(); // This is the first time the app is launched on Android phone. // Need to send the token. Also, store it to the store. if (isAndroid() && mToken) { storeRegistrationID(mToken); } }
/** * Destructor. */ ListScreen::~ListScreen() { mListView->removeListViewListener(this); mRemoveFirstSection->removeButtonListener(this); mAddItem->removeButtonListener(this); mRemoveItem->removeButtonListener(this); if (isIOS() || isAndroid()) { mReloadData->removeButtonListener(this); } mListScreenListeners.clear(); }
/** * Called when connect button is pressed. * @param ipAddress Server's ip address written by the user. * @param port Server's port written by the user. */ void MainScreen::connectToServer(const MAUtil::String& ipAddress, const MAUtil::String& port) { int resultCode; if ( isAndroid() ) { resultCode = mHttpConnection->sendApiKey(ipAddress, *mToken); } else if( isIOS() ) { resultCode = mTCPConnection->connect(ipAddress, port); } if (resultCode <= 0 ) { mSettingsScreen->connectionFailed(); } }
/** * Constructor. */ TCPConnection::TCPConnection(TCPListener* listener): mConnection(this), mMessageSent(false), mConnected(false) { mListener = listener; if ( isAndroid() ) mConnectionStatus = mConnection.connect(SERVER_ADDRESS_ANDROID); else mConnectionStatus = mConnection.connect(SERVER_ADDRESS_iOS); if(mConnectionStatus < 0) { printf("Cannot connect"); maMessageBox(CONNECTION_ERROR_TITLE, CONNECTION_ERROR_MESSAGE); } }
/** * Creates and adds main layout to the screen. */ void ListScreen::createMainLayout() { // Create and add the main layout to the screen. mMainLayout = new VerticalLayout(); Screen::setMainWidget(mMainLayout); mListView = new ListView(LIST_VIEW_TYPE_SEGMENTED); // the list view doesn't automatically sort its elements - the // developer has to handle the sorting for (int i = 0; i <= 5; i++) { ListViewSection* section = new ListViewSection(LIST_VIEW_SECTION_TYPE_SEGMENTED); MAUtil::String sectionTitle = "Header "; sectionTitle += MAUtil::integerToString(i); section->setTitle("H" + MAUtil::integerToString(i)); section->setHeaderText(sectionTitle); section->setFooterText("Footer " + MAUtil::integerToString(i)); mListView->addChild(section); for (int j = 0; j <= 6; j++) { ListViewItem* item = new ListViewItem(); MAUtil::String itemText = "Item "; itemText += MAUtil::integerToString(j); item->setText(itemText); item->setSubtitle("subtitle " + MAUtil::integerToString(j)); item->fillSpaceHorizontally(); section->addItem(item); } } int result = mMainLayout->addChild(mListView); printf("add mListView result = %d", result); createListManipulationLayout(); if (isIOS() || isAndroid()) { mReloadData = new Button(); mReloadData->setText("Reload data"); mReloadData->fillSpaceHorizontally(); mMainLayout->addChild(mReloadData); } }
/** * Constructor that creates the UI. */ NativeUIMoblet() { if (!isAndroid() && !isIOS()) { maMessageBox("Error", "Run this program on Android or iOS devices"); } else { // Create the main user interface screen. mMainScreen = new MainScreen(); // Show the screen. mMainScreen->show(); } this->addFocusListener(this); }
/** * Called when the application is connected to the server. */ void MainScreen::connectionEstablished() { printf("MainScreen::connectionEstablished()"); // Update the UI. mSettingsScreen->connectionEstablished(); if (mToken) { // This is the first time the app is launched on Android phone. // Need to send the token. Also, store it to the store. if (isAndroid()) { storeRegistrationID(mToken); } // Finally send it over TCP to the server. mTCPConnection->sendData(*mToken); } }
/** * Constructor. */ ListScreen::ListScreen() : Screen(), mMainLayout(NULL), mListView(NULL), mRemoveFirstSection(NULL), mAddItem(NULL), mRemoveItem(NULL), mReloadData(NULL) { createMainLayout(); mListView->addListViewListener(this); mRemoveFirstSection->addButtonListener(this); mAddItem->addButtonListener(this); mRemoveItem->addButtonListener(this); if (isIOS() || isAndroid()) { mReloadData->addButtonListener(this); } }
void ofApp::update() { #if defined TARGET_SEMIBREVE inactivityHandler(); oscMultitouchHandler(); #endif #ifndef TARGET_OSX if (isIos() || isAndroid()) shakeHandler(); #endif appStateHandler(); for (touchesIterator it = touches.begin(); it != touches.end(); it++) { it->second.update(); } for (unsigned int i = 0; i < modules.size(); i++) { modules[i]->update(); } }
void ofApp::setup() { ofSetLogLevel(OF_LOG_NOTICE); ofLogNotice() << "setup()"; if (ofApp::isSemibreve()) ofLogNotice() << "Going to run Semibreve version"; if (ofApp::isOsx()) ofLogNotice() << "OSX detected"; if (ofApp::isIos()) ofLogNotice() << "iOS detected"; if (ofApp::isAndroid()) ofLogNotice() << "Android detected"; if (ofApp::isPhone()) ofLogNotice() << "Phone detected"; if (ofApp::isTablet()) ofLogNotice() << "Tablet detected"; // if (ofApp::isIphone()) ofLogNotice() << "iPhone detected"; // if (ofApp::isIpad()) ofLogNotice() << "iPad detected"; // if (ofApp::isAndroidPhone()) ofLogNotice() << "Android phone detected"; // if (ofApp::isAndroidTablet()) ofLogNotice() << "Android tablet detected"; #if defined TARGET_OSX ofLogNotice() << "Running OSX version"; ofSetDataPathRoot("../Resources/data/"); #endif #if defined TARGET_SEMIBREVE ofLogNotice() << "Running SEMIBREVE version"; oscReceiver.setup(RECEIVE_PORT); oscSender.setup(HOST, SEND_PORT); #endif #if defined TARGET_OF_IOS if (ofApp::isTablet()) { ofSetOrientation(OF_ORIENTATION_90_LEFT); swiper.setup(); ofAddListener(swiper.swipeRecognized, this, &ofApp::onSwipe); swiping = false; } else { swiper.setup(); ofAddListener(swiper.swipeRecognized, this, &ofApp::onSwipe); swiping = false; } #endif #ifndef TARGET_OSX if (isAndroid() || isIos()) { ofxAccelerometer.setup(); accelCount = 0; crop = 0; } #endif if (!ofApp::isIos()) { ofLogNotice() << "Registering for touch events if not ios"; ofRegisterTouchEvents(this); } ofSetFrameRate(FRAME_RATE); ofSetCircleResolution(CIRCLE_RESOLUTION); if (multitouch) ofHideCursor(); ofApp::language = ofApp::getSystemLanguage(); ofLogNotice() << "Language is " << ofApp::language; initTranslations(); initModules(); setupModules(); loadModuleSounds(); initImages(); appState = ABOUT; inactivityState = ACTIVE; // init global vars aboutY = 0; splashAlpha = 255; arrowDownY = ofGetHeight()/3*2; arrowDownYBase = arrowDownY; arrowDownDir = 1; showSwipeInfo = true; ofApp::maxParticleY = round(ofGetHeight() * (1-LIMIT_PARTICLE)); uint swipeFontSize; if (isTablet()) swipeFontSize = 26; else swipeFontSize = 20; swipeFont.load(UI_FONT_FACE, swipeFontSize); }
/** * Creates and adds main layout to the screen. */ void CreateNotificationScreen::createMainLayout() { VerticalLayout* mainLayout = new VerticalLayout(); Screen::setMainWidget(mainLayout); ListView* listView = new ListView(); listView->fillSpaceHorizontally(); listView->fillSpaceVertically(); mainLayout->addChild(listView); ListViewItem* listItem; HorizontalLayout* hLayout; Widget* space; // ================ Content body ===================== mContentBody = new EditBox(); listView->addChild(createListViewItem(CONTENT_BODY_LABEL_TEXT,(Widget*) mContentBody)); if ( isAndroid() ) { // ================ Content title ===================== mContentTitle = new EditBox(); listView->addChild(createListViewItem(CONTENT_TITLE_LABEL_TEXT, mContentTitle)); // ================ Ticker text ===================== mTickerText = new EditBox(); listView->addChild(createListViewItem(TICKER_TEXT_LABEL_TEXT, mTickerText)); } else { // ================ Badge number ===================== mBadgeNumber = new EditBox(); mBadgeNumber->setWidth(NUMERIC_EDIT_BOX_WIDTH); mBadgeNumber->setInputMode(EDIT_BOX_INPUT_MODE_NUMERIC); mBadgeNumber->addEditBoxListener(this); listView->addChild(createListViewItem(BADGE_NUMBER_LABEL_TEXT, mBadgeNumber)); // ================ Alert action ===================== mAlertAction = new EditBox(); mAlertAction->addEditBoxListener(this); listView->addChild(createListViewItem(ALERT_ACTION_LABEL_TEXT, mAlertAction)); } // ================ Play sound ===================== mPlaySound = new CheckBox(); listView->addChild(createListViewItem(PLAY_SOUND_LABEL_TEXT, mPlaySound)); if ( isAndroid() ) { // ================ Sound path===================== mSoundPath = new EditBox(); listView->addChild(createListViewItem(SOUND_PATH_LABEL_TEXT, mSoundPath)); // ================ Vibrate ===================== mVibrate = new CheckBox(); listView->addChild(createListViewItem(VIBRATE_LABEL_TEXT, mVibrate)); mVibrateDuration = new EditBox(); mVibrateDuration->setInputMode(EDIT_BOX_INPUT_MODE_NUMERIC); listView->addChild(createListViewItem(VIBRATE_DURATION_LABEL_TEXT, mVibrateDuration)); // ================ Flashing LED ===================== mFlash = new CheckBox(); listView->addChild(createListViewItem(FLASH_LABEL_TEXT, mFlash)); // The pattern mFlashColor = new EditBox(); listView->addChild(createListViewItem(FLASH_COLOR_LABEL_TEXT, mFlashColor)); mFlashOnLength = new EditBox(); mFlashOnLength->setInputMode(EDIT_BOX_INPUT_MODE_NUMERIC); listView->addChild(createListViewItem(FLASH_ON_LABEL_TEXT, mFlashOnLength)); mFlashOffLength = new EditBox(); mFlashOffLength->setInputMode(EDIT_BOX_INPUT_MODE_NUMERIC); listView->addChild(createListViewItem(FLASH_OFF_LABEL_TEXT, mFlashOffLength)); } // ================ Fire time ===================== mTime = new EditBox(); mTime->setWidth(NUMERIC_EDIT_BOX_WIDTH); mTime->setInputMode(EDIT_BOX_INPUT_MODE_NUMERIC); listView->addChild(createListViewItem(FIRE_TIME_LABEL_TEXT, mTime)); // ================= Send image button ================ hLayout = new HorizontalLayout(); hLayout->fillSpaceHorizontally(); listItem = new ListViewItem(); listItem->addChild(hLayout); listView->addChild(listItem); mCreateNotificationButton = new ImageButton(); mCreateNotificationButton->setImage(RES_IMAGE); space = this->createSpacer(); hLayout->addChild(space); hLayout->addChild(mCreateNotificationButton); // Align the image button at the center of the layout. // Only after adding the image button widget to layout the widget's width // is available. int spacerWidth = hLayout->getWidth() / 2 - mCreateNotificationButton->getWidth() / 2; space->setWidth(spacerWidth); }
bool AsemanDevices::isTouchDevice() const { return isAndroid() || isIOS() || isWindowsPhone() || isUbuntuTouch(); }
/** * Constructor. */ SettingsScreen::SettingsScreen(): Screen(), mMainLayout(NULL), mPropertiesListView(NULL), mListViewAllowSelectionCheckbox(NULL), mListViewSectionLabel(NULL), mCurrentListViewItemLabel(NULL), mDisplayCheckBox(NULL), mEditCheckBox(NULL), mSetListViewSectionTitleButton(NULL), mSetListViewSectionHeaderButton(NULL), mSetListViewSectionFooterButton(NULL), mCurrentListViewSectionTitleEditBox(NULL), mCurrentListViewSectionHeaderEditBox(NULL), mCurrentListViewSectionFooterEditBox(NULL), mSetListViewItemTextEditBox(NULL), mSetListViewItemTextButton(NULL), mSetListViewItemFontColorEditBox(NULL), mSetListViewItemFontColorButton(NULL), mSetListViewItemFontSizeEditBox(NULL), mSetListViewItemFontSizeButton(NULL), mListViewItemEditModeCheckbox(NULL), mSetListViewItemDeleteTitleButton(NULL), mSetListViewItemDeleteTitleEditBox(NULL), mListViewItemSelectedCheckbox(NULL), mListViewItemUnselectedCheckbox(NULL), mListViewItemHighlightedCheckbox(NULL), mListViewItemUnhighlightedCheckbox(NULL), mListViewItemAccessoryTypeIntNoneCheckbox(NULL), mListViewItemAccessoryTypeIntDisclosureCheckbox(NULL), mListViewItemAccessoryTypeIntDetailCheckbox(NULL), mListViewItemAccessoryTypeIntCheckmarkCheckbox(NULL), mListViewItemAccessoryTypeEditModeNoneCheckbox(NULL), mListViewItemAccessoryTypeEditModeDisclosureCheckbox(NULL), mListViewItemAccessoryTypeEditModeDetailCheckbox(NULL), mListViewItemAccessoryTypeEditModeCheckmarkCheckbox(NULL), mListViewItemEditStyleNoneCheckbox(NULL), mListViewItemEditStyleDeleteCheckbox(NULL), mListViewItemEditStyleInsertCheckbox(NULL), mSetSectionHeaderBackgroundColor(NULL), mSetSectionHeaderFontSize(NULL), mSetSectionHeaderFontColor(NULL), mHeaderBackgroundColorEditBox(NULL), mHeaderFontSizeEditBox(NULL), mHeaderFontColorEditBox(NULL), mSetSectionFooterBackgroundColor(NULL), mSetSectionFooterFontSize(NULL), mSetSectionFooterFontColor(NULL), mSetSelectionStyle(NULL), mGetSelectionStyle(NULL), mFooterBackgroundColorEditBox(NULL), mFooterFontSizeEditBox(NULL), mFooterFontColorEditBox(NULL) { createMainLayout(); mListViewAllowSelectionCheckbox->addCheckBoxListener(this); mDisplayCheckBox->addCheckBoxListener(this); mEditCheckBox->addCheckBoxListener(this); mSetListViewSectionTitleButton->addButtonListener(this); mSetListViewSectionHeaderButton->addButtonListener(this); mSetListViewSectionFooterButton->addButtonListener(this); mSetListViewItemTextButton->addButtonListener(this); mSetListViewItemFontColorButton->addButtonListener(this); mSetListViewItemFontSizeButton->addButtonListener(this); mCurrentListViewSectionTitleEditBox->addEditBoxListener(this); mCurrentListViewSectionHeaderEditBox->addEditBoxListener(this); mCurrentListViewSectionFooterEditBox->addEditBoxListener(this); mSetListViewItemTextEditBox->addEditBoxListener(this); mSetListViewItemFontColorEditBox->addEditBoxListener(this); mSetListViewItemFontSizeEditBox->addEditBoxListener(this); if (isIOS()) { mListViewItemEditModeCheckbox->addCheckBoxListener(this); mSetListViewItemDeleteTitleButton->addButtonListener(this); mListViewItemSelectedCheckbox->addCheckBoxListener(this); mListViewItemUnselectedCheckbox->addCheckBoxListener(this); mListViewItemHighlightedCheckbox->addCheckBoxListener(this); mListViewItemUnhighlightedCheckbox->addCheckBoxListener(this); mListViewItemAccessoryTypeIntNoneCheckbox->addCheckBoxListener(this); mListViewItemAccessoryTypeIntDisclosureCheckbox->addCheckBoxListener(this); mListViewItemAccessoryTypeIntDetailCheckbox->addCheckBoxListener(this); mListViewItemAccessoryTypeIntCheckmarkCheckbox->addCheckBoxListener(this); mListViewItemAccessoryTypeEditModeNoneCheckbox->addCheckBoxListener(this); mListViewItemAccessoryTypeEditModeDisclosureCheckbox->addCheckBoxListener(this); mListViewItemAccessoryTypeEditModeDetailCheckbox->addCheckBoxListener(this); mListViewItemAccessoryTypeEditModeCheckmarkCheckbox->addCheckBoxListener(this); mListViewItemEditStyleNoneCheckbox->addCheckBoxListener(this); mListViewItemEditStyleDeleteCheckbox->addCheckBoxListener(this); mListViewItemEditStyleInsertCheckbox->addCheckBoxListener(this); mSetSelectionStyle->addButtonListener(this); mGetSelectionStyle->addButtonListener(this); mSetListViewItemDeleteTitleEditBox->addEditBoxListener(this); OptionsBox* optionBox = OptionsBox::getInstance(); optionBox->addOptionsBoxListener(this); } if (isWindowsPhone() || isAndroid()) { mSetSectionHeaderBackgroundColor->addButtonListener(this); mSetSectionHeaderFontSize->addButtonListener(this); mSetSectionHeaderFontColor->addButtonListener(this); mSetSectionFooterBackgroundColor->addButtonListener(this); mSetSectionFooterFontSize->addButtonListener(this); mSetSectionFooterFontColor->addButtonListener(this); mHeaderBackgroundColorEditBox->addEditBoxListener(this); mHeaderFontSizeEditBox->addEditBoxListener(this); mHeaderFontColorEditBox->addEditBoxListener(this); mFooterBackgroundColorEditBox->addEditBoxListener(this); mFooterFontSizeEditBox->addEditBoxListener(this); mFooterFontColorEditBox->addEditBoxListener(this); } }
/** * Creates and adds main layout to the screen. */ void MainScreen::createMainLayout() { // Create and add the main layout to the screen. mMainLayout = new VerticalLayout(); mMainLayout->setBackgroundColor(0xFF0000); Screen::setMainWidget(mMainLayout); mVideoView = new VideoView(); mVideoView->setWidth(200); mVideoView->setHeight(200); mMainLayout->addChild(mVideoView); mEditBox = new EditBox(); mEditBox->fillSpaceHorizontally(); mMainLayout->addChild(mEditBox); mSetUrl = new Button(); mSetUrl->setText("Set url"); mMainLayout->addChild(mSetUrl); HorizontalLayout* controlsLayout = new HorizontalLayout(); mMainLayout->addChild(controlsLayout); mPlay = new Button(); mPlay->setText("Play"); mPlay->fillSpaceHorizontally(); controlsLayout->addChild(mPlay); mPause = new Button(); mPause->setText("Pause"); mPause->fillSpaceHorizontally(); controlsLayout->addChild(mPause); mStop = new Button(); mStop->setText("Stop"); mStop->fillSpaceHorizontally(); controlsLayout->addChild(mStop); mSeekTo = new Button(); mSeekTo->setText("Seek to 1000"); mMainLayout->addChild(mSeekTo); HorizontalLayout* durationlayout = new HorizontalLayout(); mMainLayout->addChild(durationlayout); mGetDuration = new Button(); mGetDuration->setText("Get Duration"); durationlayout->addChild(mGetDuration); mDuration = new Label(); mDuration->setText("The duration"); durationlayout->addChild(mDuration); mVideoControl = new Button(); mVideoControl->setText(HIDE_VIDEO_CONTROL_BUTTON_TEXT); mMainLayout->addChild(mVideoControl); HorizontalLayout* timeLayout = new HorizontalLayout(); mMainLayout->addChild(timeLayout); mCurrentTime = new Button(); mCurrentTime->setText("Current time"); timeLayout->addChild(mCurrentTime); mTime = new Label(); mTime->setText("Current Time"); timeLayout->addChild(mTime); if (isAndroid()) { mEditBox->setText("http://www.mosync.com/files/videos/Video.3gp"); } else if (isWindowsPhone()) { mEditBox->setText("http://www.educationalquestions.com/video/ELL_PART_5_768k.wmv"); } else { mEditBox->setText("http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/sl.m3u8"); } mVideoView->setURL(mEditBox->getText()); }