Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Commit

Permalink
Optized reader
Browse files Browse the repository at this point in the history
  • Loading branch information
Koitharu committed Aug 22, 2016
1 parent 0872d18 commit 876a2d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.CallSuper;
import android.support.annotation.ColorRes;
import android.support.annotation.IdRes;
import android.support.annotation.MainThread;
Expand Down Expand Up @@ -310,28 +311,31 @@ boolean isFirstStart() {

protected abstract class LoaderTask<Params, Progress, Result> extends AsyncTask<Params, Progress, Result> {

@CallSuper
@Override
protected void onPreExecute() {
super.onPreExecute();
registerLoaderTask(this);
}

@CallSuper
@Override
protected void onPostExecute(Result result) {
super.onPostExecute(result);
unregisterLoaderTask(this);
}

@CallSuper
@Override
protected void onCancelled(Result result) {
super.onCancelled(result);
unregisterLoaderTask(this);
}

@CallSuper
@Override
protected void onCancelled() {
super.onCancelled();

unregisterLoaderTask(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,10 @@ public boolean onKeyUp(int keyCode, KeyEvent event) {

@Override
public void onPageSelected(int position) {
mPageId = mPager.getCurrentPageIndex();
mPager.getReaderAdapter().setTopPage(position);
if (mLoader.getVisibility() != View.VISIBLE && !mPager.getReaderAdapter().isFreezed()) {
mPageId = mPager.getCurrentPageIndex();
mPager.getReaderAdapter().setTopPage(position);
}
}

@Override
Expand Down

0 comments on commit 876a2d0

Please sign in to comment.