修改手势,字符串
This commit is contained in:
1 parent
c6c060b5e2
commit
74e37ea72d
10 files changed
+47
-156
No files matched your search
@@ -150,6 +150,8 @@ public class MangaActivity extends Activity {
|
||||
private boolean testImage(String path, String name) {
|
||||
boolean isImage = false;
|
||||
File file = new File(path, name);
|
||||
if (!file.exists() || !file.isFile())
|
||||
return false;
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
// Just test bound might error
|
||||
|
||||
@@ -6,9 +6,6 @@ import android.graphics.Color;
|
||||
import android.graphics.Movie;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
|
||||
import com.hippo.ehviewer.util.Log;
|
||||
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
@@ -24,6 +21,10 @@ import com.hippo.ehviewer.gallery.ui.GLView;
|
||||
import com.hippo.ehviewer.gallery.ui.GestureRecognizer;
|
||||
import com.hippo.ehviewer.gallery.util.GalleryUtils;
|
||||
import com.hippo.ehviewer.util.Config;
|
||||
import com.hippo.ehviewer.util.Log;
|
||||
import com.hippo.ehviewer.util.ThreadPool;
|
||||
import com.hippo.ehviewer.util.ThreadPool.Job;
|
||||
import com.hippo.ehviewer.util.ThreadPool.JobContext;
|
||||
import com.hippo.ehviewer.util.TimeRunner;
|
||||
import com.hippo.ehviewer.util.Ui;
|
||||
|
||||
@@ -93,6 +94,7 @@ public class GalleryView extends GLView {
|
||||
|
||||
// TODO
|
||||
private static final int BACKGROUND_COLOR = Color.BLACK;
|
||||
@SuppressWarnings("unused")
|
||||
private static final int MASK_COLOR = 0x88000000;
|
||||
|
||||
|
||||
@@ -144,6 +146,8 @@ public class GalleryView extends GLView {
|
||||
private OnTapTextListener mOnTapTextListener;
|
||||
private OnScrollPageListener mOnScrollPageListener;
|
||||
|
||||
private ThreadPool mMovieWait;
|
||||
|
||||
public interface OnEdgeListener {
|
||||
public void onFirstPageEdge();
|
||||
public void onLastPageEdge();
|
||||
@@ -182,6 +186,8 @@ public class GalleryView extends GLView {
|
||||
|
||||
setState();
|
||||
|
||||
mMovieWait = new ThreadPool(1, 1);
|
||||
|
||||
mGestureRecognizer = new GestureRecognizer(mContext, new MyGestureListener());
|
||||
setBackgroundColor(GalleryUtils.intColorToFloatARGBArray(BACKGROUND_COLOR));
|
||||
|
||||
@@ -296,24 +302,24 @@ public class GalleryView extends GLView {
|
||||
//canvas.fillRect(0, 0, mWidth, mHeight, MASK_COLOR);
|
||||
|
||||
|
||||
// TODO
|
||||
if (hasMovie) {
|
||||
Log.d(TAG, "hasMovie");
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
if (hasMovie)
|
||||
mMovieWait.submit(mMovieShowJob);
|
||||
}
|
||||
|
||||
private Job<Object> mMovieShowJob = new Job<Object>() {
|
||||
@Override
|
||||
public Object run(JobContext jc) {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
invalidate();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
private void resetSizePosition() {
|
||||
resetSizePosition(PRE_TARGET_INDEX);
|
||||
resetSizePosition(CUR_TARGET_INDEX);
|
||||
@@ -579,11 +585,9 @@ public class GalleryView extends GLView {
|
||||
@Override
|
||||
public void onDecodeOver(Object res, int index) {
|
||||
int targetIndex = index - mCurIndex + 1;
|
||||
ShowItem showItem;
|
||||
Image image;
|
||||
|
||||
if (targetIndex < 0 || targetIndex > 2
|
||||
|| !((showItem = showItems[targetIndex]) instanceof EmptyItem)) {// If it do not need any more
|
||||
|| !(showItems[targetIndex] instanceof EmptyItem)) {// If it do not need any more
|
||||
if (res != null && res instanceof Bitmap)
|
||||
((Bitmap)res).recycle();
|
||||
} else {
|
||||
@@ -777,9 +781,14 @@ public class GalleryView extends GLView {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSingleTapUp(float x, float y) {
|
||||
if (mScrollState != SCROLL_NONE || mShowTapAreaTurn)
|
||||
public boolean onSingleTapConfirmed(float x, float y) {
|
||||
if (mScrollState != SCROLL_NONE) {
|
||||
return false;
|
||||
}
|
||||
if (mShowTapAreaTurn) {
|
||||
mShowTapAreaTurn = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( showItems[CUR_TARGET_INDEX] == null
|
||||
|| showItems[CUR_TARGET_INDEX] instanceof Text) {
|
||||
@@ -815,6 +824,7 @@ public class GalleryView extends GLView {
|
||||
|
||||
@Override
|
||||
public boolean onDoubleTap(float x, float y) {
|
||||
Log.d(TAG, "onDoubleTap");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1029,8 +1039,13 @@ public class GalleryView extends GLView {
|
||||
@Override
|
||||
public void onUp() {
|
||||
mShowEdegTip = true;
|
||||
if (!mShowTapArea)
|
||||
|
||||
|
||||
// if use onSingleTapUp, use below
|
||||
/*
|
||||
* if (mShowTapAreaTurn) {
|
||||
mShowTapAreaTurn = false;
|
||||
*/
|
||||
}
|
||||
|
||||
// *** TimeRunner *** //
|
||||
@@ -1168,10 +1183,6 @@ public class GalleryView extends GLView {
|
||||
imageScale = 1;
|
||||
}
|
||||
|
||||
public boolean isLoaded() {
|
||||
return mTexture != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(GLCanvas canvas, int xOffset, int yOffset) {
|
||||
if (mTexture != null) {
|
||||
|
||||
@@ -29,7 +29,7 @@ public class GestureRecognizer {
|
||||
private static final String TAG = "GestureRecognizer";
|
||||
|
||||
public interface Listener {
|
||||
boolean onSingleTapUp(float x, float y);
|
||||
boolean onSingleTapConfirmed(float x, float y);
|
||||
boolean onDoubleTap(float x, float y);
|
||||
void onLongPress(MotionEvent e);
|
||||
boolean onScrollBegin(float dx, float dy, float totalX, float totalY);
|
||||
@@ -82,8 +82,8 @@ public class GestureRecognizer {
|
||||
float firstX = 0;
|
||||
float firstY = 0;
|
||||
@Override
|
||||
public boolean onSingleTapUp(MotionEvent e) {
|
||||
return mListener.onSingleTapUp(e.getX(), e.getY());
|
||||
public boolean onSingleTapConfirmed(MotionEvent e) {
|
||||
return mListener.onSingleTapConfirmed(e.getX(), e.getY());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user