Commit 53d03926 authored by wanglei's avatar wanglei

...

parent 7096a17f
...@@ -9,7 +9,9 @@ package com.cherry.lib.doc.office.pg.control; ...@@ -9,7 +9,9 @@ package com.cherry.lib.doc.office.pg.control;
import com.cherry.lib.doc.office.common.ISlideShow; import com.cherry.lib.doc.office.common.ISlideShow;
import com.cherry.lib.doc.office.system.IControl; import com.cherry.lib.doc.office.system.IControl;
import com.cherry.lib.doc.office.system.beans.AEventManage; import com.cherry.lib.doc.office.system.beans.AEventManage;
import android.graphics.Rect; import android.graphics.Rect;
import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
...@@ -29,14 +31,11 @@ import android.view.View; ...@@ -29,14 +31,11 @@ import android.view.View;
* <p> * <p>
* <p> * <p>
*/ */
public class PGEventManage extends AEventManage public class PGEventManage extends AEventManage {
{
/** /**
* *
* @param spreadsheet
*/ */
public PGEventManage(Presentation presentation, IControl control) public PGEventManage(Presentation presentation, IControl control) {
{
super(presentation.getContext(), control); super(presentation.getContext(), control);
this.presentation = presentation; this.presentation = presentation;
presentation.setOnTouchListener(this); presentation.setOnTouchListener(this);
...@@ -45,32 +44,25 @@ public class PGEventManage extends AEventManage ...@@ -45,32 +44,25 @@ public class PGEventManage extends AEventManage
/** /**
* 触摸事件 * 触摸事件
*
*/ */
public boolean onTouch(View v, MotionEvent event) public boolean onTouch(View v, MotionEvent event) {
{
super.onTouch(v, event); super.onTouch(v, event);
return false; return false;
} }
/** /**
*
* *
*/ */
public boolean onDoubleTap(MotionEvent e) public boolean onDoubleTap(MotionEvent e) {
{
super.onDoubleTap(e); super.onDoubleTap(e);
return true; return true;
} }
/** /**
*
* *
*/ */
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
{
super.onScroll(e1, e2, distanceX, distanceY); super.onScroll(e1, e2, distanceX, distanceY);
return true; return true;
} }
...@@ -81,12 +73,9 @@ public class PGEventManage extends AEventManage ...@@ -81,12 +73,9 @@ public class PGEventManage extends AEventManage
* @param velocityX X方向速率 * @param velocityX X方向速率
* @param velocityY Y方向速率 * @param velocityY Y方向速率
*/ */
public void fling(int velocityX, int velocityY) public void fling(int velocityX, int velocityY) {
{ if (presentation.isSlideShow()) {
if(presentation.isSlideShow()) if (Math.abs(velocityY) < 400 && Math.abs(velocityX) < 400) {
{
if (Math.abs(velocityY) < 400 && Math.abs(velocityX) < 400)
{
presentation.slideShow(ISlideShow.SlideShow_NextStep); presentation.slideShow(ISlideShow.SlideShow_NextStep);
return; return;
} }
...@@ -94,30 +83,21 @@ public class PGEventManage extends AEventManage ...@@ -94,30 +83,21 @@ public class PGEventManage extends AEventManage
super.fling(velocityX, velocityY); super.fling(velocityX, velocityY);
int currentIndex = presentation.getCurrentIndex(); int currentIndex = presentation.getCurrentIndex();
if (Math.abs(velocityY) > Math.abs(velocityX)) if (Math.abs(velocityY) > Math.abs(velocityX)) {
{
//vertical //vertical
if (velocityY < 0 && currentIndex >= 0) if (velocityY < 0 && currentIndex >= 0) {
{
//previous step //previous step
presentation.slideShow(ISlideShow.SlideShow_NextStep); presentation.slideShow(ISlideShow.SlideShow_NextStep);
} } else if (velocityY > 0 && currentIndex <= presentation.getRealSlideCount() - 1) {
else if (velocityY > 0 && currentIndex <= presentation.getRealSlideCount() - 1)
{
//next step //next step
presentation.slideShow(ISlideShow.SlideShow_PreviousStep); presentation.slideShow(ISlideShow.SlideShow_PreviousStep);
} }
} } else {
else
{
// horizontal // horizontal
if (velocityX < 0 && currentIndex >= 0) if (velocityX < 0 && currentIndex >= 0) {
{
// previous Slide // previous Slide
presentation.slideShow(ISlideShow.SlideShow_PreviousSlide); presentation.slideShow(ISlideShow.SlideShow_PreviousSlide);
} } else if (velocityX > 0 && currentIndex < presentation.getRealSlideCount() - 1) {
else if (velocityX > 0 && currentIndex < presentation.getRealSlideCount() - 1)
{
// next Slide // next Slide
presentation.slideShow(ISlideShow.SlideShow_NextSlide); presentation.slideShow(ISlideShow.SlideShow_NextSlide);
} }
...@@ -127,17 +107,15 @@ public class PGEventManage extends AEventManage ...@@ -127,17 +107,15 @@ public class PGEventManage extends AEventManage
} }
/** /**
*
* *
*/ */
public boolean onSingleTapUp(MotionEvent e) public boolean onSingleTapUp(MotionEvent e) {
{ Log.e("PGEventManage", "onSingleTapUp");
control.getMainFrame().singleTap();
super.onSingleTapUp(e); super.onSingleTapUp(e);
if (e.getAction() == MotionEvent.ACTION_UP) if (e.getAction() == MotionEvent.ACTION_UP) {
{
Rect drawRect = presentation.getSlideDrawingRect(); Rect drawRect = presentation.getSlideDrawingRect();
if(presentation.isSlideShow() && drawRect.contains((int)e.getX(), (int)e.getY())) if (presentation.isSlideShow() && drawRect.contains((int) e.getX(), (int) e.getY())) {
{
//not click hyperlink, then go to next step //not click hyperlink, then go to next step
this.presentation.slideShow(ISlideShow.SlideShow_NextStep); this.presentation.slideShow(ISlideShow.SlideShow_NextStep);
} }
...@@ -148,11 +126,11 @@ public class PGEventManage extends AEventManage ...@@ -148,11 +126,11 @@ public class PGEventManage extends AEventManage
/** /**
* *
*/ */
public void dispose() public void dispose() {
{
super.dispose(); super.dispose();
presentation = null; presentation = null;
} }
// Spreadsheet // Spreadsheet
private Presentation presentation; private Presentation presentation;
} }
...@@ -428,6 +428,12 @@ public class PGPrintMode extends FrameLayout implements IPageListViewListener { ...@@ -428,6 +428,12 @@ public class PGPrintMode extends FrameLayout implements IPageListViewListener {
return control.getMainFrame().getPageListViewMovingPosition(); return control.getMainFrame().getPageListViewMovingPosition();
} }
@Override
public void singleTab() {
Log.e("PGPrintMode", "singleTab");
control.getMainFrame().singleTap();
}
/** /**
* *
*/ */
......
...@@ -161,4 +161,6 @@ public interface IPageListViewListener ...@@ -161,4 +161,6 @@ public interface IPageListViewListener
* page list view moving position * page list view moving position
*/ */
public int getPageListViewMovingPosition(); public int getPageListViewMovingPosition();
public void singleTab();
} }
...@@ -434,6 +434,11 @@ public class PrintWord extends FrameLayout implements IPageListViewListener { ...@@ -434,6 +434,11 @@ public class PrintWord extends FrameLayout implements IPageListViewListener {
return control.getMainFrame().getPageListViewMovingPosition(); return control.getMainFrame().getPageListViewMovingPosition();
} }
@Override
public void singleTab() {
}
/** /**
* *
*/ */
......
...@@ -39,7 +39,6 @@ import com.cherry.lib.doc.office.system.beans.AEventManage; ...@@ -39,7 +39,6 @@ import com.cherry.lib.doc.office.system.beans.AEventManage;
*/ */
public class WPEventManage extends AEventManage { public class WPEventManage extends AEventManage {
/** /**
* @param spreadsheet
*/ */
public WPEventManage(Word word, IControl control) { public WPEventManage(Word word, IControl control) {
super(word.getContext(), control); super(word.getContext(), control);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment