void RootWindow::keyBackClicked() { if (this->getModalViewController()) { this->dismissModalViewController(true); } else if (this->getDrawerController()->isShowLeftViewController()) { this->getDrawerController()->hideLeftViewController(true); } else if (this->getRootNavigationController()->getViewControllerCount() > 1) { this->getRootNavigationController()->popViewControllerAnimated(true); } else if (this->getRootTabBarController()->getSelectedViewController()->isEqual(m_pSecondNavigationController) && this->getSecondNavigationController()->getViewControllerCount() > 1) { this->getSecondNavigationController()->popViewControllerAnimated(true); } else { CC_RETURN_IF(m_bAlertShow); m_bAlertShow = true; CAAlertView* alertView = CAAlertView::createWithText("提示", "确定要退出?", "确定", "取消", NULL); alertView->setTarget(this, CAAlertView_selector(RootWindow::onAlertView)); alertView->show(); } }
void FSNewsView2::onClickBookMark(CAControl* btn, CCPoint point) { //加入标签 BookMarkInfo *bookmarkinfo = new BookMarkInfo(); ChapterInfo *curChapterInfo = FSDataManager::GetInstance().getNewsManager()->getCurChapterInfo(); // int dff= this->getChapterInfo()->getNewsID(); bookmarkinfo->setChapterID(curChapterInfo->getChapterID()); bookmarkinfo->setNewsID(curChapterInfo->getNewsID()); string strMarkDigest; // if (curFSNewsView2->getCurContent().length()>10) { // strMarkDigest = curFSNewsView2->getCurContent().substr(0,10); // } // else // { // strMarkDigest = m_curContent; // } int curPage = curFSNewsView2->listView->getCurrPage(); bookmarkinfo->setMarkDigest(curFSNewsView2->getDigestForMark()); double contentSize = (double)curFSNewsView2->m_aryContent.size(); double curPageDouble = (double)(curPage+1); double chapterPrecent = curPageDouble/contentSize; chapterPrecent = roundEx(chapterPrecent, 4); // double chapterPrecent = 1; char chrChapterPrecent[50] = ""; sprintf(chrChapterPrecent,"%.4lf",chapterPrecent); bookmarkinfo->setMarkProgress(chrChapterPrecent); bool flag = FSDataManager::GetInstance().getNewsManager()->addBookMarkInfo(bookmarkinfo); string strTitle = "提示"; string strClose="关闭"; string strContent; if (!flag) { //加入失败 strContent = "已经有重复的标签"; } else { strContent = "添加标签成功"; } CAAlertView* alertView = CAAlertView::createWithText(strTitle.c_str(), strContent.c_str(), strClose.c_str(),NULL); alertView->show(); }
void huaFeiViewController::onRequestFinished(const HttpResponseStatus &status, const CSJson::Value &json){ if (status == HttpResponseSucceed) { // const CSJson::Value& code = json["code"]; const CSJson::Value& value = json["msg"]; CCLog("str = %s", value.asString().c_str()); CAAlertView* alertView = CAAlertView::createWithText("提示", value.asString().c_str(), "close",NULL); alertView->show(); } }