Exemplo n.º 1
0
	/**
	 * Constructor.
	 */
	Controller::Controller():
		mDatabaseManager(NULL),
		mCountriesListScreen(NULL),
		mCountryInfoScreen(NULL),
		mDisclaimerScreen(NULL),
		mCurrentlyShownScreen(NULL)
	{
		initScreenSizeConstants();
		initPlatformType();

		LoadingScreen* loadingScreen = NULL;
		if (isWindowsPhone())
		{
			// Show LoadingScreen.
			loadingScreen = new LoadingScreen();
			loadingScreen->show();
		}

		// Create and load the database.
		mDatabaseManager = new DatabaseManager();
		mDatabaseManager->readDataFromFiles();

		// Create screens.
		mCountriesListScreen = new CountriesListScreen(*mDatabaseManager, *this);
		mCountryInfoScreen = new CountryInfoScreen(*this);
		mDisclaimerScreen = new DisclaimerScreen(*this);

		// Show the country list screen.
		this->showScreen(*mCountriesListScreen);

		// Delete the loading screen.
		delete loadingScreen;
	}
Exemplo n.º 2
0
/**
 * 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);
}
Exemplo n.º 3
0
/**
 * 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);
	}
}
Exemplo n.º 4
0
	/**
	 * Create an empty transparent VerticalLayout widget.
	 * @param height Layout's height.
	 * @param width Layout's width.
	 * @return The layout. Its ownership is passed to the caller.
	 */
	NativeUI::VerticalLayout* createSpacer(
		const int height,
		const int width)
	{
		NativeUI::VerticalLayout* layout = new NativeUI::VerticalLayout();
		layout->setHeight(height);
		layout->setWidth(width);
		if (!isWindowsPhone())
		{
			layout->setProperty(MAW_WIDGET_BACKGROUND_COLOR, gLayoutBackgroundColor);
		}
		return layout;
	}
Exemplo n.º 5
0
	/**
	 * Create and add an ListView widget to the screen's main layout.
	 * It will take the screen size and will be placed above the image widget.
	 */
	void CountriesListScreen::createListViewWidget()
	{
		mListView = new NativeUI::ListView(
			NativeUI::LIST_VIEW_TYPE_ALPHABETICAL);
		mListView->setHeight(gScreenHeight);
		mListView->setWidth(gScreenWidth);
		mListView->setTopPosition(0);
		mListView->setLeftPosition(0);
		if (!isWindowsPhone())
		{
			mListView->setProperty(MAW_WIDGET_BACKGROUND_COLOR, gLayoutBackgroundColor);
		}
		mMainLayout->addChild(mListView);
	}
Exemplo n.º 6
0
	/**
	 * Create screen's UI.
	 */
	void LoadingScreen::createUI()
	{
		// Create and add main layout to the screen.
		mMainLayout = new NativeUI::VerticalLayout();
		this->setMainWidget(mMainLayout);

		// Add spacer.
		mMainLayout->addChild(new NativeUI::VerticalLayout);

		// Add ActivityIndicatior.
		NativeUI::ActivityIndicator* activityIndicator =
			new NativeUI::ActivityIndicator();
		mMainLayout->addChild(activityIndicator);

		if (isWindowsPhone())
		{
			// For WP7 platform add an Label widget.
			NativeUI::Label* loading = new NativeUI::Label(LOADING_LABEL_TEXT);
			loading->setTextHorizontalAlignment(MAW_ALIGNMENT_CENTER);
			loading->fillSpaceHorizontally();
			mMainLayout->addChild(loading);

			mMainLayout->addChild(createSpacer(SPACER_HEIGHT));
			activityIndicator->fillSpaceHorizontally();
		}
		else
		{
			mMainLayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER);
		}

		// Add spacer.
		mMainLayout->addChild(new NativeUI::VerticalLayout);

		// Show the ActivityIndicator.
		activityIndicator->show();
	}
Exemplo n.º 7
0
bool AsemanDevices::isTouchDevice() const
{
    return isAndroid() || isIOS() || isWindowsPhone() || isUbuntuTouch();
}
Exemplo n.º 8
0
/**
 * 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);
	}
}
Exemplo n.º 9
0
/**
 * 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());
}