Make overlay buttons fuctional.

This commit is contained in:
ojiikun 2013-08-09 08:30:52 +00:00
parent 18b11b1922
commit da583b31f7
2 changed files with 17 additions and 5 deletions

View file

@ -22,7 +22,8 @@
android:layout_alignParentRight="true"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:text="next" />
android:text="next"
android:onClick="overlayNext" />
<Button
android:id="@+id/reading_overlay_prev"
@ -32,6 +33,7 @@
android:layout_toLeftOf="@+id/reading_overlay_next"
android:layout_marginBottom="10dp"
android:layout_marginRight="15dp"
android:text="prev" />
android:text="prev"
android:onClick="overlayPrev" />
</RelativeLayout>

View file

@ -179,7 +179,8 @@ public abstract class Reading extends NbFragmentActivity implements OnPageChange
}
@Override
public void onPageSelected(final int position) {
public void onPageSelected(int position) {
this.setOverlayAlpha(1.0f);
}
// interface ScrollChangeListener
@ -197,9 +198,13 @@ public abstract class Reading extends NbFragmentActivity implements OnPageChange
float delta = this.overlayRangeBotPx - ((float) posFromBot);
newAlpha = delta / this.overlayRangeBotPx;
}
this.setOverlayAlpha(newAlpha);
}
private void setOverlayAlpha(float a) {
for (View v : this.overlayControls) {
UIUtils.setViewAlpha(v, newAlpha);
UIUtils.setViewAlpha(v, a);
}
}
@ -286,7 +291,12 @@ public abstract class Reading extends NbFragmentActivity implements OnPageChange
public void onStopTrackingTouch(SeekBar seekBar) {
}
public void overlayNext(View v) {
pager.setCurrentItem(pager.getCurrentItem()+1, true);
}
public void overlayPrev(View v) {
pager.setCurrentItem(pager.getCurrentItem()-1, true);
}
}