當前位置: 首頁>>代碼示例>>Java>>正文


Java GestureDetectorCompat.setOnDoubleTapListener方法代碼示例

本文整理匯總了Java中android.support.v4.view.GestureDetectorCompat.setOnDoubleTapListener方法的典型用法代碼示例。如果您正苦於以下問題:Java GestureDetectorCompat.setOnDoubleTapListener方法的具體用法?Java GestureDetectorCompat.setOnDoubleTapListener怎麽用?Java GestureDetectorCompat.setOnDoubleTapListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v4.view.GestureDetectorCompat的用法示例。


在下文中一共展示了GestureDetectorCompat.setOnDoubleTapListener方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: Attacher

import android.support.v4.view.GestureDetectorCompat; //導入方法依賴的package包/類
public Attacher(DraweeView<GenericDraweeHierarchy> draweeView) {
    mDraweeView = new WeakReference<>(draweeView);
    draweeView.getHierarchy().setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER);
    draweeView.setOnTouchListener(this);
    mScaleDragDetector = new ScaleDragDetector(draweeView.getContext(), this);
    mGestureDetector = new GestureDetectorCompat(draweeView.getContext(),
            new GestureDetector.SimpleOnGestureListener() {
                @Override public void onLongPress(MotionEvent e) {
                    super.onLongPress(e);
                    if (null != mLongClickListener) {
                        mLongClickListener.onLongClick(getDraweeView());
                    }
                }
            });
    mGestureDetector.setOnDoubleTapListener(new DefaultOnDoubleTapListener(this));
}
 
開發者ID:lanyuanxiaoyao,項目名稱:PicKing,代碼行數:17,代碼來源:Attacher.java

示例2: initTracker

import android.support.v4.view.GestureDetectorCompat; //導入方法依賴的package包/類
private void initTracker() {
    if (!Utils.hasExternalStoragePermission(this)) {
        ActivityCompat.requestPermissions(
                this,
                new String[] {
                        Manifest.permission.READ_EXTERNAL_STORAGE,
                        Manifest.permission.WRITE_EXTERNAL_STORAGE
                },
                Constants.REQUEST_CODE_PERMISSION_EXTERNAL_STORAGE);
    }

    // TODO(youngseokyoon): consolidate the Tracker into UserActionLogger
    mLogger = UserActionLogger.getInstance(this);
    mGestureListener = new GestureListener(this);
    mGestureDetector = new GestureDetectorCompat(this, mGestureListener);
    mGestureDetector.setOnDoubleTapListener(mGestureListener);
}
 
開發者ID:vanadium-archive,項目名稱:reader,代碼行數:18,代碼來源:BaseReaderActivity.java

示例3: Attacher

import android.support.v4.view.GestureDetectorCompat; //導入方法依賴的package包/類
public Attacher(DraweeView<GenericDraweeHierarchy> draweeView) {
    mDraweeView = new WeakReference<>(draweeView);
    draweeView.getHierarchy().setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER);
    draweeView.setOnTouchListener(this);
    mScaleDragDetector = new ScaleDragDetector(draweeView.getContext(), this);
    mGestureDetector = new GestureDetectorCompat(draweeView.getContext(),
            new GestureDetector.SimpleOnGestureListener() {
                @Override
                public void onLongPress(MotionEvent e) {
                    super.onLongPress(e);
                    if (null != mLongClickListener) {
                        mLongClickListener.onLongClick(getDraweeView());
                    }
                }
            });
    mGestureDetector.setOnDoubleTapListener(new DefaultOnDoubleTapListener(this));
}
 
開發者ID:gzsll,項目名稱:TLint,代碼行數:18,代碼來源:Attacher.java

示例4: onCreate

import android.support.v4.view.GestureDetectorCompat; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_unlock);

    mDetector = new GestureDetectorCompat(this, this);
    // Set the gesture detector as the double tap
    // listener.
    mDetector.setOnDoubleTapListener(this);

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
 
開發者ID:Jayant11,項目名稱:LockScreen-Oreo,代碼行數:13,代碼來源:UnlockActivity.java

示例5: Window

import android.support.v4.view.GestureDetectorCompat; //導入方法依賴的package包/類
public Window(MainService context, int contentView){

        this.context = context;

        LayoutInflater inflater = (LayoutInflater) this.context.getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        windowManager = (WindowManager) this.context.getSystemService(Context.WINDOW_SERVICE);
        window = inflater.inflate(R.layout.window, null);
        mRealDisplaySize = this.context.getRealDisplaySize();
        params = getDefaultParams();

        WindowView mWindowView = (WindowView) window.findViewById(R.id.window_view);
        ResizeView mResizeView = (ResizeView) window.findViewById(R.id.resize_view);
        mWindowView.setWindowListener(this);
        mResizeView.setWindowListener(this);
        GestureDetectorCompat detectorCompat = new GestureDetectorCompat(context, this);
        detectorCompat.setOnDoubleTapListener(this);
        mWindowView.setDetector(detectorCompat);

        RelativeLayout relativeLayout = (RelativeLayout) window.findViewById(R.id.content_view);
        relativeLayout.addView(inflater.inflate(contentView, relativeLayout, false));

        windowManager.addView(window, params);

        // Hacky way to check if we are fullscreen
        WindowManager.LayoutParams p = new WindowManager.LayoutParams();
        p.width = 1;
        p.height = WindowManager.LayoutParams.MATCH_PARENT;
        p.type = WindowManager.LayoutParams.TYPE_PHONE;
        p.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
        p.format = PixelFormat.TRANSPARENT;
        p.gravity = Gravity.END | Gravity.TOP;
        mHeightView = new View(context);
        windowManager.addView(mHeightView, p);
    }
 
開發者ID:0x1bad1d3a,項目名稱:Kaku,代碼行數:36,代碼來源:Window.java

示例6: onCreate

import android.support.v4.view.GestureDetectorCompat; //導入方法依賴的package包/類
@Override
public void onCreate(SurfaceHolder surfaceHolder) {
    super.onCreate(surfaceHolder);
    drawScript = new LWQSurfaceHolderDrawScript(surfaceHolder);
    gestureDetectorCompat = new GestureDetectorCompat(LWQWallpaperService.this, this);
    gestureDetectorCompat.setOnDoubleTapListener(this);
    EventBus.getDefault().register(this);
    LWQWallpaperController wallpaperController = LWQWallpaperControllerHelper.get();
    if (!wallpaperController.activeWallpaperLoaded()) {
        wallpaperController.retrieveActiveWallpaper();
    }
}
 
開發者ID:stanidesis,項目名稱:quotograph,代碼行數:13,代碼來源:LWQWallpaperService.java

示例7: init

import android.support.v4.view.GestureDetectorCompat; //導入方法依賴的package包/類
/**
 * initializes standards
 */
private void init() {
	background = new Paint();
	background.setColor(Color.rgb(57,75,133));

	lines = new Paint();
	lines.setColor(Color.rgb(243,173,30));

	buttons = new Paint();
	buttons.setColor(Color.WHITE);

	// point in time text
	pitText = new Paint();
	pitText.setTextAlign(Paint.Align.LEFT);
	pitText.setColor(Color.LTGRAY);
	pitText.setTextSize(50);
	
	// point in time + time frame text
	pitplusText = new Paint();
	pitplusText.setTextAlign(Paint.Align.RIGHT);
	pitplusText.setColor(Color.LTGRAY);
	pitplusText.setTextSize(50);

	// time frames text
	tfText = new Paint();
	tfText.setTextAlign(Paint.Align.CENTER);
	tfText.setColor(Color.LTGRAY);
	tfText.setTextSize(50);
	
	selectedTfText = new Paint();
	selectedTfText.setTextAlign(Paint.Align.CENTER);
	selectedTfText.setColor(Color.BLACK);
	selectedTfText.setTextSize(50);

	detector = new GestureDetectorCompat(this.getContext(), this);
	detector.setOnDoubleTapListener(this);

	Log.d(TAG, "created");
}
 
開發者ID:lkastler,項目名稱:Timeslider,代碼行數:42,代碼來源:TimesliderView.java

示例8: onCreate

import android.support.v4.view.GestureDetectorCompat; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "onCreate");
    /** NO_TITLE  SCREEN_ON   FULLSCREEN */
    Window win = getWindow();
    win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    win.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    win.requestFeature(Window.FEATURE_NO_TITLE);
    /**攝像頭方向*/
    isOritationLanscape = getIntent().getBooleanExtra("oritation_landscape", false);
    if (isOritationLanscape) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        setContentView(R.layout.activity_streaming_landscape);
    } else {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(R.layout.activity_streaming_portrait);
    }
    /**推流視頻寬度*/
    mVideoWidth = getIntent().getIntExtra("res_w", 1280);
    /**推流視頻高度*/
    mVideoHeight = getIntent().getIntExtra("res_h", 720);
    /**視頻幀率*/
    mFrameRate = getIntent().getIntExtra("frame_rate", 15);
    /**視頻碼率*/
    mBitrate = getIntent().getIntExtra("bitrate", 1024) * 1000;
    /**推流地址*/
    mStreamingUrl = getIntent().getStringExtra("push_url");

    initUIElements();

    /**攝像頭為前置攝像頭*/
    mCurrentCamera = LiveConfig.CAMERA_FACING_FRONT;
    /**是否開始散光燈*/
    isFlashOn = false;
    initUIEventHandler();
    /**推流狀態的監聽*/
    initStateListener();
    /**初始化推流會話*/
    initRTMPSession(mCameraView.getHolder());

    mDetector = new GestureDetectorCompat(this, this);
    mDetector.setOnDoubleTapListener(this);
}
 
開發者ID:LiuJunb,項目名稱:Android-LSS,代碼行數:45,代碼來源:StreamingActivity.java

示例9: onCreate

import android.support.v4.view.GestureDetectorCompat; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_locked_screen);


        startService(new Intent(this, LockScreenService.class).setAction(Intent.ACTION_SYNC));
        if (!isMyServiceRunning(LockScreenService.class)) {
            startService(new Intent(this, LockScreenService.class).setAction(Intent.ACTION_SYNC));
        }

        this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);


   /*
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

       View view = (View) findViewById(R.id.layout);
        view.startAnimation(AnimationUtils.loadAnimation(
                context, R.anim.right_out;
        ));
*/
        // Instantiate the gesture detector with the
        // application context and an implementation of
        // GestureDetector.OnGestureListener
        mDetector = new GestureDetectorCompat(this, this);
        // Set the gesture detector as the double tap
        // listener.
        mDetector.setOnDoubleTapListener(this);


        txtTime = (TextView) findViewById(R.id.textClock2);
        TimeFace = Typeface.createFromAsset(getAssets(), "Roboto-Light.ttf");
        txtTime.setTypeface(TimeFace);
        txtDate = (TextView) findViewById(R.id.date);
        batteryStatus = (TextView) findViewById(R.id.test);

        this.mHandler = new Handler();
        this.mHandler.postDelayed(m_Runnable, 500);

        init();
        reset();
    }
 
開發者ID:Jayant11,項目名稱:LockScreen-Oreo,代碼行數:45,代碼來源:LockedScreen.java

示例10: ItemGestureListener

import android.support.v4.view.GestureDetectorCompat; //導入方法依賴的package包/類
public ItemGestureListener(Context context, Item item, ItemGestureCallback callback) {
    detector = new GestureDetectorCompat(context, this);
    detector.setOnDoubleTapListener(this);
    this.item = item;
    this.callback = callback;
}
 
開發者ID:OpenLauncherTeam,項目名稱:openlauncher,代碼行數:7,代碼來源:ItemGestureListener.java

示例11: init

import android.support.v4.view.GestureDetectorCompat; //導入方法依賴的package包/類
private void init(Context context){
    mDetector = new GestureDetectorCompat(context, this);
    mDetector.setOnDoubleTapListener(this);
}
 
開發者ID:0x1bad1d3a,項目名稱:Kaku,代碼行數:5,代碼來源:ResizeView.java

示例12: onCreate

import android.support.v4.view.GestureDetectorCompat; //導入方法依賴的package包/類
@Override
  protected void onCreate(Bundle savedInstanceState)
  {
      super.onCreate(savedInstanceState);
      won = false;
      setTitle("2048");
      setContentView(R.layout.activity_main);
      SharedPreferences data =
          getSharedPreferences("com.jbapps.twenty48", MODE_PRIVATE);
      highScore = data.getInt("highScore", 0);
      model = new Model();
      textView1 = (TextView)findViewById(R.id.textView1);
      textView2 = (TextView)findViewById(R.id.textView2);
      textView3 = (TextView)findViewById(R.id.textView3);
      textView4 = (TextView)findViewById(R.id.textView4);
      textView5 = (TextView)findViewById(R.id.textView5);
      textView6 = (TextView)findViewById(R.id.textView6);
      textView7 = (TextView)findViewById(R.id.textView7);
      textView8 = (TextView)findViewById(R.id.textView8);
      textView9 = (TextView)findViewById(R.id.textView9);
      textView10 = (TextView)findViewById(R.id.textView10);
      textView11 = (TextView)findViewById(R.id.textView11);
      textView12 = (TextView)findViewById(R.id.textView12);
      textView13 = (TextView)findViewById(R.id.textView13);
      textView14 = (TextView)findViewById(R.id.textView14);
      textView15 = (TextView)findViewById(R.id.textView15);
      textView16 = (TextView)findViewById(R.id.textView16);
      scoreView = (TextView)findViewById(R.id.textView17);
      highScoreView = (TextView)findViewById(R.id.textView18);
      textViews = new ArrayList<TextView>();
      textViews.add(textView1);
      textViews.add(textView2);
      textViews.add(textView3);
      textViews.add(textView4);
      textViews.add(textView5);
      textViews.add(textView6);
      textViews.add(textView7);
      textViews.add(textView8);
      textViews.add(textView9);
      textViews.add(textView10);
      textViews.add(textView11);
      textViews.add(textView12);
      textViews.add(textView13);
      textViews.add(textView14);
      textViews.add(textView15);
      textViews.add(textView16);
      mDetector = new GestureDetectorCompat(this, this);
      mDetector.setOnDoubleTapListener(this);
      GridLayout gridLayout = (GridLayout) findViewById(R.id.gridLayout1);
      gridLayout.addOnLayoutChangeListener(new OnLayoutChangeListener() {
	@Override
	public void onLayoutChange(View view, int arg1, int arg2, int arg3,
			int arg4, int arg5, int arg6, int arg7, int arg8) {
		int sideLength;
		if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
			sideLength = view.getWidth() / 4;
		} else {
			sideLength = view.getHeight() / 4;
		}
		for (TextView text : textViews)
        {
            text.setWidth(sideLength);
            text.setHeight(sideLength);
            text.setGravity(Gravity.CENTER);
        }
	}
});
      update();
  }
 
開發者ID:mrjbanksy,項目名稱:twenty48,代碼行數:70,代碼來源:MainActivity.java

示例13: TouchGestureDetector

import android.support.v4.view.GestureDetectorCompat; //導入方法依賴的package包/類
public TouchGestureDetector(Context context, OnTouchGestureListener listener) {
	mGestureDetector = new GestureDetectorCompat(context, listener);
	mGestureDetector.setOnDoubleTapListener(listener);
	mScaleGestureDetector = new ScaleGestureDetector(context, listener);
	ScaleGestureDetectorCompat.setQuickScaleEnabled(mScaleGestureDetector, false);
}
 
開發者ID:yrom,項目名稱:AcFun-Area63,代碼行數:7,代碼來源:TouchGestureDetector.java

示例14: onCreate

import android.support.v4.view.GestureDetectorCompat; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    
    Log.d(TAG, "=== Starting demo");

    // comment the following two lines if the log is too verbose
    SystemOutLogProvider prov = new SystemOutLogProvider();
    com.lightstreamer.client.LightstreamerClient.setLoggerProvider(prov);
    
    checkPlayServices();
    
    String serverAddress = getResources().getString(R.string.host);
    String adapterName = "DEMO";
    String senderId = getResources().getString(R.string.sender_id);
    LsClient.instance.initClient(serverAddress, adapterName, getApplicationContext(), senderId);

    GestureControls gs = new GestureControls();
    mDetector = new GestureDetectorCompat(this,gs);
    mDetector.setOnDoubleTapListener(gs);
    
    this.handler = new Handler();
    
    getSupportActionBar().setTitle(R.string.lightstreamer);
    
    setContentView(R.layout.stocks);

    if (findViewById(R.id.fragment_container) != null) {
        
        //single fragment view (phone)

        if (savedInstanceState != null) {
            return;
        }

        StocksFragment firstFragment = new StocksFragment();

        firstFragment.setArguments(getIntent().getExtras());

        getSupportFragmentManager().beginTransaction()
                .add(R.id.fragment_container, firstFragment).commit();
    }
}
 
開發者ID:Lightstreamer,項目名稱:Lightstreamer-example-MPNStockList-client-android,代碼行數:44,代碼來源:StockListDemo.java


注:本文中的android.support.v4.view.GestureDetectorCompat.setOnDoubleTapListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。