mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-06 03:50:19 +02:00
fixed first scrolling direction; animation speed setting
This commit is contained in:
parent
9d7932a015
commit
5f5e8a398a
29 changed files with 275 additions and 39 deletions
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.geometerplus.zlibrary.ui.android" android:versionCode="10000" android:versionName="1.0" android:installLocation="auto">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.geometerplus.zlibrary.ui.android" android:versionCode="10001" android:versionName="1.0.1" android:installLocation="auto">
|
||||||
<uses-sdk android:minSdkVersion="4" />
|
<uses-sdk android:minSdkVersion="4" />
|
||||||
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true" />
|
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
1.0
|
1.0.1
|
||||||
|
|
|
@ -515,6 +515,10 @@
|
||||||
<node name="slide" value="Animace vysunutí"/>
|
<node name="slide" value="Animace vysunutí"/>
|
||||||
<node name="shift" value="Animace posunutí"/>
|
<node name="shift" value="Animace posunutí"/>
|
||||||
</node>
|
</node>
|
||||||
|
<node name="animationSpeed" value="Animation speed" toBeTranslated="true">
|
||||||
|
<node name="fast" value="fast" toBeTranslated="true"/>
|
||||||
|
<node name="slow" value="slow" toBeTranslated="true"/>
|
||||||
|
</node>
|
||||||
<node name="horizontal" value="Vodorovné posouvání">
|
<node name="horizontal" value="Vodorovné posouvání">
|
||||||
<node name="summaryOn" value="Posouvat stránky vodorovně"/>
|
<node name="summaryOn" value="Posouvat stránky vodorovně"/>
|
||||||
<node name="summaryOff" value="Posouvat stránky svisle"/>
|
<node name="summaryOff" value="Posouvat stránky svisle"/>
|
||||||
|
|
|
@ -512,6 +512,10 @@
|
||||||
<node name="slide" value="Slide animation" toBeTranslated="true"/>
|
<node name="slide" value="Slide animation" toBeTranslated="true"/>
|
||||||
<node name="shift" value="Shift animation" toBeTranslated="true"/>
|
<node name="shift" value="Shift animation" toBeTranslated="true"/>
|
||||||
</node>
|
</node>
|
||||||
|
<node name="animationSpeed" value="Animation speed" toBeTranslated="true">
|
||||||
|
<node name="fast" value="fast" toBeTranslated="true"/>
|
||||||
|
<node name="slow" value="slow" toBeTranslated="true"/>
|
||||||
|
</node>
|
||||||
<node name="horizontal" value="Horizontales umblättern">
|
<node name="horizontal" value="Horizontales umblättern">
|
||||||
<node name="summaryOn" value="Seiten horizontal umblättern"/>
|
<node name="summaryOn" value="Seiten horizontal umblättern"/>
|
||||||
<node name="summaryOff" value="Seiten vertikal umblättern"/>
|
<node name="summaryOff" value="Seiten vertikal umblättern"/>
|
||||||
|
|
|
@ -514,6 +514,10 @@
|
||||||
<node name="slide" value="Slide animation"/>
|
<node name="slide" value="Slide animation"/>
|
||||||
<node name="shift" value="Shift animation"/>
|
<node name="shift" value="Shift animation"/>
|
||||||
</node>
|
</node>
|
||||||
|
<node name="animationSpeed" value="Animation speed">
|
||||||
|
<node name="fast" value="fast"/>
|
||||||
|
<node name="slow" value="slow"/>
|
||||||
|
</node>
|
||||||
<node name="horizontal" value="Horizontal scrolling">
|
<node name="horizontal" value="Horizontal scrolling">
|
||||||
<node name="summaryOn" value="Scroll pages horizontally"/>
|
<node name="summaryOn" value="Scroll pages horizontally"/>
|
||||||
<node name="summaryOff" value="Scroll pages vertically"/>
|
<node name="summaryOff" value="Scroll pages vertically"/>
|
||||||
|
|
|
@ -514,6 +514,10 @@
|
||||||
<node name="slide" value="Slide animation" toBeTranslated="true"/>
|
<node name="slide" value="Slide animation" toBeTranslated="true"/>
|
||||||
<node name="shift" value="Shift animation" toBeTranslated="true"/>
|
<node name="shift" value="Shift animation" toBeTranslated="true"/>
|
||||||
</node>
|
</node>
|
||||||
|
<node name="animationSpeed" value="Animation speed" toBeTranslated="true">
|
||||||
|
<node name="fast" value="fast" toBeTranslated="true"/>
|
||||||
|
<node name="slow" value="slow" toBeTranslated="true"/>
|
||||||
|
</node>
|
||||||
<node name="horizontal" value="Défilement horizontal">
|
<node name="horizontal" value="Défilement horizontal">
|
||||||
<node name="summaryOn" value="Défilement des pages horizontalement"/>
|
<node name="summaryOn" value="Défilement des pages horizontalement"/>
|
||||||
<node name="summaryOff" value="Défilement des pages verticalement"/>
|
<node name="summaryOff" value="Défilement des pages verticalement"/>
|
||||||
|
|
|
@ -511,6 +511,10 @@
|
||||||
<node name="slide" value="Deslizar"/>
|
<node name="slide" value="Deslizar"/>
|
||||||
<node name="shift" value="Pasar"/>
|
<node name="shift" value="Pasar"/>
|
||||||
</node>
|
</node>
|
||||||
|
<node name="animationSpeed" value="Animation speed" toBeTranslated="true">
|
||||||
|
<node name="fast" value="fast" toBeTranslated="true"/>
|
||||||
|
<node name="slow" value="slow" toBeTranslated="true"/>
|
||||||
|
</node>
|
||||||
<node name="horizontal" value="Desprazamento horizontal">
|
<node name="horizontal" value="Desprazamento horizontal">
|
||||||
<node name="summaryOn" value="Desprazar as páxinas en horizontal"/>
|
<node name="summaryOn" value="Desprazar as páxinas en horizontal"/>
|
||||||
<node name="summaryOff" value="Desprazar as páxinas en vertical"/>
|
<node name="summaryOff" value="Desprazar as páxinas en vertical"/>
|
||||||
|
|
|
@ -511,6 +511,10 @@
|
||||||
<node name="slide" value="Slide animation" toBeTranslated="true"/>
|
<node name="slide" value="Slide animation" toBeTranslated="true"/>
|
||||||
<node name="shift" value="Shift animation" toBeTranslated="true"/>
|
<node name="shift" value="Shift animation" toBeTranslated="true"/>
|
||||||
</node>
|
</node>
|
||||||
|
<node name="animationSpeed" value="Animation speed" toBeTranslated="true">
|
||||||
|
<node name="fast" value="fast" toBeTranslated="true"/>
|
||||||
|
<node name="slow" value="slow" toBeTranslated="true"/>
|
||||||
|
</node>
|
||||||
<node name="horizontal" value="Vízszintes lapozás">
|
<node name="horizontal" value="Vízszintes lapozás">
|
||||||
<node name="summaryOn" value="Oldalak görgetése vízszintesen"/>
|
<node name="summaryOn" value="Oldalak görgetése vízszintesen"/>
|
||||||
<node name="summaryOff" value="Oldalak görgetése függőlegesen"/>
|
<node name="summaryOff" value="Oldalak görgetése függőlegesen"/>
|
||||||
|
|
|
@ -511,6 +511,10 @@
|
||||||
<node name="slide" value="Slide animation" toBeTranslated="true"/>
|
<node name="slide" value="Slide animation" toBeTranslated="true"/>
|
||||||
<node name="shift" value="Shift animation" toBeTranslated="true"/>
|
<node name="shift" value="Shift animation" toBeTranslated="true"/>
|
||||||
</node>
|
</node>
|
||||||
|
<node name="animationSpeed" value="Animation speed" toBeTranslated="true">
|
||||||
|
<node name="fast" value="fast" toBeTranslated="true"/>
|
||||||
|
<node name="slow" value="slow" toBeTranslated="true"/>
|
||||||
|
</node>
|
||||||
<node name="horizontal" value="Scorrimento orizzontale">
|
<node name="horizontal" value="Scorrimento orizzontale">
|
||||||
<node name="summaryOn" value="Scorri le pagine orizzontalmente"/>
|
<node name="summaryOn" value="Scorri le pagine orizzontalmente"/>
|
||||||
<node name="summaryOff" value="Scorri le pagine in verticale"/>
|
<node name="summaryOff" value="Scorri le pagine in verticale"/>
|
||||||
|
|
|
@ -511,6 +511,10 @@
|
||||||
<node name="slide" value="Slide-animatie"/>
|
<node name="slide" value="Slide-animatie"/>
|
||||||
<node name="shift" value="Shift-animatie"/>
|
<node name="shift" value="Shift-animatie"/>
|
||||||
</node>
|
</node>
|
||||||
|
<node name="animationSpeed" value="Animation speed" toBeTranslated="true">
|
||||||
|
<node name="fast" value="fast" toBeTranslated="true"/>
|
||||||
|
<node name="slow" value="slow" toBeTranslated="true"/>
|
||||||
|
</node>
|
||||||
<node name="horizontal" value="Horizontaal omslaan">
|
<node name="horizontal" value="Horizontaal omslaan">
|
||||||
<node name="summaryOn" value="Pagina's horizontaal omslaan"/>
|
<node name="summaryOn" value="Pagina's horizontaal omslaan"/>
|
||||||
<node name="summaryOff" value="Pagina's verticaal omslaan"/>
|
<node name="summaryOff" value="Pagina's verticaal omslaan"/>
|
||||||
|
|
|
@ -176,8 +176,8 @@
|
||||||
<node name="cancelMenu">
|
<node name="cancelMenu">
|
||||||
<node name="previousBook" value="Открыть предыдущую книгу"/>
|
<node name="previousBook" value="Открыть предыдущую книгу"/>
|
||||||
<node name="returnTo" value="Вернуться к ..."/>
|
<node name="returnTo" value="Вернуться к ..."/>
|
||||||
<node name="back" value="Back" toBeTranslated="true"/>
|
<node name="back" value="Назад"/>
|
||||||
<node name="forward" value="Forward" toBeTranslated="true"/>
|
<node name="forward" value="Вперед"/>
|
||||||
<node name="close" value="Закрыть FBReader"/>
|
<node name="close" value="Закрыть FBReader"/>
|
||||||
</node>
|
</node>
|
||||||
<node name="menu">
|
<node name="menu">
|
||||||
|
@ -425,7 +425,7 @@
|
||||||
<node name="selectionBackground" value="Фон пометки"/>
|
<node name="selectionBackground" value="Фон пометки"/>
|
||||||
<node name="text" value="Обычный текст"/>
|
<node name="text" value="Обычный текст"/>
|
||||||
<node name="hyperlink" value="Гиперссылка"/>
|
<node name="hyperlink" value="Гиперссылка"/>
|
||||||
<node name="hyperlinkVisited" value="Visited hyperlink text" toBeTranslated="true"/>
|
<node name="hyperlinkVisited" value="Посещенная ссылка"/>
|
||||||
<node name="highlighting" value="Фон результатов поиска"/>
|
<node name="highlighting" value="Фон результатов поиска"/>
|
||||||
<node name="footer" value="Подвал"/>
|
<node name="footer" value="Подвал"/>
|
||||||
</node>
|
</node>
|
||||||
|
@ -506,10 +506,14 @@
|
||||||
</node>
|
</node>
|
||||||
<node name="animation" value="Анимация">
|
<node name="animation" value="Анимация">
|
||||||
<node name="none" value="Выключить анимацию"/>
|
<node name="none" value="Выключить анимацию"/>
|
||||||
<node name="curl" value="Curl animation" toBeTranslated="true"/>
|
<node name="curl" value="Трехмерная анимация"/>
|
||||||
<node name="slide" value="Сдвиг с перекрытием"/>
|
<node name="slide" value="Сдвиг с перекрытием"/>
|
||||||
<node name="shift" value="Сдвиг"/>
|
<node name="shift" value="Сдвиг"/>
|
||||||
</node>
|
</node>
|
||||||
|
<node name="animationSpeed" value="Скорость анимации">
|
||||||
|
<node name="fast" value="быстро"/>
|
||||||
|
<node name="slow" value="медленно"/>
|
||||||
|
</node>
|
||||||
<node name="horizontal" value="Горизонтальное перелистывание">
|
<node name="horizontal" value="Горизонтальное перелистывание">
|
||||||
<node name="summaryOn" value="При листании страница движется по горизонтали"/>
|
<node name="summaryOn" value="При листании страница движется по горизонтали"/>
|
||||||
<node name="summaryOff" value="При листании страница движется по вертикали"/>
|
<node name="summaryOff" value="При листании страница движется по вертикали"/>
|
||||||
|
|
|
@ -511,6 +511,10 @@
|
||||||
<node name="slide" value="เลื่อนหน้าแบบสไลด์"/>
|
<node name="slide" value="เลื่อนหน้าแบบสไลด์"/>
|
||||||
<node name="shift" value="เลื่อนหน้าแบบสลับ"/>
|
<node name="shift" value="เลื่อนหน้าแบบสลับ"/>
|
||||||
</node>
|
</node>
|
||||||
|
<node name="animationSpeed" value="Animation speed" toBeTranslated="true">
|
||||||
|
<node name="fast" value="fast" toBeTranslated="true"/>
|
||||||
|
<node name="slow" value="slow" toBeTranslated="true"/>
|
||||||
|
</node>
|
||||||
<node name="horizontal" value="เลื่อนหน้าในแนวนอน">
|
<node name="horizontal" value="เลื่อนหน้าในแนวนอน">
|
||||||
<node name="summaryOn" value="เลื่อนหน้าตามแนวนอน"/>
|
<node name="summaryOn" value="เลื่อนหน้าตามแนวนอน"/>
|
||||||
<node name="summaryOff" value="เลื่อนหน้าตามแนวตั้ง"/>
|
<node name="summaryOff" value="เลื่อนหน้าตามแนวตั้ง"/>
|
||||||
|
|
|
@ -511,6 +511,10 @@
|
||||||
<node name="slide" value="Slide animation" toBeTranslated="true"/>
|
<node name="slide" value="Slide animation" toBeTranslated="true"/>
|
||||||
<node name="shift" value="Shift animation" toBeTranslated="true"/>
|
<node name="shift" value="Shift animation" toBeTranslated="true"/>
|
||||||
</node>
|
</node>
|
||||||
|
<node name="animationSpeed" value="Animation speed" toBeTranslated="true">
|
||||||
|
<node name="fast" value="fast" toBeTranslated="true"/>
|
||||||
|
<node name="slow" value="slow" toBeTranslated="true"/>
|
||||||
|
</node>
|
||||||
<node name="horizontal" value="Горизонтальне перегортання">
|
<node name="horizontal" value="Горизонтальне перегортання">
|
||||||
<node name="summaryOn" value="При гортанні сторінка рухається по горизонталі"/>
|
<node name="summaryOn" value="При гортанні сторінка рухається по горизонталі"/>
|
||||||
<node name="summaryOff" value="При гортанні сторінка рухається по вертикалі"/>
|
<node name="summaryOff" value="При гортанні сторінка рухається по вертикалі"/>
|
||||||
|
|
|
@ -511,6 +511,10 @@
|
||||||
<node name="slide" value="Slide animation" toBeTranslated="true"/>
|
<node name="slide" value="Slide animation" toBeTranslated="true"/>
|
||||||
<node name="shift" value="Shift animation" toBeTranslated="true"/>
|
<node name="shift" value="Shift animation" toBeTranslated="true"/>
|
||||||
</node>
|
</node>
|
||||||
|
<node name="animationSpeed" value="Animation speed" toBeTranslated="true">
|
||||||
|
<node name="fast" value="fast" toBeTranslated="true"/>
|
||||||
|
<node name="slow" value="slow" toBeTranslated="true"/>
|
||||||
|
</node>
|
||||||
<node name="horizontal" value="Cuộn ngang">
|
<node name="horizontal" value="Cuộn ngang">
|
||||||
<node name="summaryOn" value="Cuộn trang theo chiều ngang"/>
|
<node name="summaryOn" value="Cuộn trang theo chiều ngang"/>
|
||||||
<node name="summaryOff" value="Cuộn trang theo chiều dọc"/>
|
<node name="summaryOff" value="Cuộn trang theo chiều dọc"/>
|
||||||
|
|
|
@ -511,6 +511,10 @@
|
||||||
<node name="slide" value="Slide animation" toBeTranslated="true"/>
|
<node name="slide" value="Slide animation" toBeTranslated="true"/>
|
||||||
<node name="shift" value="Shift animation" toBeTranslated="true"/>
|
<node name="shift" value="Shift animation" toBeTranslated="true"/>
|
||||||
</node>
|
</node>
|
||||||
|
<node name="animationSpeed" value="Animation speed" toBeTranslated="true">
|
||||||
|
<node name="fast" value="fast" toBeTranslated="true"/>
|
||||||
|
<node name="slow" value="slow" toBeTranslated="true"/>
|
||||||
|
</node>
|
||||||
<node name="horizontal" value="横向翻阅">
|
<node name="horizontal" value="横向翻阅">
|
||||||
<node name="summaryOn" value="横向翻阅" />
|
<node name="summaryOn" value="横向翻阅" />
|
||||||
<node name="summaryOff" value="纵向翻阅" />
|
<node name="summaryOff" value="纵向翻阅" />
|
||||||
|
|
|
@ -0,0 +1,159 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2010-2011 Geometer Plus <contact@geometerplus.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.geometerplus.android.fbreader.preferences;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.graphics.*;
|
||||||
|
import android.graphics.drawable.*;
|
||||||
|
import android.preference.DialogPreference;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.SeekBar;
|
||||||
|
|
||||||
|
import org.geometerplus.zlibrary.core.options.ZLIntegerRangeOption;
|
||||||
|
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
|
|
||||||
|
import org.geometerplus.zlibrary.ui.android.R;
|
||||||
|
|
||||||
|
class AnimationSpeedPreference extends DialogPreference implements ZLPreference {
|
||||||
|
private final ZLIntegerRangeOption myOption;
|
||||||
|
private final ZLResource myResource;
|
||||||
|
|
||||||
|
private SeekBar mySlider;
|
||||||
|
|
||||||
|
AnimationSpeedPreference(Context context, ZLResource resource, String resourceKey, ZLIntegerRangeOption option) {
|
||||||
|
super(context, null);
|
||||||
|
myOption = option;
|
||||||
|
myResource = resource.getResource(resourceKey);
|
||||||
|
final String title = myResource.getValue();
|
||||||
|
setTitle(title);
|
||||||
|
setDialogTitle(title);
|
||||||
|
setDialogLayoutResource(R.layout.animation_speed_dialog);
|
||||||
|
|
||||||
|
final ZLResource buttonResource = ZLResource.resource("dialog").getResource("button");
|
||||||
|
setPositiveButtonText(buttonResource.getResource("ok").getValue());
|
||||||
|
setNegativeButtonText(buttonResource.getResource("cancel").getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onBindDialogView(View view) {
|
||||||
|
mySlider = (SeekBar)view.findViewById(R.id.animation_speed_slider);
|
||||||
|
mySlider.setMax(myOption.MaxValue - myOption.MinValue);
|
||||||
|
mySlider.setProgress(myOption.getValue() - myOption.MinValue);
|
||||||
|
mySlider.setProgressDrawable(new SeekBarDrawable());
|
||||||
|
|
||||||
|
super.onBindDialogView(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
if (which == DialogInterface.BUTTON_POSITIVE) {
|
||||||
|
myOption.setValue(myOption.MinValue + mySlider.getProgress());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onAccept() {
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SeekBarDrawable extends Drawable {
|
||||||
|
private final Drawable myBase;
|
||||||
|
private final Paint myPaint;
|
||||||
|
private final Paint myOutlinePaint;
|
||||||
|
|
||||||
|
public SeekBarDrawable() {
|
||||||
|
myBase = mySlider.getProgressDrawable();
|
||||||
|
|
||||||
|
myPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
myPaint.setTypeface(Typeface.DEFAULT_BOLD);
|
||||||
|
myPaint.setColor(Color.BLACK);
|
||||||
|
myPaint.setAlpha(255);
|
||||||
|
|
||||||
|
myOutlinePaint = new Paint(myPaint);
|
||||||
|
myOutlinePaint.setStyle(Paint.Style.STROKE);
|
||||||
|
myOutlinePaint.setStrokeWidth(3);
|
||||||
|
myOutlinePaint.setColor(0xFFAAAAAA);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onBoundsChange(Rect bounds) {
|
||||||
|
myBase.setBounds(bounds);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean onStateChange(int[] state) {
|
||||||
|
invalidateSelf();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isStateful() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean onLevelChange(int level) {
|
||||||
|
return myBase.setLevel(level);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(Canvas canvas) {
|
||||||
|
myBase.draw(canvas);
|
||||||
|
|
||||||
|
final Rect bounds = getBounds();
|
||||||
|
final int textSize = bounds.height() * 2 / 3;
|
||||||
|
myPaint.setTextSize(textSize);
|
||||||
|
myOutlinePaint.setTextSize(textSize);
|
||||||
|
|
||||||
|
final Rect textBounds = new Rect();
|
||||||
|
myPaint.getTextBounds("a", 0, 1, textBounds);
|
||||||
|
final float y = bounds.height() / 2 + textBounds.height();
|
||||||
|
|
||||||
|
final int progress = mySlider.getProgress();
|
||||||
|
final int max = mySlider.getMax();
|
||||||
|
if (progress >= max / 3) {
|
||||||
|
final String text = myResource.getResource("slow").getValue();
|
||||||
|
final float textWidth = myOutlinePaint.measureText(text);
|
||||||
|
final float x = 6;
|
||||||
|
canvas.drawText(text, x, y, myOutlinePaint);
|
||||||
|
canvas.drawText(text, x, y, myPaint);
|
||||||
|
}
|
||||||
|
if (progress <= 2 * max / 3) {
|
||||||
|
final String text = myResource.getResource("fast").getValue();
|
||||||
|
final float textWidth = myOutlinePaint.measureText(text);
|
||||||
|
final float x = bounds.width() - textWidth - 6;
|
||||||
|
canvas.drawText(text, x, y, myOutlinePaint);
|
||||||
|
canvas.drawText(text, x, y, myPaint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getOpacity() {
|
||||||
|
return PixelFormat.TRANSLUCENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAlpha(int alpha) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setColorFilter(ColorFilter cf) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -361,6 +361,12 @@ public class PreferenceActivity extends ZLPreferenceActivity {
|
||||||
volumeKeysPreferences.setEnabled(scrollingPreferences.VolumeKeysOption.getValue());
|
volumeKeysPreferences.setEnabled(scrollingPreferences.VolumeKeysOption.getValue());
|
||||||
|
|
||||||
scrollingScreen.addOption(scrollingPreferences.AnimationOption, "animation");
|
scrollingScreen.addOption(scrollingPreferences.AnimationOption, "animation");
|
||||||
|
scrollingScreen.addPreference(new AnimationSpeedPreference(
|
||||||
|
this,
|
||||||
|
scrollingScreen.Resource,
|
||||||
|
"animationSpeed",
|
||||||
|
scrollingPreferences.AnimationSpeedOption
|
||||||
|
));
|
||||||
scrollingScreen.addOption(scrollingPreferences.HorizontalOption, "horizontal");
|
scrollingScreen.addOption(scrollingPreferences.HorizontalOption, "horizontal");
|
||||||
|
|
||||||
final Screen dictionaryScreen = createPreferenceScreen("dictionary");
|
final Screen dictionaryScreen = createPreferenceScreen("dictionary");
|
||||||
|
|
|
@ -244,7 +244,7 @@ public final class FBView extends ZLTextView {
|
||||||
? PageIndex.current
|
? PageIndex.current
|
||||||
: (diff < 0 ? PageIndex.next : PageIndex.previous);
|
: (diff < 0 ? PageIndex.next : PageIndex.previous);
|
||||||
if (getAnimationType() != Animation.none) {
|
if (getAnimationType() != Animation.none) {
|
||||||
startAutoScrolling(pageIndex, horizontal ? Direction.rightToLeft : Direction.up);
|
startAutoScrolling(pageIndex, horizontal ? Direction.rightToLeft : Direction.up, ScrollingPreferences.Instance().AnimationSpeedOption.getValue());
|
||||||
} else {
|
} else {
|
||||||
myReader.scrollViewToCenter();
|
myReader.scrollViewToCenter();
|
||||||
onScrollingFinished(pageIndex);
|
onScrollingFinished(pageIndex);
|
||||||
|
|
|
@ -21,6 +21,7 @@ package org.geometerplus.fbreader.fbreader;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.options.ZLBooleanOption;
|
import org.geometerplus.zlibrary.core.options.ZLBooleanOption;
|
||||||
import org.geometerplus.zlibrary.core.options.ZLEnumOption;
|
import org.geometerplus.zlibrary.core.options.ZLEnumOption;
|
||||||
|
import org.geometerplus.zlibrary.core.options.ZLIntegerRangeOption;
|
||||||
import org.geometerplus.zlibrary.core.view.ZLView;
|
import org.geometerplus.zlibrary.core.view.ZLView;
|
||||||
|
|
||||||
public class ScrollingPreferences {
|
public class ScrollingPreferences {
|
||||||
|
@ -43,6 +44,8 @@ public class ScrollingPreferences {
|
||||||
|
|
||||||
public final ZLEnumOption<ZLView.Animation> AnimationOption =
|
public final ZLEnumOption<ZLView.Animation> AnimationOption =
|
||||||
new ZLEnumOption<ZLView.Animation>("Scrolling", "Animation", ZLView.Animation.slide);
|
new ZLEnumOption<ZLView.Animation>("Scrolling", "Animation", ZLView.Animation.slide);
|
||||||
|
public final ZLIntegerRangeOption AnimationSpeedOption =
|
||||||
|
new ZLIntegerRangeOption("Scrolling", "AnimationSpeed", 1, 10, 4);
|
||||||
|
|
||||||
public final ZLBooleanOption HorizontalOption =
|
public final ZLBooleanOption HorizontalOption =
|
||||||
new ZLBooleanOption("Scrolling", "Horizontal", true);
|
new ZLBooleanOption("Scrolling", "Horizontal", true);
|
||||||
|
|
|
@ -61,7 +61,8 @@ class TurnPageAction extends FBAction {
|
||||||
view.startAutoScrolling(
|
view.startAutoScrolling(
|
||||||
myForward ? FBView.PageIndex.next : FBView.PageIndex.previous,
|
myForward ? FBView.PageIndex.next : FBView.PageIndex.previous,
|
||||||
preferences.HorizontalOption.getValue()
|
preferences.HorizontalOption.getValue()
|
||||||
? FBView.Direction.rightToLeft : FBView.Direction.up
|
? FBView.Direction.rightToLeft : FBView.Direction.up,
|
||||||
|
preferences.AnimationSpeedOption.getValue()
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
view.scrollPage(myForward, FBView.ScrollingMode.NO_OVERLAPPING, 0);
|
view.scrollPage(myForward, FBView.ScrollingMode.NO_OVERLAPPING, 0);
|
||||||
|
@ -77,7 +78,8 @@ class TurnPageAction extends FBAction {
|
||||||
myForward ? FBView.PageIndex.next : FBView.PageIndex.previous,
|
myForward ? FBView.PageIndex.next : FBView.PageIndex.previous,
|
||||||
preferences.HorizontalOption.getValue()
|
preferences.HorizontalOption.getValue()
|
||||||
? FBView.Direction.rightToLeft : FBView.Direction.up,
|
? FBView.Direction.rightToLeft : FBView.Direction.up,
|
||||||
x, y
|
x, y,
|
||||||
|
preferences.AnimationSpeedOption.getValue()
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
view.scrollPage(myForward, FBView.ScrollingMode.NO_OVERLAPPING, 0);
|
view.scrollPage(myForward, FBView.ScrollingMode.NO_OVERLAPPING, 0);
|
||||||
|
|
|
@ -59,7 +59,8 @@ class VolumeKeyTurnPageAction extends FBAction {
|
||||||
view.startAutoScrolling(
|
view.startAutoScrolling(
|
||||||
forward ? FBView.PageIndex.next : FBView.PageIndex.previous,
|
forward ? FBView.PageIndex.next : FBView.PageIndex.previous,
|
||||||
preferences.HorizontalOption.getValue()
|
preferences.HorizontalOption.getValue()
|
||||||
? FBView.Direction.rightToLeft : FBView.Direction.up
|
? FBView.Direction.rightToLeft : FBView.Direction.up,
|
||||||
|
preferences.AnimationSpeedOption.getValue()
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
view.scrollPage(forward, FBView.ScrollingMode.NO_OVERLAPPING, 0);
|
view.scrollPage(forward, FBView.ScrollingMode.NO_OVERLAPPING, 0);
|
||||||
|
|
|
@ -80,15 +80,15 @@ public abstract class ZLApplication {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void startViewAutoScrolling(ZLView.PageIndex pageIndex, ZLView.Direction direction) {
|
public final void startViewAutoScrolling(ZLView.PageIndex pageIndex, ZLView.Direction direction, int speed) {
|
||||||
if (myWindow != null) {
|
if (myWindow != null) {
|
||||||
myWindow.startViewAutoScrolling(pageIndex, direction);
|
myWindow.startViewAutoScrolling(pageIndex, direction, speed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void startViewAutoScrolling(ZLView.PageIndex pageIndex, ZLView.Direction direction, int x, int y) {
|
public final void startViewAutoScrolling(ZLView.PageIndex pageIndex, ZLView.Direction direction, int x, int y, int speed) {
|
||||||
if (myWindow != null) {
|
if (myWindow != null) {
|
||||||
myWindow.startViewAutoScrolling(pageIndex, direction, x, y);
|
myWindow.startViewAutoScrolling(pageIndex, direction, x, y, speed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,8 @@ abstract public class ZLApplicationWindow {
|
||||||
abstract protected void repaintView();
|
abstract protected void repaintView();
|
||||||
abstract protected void scrollViewManually(int startX, int startY, int endX, int endY, ZLView.Direction direction);
|
abstract protected void scrollViewManually(int startX, int startY, int endX, int endY, ZLView.Direction direction);
|
||||||
abstract protected void scrollViewToCenter();
|
abstract protected void scrollViewToCenter();
|
||||||
abstract protected void startViewAutoScrolling(ZLView.PageIndex pageIndex, ZLView.Direction direction);
|
abstract protected void startViewAutoScrolling(ZLView.PageIndex pageIndex, ZLView.Direction direction, int speed);
|
||||||
abstract protected void startViewAutoScrolling(ZLView.PageIndex pageIndex, ZLView.Direction direction, int x, int y);
|
abstract protected void startViewAutoScrolling(ZLView.PageIndex pageIndex, ZLView.Direction direction, int x, int y, int speed);
|
||||||
|
|
||||||
abstract protected void rotate();
|
abstract protected void rotate();
|
||||||
abstract protected boolean canRotate();
|
abstract protected boolean canRotate();
|
||||||
|
|
|
@ -199,22 +199,22 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
||||||
myScrollingIsActive = active;
|
myScrollingIsActive = active;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final synchronized void startAutoScrolling(PageIndex pageIndex, Direction direction) {
|
public final synchronized void startAutoScrolling(PageIndex pageIndex, Direction direction, int speed) {
|
||||||
if (isScrollingActive()) {
|
if (isScrollingActive()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setScrollingActive(true);
|
setScrollingActive(true);
|
||||||
ZLApplication.Instance().startViewAutoScrolling(pageIndex, direction);
|
ZLApplication.Instance().startViewAutoScrolling(pageIndex, direction, speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final synchronized void startAutoScrolling(PageIndex pageIndex, Direction direction, int x, int y) {
|
public final synchronized void startAutoScrolling(PageIndex pageIndex, Direction direction, int x, int y, int speed) {
|
||||||
if (isScrollingActive()) {
|
if (isScrollingActive()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setScrollingActive(true);
|
setScrollingActive(true);
|
||||||
ZLApplication.Instance().startViewAutoScrolling(pageIndex, direction, x, y);
|
ZLApplication.Instance().startViewAutoScrolling(pageIndex, direction, x, y, speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -89,17 +89,17 @@ public final class ZLAndroidApplicationWindow extends ZLApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void startViewAutoScrolling(ZLView.PageIndex pageIndex, ZLView.Direction direction) {
|
protected void startViewAutoScrolling(ZLView.PageIndex pageIndex, ZLView.Direction direction, int speed) {
|
||||||
final ZLAndroidWidget widget =
|
final ZLAndroidWidget widget =
|
||||||
((ZLAndroidLibrary)ZLAndroidLibrary.Instance()).getWidget();
|
((ZLAndroidLibrary)ZLAndroidLibrary.Instance()).getWidget();
|
||||||
widget.startAutoScrolling(pageIndex, direction, null, null);
|
widget.startAutoScrolling(pageIndex, direction, null, null, speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void startViewAutoScrolling(ZLView.PageIndex pageIndex, ZLView.Direction direction, int x, int y) {
|
protected void startViewAutoScrolling(ZLView.PageIndex pageIndex, ZLView.Direction direction, int x, int y, int speed) {
|
||||||
final ZLAndroidWidget widget =
|
final ZLAndroidWidget widget =
|
||||||
((ZLAndroidLibrary)ZLAndroidLibrary.Instance()).getWidget();
|
((ZLAndroidLibrary)ZLAndroidLibrary.Instance()).getWidget();
|
||||||
widget.startAutoScrolling(pageIndex, direction, x, y);
|
widget.startAutoScrolling(pageIndex, direction, x, y, speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rotate() {
|
public void rotate() {
|
||||||
|
|
|
@ -67,7 +67,8 @@ abstract class AnimationProvider {
|
||||||
setup(startX, startY, endX, endY, direction, w, h);
|
setup(startX, startY, endX, endY, direction, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void startAutoScrolling(boolean forward, float speed, ZLView.Direction direction, int w, int h, Integer x, Integer y) {
|
void startAutoScrolling(boolean forward, float startSpeed, ZLView.Direction direction, int w, int h, Integer x, Integer y, int speed) {
|
||||||
|
System.err.println("starting: " + forward + " " + startSpeed + " " + direction + " " + w + " " + h + " " + x + " " + y + " " + speed);
|
||||||
if (!inProgress()) {
|
if (!inProgress()) {
|
||||||
if (x == null || y == null) {
|
if (x == null || y == null) {
|
||||||
if (direction.IsHorizontal) {
|
if (direction.IsHorizontal) {
|
||||||
|
@ -84,7 +85,7 @@ abstract class AnimationProvider {
|
||||||
myMode = forward
|
myMode = forward
|
||||||
? Mode.AutoScrollingForward
|
? Mode.AutoScrollingForward
|
||||||
: Mode.AutoScrollingBackward;
|
: Mode.AutoScrollingBackward;
|
||||||
mySpeed = speed;
|
mySpeed = startSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean inProgress() {
|
boolean inProgress() {
|
||||||
|
|
|
@ -31,6 +31,8 @@ class CurlAnimationProvider extends AnimationProvider {
|
||||||
final Path myFgPath = new Path();
|
final Path myFgPath = new Path();
|
||||||
final Path myEdgePath = new Path();
|
final Path myEdgePath = new Path();
|
||||||
|
|
||||||
|
private float mySpeedFactor;
|
||||||
|
|
||||||
CurlAnimationProvider(Paint paint) {
|
CurlAnimationProvider(Paint paint) {
|
||||||
super(paint);
|
super(paint);
|
||||||
|
|
||||||
|
@ -195,18 +197,18 @@ class CurlAnimationProvider extends AnimationProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void startAutoScrolling(boolean forward, float speed, ZLView.Direction direction, int w, int h, Integer x, Integer y) {
|
void startAutoScrolling(boolean forward, float startSpeed, ZLView.Direction direction, int w, int h, Integer x, Integer y, int speed) {
|
||||||
if (x == null || y == null) {
|
if (x == null || y == null) {
|
||||||
if (direction.IsHorizontal) {
|
if (direction.IsHorizontal) {
|
||||||
x = speed < 0 ? w - 3 : 3;
|
x = startSpeed < 0 ? w - 3 : 3;
|
||||||
y = 1;
|
y = 1;
|
||||||
} else {
|
} else {
|
||||||
x = 1;
|
x = 1;
|
||||||
y = speed < 0 ? h - 3 : 3;
|
y = startSpeed < 0 ? h - 3 : 3;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final int cornerX = x > myWidth / 2 ? myWidth : 0;
|
final int cornerX = x > w / 2 ? w : 0;
|
||||||
final int cornerY = y > myHeight / 2 ? myHeight : 0;
|
final int cornerY = y > h / 2 ? h : 0;
|
||||||
int deltaX = Math.min(Math.abs(x - cornerX), w / 5);
|
int deltaX = Math.min(Math.abs(x - cornerX), w / 5);
|
||||||
int deltaY = Math.min(Math.abs(y - cornerY), h / 5);
|
int deltaY = Math.min(Math.abs(y - cornerY), h / 5);
|
||||||
if (direction.IsHorizontal) {
|
if (direction.IsHorizontal) {
|
||||||
|
@ -217,7 +219,8 @@ class CurlAnimationProvider extends AnimationProvider {
|
||||||
x = Math.abs(cornerX - deltaX);
|
x = Math.abs(cornerX - deltaX);
|
||||||
y = Math.abs(cornerY - deltaY);
|
y = Math.abs(cornerY - deltaY);
|
||||||
}
|
}
|
||||||
super.startAutoScrolling(forward, speed, direction, w, h, x, y);
|
super.startAutoScrolling(forward, startSpeed, direction, w, h, x, y, speed);
|
||||||
|
mySpeedFactor = (float)Math.pow(2.0, 0.25 * speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -227,7 +230,7 @@ class CurlAnimationProvider extends AnimationProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
final int speed = (int)Math.abs(mySpeed);
|
final int speed = (int)Math.abs(mySpeed);
|
||||||
mySpeed *= 2;
|
mySpeed *= mySpeedFactor;
|
||||||
|
|
||||||
final int cornerX = myStartX > myWidth / 2 ? myWidth : 0;
|
final int cornerX = myStartX > myWidth / 2 ? myWidth : 0;
|
||||||
final int cornerY = myStartY > myHeight / 2 ? myHeight : 0;
|
final int cornerY = myStartY > myHeight / 2 ? myHeight : 0;
|
||||||
|
|
|
@ -24,6 +24,8 @@ import android.graphics.Paint;
|
||||||
import org.geometerplus.zlibrary.core.view.ZLView;
|
import org.geometerplus.zlibrary.core.view.ZLView;
|
||||||
|
|
||||||
abstract class SimpleAnimationProvider extends AnimationProvider {
|
abstract class SimpleAnimationProvider extends AnimationProvider {
|
||||||
|
private float mySpeedFactor;
|
||||||
|
|
||||||
SimpleAnimationProvider(Paint paint) {
|
SimpleAnimationProvider(Paint paint) {
|
||||||
super(paint);
|
super(paint);
|
||||||
}
|
}
|
||||||
|
@ -43,6 +45,12 @@ abstract class SimpleAnimationProvider extends AnimationProvider {
|
||||||
return ZLView.PageIndex.current;
|
return ZLView.PageIndex.current;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void startAutoScrolling(boolean forward, float startSpeed, ZLView.Direction direction, int w, int h, Integer x, Integer y, int speed) {
|
||||||
|
super.startAutoScrolling(forward, startSpeed, direction, w, h, x, y, speed);
|
||||||
|
mySpeedFactor = (float)Math.pow(1.5, 0.25 * speed);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void doStep() {
|
void doStep() {
|
||||||
if (!getMode().Auto) {
|
if (!getMode().Auto) {
|
||||||
|
@ -69,6 +77,7 @@ abstract class SimpleAnimationProvider extends AnimationProvider {
|
||||||
} else {
|
} else {
|
||||||
bound = 0;
|
bound = 0;
|
||||||
}
|
}
|
||||||
|
System.err.println("before check: " + mySpeed + " " + getScrollingShift() + " " + bound);
|
||||||
if (mySpeed > 0) {
|
if (mySpeed > 0) {
|
||||||
if (getScrollingShift() >= bound) {
|
if (getScrollingShift() >= bound) {
|
||||||
if (myDirection.IsHorizontal) {
|
if (myDirection.IsHorizontal) {
|
||||||
|
@ -90,6 +99,6 @@ abstract class SimpleAnimationProvider extends AnimationProvider {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mySpeed *= 1.5;
|
mySpeed *= mySpeedFactor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,7 +202,7 @@ public class ZLAndroidWidget extends View implements View.OnLongClickListener {
|
||||||
postInvalidate();
|
postInvalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startAutoScrolling(ZLView.PageIndex pageIndex, ZLView.Direction direction, Integer x, Integer y) {
|
public void startAutoScrolling(ZLView.PageIndex pageIndex, ZLView.Direction direction, Integer x, Integer y, int speed) {
|
||||||
if (myMainBitmap == null) {
|
if (myMainBitmap == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -216,19 +216,19 @@ public class ZLAndroidWidget extends View implements View.OnLongClickListener {
|
||||||
animator.terminate();
|
animator.terminate();
|
||||||
break;
|
break;
|
||||||
case previous:
|
case previous:
|
||||||
animator.startAutoScrolling(false, -3, direction, w, h, x, y);
|
animator.startAutoScrolling(false, -3, direction, w, h, x, y, speed);
|
||||||
break;
|
break;
|
||||||
case next:
|
case next:
|
||||||
animator.startAutoScrolling(false, 3, direction, w, h, x, y);
|
animator.startAutoScrolling(false, 3, direction, w, h, x, y, speed);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case previous:
|
case previous:
|
||||||
animator.startAutoScrolling(true, 3, direction, w, h, x, y);
|
animator.startAutoScrolling(true, 3, direction, w, h, x, y, speed);
|
||||||
setPageToScrollTo(pageIndex);
|
setPageToScrollTo(pageIndex);
|
||||||
break;
|
break;
|
||||||
case next:
|
case next:
|
||||||
animator.startAutoScrolling(true, -3, direction, w, h, x, y);
|
animator.startAutoScrolling(true, -3, direction, w, h, x, y, speed);
|
||||||
setPageToScrollTo(pageIndex);
|
setPageToScrollTo(pageIndex);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue