Skip to content

Commit

Permalink
Merge pull request #85 from codetoart/dev
Browse files Browse the repository at this point in the history
code cleanup fixed travis build
  • Loading branch information
Mahavir Jain committed Dec 8, 2017
2 parents e1329d3 + 69b2973 commit f539591
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 34 deletions.
Expand Up @@ -261,7 +261,7 @@ public void onOrientationChange(int orentation) {
}

private void configFolio() {
mFolioPageViewPager = (DirectionalViewpager) findViewById(R.id.folioPageViewPager);
mFolioPageViewPager = findViewById(R.id.folioPageViewPager);
mFolioPageViewPager.setOnPageChangeListener(new DirectionalViewpager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
Expand All @@ -270,7 +270,6 @@ public void onPageScrolled(int position, float positionOffset, int positionOffse
@Override
public void onPageSelected(int position) {
EventBus.getDefault().post(new MediaOverlayPlayPauseEvent(mSpineReferenceList.get(mChapterPosition).href, false, true));
// BUS.post(new MediaOverlayPlayPauseEvent(mSpineReferenceList.get(mChapterPosition).href, false, true));
mPlayPauseBtn.setImageDrawable(ContextCompat.getDrawable(FolioActivity.this, R.drawable.play_icon));
mChapterPosition = position;
}
Expand Down Expand Up @@ -392,7 +391,6 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
mFolioPageViewPager.setCurrentItem(mChapterPosition);
title.setText(data.getStringExtra(Constants.BOOK_TITLE));
EventBus.getDefault().post(new AnchorIdEvent(selectedChapterHref));
//BUS.post(new AnchorIdEvent(selectedChapterHref));
break;
}
}
Expand All @@ -401,7 +399,6 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
int position = highlightImpl.getPageNumber();
mFolioPageViewPager.setCurrentItem(position);
EventBus.getDefault().post(new WebViewPosition(mSpineReferenceList.get(mChapterPosition).href, highlightImpl.getRangy()));
// BUS.post(new WebViewPosition(mSpineReferenceList.get(mChapterPosition).href, highlightImpl.getRangy()));
}
}
}
Expand Down Expand Up @@ -463,18 +460,18 @@ private void setConfig() {
private RelativeLayout shade;

private void initAudioView() {
mHalfSpeed = (StyleableTextView) findViewById(R.id.btn_half_speed);
mOneSpeed = (StyleableTextView) findViewById(R.id.btn_one_x_speed);
mTwoSpeed = (StyleableTextView) findViewById(R.id.btn_twox_speed);
audioContainer = (RelativeLayout) findViewById(R.id.container);
shade = (RelativeLayout) findViewById(R.id.shade);
mOneAndHalfSpeed = (StyleableTextView) findViewById(R.id.btn_one_and_half_speed);
mPlayPauseBtn = (ImageButton) findViewById(R.id.play_button);
mPreviousButton = (ImageButton) findViewById(R.id.prev_button);
mNextButton = (ImageButton) findViewById(R.id.next_button);
mBackgroundColorStyle = (StyleableTextView) findViewById(R.id.btn_backcolor_style);
mUnderlineStyle = (StyleableTextView) findViewById(R.id.btn_text_undeline_style);
mTextColorStyle = (StyleableTextView) findViewById(R.id.btn_text_color_style);
mHalfSpeed = findViewById(R.id.btn_half_speed);
mOneSpeed = findViewById(R.id.btn_one_x_speed);
mTwoSpeed = findViewById(R.id.btn_twox_speed);
audioContainer = findViewById(R.id.container);
shade = findViewById(R.id.shade);
mOneAndHalfSpeed = findViewById(R.id.btn_one_and_half_speed);
mPlayPauseBtn = findViewById(R.id.play_button);
mPreviousButton = findViewById(R.id.prev_button);
mNextButton = findViewById(R.id.next_button);
mBackgroundColorStyle = findViewById(R.id.btn_backcolor_style);
mUnderlineStyle = findViewById(R.id.btn_text_undeline_style);
mTextColorStyle = findViewById(R.id.btn_text_color_style);
mIsSpeaking = false;

final Context mContext = mHalfSpeed.getContext();
Expand Down
Expand Up @@ -284,6 +284,7 @@ public void styleChanged(MediaOverlayHighlightStyleEvent event) {
*
* @param reloadDataEvent empty POJO.
*/
@SuppressWarnings("unused")
@Subscribe(threadMode = ThreadMode.MAIN)
public void reload(ReloadDataEvent reloadDataEvent) {
if (isAdded()) {
Expand All @@ -294,14 +295,20 @@ public void reload(ReloadDataEvent reloadDataEvent) {
}
}

@Subscribe()
/**
* [EVENT BUS FUNCTION]
*
* Function triggered when highlight is deleted and page is needed to
* be updated.
*
* @param event empty POJO.
*/
@SuppressWarnings("unused")
@Subscribe(threadMode = ThreadMode.MAIN)
public void updateHighlight(UpdateHighlightEvent event){
if(isAdded()) {
String rangy = HighlightUtil.generateRangyString(getPageName());
FolioPageFragment.this.rangy = rangy;
if (!rangy.isEmpty()) {
loadRangy(mWebview, rangy);
}
this.rangy = HighlightUtil.generateRangyString(getPageName());
loadRangy(mWebview, this.rangy);
}
}

Expand All @@ -324,6 +331,14 @@ public void jumpToAnchorPoint(AnchorIdEvent event) {
}
}

@SuppressWarnings("unused")
@Subscribe(threadMode = ThreadMode.MAIN)
public void resetCurrentIndex(RewindIndexEvent resetIndex) {
if (isCurrentFragment()) {
mWebview.loadUrl("javascript:alert(rewindCurrentIndex())");
}
}

@Override
public void onReceiveHtml(String html) {
if (isAdded()) {
Expand Down Expand Up @@ -426,10 +441,7 @@ public void onPageFinished(WebView view, String url) {
if (!rangy.isEmpty()) {
loadRangy(view, rangy);
}

scrollToHighlightId();


}
}

Expand Down Expand Up @@ -473,7 +485,6 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
return true;
}


// prevent favicon.ico to be loaded automatically
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
Expand Down Expand Up @@ -978,13 +989,6 @@ public void run() {
}
}

@Subscribe(threadMode = ThreadMode.MAIN)
public void resetCurrentIndex(RewindIndexEvent resetIndex) {
if (isCurrentFragment()) {
mWebview.loadUrl("javascript:alert(rewindCurrentIndex())");
}
}

@Override
public void onDestroy() {
super.onDestroy();
Expand Down
Expand Up @@ -23,7 +23,6 @@
import com.folioreader.R;
import com.folioreader.model.HighLight;
import com.folioreader.model.HighlightImpl;
import com.folioreader.model.event.ReloadDataEvent;
import com.folioreader.model.event.UpdateHighlightEvent;
import com.folioreader.model.sqlite.HighLightTable;
import com.folioreader.ui.folio.adapter.HighlightAdapter;
Expand Down

0 comments on commit f539591

Please sign in to comment.