Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ repositories {
}

dependencies {
compile 'com.android.support:support-v4:19.0.0'
compile 'com.android.support:support-v4:19.1.0'

compile files('libs/zxing-core-2.3.jar')

}

android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
buildToolsVersion "19.1.0"

sourceSets {
main {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.welcu.android.zxingfragmentlib.camera;

import android.annotation.TargetApi;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Point;
Expand Down Expand Up @@ -139,15 +140,24 @@ void setDesiredCameraParameters(Camera camera, boolean safeMode) {

private void setOrientation(Camera camera, Camera.Parameters parameters) {
if (view.getWidth() < view.getHeight()){
if (Build.VERSION.SDK_INT==7) {
parameters.set("orientation", "portrait");
parameters.setRotation(90);
if (Build.VERSION.SDK_INT<=7) {
setOrientationBefore8(parameters);
} else {
camera.setDisplayOrientation(90);
setOrientation8(camera);
}
}
}

private void setOrientationBefore8(Camera.Parameters parameters) {
parameters.set("orientation", "portrait");
parameters.setRotation(90);
}

@TargetApi(Build.VERSION_CODES.FROYO)
private void setOrientation8(Camera camera) {
camera.setDisplayOrientation(90);
}

Point getCameraResolution() {
return cameraResolution;
}
Expand Down