MCPcopy Create free account
hub / github.com/9miao/CrossApp / setPullToRefreshStateType

Method setPullToRefreshStateType

CrossApp/view/CAPullToRefreshView.cpp:184–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182}
183
184void CAPullToRefreshView::setPullToRefreshStateType(const PullToRefreshStateType& stateType)
185{
186 CC_RETURN_IF(m_eStateType == stateType);
187
188 CC_RETURN_IF(stateType != None && m_eStateType == Refreshing);
189 m_eStateType = stateType;
190 switch (m_eStateType)
191 {
192 case None:
193 case Normal:
194 {
195 if (m_pLoadingView)
196 {
197 m_pLoadingView->stopAnimating();
198 }
199 m_pPullToImageView->setVisible(true);
200 m_pPullToRefreshLabel->setVisible(true);
201 m_pReleaseToRefreshLabel->setVisible(false);
202 m_pRefreshingLabel->setVisible(false);
203
204 CAViewAnimation::removeAnimations(m_s__StrID);
205
206 CAViewAnimation::beginAnimations(m_s__StrID, NULL);
207 CAViewAnimation::setAnimationDuration(0.2f * m_pPullToImageView->getRotation() / 180.f);
208 m_pPullToImageView->setRotation(0);
209 CAViewAnimation::commitAnimations();
210 }
211 break;
212 case Pulling:
213 {
214 if (m_pLoadingView)
215 {
216 m_pLoadingView->stopAnimating();
217 }
218 m_pPullToImageView->setVisible(true);
219 m_pPullToRefreshLabel->setVisible(false);
220 m_pReleaseToRefreshLabel->setVisible(true);
221 m_pRefreshingLabel->setVisible(false);
222
223 CAViewAnimation::removeAnimations(m_s__StrID);
224
225 CAViewAnimation::beginAnimations(m_s__StrID, NULL);
226 CAViewAnimation::setAnimationDuration(0.2f * (1 - m_pPullToImageView->getRotation() / 180.f));
227 m_pPullToImageView->setRotation(180);
228 CAViewAnimation::commitAnimations();
229 }
230 break;
231 case Refreshing:
232 {
233 if (m_pLoadingView)
234 {
235 if (m_pLoadingView->getSuperview() == NULL)
236 {
237 this->addSubview(m_pLoadingView);
238 }
239 m_pLoadingView->startAnimating();
240 }
241 m_pPullToImageView->setVisible(false);

Callers 5

startLayoutMethod · 0.95
endHeaderRefreshMethod · 0.80
endFooterRefreshMethod · 0.80

Calls 7

getRotationMethod · 0.80
setRotationMethod · 0.80
getSuperviewMethod · 0.80
stopAnimatingMethod · 0.45
setVisibleMethod · 0.45
addSubviewMethod · 0.45
startAnimatingMethod · 0.45

Tested by

no test coverage detected