if (mSyncTask != null) {
mSyncTask.cancel();
mSyncTask = null;
+ clearLoadingBit(BIT_LOADING_SYNC);
}
mActionModeHandler.pause();
+ GalleryUtils.setSpinnerVisibility((Activity) mActivity, false);
}
@Override
if (resultCode == MediaSet.SYNC_RESULT_SUCCESS) {
mInitialSynced = true;
}
- if (!mIsActive) return;
clearLoadingBit(BIT_LOADING_SYNC);
- if (resultCode == MediaSet.SYNC_RESULT_ERROR) {
+ if (resultCode == MediaSet.SYNC_RESULT_ERROR && mIsActive) {
Toast.makeText((Context) mActivity, R.string.sync_album_error,
Toast.LENGTH_LONG).show();
}
}
private void setLoadingBit(int loadTaskBit) {
- if (mLoadingBits == 0) {
+ if (mLoadingBits == 0 && mIsActive) {
GalleryUtils.setSpinnerVisibility((Activity) mActivity, true);
}
mLoadingBits |= loadTaskBit;
private void clearLoadingBit(int loadTaskBit) {
mLoadingBits &= ~loadTaskBit;
- if (mLoadingBits == 0) {
+ if (mLoadingBits == 0 && mIsActive) {
GalleryUtils.setSpinnerVisibility((Activity) mActivity, false);
if (mAlbumDataAdapter.size() == 0) {
@Override
public void onLoadingFinished() {
- if (!mIsActive) return;
clearLoadingBit(BIT_LOADING_RELOAD);
}
}
private void clearLoadingBit(int loadingBit) {
mLoadingBits &= ~loadingBit;
- if (mLoadingBits == 0) {
+ if (mLoadingBits == 0 && mIsActive) {
GalleryUtils.setSpinnerVisibility((Activity) mActivity, false);
// Only show toast when there's no album and we are going to finish
}
private void setLoadingBit(int loadingBit) {
- if (mLoadingBits == 0) {
+ if (mLoadingBits == 0 && mIsActive) {
GalleryUtils.setSpinnerVisibility((Activity) mActivity, true);
}
mLoadingBits |= loadingBit;
mSyncTask = null;
clearLoadingBit(BIT_LOADING_SYNC);
}
+ GalleryUtils.setSpinnerVisibility((Activity) mActivity, false);
}
@Override
if (resultCode == MediaSet.SYNC_RESULT_SUCCESS) {
mInitialSynced = true;
}
- if (!mIsActive) return;
clearLoadingBit(BIT_LOADING_SYNC);
- if (resultCode == MediaSet.SYNC_RESULT_ERROR) {
+ if (resultCode == MediaSet.SYNC_RESULT_ERROR && mIsActive) {
Toast.makeText((Context) mActivity, R.string.sync_album_set_error,
Toast.LENGTH_LONG).show();
}
}
public void onLoadingFinished() {
- if (!mIsActive) return;
clearLoadingBit(BIT_LOADING_RELOAD);
}
}
}
void finishState(ActivityState state) {
- Log.v(TAG, "finishState " + state.getClass());
+ Log.v(TAG, "finishState " + state);
if (state != mStack.peek().activityState) {
if (state.isDestroyed()) {
Log.d(TAG, "The state is already destroyed");