Commit 53d03926 authored by wanglei's avatar wanglei

...

parent 7096a17f
/*
* 文件名称: PGEventManage.java
*
*
* 编译器: android2.2
* 时间: 下午7:00:11
*/
......@@ -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.system.IControl;
import com.cherry.lib.doc.office.system.beans.AEventManage;
import android.graphics.Rect;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
......@@ -25,134 +27,110 @@ import android.view.View;
* <p>
* 负责人: ljj8494
* <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);
this.presentation = presentation;
presentation.setOnTouchListener(this);
presentation.setLongClickable(true);
}
}
/**
* 触摸事件
*
*/
public boolean onTouch(View v, MotionEvent event)
{
super.onTouch(v, event);
public boolean onTouch(View v, MotionEvent event) {
super.onTouch(v, event);
return false;
}
/**
*
*
*/
public boolean onDoubleTap(MotionEvent e)
{
public boolean onDoubleTap(MotionEvent e) {
super.onDoubleTap(e);
return true;
}
/**
*
*
*/
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)
{
super.onScroll(e1, e2, distanceX, distanceY);
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
super.onScroll(e1, e2, distanceX, distanceY);
return true;
}
/**
* Fling the scroll view
*
* @param velocityX X方向速率
* @param velocityY Y方向速率
* @param velocityX X方向速率
* @param velocityY Y方向速率
*/
public void fling(int velocityX, int velocityY)
{
if(presentation.isSlideShow())
{
if (Math.abs(velocityY) < 400 && Math.abs(velocityX) < 400)
{
public void fling(int velocityX, int velocityY) {
if (presentation.isSlideShow()) {
if (Math.abs(velocityY) < 400 && Math.abs(velocityX) < 400) {
presentation.slideShow(ISlideShow.SlideShow_NextStep);
return;
}
super.fling(velocityX, velocityY);
int currentIndex = presentation.getCurrentIndex();
if (Math.abs(velocityY) > Math.abs(velocityX))
{
if (Math.abs(velocityY) > Math.abs(velocityX)) {
//vertical
if (velocityY < 0 && currentIndex >= 0)
{
//previous step
presentation.slideShow(ISlideShow.SlideShow_NextStep);
}
else if (velocityY > 0 && currentIndex <= presentation.getRealSlideCount() - 1)
{
if (velocityY < 0 && currentIndex >= 0) {
//previous step
presentation.slideShow(ISlideShow.SlideShow_NextStep);
} else if (velocityY > 0 && currentIndex <= presentation.getRealSlideCount() - 1) {
//next step
presentation.slideShow(ISlideShow.SlideShow_PreviousStep);
}
}
else
{
} else {
// horizontal
if (velocityX < 0 && currentIndex >= 0)
{
if (velocityX < 0 && currentIndex >= 0) {
// previous Slide
presentation.slideShow(ISlideShow.SlideShow_PreviousSlide);
}
else if (velocityX > 0 && currentIndex < presentation.getRealSlideCount() - 1)
{
} else if (velocityX > 0 && currentIndex < presentation.getRealSlideCount() - 1) {
// next Slide
presentation.slideShow(ISlideShow.SlideShow_NextSlide);
}
}
}
}
/**
*
*
*/
public boolean onSingleTapUp(MotionEvent e)
{
public boolean onSingleTapUp(MotionEvent e) {
Log.e("PGEventManage", "onSingleTapUp");
control.getMainFrame().singleTap();
super.onSingleTapUp(e);
if (e.getAction() == MotionEvent.ACTION_UP)
{
if (e.getAction() == MotionEvent.ACTION_UP) {
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
this.presentation.slideShow(ISlideShow.SlideShow_NextStep);
}
}
return true;
}
/**
*
*
*/
public void dispose()
{
public void dispose() {
super.dispose();
presentation = null;
}
// Spreadsheet
private Presentation presentation;
}
......@@ -428,6 +428,12 @@ public class PGPrintMode extends FrameLayout implements IPageListViewListener {
return control.getMainFrame().getPageListViewMovingPosition();
}
@Override
public void singleTab() {
Log.e("PGPrintMode", "singleTab");
control.getMainFrame().singleTap();
}
/**
*
*/
......
......@@ -161,4 +161,6 @@ public interface IPageListViewListener
* page list view moving position
*/
public int getPageListViewMovingPosition();
public void singleTab();
}
......@@ -434,6 +434,11 @@ public class PrintWord extends FrameLayout implements IPageListViewListener {
return control.getMainFrame().getPageListViewMovingPosition();
}
@Override
public void singleTab() {
}
/**
*
*/
......
......@@ -39,7 +39,6 @@ import com.cherry.lib.doc.office.system.beans.AEventManage;
*/
public class WPEventManage extends AEventManage {
/**
* @param spreadsheet
*/
public WPEventManage(Word word, IControl 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