mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Target API 22 since not yet updated for new permission model; fix beep problem that surfaces in Android 6; update plugins
This commit is contained in:
parent
ff5198e639
commit
f8623ccb12
|
@ -30,7 +30,7 @@
|
||||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
|
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="23"/>
|
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="22"/>
|
||||||
|
|
||||||
<!-- Don't require camera, as this requires a rear camera. This allows it to work on the Nexus 7 -->
|
<!-- Don't require camera, as this requires a rear camera. This allows it to work on the Nexus 7 -->
|
||||||
<uses-feature android:name="android.hardware.camera" android:required="false"/>
|
<uses-feature android:name="android.hardware.camera" android:required="false"/>
|
||||||
|
|
|
@ -32,8 +32,7 @@ import java.io.IOException;
|
||||||
/**
|
/**
|
||||||
* Manages beeps and vibrations for {@link CaptureActivity}.
|
* Manages beeps and vibrations for {@link CaptureActivity}.
|
||||||
*/
|
*/
|
||||||
final class BeepManager implements
|
final class BeepManager implements MediaPlayer.OnErrorListener, Closeable {
|
||||||
MediaPlayer.OnCompletionListener, MediaPlayer.OnErrorListener, Closeable {
|
|
||||||
|
|
||||||
private static final String TAG = BeepManager.class.getSimpleName();
|
private static final String TAG = BeepManager.class.getSimpleName();
|
||||||
|
|
||||||
|
@ -87,9 +86,6 @@ final class BeepManager implements
|
||||||
|
|
||||||
private MediaPlayer buildMediaPlayer(Context activity) {
|
private MediaPlayer buildMediaPlayer(Context activity) {
|
||||||
MediaPlayer mediaPlayer = new MediaPlayer();
|
MediaPlayer mediaPlayer = new MediaPlayer();
|
||||||
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
|
|
||||||
mediaPlayer.setOnCompletionListener(this);
|
|
||||||
mediaPlayer.setOnErrorListener(this);
|
|
||||||
try {
|
try {
|
||||||
AssetFileDescriptor file = activity.getResources().openRawResourceFd(R.raw.beep);
|
AssetFileDescriptor file = activity.getResources().openRawResourceFd(R.raw.beep);
|
||||||
try {
|
try {
|
||||||
|
@ -97,6 +93,9 @@ final class BeepManager implements
|
||||||
} finally {
|
} finally {
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
mediaPlayer.setOnErrorListener(this);
|
||||||
|
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
|
||||||
|
mediaPlayer.setLooping(false);
|
||||||
mediaPlayer.setVolume(BEEP_VOLUME, BEEP_VOLUME);
|
mediaPlayer.setVolume(BEEP_VOLUME, BEEP_VOLUME);
|
||||||
mediaPlayer.prepare();
|
mediaPlayer.prepare();
|
||||||
return mediaPlayer;
|
return mediaPlayer;
|
||||||
|
@ -107,12 +106,6 @@ final class BeepManager implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCompletion(MediaPlayer mp) {
|
|
||||||
// When the beep has finished playing, rewind to queue up another one.
|
|
||||||
mp.seekTo(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized boolean onError(MediaPlayer mp, int what, int extra) {
|
public synchronized boolean onError(MediaPlayer mp, int what, int extra) {
|
||||||
if (what == MediaPlayer.MEDIA_ERROR_SERVER_DIED) {
|
if (what == MediaPlayer.MEDIA_ERROR_SERVER_DIED) {
|
||||||
|
@ -120,8 +113,7 @@ final class BeepManager implements
|
||||||
activity.finish();
|
activity.finish();
|
||||||
} else {
|
} else {
|
||||||
// possibly media player error, so release and recreate
|
// possibly media player error, so release and recreate
|
||||||
mp.release();
|
close();
|
||||||
mediaPlayer = null;
|
|
||||||
updatePrefs();
|
updatePrefs();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
10
pom.xml
10
pom.xml
|
@ -210,7 +210,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-clean-plugin</artifactId>
|
<artifactId>maven-clean-plugin</artifactId>
|
||||||
<version>2.6.1</version>
|
<version>3.0.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<filesets>
|
<filesets>
|
||||||
<fileset>
|
<fileset>
|
||||||
|
@ -277,7 +277,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-release-plugin</artifactId>
|
<artifactId>maven-release-plugin</artifactId>
|
||||||
<version>2.5.2</version>
|
<version>2.5.3</version>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven.scm</groupId>
|
<groupId>org.apache.maven.scm</groupId>
|
||||||
|
@ -328,7 +328,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.18.1</version>
|
<version>2.19</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<forkCount>0.5C</forkCount>
|
<forkCount>0.5C</forkCount>
|
||||||
<systemPropertyVariables>
|
<systemPropertyVariables>
|
||||||
|
@ -362,7 +362,7 @@
|
||||||
</executions>
|
</executions>
|
||||||
<configuration>
|
<configuration>
|
||||||
<sdk>
|
<sdk>
|
||||||
<platform>23</platform>
|
<platform>22</platform>
|
||||||
</sdk>
|
</sdk>
|
||||||
<proguard>
|
<proguard>
|
||||||
<skip>true</skip>
|
<skip>true</skip>
|
||||||
|
@ -417,7 +417,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||||
<version>2.16</version>
|
<version>2.17</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<configLocation>src/checkstyle/checkstyle.xml</configLocation>
|
<configLocation>src/checkstyle/checkstyle.xml</configLocation>
|
||||||
<!-- Android generated files -->
|
<!-- Android generated files -->
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
<artifactId>jetty-maven-plugin</artifactId>
|
<artifactId>jetty-maven-plugin</artifactId>
|
||||||
<version>9.3.4.RC0</version>
|
<version>9.3.5.v20151012</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<webAppSourceDirectory>src/web</webAppSourceDirectory>
|
<webAppSourceDirectory>src/web</webAppSourceDirectory>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
Loading…
Reference in a new issue