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


Java OrientationEventListener.disable方法代码示例

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


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

示例1: RCTCameraView

import android.view.OrientationEventListener; //导入方法依赖的package包/类
public RCTCameraView(Context context) {
    super(context);
    this._context = context;
    RCTCamera.createInstance(getDeviceOrientation(context));

    _orientationListener = new OrientationEventListener(context, SensorManager.SENSOR_DELAY_NORMAL) {
        @Override
        public void onOrientationChanged(int orientation) {
            if (setActualDeviceOrientation(_context)) {
                layoutViewFinder();
            }
        }
    };

    if (_orientationListener.canDetectOrientation()) {
        _orientationListener.enable();
    } else {
        _orientationListener.disable();
    }
}
 
开发者ID:jonathan68,项目名称:react-native-camera,代码行数:21,代码来源:RCTCameraView.java

示例2: OrientationPlugin

import android.view.OrientationEventListener; //导入方法依赖的package包/类
public OrientationPlugin(Context ctxt) {
  this.ctxt=ctxt.getApplicationContext();

  orientationEventListener=new OrientationEventListener(ctxt) {
    @Override
    public void onOrientationChanged(int orientation) {
      lastOrientation=orientation;
    }
  };

  if (orientationEventListener.canDetectOrientation()) {
    orientationEventListener.enable();
  }
  else {
    orientationEventListener.disable();
    orientationEventListener=null;
  }
}
 
开发者ID:code-mc,项目名称:FacerecognitionFlowpilots,代码行数:19,代码来源:OrientationPlugin.java

示例3: FocusModePlugin

import android.view.OrientationEventListener; //导入方法依赖的package包/类
public FocusModePlugin(Context ctxt,
                       FocusMode focusMode,
                       boolean isVideo) {
  this.ctxt=ctxt.getApplicationContext();
  this.focusMode=focusMode;
  this.isVideo=isVideo;

  orientationEventListener=new OrientationEventListener(ctxt) {
    @Override
    public void onOrientationChanged(int orientation) {
      lastOrientation=orientation;
    }
  };

  if (orientationEventListener.canDetectOrientation()) {
    orientationEventListener.enable();
  }
  else {
    orientationEventListener.disable();
    orientationEventListener=null;
  }
}
 
开发者ID:commonsguy,项目名称:cwac-cam2,代码行数:23,代码来源:FocusModePlugin.java

示例4: OrientationPlugin

import android.view.OrientationEventListener; //导入方法依赖的package包/类
public OrientationPlugin(Context ctxt) {
  this.ctxt=ctxt.getApplicationContext();

  orientationEventListener=new OrientationEventListener(ctxt) {
    @Override
    public void onOrientationChanged(int orientation) {
      if (lastOrientation!=orientation) {
        AbstractCameraActivity.BUS
          .post(new CameraEngine.OrientationChangedEvent());
      }

      lastOrientation=orientation;
    }
  };

  if (orientationEventListener.canDetectOrientation()) {
    orientationEventListener.enable();
  }
  else {
    orientationEventListener.disable();
    orientationEventListener=null;
  }
}
 
开发者ID:commonsguy,项目名称:cwac-cam2,代码行数:24,代码来源:OrientationPlugin.java

示例5: _initMediaPlayer

import android.view.OrientationEventListener; //导入方法依赖的package包/类
/**
 * 初始化
 */
private void _initMediaPlayer() {
    // 加载 IjkMediaPlayer 库
    IjkMediaPlayer.loadLibrariesOnce(null);
    IjkMediaPlayer.native_profileBegin("libijkplayer.so");
    // 声音
    mAudioManager = (AudioManager) mAttachActivity.getSystemService(Context.AUDIO_SERVICE);
    mMaxVolume = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
    // 亮度
    try {
        int e = Settings.System.getInt(mAttachActivity.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS);
        float progress = 1.0F * (float) e / 255.0F;
        WindowManager.LayoutParams layout = mAttachActivity.getWindow().getAttributes();
        layout.screenBrightness = progress;
        mAttachActivity.getWindow().setAttributes(layout);
    } catch (Settings.SettingNotFoundException var7) {
        var7.printStackTrace();
    }
    // 进度
    mPlayerSeek.setMax(MAX_VIDEO_SEEK);
    mPlayerSeek.setOnSeekBarChangeListener(mSeekListener);
    // 视频监听
    mVideoView.setOnInfoListener(mInfoListener);
    // 触摸控制
    mGestureDetector = new GestureDetector(mAttachActivity, mPlayerGestureListener);
    mFlVideoBox.setClickable(true);
    mFlVideoBox.setOnTouchListener(mPlayerTouchListener);
    // 屏幕翻转控制
    mOrientationListener = new OrientationEventListener(mAttachActivity) {
        @Override
        public void onOrientationChanged(int orientation) {
            _handleOrientation(orientation);
        }
    };
    if (mIsForbidOrientation) {
        // 禁止翻转
        mOrientationListener.disable();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:42,代码来源:IjkPlayerView.java

示例6: CameraSession

import android.view.OrientationEventListener; //导入方法依赖的package包/类
public CameraSession(CameraInfo info, Size preview, Size picture, int format) {
    previewSize = preview;
    pictureSize = picture;
    pictureFormat = format;
   cameraInfo = info;

    SharedPreferences sharedPreferences = Gallery.applicationContext.getSharedPreferences("camera", Activity.MODE_PRIVATE);
    currentFlashMode = sharedPreferences.getString(cameraInfo.frontCamera != 0 ? "flashMode_front" : "flashMode", Camera.Parameters.FLASH_MODE_OFF);

    orientationEventListener = new OrientationEventListener(Gallery.applicationContext) {
        @Override
        public void onOrientationChanged(int orientation) {
            if (orientationEventListener == null || !initied || orientation == ORIENTATION_UNKNOWN) {
                return;
            }
            jpegOrientation = roundOrientation(orientation, jpegOrientation);
            WindowManager mgr = (WindowManager)Gallery.applicationContext.getSystemService(Context.WINDOW_SERVICE);
            int rotation = mgr.getDefaultDisplay().getRotation();
            if (lastOrientation != jpegOrientation || rotation != lastDisplayOrientation) {
                if (!isVideo) {
                    configurePhotoCamera();
                }
                lastDisplayOrientation = rotation;
                lastOrientation = jpegOrientation;
            }
        }
    };

    if (orientationEventListener.canDetectOrientation()) {
        orientationEventListener.enable();
    } else {
        orientationEventListener.disable();
        orientationEventListener = null;
    }
}
 
开发者ID:chengzichen,项目名称:KrGallery,代码行数:36,代码来源:CameraSession.java

示例7: CameraSession

import android.view.OrientationEventListener; //导入方法依赖的package包/类
public CameraSession(CameraInfo info, Size preview, Size picture, int format) {
    previewSize = preview;
    pictureSize = picture;
    pictureFormat = format;
    cameraInfo = info;

    SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("camera", Activity.MODE_PRIVATE);
    currentFlashMode = sharedPreferences.getString(cameraInfo.frontCamera != 0 ? "flashMode_front" : "flashMode", Camera.Parameters.FLASH_MODE_OFF);

    orientationEventListener = new OrientationEventListener(ApplicationLoader.applicationContext) {
        @Override
        public void onOrientationChanged(int orientation) {
            if (orientationEventListener == null || !initied) {
                return;
            }
            WindowManager mgr = (WindowManager) ApplicationLoader.applicationContext.getSystemService(Context.WINDOW_SERVICE);
            int rotation = mgr.getDefaultDisplay().getRotation();
            if (lastOrientation != rotation) {
                if (!isVideo) {
                    configurePhotoCamera();
                }
                lastOrientation = rotation;
            }
        }
    };

    if (orientationEventListener.canDetectOrientation()) {
        orientationEventListener.enable();
    } else {
        orientationEventListener.disable();
        orientationEventListener = null;
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:34,代码来源:CameraSession.java

示例8: ReactOrientationListenerModule

import android.view.OrientationEventListener; //导入方法依赖的package包/类
public ReactOrientationListenerModule(ReactApplicationContext reactContext) {
  super(reactContext);
  this.reactContext = reactContext;
  final ReactApplicationContext thisContext = reactContext;

  mOrientationListener = new OrientationEventListener(reactContext,
    SensorManager.SENSOR_DELAY_NORMAL) {
    @Override
    public void onOrientationChanged(int orientation) {
      WritableNativeMap params = new WritableNativeMap();
      String orientationValue = "";
      if(orientation == 0) {
        orientationValue = "PORTRAIT";
      } else {
        orientationValue = "LANDSCAPE";
      }
      params.putString("orientation", orientationValue);
      params.putString("device", getDeviceName());
      if (thisContext.hasActiveCatalystInstance()) {
        thisContext
          .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
          .emit("orientationDidChange", params);
      }
    }
  };

  if (mOrientationListener.canDetectOrientation() == true) {
    mOrientationListener.enable();
  } else {
    mOrientationListener.disable();
  }
}
 
开发者ID:walmartlabs,项目名称:react-native-orientation-listener,代码行数:33,代码来源:ReactOrientationListenerModule.java

示例9: ReactOrientationControllerModule

import android.view.OrientationEventListener; //导入方法依赖的package包/类
public ReactOrientationControllerModule(final ReactApplicationContext reactContext, Activity activity) {
    super(reactContext);
    this.reactContext = reactContext;
    this.mActivity = activity;

    mApplicationOrientationListener = new OrientationEventListener(reactContext) {
        @Override
        public void onOrientationChanged(int orientation) {
            deviceOrientation = orientation;
            if(lastDeviceOrientation.compareTo(getDeviceOrientationAsString())!=0){
                lastDeviceOrientation = getDeviceOrientationAsString();
                WritableNativeMap data = getDataMap();
                try{
                reactContext
                        .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
                        .emit("orientationDidChange", data);
                 } catch (RuntimeException e) {
                      Log.e("ERROR ", "java.lang.RuntimeException: Trying to invoke JS before CatalystInstance has been set!");
                }
            }
        }
    };

    if (mApplicationOrientationListener.canDetectOrientation() == true) {
        mApplicationOrientationListener.enable();
    } else {
        mApplicationOrientationListener.disable();
    }


}
 
开发者ID:inProgress-team,项目名称:react-native-orientation-controller,代码行数:32,代码来源:ReactOrientationControllerModule.java

示例10: CameraSession

import android.view.OrientationEventListener; //导入方法依赖的package包/类
public CameraSession(CameraInfo info, Size preview, Size picture, int format) {
    previewSize = preview;
    pictureSize = picture;
    pictureFormat = format;
    cameraInfo = info;

    SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("camera", Activity.MODE_PRIVATE);
    currentFlashMode = sharedPreferences.getString(cameraInfo.frontCamera != 0 ? "flashMode_front" : "flashMode", Camera.Parameters.FLASH_MODE_OFF);

    orientationEventListener = new OrientationEventListener(ApplicationLoader.applicationContext) {
        @Override
        public void onOrientationChanged(int orientation) {
            if (orientationEventListener == null || !initied || orientation == ORIENTATION_UNKNOWN) {
                return;
            }
            jpegOrientation = roundOrientation(orientation, jpegOrientation);
            WindowManager mgr = (WindowManager) ApplicationLoader.applicationContext.getSystemService(Context.WINDOW_SERVICE);
            int rotation = mgr.getDefaultDisplay().getRotation();
            if (lastOrientation != jpegOrientation || rotation != lastDisplayOrientation) {
                if (!isVideo) {
                    configurePhotoCamera();
                }
                lastDisplayOrientation = rotation;
                lastOrientation = jpegOrientation;
            }
        }
    };

    if (orientationEventListener.canDetectOrientation()) {
        orientationEventListener.enable();
    } else {
        orientationEventListener.disable();
        orientationEventListener = null;
    }
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:36,代码来源:CameraSession.java

示例11: GiraffePlayer

import android.view.OrientationEventListener; //导入方法依赖的package包/类
public GiraffePlayer(final Activity activity) {
    log = LogUtil.getInstance();
    /*通过sharepreference得到屏幕参数*/
    SharedPreferences sharedPreferences= activity.getSharedPreferences("screeninfo",
            Activity.MODE_PRIVATE);
    mWidthPixels =sharedPreferences.getInt("widthPixels", 0);
    mHeightPixels =sharedPreferences.getInt("heightPixels",0);
    try {
        IjkMediaPlayer.loadLibrariesOnce(null);
        IjkMediaPlayer.native_profileBegin("libijkplayer.so");
        playerSupport=true;
    } catch (Throwable e) {
        log.e("GiraffePlayer", "loadLibraries error"+e);
    }
    this.activity=activity;
    $=new Query(activity);

    /*初始化控件*/
    initViews();

     /*声音*/
    voiceThread = new VoiceThread();
    voiceThread.start();

    /*初始化屏幕监听*/
    orientationEventListener = new OrientationEventListener(activity) {
        @Override
        public void onOrientationChanged(int orientation) {
            if (orientation >= 0 && orientation <= 30 || orientation >= 330 || (orientation >= 150 && orientation <= 210)) {
                //竖屏
                if (portrait) {
                    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
                    orientationEventListener.disable();
                }
            } else if ((orientation >= 90 && orientation <= 120) || (orientation >= 240 && orientation <= 300)) {
                if (!portrait) {
                    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
                    orientationEventListener.disable();
                }
            }
        }
    };
    portrait=true;
    initHeight=activity.findViewById(R.id.app_video_box).getLayoutParams().height;
    if (!playerSupport) {
        showStatus(activity.getResources().getString(R.string.not_support));
    }

    /*初始化隐藏显示控件列表*/
    initViewList();
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:52,代码来源:GiraffePlayer.java

示例12: IjkPlayer

import android.view.OrientationEventListener; //导入方法依赖的package包/类
public IjkPlayer(final Activity activity) {
    log = LogUtil.getInstance();
    /*通过sharepreference得到屏幕参数*/
    SharedPreferences sharedPreferences= activity.getSharedPreferences("screeninfo",
            Activity.MODE_PRIVATE);
    mWidthPixels =sharedPreferences.getInt("widthPixels", 0);
    mHeightPixels =sharedPreferences.getInt("heightPixels",0);
    try {
        IjkMediaPlayer.loadLibrariesOnce(null);
        IjkMediaPlayer.native_profileBegin("libijkplayer.so");
        playerSupport=true;
    } catch (Throwable e) {
        log.e("GiraffePlayer", "loadLibraries error"+e);
    }
    this.activity=activity;
    $=new Query(activity);

    /*初始化控件*/
    initViews();

     /*声音*/
    voiceThread = new VoiceThread();
    voiceThread.start();

    /*初始化屏幕监听*/
    orientationEventListener = new OrientationEventListener(activity) {
        @Override
        public void onOrientationChanged(int orientation) {
            if (orientation >= 0 && orientation <= 30 || orientation >= 330 || (orientation >= 150 && orientation <= 210)) {
                //竖屏
                if (portrait) {
                    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
                    orientationEventListener.disable();
                }
            } else if ((orientation >= 90 && orientation <= 120) || (orientation >= 240 && orientation <= 300)) {
                if (!portrait) {
                    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
                    orientationEventListener.disable();
                }
            }
        }
    };
    portrait=true;
    initHeight=activity.findViewById(R.id.app_video_box).getLayoutParams().height;
    if (!playerSupport) {
        showStatus(activity.getResources().getString(R.string.not_support));
    }

    /*初始化隐藏显示控件列表*/
    initViewList();
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:52,代码来源:IjkPlayer.java

示例13: initView

import android.view.OrientationEventListener; //导入方法依赖的package包/类
/**
 * 初始化控件
 */
private void initView() {
	contentView = View.inflate(context, R.layout.view_super_player, this);
	rl_video_box = (RelativeLayout) contentView.findViewById(R.id.rl_video_box);

	mVideoView = (VideoView) contentView.findViewById(R.id.videoView);
	mVolumeBrightnessLayout = contentView.findViewById(R.id.operation_volume_brightness);
	operation_progress = contentView.findViewById(R.id.operation_progress);
	geture_tv_progress_time = (TextView) contentView.findViewById(R.id.geture_tv_progress_time);
	mOperationBg = (ImageView) contentView.findViewById(R.id.operation_bg);
	operation_tv = (TextView) contentView.findViewById(R.id.operation_tv);
	iv_progress = (ImageView) contentView.findViewById(R.id.iv_progress);
	mLoadingView = contentView.findViewById(R.id.video_loading);
	rl_top = (RelativeLayout) contentView.findViewById(R.id.rl_top);
	iv_back = (ImageView) contentView.findViewById(R.id.iv_back);
	tv_video_name = (TextView) contentView.findViewById(R.id.tv_video_name);
	view_tip_control = contentView.findViewById(R.id.view_tip_control);
	tv_continue = (TextView) contentView.findViewById(R.id.tv_continue);
	view_center_control = contentView.findViewById(R.id.view_center_control);
	iv_center_play = (ImageView) contentView.findViewById(R.id.iv_center_play);

	layout_controller = contentView.findViewById(R.id.layout_controller);
	play_pause = (ImageButton) contentView.findViewById(R.id.play_pause);
	current_time = (TextView) contentView.findViewById(R.id.current_time);
	total_time = (TextView) contentView.findViewById(R.id.total_time);
	fullScreenButton = (ImageButton) contentView.findViewById(R.id.fullScreenButton);
	seekBar = (SeekBar) contentView.findViewById(R.id.seekbar);
	ibtn_volume = (ImageButton) contentView.findViewById(R.id.ibtn_volume);


	// 为进度条添加进度更改事件
	seekBar.setOnSeekBarChangeListener(change);
	// 获得AudioManager
	mAudioManager = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
	mMaxVolume = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);

	//手势监听
	mGestureDetector = new GestureDetector(activity, new MyGestureListener());

	/**
	 * 监听手机重力感应的切换屏幕的方向
	 */
	mOrientationListener = new OrientationEventListener(activity) {
		@Override
		public void onOrientationChanged(int orientation) {
			if (orientation >= 0 && orientation <= 30 || orientation >= 330
					|| (orientation >= 150 && orientation <= 210)) {
				// 竖屏
				if (portrait) {
					activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
					mOrientationListener.disable();
				}
			} else if ((orientation >= 90 && orientation <= 120)
					|| (orientation >= 240 && orientation <= 300)) {
				if (!portrait) {
					activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
					mOrientationListener.disable();
				}
			}
		}
	};


	if (fullScreenOnly) {
		activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
	}

	portrait = getScreenOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;

	if(!portrait){
		setFullScreen(true);
	}
	hideAll();
}
 
开发者ID:CoderCF,项目名称:SuperVideoPlayer,代码行数:77,代码来源:SuperPlayer.java


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