当前位置: 首页>>代码示例>>Java>>正文


Java GestureDetector.onTouchEvent方法代码示例

本文整理汇总了Java中android.view.GestureDetector.onTouchEvent方法的典型用法代码示例。如果您正苦于以下问题:Java GestureDetector.onTouchEvent方法的具体用法?Java GestureDetector.onTouchEvent怎么用?Java GestureDetector.onTouchEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.GestureDetector的用法示例。


在下文中一共展示了GestureDetector.onTouchEvent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setPageController

import android.view.GestureDetector; //导入方法依赖的package包/类
@Override
public void setPageController(PageController controller, int pageNumber) {
  super.setPageController(controller, pageNumber);
  final GestureDetector gestureDetector = new GestureDetector(context,
      new PageGestureDetector());
  OnTouchListener gestureListener = (v, event) -> gestureDetector.onTouchEvent(event);
  imageView.setOnTouchListener(gestureListener);
  imageView.setClickable(true);
  imageView.setLongClickable(true);
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:11,代码来源:QuranImagePageLayout.java

示例2: setupGestureDetection

import android.view.GestureDetector; //导入方法依赖的package包/类
private void setupGestureDetection() {
    final GestureDetector gestureDetector = new GestureDetector(this, new SwipeGestureDetector(this));
    View.OnTouchListener gestureOnTouchListener = new View.OnTouchListener() {
        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            return gestureDetector.onTouchEvent(motionEvent);
        }
    };

    imgRecipe.setOnTouchListener(gestureOnTouchListener);

}
 
开发者ID:micromasterandroid,项目名称:androidadvanced,代码行数:13,代码来源:RecipeMainActivity.java

示例3: onActivityCreated

import android.view.GestureDetector; //导入方法依赖的package包/类
@Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        DisplayMetrics metrics = new DisplayMetrics();

        getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);

        displayPageNumber(-1); // Initializes the pagenumber view properly

        final GestureDetector gestureDetector = new GestureDetector(context,
                new NavGestureDetector(bookView, this, metrics));

        View.OnTouchListener gestureListener = new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                return gestureDetector.onTouchEvent(event);
            }
        };


        this.viewSwitcher.setOnTouchListener(gestureListener);
        this.bookView.setOnTouchListener(gestureListener);
        this.dummyView.setOnTouchListener(gestureListener);

        registerForContextMenu(bookView);
        saveConfigState();

        Intent intent = getActivity().getIntent();
        String file = null;

        if ( intent.getData() != null) {
            file = intent.getData().getPath();
        }

        if (file == null) {
            file = "";
            file = config.getLastOpenedFile();
        }

        updateFromPrefs();
        updateFileName(savedInstanceState, file);

        if ("".equals(fileName) || ! new File(fileName).exists() ) {

            LOG.info( "Requested to open file " + fileName + ", which doesn't seem to exist. " +
                    "Switching back to the library.");

           Toast.makeText(getContext(), "File not exits!", Toast.LENGTH_SHORT).show();
            return;

        } else {

            if (savedInstanceState == null && config.isSyncEnabled()) {
//                new DownloadProgressTask().execute();
            } else {
                bookView.restore();
            }
        }

    }
 
开发者ID:ceji-longquan,项目名称:ceji_android,代码行数:62,代码来源:ReadingFragment.java


注:本文中的android.view.GestureDetector.onTouchEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。