__pPopUp->Initialize();
ShareInfo* pShareInfo = new(std::nothrow) ShareInfo();
- pShareInfo->SetPageTitle(L"Google");//temporary only for testing
- pShareInfo->SetPageUrl(L"http://www.google.com");//temporary only for testing
+ pShareInfo->SetPageTitle(*__pShareTitle);
+ pShareInfo->SetPageUrl(*__pShareUrl);
pShareInfo->SetImageAttached(false);
__pPopUp->RemoveAllShareInfo();
__pPopUp->AddShareInfo(pShareInfo);
break;
case IDA_COPY_TEXT_CLICKED:
{
- __pWebReader->ReleaseBlock();
+
// Sets data to a clip board item
ClipboardItem item;
String resourcePath = App::GetInstance()->GetAppResourcePath();
item.Construct(CLIPBOARD_DATA_TYPE_TEXT, __pWebReader->GetTextFromBlock());
-
+ __pWebReader->ReleaseBlock();
// copying the item to clipboard
Clipboard* pClipboard = Clipboard::GetInstance();
if (pClipboard != null)
break;
case IDA_FIND_TEXT_CLICKED:
{
+ __randomValue = true;
InitFindWordPanel();
- __pWebReader->SetBounds(0,__pFindWordControl->GetHeight(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pFooterPanel->GetHeight() - __pFindWordControl->GetHeight());
+ RelayoutControls();
+// __pWebReader->SetBounds(0,__pFindWordControl->GetHeight(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pFooterPanel->GetHeight() - __pFindWordControl->GetHeight());
}
break;
case IDA_SHARE_TEXT_CLICKED:
case IDA_FINDWORD_CANCEL_CLICKED:
{
-// __currentSearchStr = L"";
-// __currentWordIndex = 0;
-// __maxOccurrances = 0;
+// currentSearchStr = L"";
+// currentWordIndex = 0;
+// maxOccurances = 0;
__pFindWordEditField->SetText(L"");
__pFindWordNext->SetEnabled(false);
__pFindWordPrev->SetEnabled(false);
break;
case IDA_FINDWORD_CLEAR_CLICKED:
{
-
+ __pFindWordCountLabel->SetText(L"0/0");
+ __pFindWordEditField->SetText(L"");
+ __pFindWordPrev->SetEnabled(false);
+ __pWebReader->SearchText(L"aaaaaabbbbbbccccccc");
+ __pFindWordNext->SetEnabled(false);
+ __pFindWordControl->Invalidate(true);
}
break;
case IDA_FINDWORD_NEXT_CLICKED:
{
-
+ FindNextWord(true);
}
break;
case IDA_FINDWORD_PREV_CLICKED:
{
-
+ FindNextWord(false);
}
break;
+ break;
default:
break;
}
ArticleReaderForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
{
AppLog("ArticleReaderForm::OnSceneActivatedN entered");
+ int index = 0;
+ __pReaderData = static_cast<String*>(pArgs->GetAt(index++));
+ __pShareUrl = static_cast<String*>(pArgs->GetAt(index++));
+ __pShareTitle = static_cast<String*>(pArgs->GetAt(index++));
+ AppLog("ArticleReaderForm::OnSceneActivatedN __pReaderData %ls",__pReaderData->GetPointer());
+
+ String loadData = L"<html>\
+ <head>\
+ <meta name='viewport' content='width=device-width*0.73,minimum-scale=1.0, maximum-scale=1.0, user-scalable=no'>\
+ <style>\
+ h1\
+ {\
+ font-weight:bold;\
+ background-color: transparent;\
+ }\
+ div\
+ {\
+ display: block;\
+ }\
+ p\
+ {\
+ display: block; \
+ }\
+ img\
+ {\
+ margin-left:auto;\
+ margin-right:auto;\
+ }\
+ \
+ \
+ </style>\
+ </head>\
+ <body style='width:'";
+ loadData.Append(GetClientAreaBounds().width);
+ loadData.Append(L"px'>");
+ AppLogDebug("data->GetLength %d",__pReaderData->GetLength());
+ loadData.Append(*__pReaderData);
+ loadData.Append(L"</body></html>");
+
+ ByteBuffer buf ;
+ buf.Construct(loadData.GetLength());
+ AppLogDebug("data->GetLength %d",loadData.GetLength());
+ for (int z=0;z<loadData.GetLength();z++)
+ {
+ mchar b;
+ loadData.GetCharAt(z,b);
+ buf.SetByte((byte)b);
+ }
+
+ buf.Flip();
+ if (__pWebReader != null)
+ {
+ __pWebReader->LoadData(L"",buf,L"text/html");
+ AppLogDebug("LoadData result %s",GetErrorMessage(GetLastResult()));
+ }
+ else
+ {
+ AppLogDebug("cannot LoadData __pWebReader is null");
+ }
+
+
}
void
void
ArticleReaderForm::OnTextValueChanged (const Tizen::Ui::Control &source)
{
-
if (__pFindWordEditField != null)
{
__pFindWordNext->SetEnabled(false);
__pFindWordPrev->SetEnabled(false);
__pWebReader->SearchText(L"aaaaaaaabbbbbbbccccccc");
}
-
+ __randomValue = true;
// else
// {
-//// __currentSearchStr = L"aaaaaaaabbbbbbbccccccc";
+//// currentSearchStr = L"aaaaaaaabbbbbbbccccccc";
// StartWordSearch();
-//// __currentSearchStr = L"";
+//// currentSearchStr = L"";
// AppLogDebug("Enter something");
// }
}
{
StartWordSearch();
}
+ __pFindWordEditField->Invalidate(false);
return r;
}
if( __pFindWordControl && __pFindWordControl->GetShowState() == true)
{
__pFindWordControl->SetBounds(0,0, __pFindWordControl->GetWidth(), __pFindWordControl->GetHeight());
- __pWebReader->SetBounds(0,__pFindWordControl->GetHeight(),GetClientAreaBounds().width, GetClientAreaBounds().height - __pFooterPanel->GetHeight() - __pFindWordControl->GetHeight());
+ if(__pFooterPanel && __pFooterPanel->GetShowState() == true && __pWebReader)
+ __pWebReader->SetBounds(0,__pFindWordControl->GetHeight(),GetClientAreaBounds().width, GetClientAreaBounds().height - __pFooterPanel->GetHeight() - __pFindWordControl->GetHeight());
+ else if(__pWebReader)
+ __pWebReader->SetBounds(0,__pFindWordControl->GetHeight(),GetClientAreaBounds().width, GetClientAreaBounds().height - __pFindWordControl->GetHeight());
}
else
{
- if(__pWebReader)
+ if(__pFooterPanel && __pFooterPanel->GetShowState() == true && __pWebReader)
__pWebReader->SetBounds(0,0,GetClientAreaBounds().width, GetClientAreaBounds().height - __pFooterPanel->GetHeight());
+ else if(__pWebReader)
+ __pWebReader->SetBounds(0,0,GetClientAreaBounds().width, GetClientAreaBounds().height);
+
+ }
+}
+
+
+void
+ArticleReaderForm::FindNextWord(bool next)
+{
+ String currentSearchStr = __pFindWordEditField->GetText();
+ int currentWordIndex = 0;
+ String curWordIndexStr = L"";
+ int maxOccurances = 0;
+ String maxOccurancesStr = L"";
+ int index = -1;
+ String countStr = __pFindWordCountLabel->GetText();
+ countStr.IndexOf(L"/",0,index);
+ countStr.SubString(0,index,curWordIndexStr);
+ countStr.SubString(index+1,maxOccurancesStr);
+ Integer::Parse(curWordIndexStr,currentWordIndex);
+ Integer::Parse(maxOccurancesStr,maxOccurances);
+ if (next == true)
+ {
+ if (__pWebReader->SearchText(currentSearchStr, true) == true)
+ {
+ if(currentWordIndex < maxOccurances)
+ {
+ currentWordIndex++;
+ }
+ if(__randomValue == true)
+ {
+ __randomValue = false;
+ __pWebReader->SearchText(currentSearchStr, true);
+ }
+ }
+ }
+ else
+ {
+ if (__pWebReader->SearchText(currentSearchStr, false) == true)
+ {
+ if(currentWordIndex > 1)
+ {
+ currentWordIndex--;
+ }
+ }
}
+
+ countStr.Clear();
+ countStr.Append(currentWordIndex);
+ countStr.Append(L"/");
+ countStr.Append(maxOccurances);
+ __pFindWordCountLabel->SetText(countStr);
+ // __pFindWordCountLabel->SetShowState(true);
+ __pFindWordCountLabel->Invalidate(false);
+ if (currentWordIndex >= maxOccurances)
+ {
+ __pFindWordNext->SetEnabled(false);
+ }
+ else
+ {
+ __pFindWordNext->SetEnabled(true);
+ }
+ if (currentWordIndex <= 1)
+ {
+ __pFindWordPrev->SetEnabled(false);
+ }
+ else
+ {
+ __pFindWordPrev->SetEnabled(true);
+ }
+ __pFindWordPrev->Invalidate(false);
+ __pFindWordNext->Invalidate(false);
+ __pFindWordCountLabel->Invalidate(false);
+ __pFindWordControl->Invalidate(true);
}
static const wchar_t* IDS_APPID = L"AppID";
static const wchar_t* IDB_TITLE_PROGRESS_BAR_BG = L"I01_title_progress_bar_bg.png";
static const wchar_t* IDB_TITLE_PROGRESS_BAR = L"I01_title_progress_bar.png";
+//static const wchar_t* IDB_ADDRESS_BAR_BACKGROUND = L"I01_toolbar_bg_02.9.png";
const int IDA_BACKBTN_CLICKED = 101;
const int IDA_BOOKMARKBTN_CLICKED = 102;
if (__pReaderData == null)
{
AppLog("MainScene::data is null Error :%s",GetErrorMessage(GetLastResult()));
- return;
+ __pReaderData = new String(L"<meta name=\"viewport\" content=\"width=0, initial-scale=1.0, maximum-scale=2.0, minimum-scale=1.0, user-scalable=no, target-densitydpi=medium-dpi\"> <h1>Chinese PM Li Keqiang vows to open up markets to India</h1><div><span class=\"arttle\"><h1>Chinese PM Li Keqiang vows to open up markets to India</h1></span></div>");
+// return;
}
AppLogDebug("evaluateJavascript result %s , __pReaderData %ls",GetErrorMessage(GetLastResult()),__pReaderData->GetPointer());
if (__pReaderData->CompareTo(L"undefined") != 0 && __pReaderData->CompareTo(L"") != 0)
}
if (__pWebViewer != null && __pWebViewer->GetShowState() == true)
{
- __pWebViewer->SetBounds(0, __webControlPosition.y, GetClientAreaBounds().width, __webControlHeight);
+ __pWebViewer->SetBounds(0, __webControlPosition.y, GetClientAreaBounds().width, __webControlHeight + 12);
__pWebViewer->Invalidate(false);
}
if(__pMostVisitedListView != null && __pAddressbar != null && __pFooterPanel != null)
__pFindWordCountLabel->Invalidate(false);
__pFindWordControl->Invalidate(true);
}
+
void
MainForm::OnWebKeypadWillOpen(Tizen::Web::Controls::Web& source)
{
__pFooterLabel->SetBackgroundBitmap(*pBitmap);
delete pBitmap;
}
- }
+
+ }
if (__pFindWordBgLabel != null)
{
Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
void
MainForm::ReaderClicked()
{
- SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_ARTICLE_READER, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
+ result r = E_SUCCESS;
+ ArrayList* pArgList = new(std::nothrow) ArrayList();
+ if (pArgList != null)
+ {
+ r = pArgList->Construct();
+ if (IsFailed(r))
+ {
+ delete pArgList;
+ return;
+ }
+
+ r = pArgList->Add(*new(std::nothrow) String(*__pReaderData));
+ if (IsFailed(r))
+ {
+ delete pArgList;
+ return;
+ }
+
+ r = pArgList->Add(*new(std::nothrow) String(__pWebViewer->GetUrl()));
+ if (IsFailed(r))
+ {
+ delete pArgList;
+ return;
+ }
+
+ r = pArgList->Add(*new(std::nothrow) String(__pWindowInfo->pageTitle));
+ if (IsFailed(r))
+ {
+ delete pArgList;
+ return;
+ }
+ }
+
+ SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_ARTICLE_READER, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList);
return;