更新CameraX至v1.2.1

This commit is contained in:
Jenly
2023-03-04 20:54:37 +08:00
parent b2fa6aaec0
commit a85d793149
53 changed files with 1566 additions and 884 deletions

View File

@@ -1,24 +1,7 @@
package com.king.zxing.manager;
/*
* Copyright (C) 2010 ZXing authors
*
* 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.content.Context;
import android.content.res.AssetFileDescriptor;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Build;
import android.os.VibrationEffect;
@@ -28,7 +11,6 @@ import com.king.zxing.R;
import com.king.zxing.util.LogUtils;
import java.io.Closeable;
import java.lang.annotation.ElementType;
/**
* @author <a href="mailto:jenly1314@gmail.com">Jenly</a>
@@ -49,11 +31,11 @@ public final class BeepManager implements MediaPlayer.OnErrorListener, Closeable
updatePrefs();
}
public void setVibrate(boolean vibrate){
public void setVibrate(boolean vibrate) {
this.vibrate = vibrate;
}
public void setPlayBeep(boolean playBeep){
public void setPlayBeep(boolean playBeep) {
this.playBeep = playBeep;
}
@@ -61,8 +43,8 @@ public final class BeepManager implements MediaPlayer.OnErrorListener, Closeable
if (mediaPlayer == null) {
mediaPlayer = buildMediaPlayer(context);
}
if(vibrator == null){
vibrator = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE);
if (vibrator == null) {
vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
}
}
@@ -85,7 +67,6 @@ public final class BeepManager implements MediaPlayer.OnErrorListener, Closeable
AssetFileDescriptor file = context.getResources().openRawResourceFd(R.raw.zxl_beep);
mediaPlayer.setDataSource(file.getFileDescriptor(), file.getStartOffset(), file.getLength());
mediaPlayer.setOnErrorListener(this);
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setLooping(false);
mediaPlayer.prepare();
return mediaPlayer;
@@ -105,12 +86,12 @@ public final class BeepManager implements MediaPlayer.OnErrorListener, Closeable
@Override
public synchronized void close() {
try{
try {
if (mediaPlayer != null) {
mediaPlayer.release();
mediaPlayer = null;
}
}catch (Exception e){
} catch (Exception e) {
LogUtils.e(e);
}
}