void FTrip::AddListItemSearch(Osp::Base::String col1, Osp::Base::String col2, Osp::Base::String col3, Osp::Base::String col4, int itemId, int searchposcol1, int searchposcol2) { CustomListItem * newItem = new CustomListItem(); CustomListElementTrip * custom_element = new CustomListElementTrip(); newItem->Construct(150); newItem->SetItemFormat(*pCustomListItemSearchFormat); custom_element->col1 = col1; custom_element->col2 = col2; custom_element->col3 = col3; custom_element->col4 = col4; if (custom_element->col4.GetLength() > 0) custom_element->col4.Replace("\n"," "); if (searchposcol1 > -1) { if (searchposcol1 > 10) { custom_element->col1.SubString(searchposcol1-3,custom_element->col1); custom_element->col1.Insert("...",0); searchposcol1 = 6; } custom_element->col1.SubString(0,searchposcol1,custom_element->col1b); custom_element->col1.SubString(searchposcol1,this->searchq.GetLength(),custom_element->col1s); if (searchposcol1+searchq.GetLength() < custom_element->col1.GetLength()) custom_element->col1.SubString(searchposcol1+searchq.GetLength(), custom_element->col1a); } if (searchposcol2 > -1) { if (searchposcol2 > 10) { custom_element->col4.SubString(searchposcol2-3,custom_element->col4); custom_element->col4.Insert("...",0); searchposcol2 = 6; } custom_element->col4.SubString(0,searchposcol2,custom_element->col4b); custom_element->col4.SubString(searchposcol2,this->searchq.GetLength(),custom_element->col4s); if (searchposcol2+searchq.GetLength() < custom_element->col4.GetLength()) custom_element->col4.SubString(searchposcol2+searchq.GetLength(), custom_element->col4a); } Osp::Base::String lowercasedsearchq; this->searchq.ToLower(lowercasedsearchq); custom_element->searchq = lowercasedsearchq; newItem->SetElement(LEL_BG, *(static_cast<ICustomListElement *>(custom_element))); pExList->AddItem(*newItem, itemId); }
void FTrip::AddListItem(Osp::Base::String col1, Osp::Base::String col2, Osp::Base::String col3, int itemId) { CustomListItem * newItem = new CustomListItem(); CustomListElementTrip * custom_element = new CustomListElementTrip(); newItem->Construct(100); newItem->SetItemFormat(*pCustomListItemFormat); custom_element->col1 = col1; custom_element->col2 = col2; custom_element->col3 = col3; newItem->SetElement(LEL_BG, *(static_cast<ICustomListElement *>(custom_element))); pExList->AddItem(*newItem, itemId); }
// Implements an ITextEventListener void StringOptionView::OnTextValueChanged(const Control& source) { // Todo: AppLog("OnTextValueChanged"); CustomListItem* pItem = new OptionListItem(this); pItem->Construct(100); pItem->SetItemFormat(*myTab->form()->__pStringViewListItemFormat); pItem->SetElement(ID_LIST_TEXT_TITLE,String((ZLOptionView::name()).c_str())); pItem->SetElement(ID_LIST_TEXT_SUBTITLE, __pKeypad->GetText()); myTab->form()->__pCustomList->SetItemAt(groupIndex,itemIndex, *pItem, ID_LIST_ITEM); ByteBuffer* bb = Tizen::Base::Utility::StringUtil:: StringToUtf8N(__pKeypad->GetText()); myValue = std::string((char *)bb->GetPointer()); AppLog( "pKeypad->GetText %s",myValue.c_str()); }
result FPlaylistForm::AddListItem(int itemid, String itemTextArtist, String itemTextTitle, Bitmap* pBitmapNormal) { CustomListItem* pItem = new CustomListItem(); CustomListElement * custom_element = new CustomListElement(); CustomListElement * custom_element2 = new CustomListElement(); custom_element->text = itemTextArtist; custom_element2->text = itemTextTitle; pItem->Construct(80); pItem->SetItemFormat(*__pCustomListItemFormat); if (pBitmapNormal != null) { pItem->SetElement(ID_LIST_TEXTARTIST, *(static_cast<ICustomListElement *>(custom_element))); pItem->SetElement(ID_LIST_TEXTTITLE, *(static_cast<ICustomListElement *>(custom_element2))); pItem->SetElement(ID_LIST_ICON, *pBitmapNormal, pBitmapNormal); } else { pItem->SetElement(ID_LIST_TEXTARTIST, *(static_cast<ICustomListElement *>(custom_element))); pItem->SetElement(ID_LIST_TEXTTITLE, *(static_cast<ICustomListElement *>(custom_element2))); } UList_->AddItem(*pItem, itemid); return E_SUCCESS; }
result InfoForm::OnInitializing(void) { Rectangle rect = this->GetClientAreaBounds(); result r = E_SUCCESS; TabsForm::OnInitializing(); AppResource *pAppResource = Application::GetInstance()->GetAppResource(); Bitmap* _bitmap; CategoryList = new CustomList(); CategoryList->Construct(Rectangle(0, 0, this->GetWidth(), rect.height), CUSTOM_LIST_STYLE_NORMAL); CategoryList->SetBackgroundColor(Color(239,239,239)); CategoryList->AddCustomItemEventListener(*this); // Category element format pCustomListItemFormat = new CustomListItemFormat(); pCustomListItemFormat->Construct(); pCustomListItemFormat->AddElement(LIST_ELEMENT_IMG, Rectangle(Retina::GetInt(5), Retina::GetInt(5), Retina::GetInt(65), Retina::GetInt(65))); pCustomListItemFormat->AddElement(LIST_ELEMENT_DESC, Rectangle(Retina::GetInt(75), Retina::GetInt(5), Retina::GetInt(180), Retina::GetInt(120)), Retina::GetInt(12), Color(151,151,151), Osp::Ui::Controls::SYSTEM_COLOR_LIST_ITEM_PRESSED_TEXT); CreateArray(); int i=0; // Adds an item to the CustomList while(__pProducts[i][0]->GetLength() == 12) { CustomListItem * newItem = new CustomListItem(); newItem->Construct(Retina::GetInt(75)); newItem->SetItemFormat(*pCustomListItemFormat); int k=0; Integer::Parse(*__pProducts[i][1], k); switch (k) { case 451549: case 451431: newItem->SetElement(LIST_ELEMENT_DESC, Helper::GetTraslation("IDS_SPACESHUFFLE")); _bitmap = pAppResource->GetBitmapN(L"Ikonka_512.png"); break; case 53471: newItem->SetElement(LIST_ELEMENT_DESC, Helper::GetTraslation("IDS_UCONVERTOR")); _bitmap = pAppResource->GetBitmapN(L"uc_icon2.png"); break; case 287131: case 287177: case 232222: case 279563: newItem->SetElement(LIST_ELEMENT_DESC, Helper::GetTraslation("IDS_sCalc")); _bitmap = pAppResource->GetBitmapN(L"scalc_icon.png"); break; } newItem->SetElement(LIST_ELEMENT_IMG, *_bitmap, _bitmap); CategoryList->AddItem(*newItem, i); i++; } this->AddControl(*CategoryList); return r; }
void MainForm::OnParsingCompleted(ArrayList &feedData) { AppResource *pAppResource = Application::GetInstance()->GetAppResource(); if (feedData.GetCount() == 0) { // no service this day String emptyText; pAppResource->GetString("IDS_NOSERVICE", emptyText); __pListFood->SetTextOfEmptyList(emptyText); } else { IEnumerator *pEnum = feedData.GetEnumeratorN(); HashMap *pItem = null; int mensaIndex = -1; String *currentMensa = null; String currencySymbol; pAppResource->GetString("IDS_CURRENCY", currencySymbol); String soldOut; pAppResource->GetString("IDS_SOLDOUT", soldOut); // iterate over items (meals) in feed while (pEnum->MoveNext() == E_SUCCESS) { pItem = (HashMap *)pEnum->GetCurrent(); // check if mensa is already in the list (we assume the feed to be ordered) if (!currentMensa || !(static_cast<String *>(pItem->GetValue(*(new String("author")))))->Equals(*currentMensa, false)) { currentMensa = static_cast<String *>(pItem->GetValue(*(new String("author")))); mensaIndex++; // Create a main item of the ExpandableList CustomListItem* pMainItem = new CustomListItem(); pMainItem->Construct(100); pMainItem->SetItemFormat(*__pMainItemFormat); pMainItem->SetElement(TEXT_ID, *(new String(*currentMensa))); // Add the item to the ExpandableList __pListFood->AddItem(*pMainItem, mensaIndex); } String *title = static_cast<String *>(pItem->GetValue(*(new String("title")))); title->Trim(); String priceStudents; String priceStaff; int stringLength = title->GetLength(); // Create a sub item of the ExpandableList CustomListItem *pSubItem = new CustomListItem(); pSubItem->Construct(100); pSubItem->SetItemFormat(*__pSubItemFormat); // get prices if (title->EndsWith(L" EUR)")) { // parse price title->SubString(stringLength - 20, 5, priceStudents); priceStudents.Append(currencySymbol); title->SubString(stringLength - 9, 5, priceStaff); priceStaff.Append(currencySymbol); title->Remove(stringLength - 22, 22); pSubItem->SetElement(PRICESTUDENT_ID, priceStudents); pSubItem->SetElement(PRICESTAFF_ID, priceStaff); } else if (title->EndsWith(L"(ausverkauft)")) { // sold out title->Remove(stringLength - 14, 14); pSubItem->SetElement(REMARK_ID, soldOut); } pSubItem->SetElement(TEXT_ID, *title); // Add sub item to the ExpandableList __pListFood->AddSubItem(mensaIndex, *pSubItem); } // clean up delete pEnum; } __pListFood->RequestRedraw(); __pListFood->ScrollToTop(); StopLoadingAnimation(); }