Example usage for android.view OrientationEventListener OrientationEventListener

List of usage examples for android.view OrientationEventListener OrientationEventListener

Introduction

In this page you can find the example usage for android.view OrientationEventListener OrientationEventListener.

Prototype

public OrientationEventListener(Context context, int rate) 

Source Link

Document

Creates a new OrientationEventListener.

Usage

From source file:ca.nehil.rter.streamingapp.StreamingActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_streaming);

    poilist = new ArrayList<POI>();

    /* Retrieve server URL from stored app values */
    storedValues = getSharedPreferences(getString(R.string.sharedPreferences_filename), MODE_PRIVATE);
    server_url = storedValues.getString("server_url", "not-set");

    /* Orientation listenever implementation to orient video */
    myOrientationEventListener = new OrientationEventListener(this, SensorManager.SENSOR_DELAY_NORMAL) {
        @Override//ww  w . ja  v a2 s .  c  o m
        public void onOrientationChanged(int orientation) {
            int rotation = getWindowManager().getDefaultDisplay().getRotation();
            if (rotation == Surface.ROTATION_270) {
                flipVideo = true;
            } else {
                flipVideo = false;
            }
        }
    };
    myOrientationEventListener.enable();

    /* Retrieve user auth data from cookie */
    cookies = getSharedPreferences("RterUserCreds", MODE_PRIVATE);
    cookieEditor = cookies.edit();
    setUsername = cookies.getString("Username", "not-set");
    setRterCredentials = cookies.getString("RterCreds", "not-set");
    if (setRterCredentials.equalsIgnoreCase("not-set") || setRterCredentials == null) {
        Log.e("PREFS", "Login Not successful, please restart");
    }
    Log.d("PREFS", "Prefs ==> rter_Creds:" + setRterCredentials);

    URL serverURL = null;
    try {
        serverURL = new URL(server_url);
        CookieStore myCookieStore = new BasicCookieStore();
        client.setCookieStore(myCookieStore);
        String[] credentials = setRterCredentials.split("=", 2);
        BasicClientCookie newCookie = new BasicClientCookie(credentials[0], credentials[1]);
        newCookie.setDomain(serverURL.getHost());
        newCookie.setPath("/");
        myCookieStore.addCookie(newCookie);
        mSensorSource = SensorSource.getInstance(this, GET_LOCATION_FROM_SERVER, serverURL, setRterCredentials,
                setUsername);
        POIs = new POIList(this, serverURL, setRterCredentials, mSensorSource);
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }

    overlay = new OverlayController(this, POIs, mSensorSource); // OpenGL overlay 

    /* Get location */

    Location location = mSensorSource.getLocation();
    if (location != null) {
        lati = (float) (location.getLatitude());
        longi = (float) (location.getLongitude());
    } else {
        Toast toast = Toast.makeText(this, "Location not available", Toast.LENGTH_LONG);
        toast.setGravity(Gravity.TOP, 0, 0);
        toast.show();
        lati = (float) (45.505958f); // Hard coded location for testing purposes.
        longi = (float) (-73.576254f);
    }

    PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
    mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, CLASS_LABEL);
    mWakeLock.acquire();

    /* Test, set desired orienation to north */
    overlay.setDesiredOrientation(0.0f);
}

From source file:de.tlabs.ssr.g1.client.SourcesView.java

private void init() {
    // make this view focusable
    setFocusable(true);//from  ww w . j  a  va2 s  .co m

    // init fields
    viewportTransformation = new Matrix();
    newViewportTransformation = new Matrix();
    inverseViewportTransformation = new Matrix();

    selectionOffset = new float[2];
    touchPoint = new float[2];

    buffer = ByteBuffer.allocate(1024);

    scalingInterpolator = new TimedInterpolator();
    scalingInterpolator.setDuration(800);
    translationXInterpolator = new TimedInterpolator();
    translationXInterpolator.setDuration(800);
    translationYInterpolator = new TimedInterpolator();
    translationYInterpolator.setDuration(800);
    rotationInterpolator = new TimedInterpolator();
    rotationInterpolator.setDuration(800);
    centerRotationInterpolator = new TimedInterpolator();
    centerRotationInterpolator.setDuration(800);

    currentOrientation = getContext().getResources().getConfiguration().orientation;
    setOrientationFlag(true);

    if (SourcesView.paint == null) {
        SourcesView.paint = new Paint();
        SourcesView.paint.setAntiAlias(false);
        SourcesView.paint.setStrokeWidth(0);
        SourcesView.paint.setTextAlign(Paint.Align.CENTER);
        SourcesView.paint.setTextSize(9.0f);
    }

    // set up orientation event listener
    orientationEventListener = new OrientationEventListener(getContext(), SensorManager.SENSOR_DELAY_NORMAL) {
        @Override
        public void onOrientationChanged(int orientation) {
            if ((orientation >= 80 && orientation <= 100) || (orientation >= 260 && orientation <= 280)) { // landscape
                setOrientation(Configuration.ORIENTATION_LANDSCAPE);
            } else if ((orientation >= 350 || orientation <= 10)
                    || (orientation >= 170 && orientation <= 190)) { // portrait
                setOrientation(Configuration.ORIENTATION_PORTRAIT);
            }
        }
    };
    if (!GlobalData.orientationTrackingEnabled) // orientation tracking and screen rotation tracking don't go together
        orientationEventListener.enable();

    // set up gesture detector
    gestureDetector = new GestureDetector(getContext(), this);
    gestureDetector.setIsLongpressEnabled(false);
    gestureDetector.setOnDoubleTapListener(this);

    // init viewport transformation matrix
    recalculateViewportTransformation();
}

From source file:ca.nehil.rter.streamingapp2.StreamingActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Orientation listenever implementation
    myOrientationEventListener = new OrientationEventListener(this, SensorManager.SENSOR_DELAY_NORMAL) {
        @Override/*from w ww  .  ja v a2s  .  com*/
        public void onOrientationChanged(int orientation) {
            int rotation = getWindowManager().getDefaultDisplay().getRotation();
            if (rotation == Surface.ROTATION_270) {
                flipVideo = true;
            } else {
                flipVideo = false;
            }
        }
    };
    myOrientationEventListener.enable();

    // stopService(new Intent(StreamingActivity.this,
    // BackgroundService.class));

    Log.e(TAG, "onCreate");

    AndroidId = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
    frameInfo = new FrameInfo();
    // openGL overlay
    overlay = new OverlayController(this);
    // orientation
    mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
    mAcc = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
    mMag = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);

    //setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    setContentView(R.layout.activity_streaming);

    // Find the total number of cameras available
    numberOfCameras = Camera.getNumberOfCameras();

    cookies = getSharedPreferences("RterUserCreds", MODE_PRIVATE);
    prefEditor = cookies.edit();
    setUsername = cookies.getString("Username", "not-set");
    setRterCredentials = cookies.getString("RterCreds", "not-set");
    if (setRterCredentials.equalsIgnoreCase("not-set") || setRterCredentials == null) {
        Log.e("PREFS", "Login Not successful, please restart");
    }
    Log.d("PREFS", "Prefs ==> rter_Creds:" + setRterCredentials);

    // Get the location manager
    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    // Define the criteria how to select the location provider -> use
    // default

    if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
        Log.e(TAG, "GPS not available");
    }
    Criteria criteria = new Criteria();
    provider = locationManager.getBestProvider(criteria, true);
    Log.d(TAG, "Requesting location");
    locationManager.requestLocationUpdates(provider, 0, 1, this);
    // register the overlay control for location updates as well, so we get
    // the geomagnetic field
    locationManager.requestLocationUpdates(provider, 0, 1000, overlay);
    if (provider != null) {
        Location location = locationManager.getLastKnownLocation(provider);
        // Initialize the location fields
        if (location != null) {
            System.out.println("Provider " + provider + " has been selected. and location " + location);
            onLocationChanged(location);
        } else {
            Toast toast = Toast.makeText(this, "Location not available", Toast.LENGTH_LONG);
            toast.setGravity(Gravity.TOP, 0, 0);
            toast.show();
            lati = (float) (45.505958f);
            longi = (float) (-73.576254f);
            Log.d(TAG, "Location not available");
        }
    }

    // power manager
    PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
    mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, CLASS_LABEL);
    mWakeLock.acquire();

    // test, set desired orienation to north
    overlay.letFreeRoam(false);
    overlay.setDesiredOrientation(0.0f);
    // CharSequence text = "Tap to start..";
    // int duration = Toast.LENGTH_SHORT;
    //
    // Toast toast = Toast.makeText(this, text, duration);
    // toast.setGravity(Gravity.TOP|Gravity.RIGHT, 0, 0);
    // toast.show();

}

From source file:com.gelakinetic.selfr.CameraActivity.java

/**
 * When the activity resumes, request permissions, or if the app has them initialize:
 * - audio capturer (to detect button presses)
 * - camera (to take pictures)//from w w w. j av  a2 s. com
 * - headset state receiver (to detect the selfie stick)
 * - accelerometer (to properly set picture rotation)
 */
@Override
protected void onResume() {
    super.onResume();

    /* Check to see what permissions we're granted */
    ArrayList<String> requestedPermissions = new ArrayList<>(3);
    if (ContextCompat.checkSelfPermission(this,
            Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
        requestedPermissions.add(Manifest.permission.CAMERA);
    }
    if (ContextCompat.checkSelfPermission(this,
            Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
        requestedPermissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
    }
    if (ContextCompat.checkSelfPermission(this,
            Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
        requestedPermissions.add(Manifest.permission.RECORD_AUDIO);
    }

    /* If we don't have all of the permissions */
    if (requestedPermissions.size() > 0) {
        String permissionStrings[] = new String[requestedPermissions.size()];
        requestedPermissions.toArray(permissionStrings);
        /* Request the permissions */
        ActivityCompat.requestPermissions(this, permissionStrings, PERMISSION_REQUEST_CODE);
    } else {
        /* Otherwise, fire everything up */

        /* Set things based on preferences */
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
        if (prefs.getBoolean(getString(R.string.display_value_key), false)) {
            mDebugTextView.setVisibility(View.VISIBLE);
        } else {
            mDebugTextView.setVisibility(View.GONE);
        }

        mButtonThreshold = Float.parseFloat(
                prefs.getString(getString(R.string.threshold_key), getString(R.string.default_threshold)));

        /* Set up the audio capture */
        mAudioCapturer = AudioCapturer.getInstance(this);

        /* Set up the camera */
        mCamera = getCameraInstance(mCameraType);
        if (mCamera != null) {
            mCameraPreview = new CameraPreview(this, mCamera);
            mContentView.addView(mCameraPreview);
        }

        /* Register the headset state receiver */
        mHeadsetStateReceiver = new HeadsetStateReceiver(this);
        registerReceiver(mHeadsetStateReceiver, new IntentFilter(Intent.ACTION_HEADSET_PLUG));

        /* Set up the accelerometer */
        mOrientationEventListener = new OrientationEventListener(CameraActivity.this,
                SensorManager.SENSOR_DELAY_NORMAL) {

            /**
             * Called when the orientation of the device has changed. orientation parameter is
             * in degrees, ranging from 0 to 359. orientation is 0 degrees when the device is
             * oriented in its natural position, 90 degrees when its left side is at the top,
             * 180 degrees when it is upside down, and 270 degrees when its right side is to the
             * top. ORIENTATION_UNKNOWN is returned when the device is close to flat and the
             * orientation cannot be determined.
             *
             * @param orientation The orientation of the device. (0->359, ORIENTATION_UNKNOWN)
             */
            @Override
            public void onOrientationChanged(int orientation) {
                /* If the orientation is unknown, don't bother */
                if (orientation == ORIENTATION_UNKNOWN) {
                    return;
                }

                /* Clamp rotation to nearest 90 degree wedge, depending on camera */
                if (mCameraType == Camera.CameraInfo.CAMERA_FACING_FRONT) {
                    if (315 <= orientation || orientation < 45) {
                        mDeviceRotation = 270;
                    } else if (45 <= orientation && orientation < 135) {
                        mDeviceRotation = 180;
                    } else if (135 <= orientation && orientation < 225) {
                        mDeviceRotation = 90;
                    } else if (225 <= orientation && orientation < 315) {
                        mDeviceRotation = 0;
                    }
                } else {
                    if (315 <= orientation || orientation < 45) {
                        mDeviceRotation = 90;
                    } else if (45 <= orientation && orientation < 135) {
                        mDeviceRotation = 180;
                    } else if (135 <= orientation && orientation < 225) {
                        mDeviceRotation = 270;
                    } else if (225 <= orientation && orientation < 315) {
                        mDeviceRotation = 0;
                    }
                }
            }
        };
        if (mOrientationEventListener.canDetectOrientation()) {
            mOrientationEventListener.enable();
        }

        /* Trigger the initial hide() shortly after the activity has been
         * created, to briefly hint to the user that UI controls
         * are available.
         */
        delayedHide(2000);
    }
}

From source file:com.ape.camera2raw.Camera2RawFragment.java

@Override
public void onViewCreated(final View view, Bundle savedInstanceState) {
    view.findViewById(R.id.picture).setOnClickListener(this);
    view.findViewById(R.id.info).setOnClickListener(this);
    mTextureView = (AutoFitTextureView) view.findViewById(R.id.texture);

    // Setup a new OrientationEventListener.  This is used to handle rotation events like a
    // 180 degree rotation that do not normally trigger a call to onCreate to do view re-layout
    // or otherwise cause the preview TextureView's size to change.
    mOrientationListener = new OrientationEventListener(getActivity(), SensorManager.SENSOR_DELAY_NORMAL) {
        @Override// w  w  w. ja  v a  2s  .c  o m
        public void onOrientationChanged(int orientation) {
            if (mTextureView != null && mTextureView.isAvailable()) {
                configureTransform(mTextureView.getWidth(), mTextureView.getHeight());
            }
        }
    };
}

From source file:us.bojie.rawgyroscope.camera.Camera2RawFragment.java

@Override
public void onViewCreated(final View view, Bundle savedInstanceState) {
    view.findViewById(R.id.picture).setOnClickListener(this);
    mTextureView = (AutoFitTextureView) view.findViewById(R.id.texture);

    // Setup a new OrientationEventListener.  This is used to handle rotation events like a
    // 180 degree rotation that do not normally trigger a call to onCreate to do view re-layout
    // or otherwise cause the preview TextureView's size to change.
    mOrientationListener = new OrientationEventListener(getActivity(), SensorManager.SENSOR_DELAY_NORMAL) {
        @Override/* w  w  w. j  a va2 s  .  co m*/
        public void onOrientationChanged(int orientation) {
            if (mTextureView != null && mTextureView.isAvailable()) {
                configureTransform(mTextureView.getWidth(), mTextureView.getHeight());
            }
        }
    };
}

From source file:com.aimfire.demo.CamcorderActivity.java

public void setCameraRotation() {
    if (BuildConfig.DEBUG)
        Log.d(TAG, "setCameraRotation");
    OrientationEventListener listener = new OrientationEventListener(this, SensorManager.SENSOR_DELAY_NORMAL) {
        @Override//from  ww w .j ava  2s.c  o m
        public void onOrientationChanged(int orientation) {
            if (orientation == ORIENTATION_UNKNOWN)
                return;

            Camera.CameraInfo info = new Camera.CameraInfo();
            Camera.getCameraInfo(mCameraId, info);
            orientation = (orientation + 45) / 90 * 90;
            int rotation = 0;
            if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
                rotation = (info.orientation - orientation + 360) % 360;
            } else { // back-facing camera
                rotation = (info.orientation + orientation) % 360;
            }
            Camera.Parameters parms = mCamera.getParameters();
            parms.setRotation(rotation);
            mCamera.setParameters(parms);
        }
    };

    if (listener.canDetectOrientation()) {
        listener.enable();
    }
}

From source file:com.aimfire.demo.CamcorderActivity.java

/**
 * Opens a camera, and attempts to establish preview mode at the specified width 
 * and height./*  w w  w  .  j av  a2 s .  c o m*/
 * <p>
 * Sets mCameraPreviewWidth and mCameraPreviewHeight to the actual width/height 
 * of the preview.
 */
private boolean openCamera(int desiredFacing, int videoQuality) {
    if (mCamera != null) {
        if (BuildConfig.DEBUG)
            Log.e(TAG, "openCamera: camera already initialized");
        FirebaseCrash.report(new Exception("CamcorderActivity openCamera: camera already initialized"));
        return false;
    }

    final Camera.CameraInfo info = new Camera.CameraInfo();

    /*
     *  Try to find camera with desired facing
     */
    int numCameras = Camera.getNumberOfCameras();
    if (numCameras == 0) {
        if (BuildConfig.DEBUG)
            Log.e(TAG, "openCamera: No camera found, exiting");
        FirebaseCrash.report(new Exception("openCamera: No camera found, exiting"));
        return false;
    }

    mCameraId = -1;
    for (int i = 0; i < numCameras; i++) {
        Camera.getCameraInfo(i, info);
        if (info.facing == desiredFacing) {
            mCameraId = i;
            break;
        }
    }
    if (mCameraId == -1) {
        if (BuildConfig.DEBUG)
            Log.d(TAG, "openCamera: No camera with desired facing found; opening default");
        FirebaseCrash.report(new Exception("openCamera: No camera with desired facing found; opening default"));
        mCameraId = 0;
    }

    try {
        mCamera = Camera.open(mCameraId);
    } catch (RuntimeException e) {
        if (BuildConfig.DEBUG)
            Log.e(TAG, "openCamera: cannot open camera!");
        FirebaseCrash.report(e);
        return false;
    }

    mCameraOrientation = info.orientation;
    mCameraFacing = info.facing;

    mCameraParams = mCamera.getParameters();

    CameraUtils.setCamParams(mCameraParams);

    /*
     * if we can find a supported video/preview size that's the same as our desired size,
     * use it. otherwise, use the best quality supported by the camera.
     */
    mSupportedVideoQualities = CameraUtils.getSupportedVideoQualities();
    if ((mSupportedVideoQualities & (1 << mQualityPref)) == 0) {
        if (BuildConfig.DEBUG)
            Log.d(TAG, "openCamera: desired quality " + mQualityPref + " not supported");

        mQualityPref = CameraUtils.getMaxVideoQuality();

        /*
         * since this device doesn't support whatever quality preference we had before,
         * we save the best quality that it does support
         */
        updateQualityPref(mQualityPref);
    }
    mCameraParams.setPreviewSize(MainConsts.VIDEO_DIMENSIONS[mQualityPref][0],
            MainConsts.VIDEO_DIMENSIONS[mQualityPref][1]);

    AspectFrameLayout afl = (AspectFrameLayout) findViewById(R.id.cameraPreview_frame);
    afl.setAspectRatio((float) MainConsts.VIDEO_DIMENSIONS[mQualityPref][0]
            / (float) MainConsts.VIDEO_DIMENSIONS[mQualityPref][1]);

    /*
     * give the camera a hint that we're recording video. this can have a big
     * impact on frame rate.
     */
    mCameraParams.setRecordingHint(true);

    /*
     * disable all the automatic settings, in the hope that frame rate will
     * be less variable
     * 
     * TODO: if any of the default modes are not available then we need to 
     * sync it with the remote device
     */
    List<String> modes;

    modes = mCameraParams.getSupportedFocusModes();
    if (modes != null) {
        for (String mode : modes) {
            if (mode.contains(Camera.Parameters.FOCUS_MODE_INFINITY)) {
                mCameraParams.setFocusMode(Camera.Parameters.FOCUS_MODE_INFINITY);
                break;
            }
        }
    }

    modes = mCameraParams.getSupportedFlashModes();
    if (modes != null) {
        for (String mode : modes) {
            if (mode.contains(Camera.Parameters.FLASH_MODE_OFF)) {
                mCameraParams.setFlashMode(Camera.Parameters.FLASH_MODE_OFF);
                break;
            }
        }
    }

    /*
            modes = mCameraParams.getSupportedWhiteBalance();
            if(modes != null)
            {
    for(String mode : modes)
    {
          if(mode.contains(Camera.Parameters.WHITE_BALANCE_FLUORESCENT))
          {
            mCameraParams.setWhiteBalance(Camera.Parameters.WHITE_BALANCE_FLUORESCENT);
            break;
          }
    }
            }
            
            modes = mCameraParams.getSupportedSceneModes();
            if(modes != null)
            {
    for(String mode : modes)
    {
          if(mode.contains(Camera.Parameters.SCENE_MODE_PORTRAIT))
          {
            mCameraParams.setSceneMode(Camera.Parameters.SCENE_MODE_PORTRAIT);
            break;
          }
    }
            }
    */

    /*
     * zoom can impact view angle. we should set it to 0 if it's not
     */
    if (mCameraParams.isZoomSupported()) {
        int zoom = mCameraParams.getZoom();
        if (zoom != 0) {
            if (BuildConfig.DEBUG)
                Log.d(TAG, "getViewAngle: camera zoom = " + zoom + ", forcing to zero");
            mCameraParams.setZoom(0);
        }
    }

    /*
     *  leave the frame rate set to default
     */
    mCamera.setParameters(mCameraParams);

    /*
    int[] fpsRange = new int[2];
    mCameraParams.getPreviewFpsRange(fpsRange);
    String previewFacts = VIDEO_DIMENSIONS[mQualityPref][0] + "x" + VIDEO_DIMENSIONS[mQualityPref][1];
    if (fpsRange[0] == fpsRange[1]) {
    previewFacts += " @" + (fpsRange[0] / 1000.0) + "fps";
    } else {
    previewFacts += " @[" + (fpsRange[0] / 1000.0) +
        " - " + (fpsRange[1] / 1000.0) + "] fps";
    }
    TextView text = (TextView) findViewById(R.id.cameraParams_text);
    text.setText(previewFacts);
    */

    if (mNaturalOrientation == Configuration.ORIENTATION_PORTRAIT) {
        if (((info.facing == Camera.CameraInfo.CAMERA_FACING_BACK)
                && (mLandscapeOrientation == mCameraOrientation))
                || ((info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT)
                        && (mLandscapeOrientation != mCameraOrientation))) {
            mCamera.setDisplayOrientation(180);
            mCameraOrientation = (mCameraOrientation + 180) % 360;
        }
    }

    if (mOrientationEventListener == null) {
        mOrientationEventListener = new OrientationEventListener(this, SensorManager.SENSOR_DELAY_NORMAL) {
            @Override
            public void onOrientationChanged(int deviceOrientation) {
                if (deviceOrientation == ORIENTATION_UNKNOWN)
                    return;

                handleOrientationChanged(deviceOrientation);
            }
        };

        if (mOrientationEventListener.canDetectOrientation()) {
            mOrientationEventListener.enable();
        }
    }

    Runnable forceOrientationCalcRunnable = new Runnable() {
        public void run() {
            final Handler handler = new Handler();
            handler.postDelayed(new Runnable() {
                public void run() {
                    int deviceOrientation = mCurrDeviceOrientation;
                    mCurrDeviceOrientation = -1;
                    handleOrientationChanged(deviceOrientation);
                }
            }, 100);
        }
    };
    runOnUiThread(forceOrientationCalcRunnable);

    return true;
}