Skip to content

Commit bde94f1

Browse files
authored
Merge pull request #52 from virxkane/onyxepd-updatefix
Onyx Eink: force update eink screen on reader view show event.
2 parents c64ecf7 + 5e129d6 commit bde94f1

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

android/src/org/coolreader/crengine/EinkScreen.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ public static void PrepareController(View view, boolean isPartially) {
9292
}
9393
*/
9494
} else if (DeviceInfo.EINK_ONYX) {
95+
if (mRefreshNumber == -1) {
96+
mRefreshNumber = 0;
97+
EpdController.setViewDefaultUpdateMode(view, UpdateMode.GC);
98+
return;
99+
}
95100
if (mUpdateInterval > 0) {
96101
mRefreshNumber++;
97102
if (mRefreshNumber >= mUpdateInterval) {
@@ -140,8 +145,7 @@ public static void ResetController(int mode, View view) {
140145
default:
141146
mRefreshNumber = -1;
142147
}
143-
}
144-
if (DeviceInfo.EINK_ONYX) {
148+
} else if (DeviceInfo.EINK_ONYX) {
145149
mIsSupportRegal = EpdController.supportRegal();
146150
mRefreshNumber = 0;
147151
if (mUpdateInterval == 0)

android/src/org/coolreader/crengine/ReaderView.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,21 @@ protected void onSizeChanged(final int w, final int h, int oldw, int oldh) {
106106

107107
@Override
108108
public void onWindowVisibilityChanged(int visibility) {
109-
if (visibility == VISIBLE)
109+
if (visibility == VISIBLE) {
110+
mActivity.einkRefresh();
110111
startStats();
112+
}
111113
else
112114
stopStats();
113115
super.onWindowVisibilityChanged(visibility);
114116
}
115117

116118
@Override
117119
public void onWindowFocusChanged(boolean hasWindowFocus) {
118-
if (hasWindowFocus)
120+
if (hasWindowFocus) {
121+
mActivity.einkRefresh();
119122
startStats();
123+
}
120124
else
121125
stopStats();
122126
super.onWindowFocusChanged(hasWindowFocus);

0 commit comments

Comments
 (0)