Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 * Copyright 2014 Google Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import android.hardware.Camera;

import java.util.List;

public class Main {
    public static void chooseFocusPoint(Camera.Parameters parameters, String focusMode, int x, int y, int width,
            int height) {
        List<String> supportedModes = parameters.getSupportedFocusModes();
        if (supportedModes != null && supportedModes.contains(focusMode)) {
            parameters.setFocusMode(focusMode);

            //              Rect focusRect = calculateTapArea(x, y, 1f);
            //              Rect meteringRect = calculateTapArea(x, y, 1.5f);
            //              if (params.getMaxNumFocusAreas() > 0) {
            //                  List<Camera.Area> focusAreas = new ArrayList<Camera.Area>();
            //                  focusAreas.add(new Camera.Area(focusRect, 600));
            //                  params.setFocusAreas(focusAreas);
            //              }
            //              if (params.getMaxNumMeteringAreas() > 0) {
            //                  List<Camera.Area> meteringAreas = new ArrayList<Camera.Area>();
            //                  meteringAreas.add(new Camera.Area(meteringRect, 600));
            //                  params.setMeteringAreas(meteringAreas);
            //              }
        }
    }
}