Sha256: a509cb55b7f1678daa8a9e70306bbe20fbea5bda3e4891bd4029828b4670e5ab

Contents?: true

Size: 1.22 KB

Versions: 14

Compression:

Stored size: 1.22 KB

Contents

package com.rho.camera;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.view.OrientationEventListener;

public class OrientationListnerService extends Service{
	public static int mRotation = 0;
	private OrientationEventListener mOrientationListener;
	@Override
	public void onCreate() {
		super.onCreate();
		mOrientationListener = new OrientationEventListener(this) {
			@Override
			public void onOrientationChanged(int rotation) {
			if(rotation != -1){
				if(rotation >=315 && rotation < 45){
					mRotation = 0;
				}else if(rotation >=45 && rotation < 135){
					mRotation = 90;
				}else if(rotation >=135 && rotation < 225){
					mRotation = 180;
				}else if(rotation >=225 && rotation< 315){
					mRotation = 270;
				}else{
					mRotation = 0;
				}
			}
		}
		};
	}
	@Override
	public int onStartCommand(Intent intent, int flags, int startId) {
		if (mOrientationListener.canDetectOrientation()) {
            mOrientationListener.enable();
        }
		return super.onStartCommand(intent, flags, startId);
	}
	@Override
	public void onDestroy() {
		mOrientationListener.disable();
		super.onDestroy();
	}
	
	@Override
	public IBinder onBind(Intent intent) {
		return null;
	}
}

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rhodes-7.6.0 lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/OrientationListnerService.java
rhodes-7.5.1 lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/OrientationListnerService.java
rhodes-7.4.1 lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/OrientationListnerService.java
rhodes-7.1.17 lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/OrientationListnerService.java
rhodes-6.2.0 lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/OrientationListnerService.java
rhodes-6.0.11 lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/OrientationListnerService.java
rhodes-5.5.18 lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/OrientationListnerService.java
rhodes-5.5.17 lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/OrientationListnerService.java
rhodes-5.5.15 lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/OrientationListnerService.java
rhodes-5.5.0.22 lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/OrientationListnerService.java
rhodes-5.5.2 lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/OrientationListnerService.java
rhodes-5.5.0.7 lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/OrientationListnerService.java
rhodes-5.5.0.3 lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/OrientationListnerService.java
rhodes-5.5.0 lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/OrientationListnerService.java