Beispiel #1
0
/**
 * Creates an empty vertical layout.
 * @param width Layout width.
 * @param height Layout height.
 * @return A vertical layout widget.
 * 		   The ownership of the result is passed to the caller!
 */
VerticalLayout* ScreenWebView::createSpacer(const int width, const int height)
{
	VerticalLayout* layout = new VerticalLayout();
	layout->setSize(width, height);

	// This shows how you set a property for which there is no
	// predefined method.
	layout->setChildHorizontalAlignment(MAW_ALIGNMENT_RIGHT);
	layout->setChildVerticalAlignment(MAW_ALIGNMENT_CENTER);

	return layout;
}
Beispiel #2
0
void LoadingScreen::initializeScreen(MAUtil::String &os)
{
			MAExtent ex = maGetScrSize();
			int screenWidth = EXTENT_X(ex);
			int screenHeight = EXTENT_Y(ex);

			mSplashScreen = new Screen();
			mSplashScreen->setBackgroundColor(40,40,40);

			//Layout that holds the screen elements
			RelativeLayout* relativeLayout = new RelativeLayout();
			relativeLayout->setSize(screenWidth, screenHeight);

			//The huge Reload "Circle"
			Image* logo = new Image();
			logo->setImage(SPLASH_IMAGE);
			logo->setSize(screenWidth,screenWidth);
			logo->setScaleMode(IMAGE_SCALE_PRESERVE_ASPECT);

			//Indicator placed on top of the reload circle
			mIndicator = new ActivityIndicator();
			mIndicator->show();

			//Progress bar for the download
			mProgressBar = new ProgressBar();
			mProgressBar->setWidth((int)(screenWidth * 0.75));
			mProgressBar->setMaximumValue(100);

			//Padding between the progress bar and the cancel button
			HorizontalLayout *paddingLayout = new HorizontalLayout();
			paddingLayout->setHeight(screenHeight / 36);

			//the cancel button stops the download and returns the user
			//to the login screen
			if(os == "Android")
			{
				mCancelDownloadButton = new Button();
				((Button*)mCancelDownloadButton)->addButtonListener(this);
			}
			else
			{
				mCancelDownloadButton = new ImageButton();
				((ImageButton*)mCancelDownloadButton)->addButtonListener(this);
				((ImageButton*)mCancelDownloadButton)->setBackgroundImage(RELOAD_BG);
				mCancelDownloadButton->setFontColor(0x000000);
			}

			mCancelDownloadButton->setText("Cancel");
			mCancelDownloadButton->setTextHorizontalAlignment(MAW_ALIGNMENT_CENTER);
			mCancelDownloadButton->setTextVerticalAlignment(MAW_ALIGNMENT_CENTER);
			mCancelDownloadButton->setWidth((int)(screenWidth * 0.75));
			mCancelDownloadButton->setHeight((int)(screenHeight * 0.1));

			//Spacing between the cancel button and the bottom of the screen
			HorizontalLayout *paddingLayout2 = new HorizontalLayout();
			paddingLayout2->setHeight(screenHeight / 15);

			VerticalLayout* logolayout = new VerticalLayout();
			logolayout->setSize(screenWidth, screenHeight);
			logolayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER);
			logolayout->setChildVerticalAlignment(MAW_ALIGNMENT_CENTER);
			logolayout->addChild(logo);

			VerticalLayout* activitylayout = new VerticalLayout();
			activitylayout->setSize(screenWidth, screenHeight);
			activitylayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER);
			activitylayout->setChildVerticalAlignment(MAW_ALIGNMENT_CENTER);
			activitylayout->addChild(mIndicator);

			VerticalLayout* progresslayout = new VerticalLayout();
			progresslayout->setSize(screenWidth, screenHeight);
			progresslayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER);
			progresslayout->setChildVerticalAlignment(MAW_ALIGNMENT_BOTTOM);
			progresslayout->addChild(mProgressBar);
			progresslayout->addChild(paddingLayout);
			progresslayout->addChild(mCancelDownloadButton);
			progresslayout->addChild(paddingLayout2);

			relativeLayout->addChild(logolayout);
			relativeLayout->addChild(activitylayout);
			relativeLayout->addChild(progresslayout);
			mSplashScreen->setMainWidget(relativeLayout);
}
Beispiel #3
0
void MainScreen::renderAlarm(AlarmMsg alarm, float ratio) {
	String s;

	HorizontalLayout *mainItemLayout = new HorizontalLayout();
	VerticalLayout *verticalTextLayout = new VerticalLayout();
	Label *lbDaysTo = new Label();
	Label *lbName = new Label();
	Label *lbsplitter = new Label();
	Label *lbMessage = new Label();

	s = "";
	String multi = "";
	int val = alarm.DaysTo;

	if (val > 99) {
		val /= 30;
		multi = Lang::getString(GS_LETTERMONTH);

		if (val > 24) {
			val /= 12;
			multi = Lang::getString(GS_LETTERYEAR);
		}
	}

	if (val == 0) {
		s += Lang::getString(GS_NOW);
	} else if (val == -1) {
		s += Lang::getString(GS_YESTERDAY);
	} else {
		s += Convert::toString(val);
		s += multi;
	}

	mainItemLayout->setChildVerticalAlignment(MAW_ALIGNMENT_CENTER);
	mainItemLayout->setBackgroundColor(Styler::getClBgMessage());
	mainItemLayout->fillSpaceHorizontally();
	mainItemLayout->wrapContentHorizontally();

	//DaysTo setup
	VerticalLayout* vlDaysTo = new VerticalLayout();
	vlDaysTo->fillSpaceHorizontally();
	vlDaysTo->wrapContentHorizontally();
	vlDaysTo->setBackgroundColor(Styler::getClBgDaysLeft());
	vlDaysTo->setChildVerticalAlignment(MAW_ALIGNMENT_CENTER);

	lbDaysTo->setText(s);

	int daysLeftFontSize = static_cast<int>(Styler::getSzFontDaysLeft()
			- ratio * (Styler::getSzFontDaysLeft() - Styler::getSzFontSize1()));
	if (val < 1) {
		daysLeftFontSize /= 2;
	}

	Styler::setLabelFont(lbDaysTo, Styler::fontnameDaysLeft, daysLeftFontSize);

	lbDaysTo->setFontSize(daysLeftFontSize);
	lbDaysTo->fillSpaceHorizontally();
	lbDaysTo->fillSpaceVertically();
	lbDaysTo->setWidth(Styler::getSzWidthDaysLeft());
	lbDaysTo->setFontColor(Styler::getClFcDaysLeft());
	lbDaysTo->setBackgroundColor(Styler::getClBgDaysLeft());
	lbDaysTo->setTextVerticalAlignment(MAW_ALIGNMENT_CENTER);
	lbDaysTo->setTextHorizontalAlignment(MAW_ALIGNMENT_CENTER);
	vlDaysTo->addChild(lbDaysTo);

	//name and message setup
	Styler::setLabelFont(lbName, Styler::fontnameEventName);
	lbName->setText(alarm.Name);
	lbName->setFontSize(Styler::getSzFontSize1());
	lbName->setFontColor(Styler::getClFcName());
	lbName->setTextHorizontalAlignment(MAW_ALIGNMENT_LEFT);
	lbMessage->setText(alarm.Message);
	lbMessage->setFontSize(Styler::szFontLittleMessage());
	lbMessage->setFontColor(Styler::getClFcMessage());
	lbMessage->setTextHorizontalAlignment(MAW_ALIGNMENT_LEFT);
	Label* lbAir = new Label();
	lbAir->setHeight(5);

	verticalTextLayout->addChild(lbName);
	verticalTextLayout->addChild(lbAir);
	verticalTextLayout->addChild(lbMessage);
	Styler::setLayoutPadding(verticalTextLayout, 3);
	verticalTextLayout->setPaddingLeft(Styler::getSzPadding() / 2);
	verticalTextLayout->setPaddingRight(Styler::getSzPadding() / 2);
	verticalTextLayout->wrapContentVertically();
	verticalTextLayout->fillSpaceHorizontally();

	mainItemLayout->addChild(vlDaysTo);
	mainItemLayout->addChild(lbsplitter);
	mainItemLayout->addChild(lbName);
	mainItemLayout->addChild(verticalTextLayout);
	mainItemLayout->wrapContentHorizontally();

	lvAlarms->addChild(mainItemLayout);
}