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:
Sean Owen 2015-10-23 05:19:25 -07:00
parent ff5198e639
commit f8623ccb12
4 changed files with 12 additions and 20 deletions

View file

@ -30,7 +30,7 @@
<uses-permission android:name="android.permission.CHANGE_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 -->
<uses-feature android:name="android.hardware.camera" android:required="false"/>

View file

@ -32,8 +32,7 @@ import java.io.IOException;
/**
* Manages beeps and vibrations for {@link CaptureActivity}.
*/
final class BeepManager implements
MediaPlayer.OnCompletionListener, MediaPlayer.OnErrorListener, Closeable {
final class BeepManager implements MediaPlayer.OnErrorListener, Closeable {
private static final String TAG = BeepManager.class.getSimpleName();
@ -87,9 +86,6 @@ final class BeepManager implements
private MediaPlayer buildMediaPlayer(Context activity) {
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setOnCompletionListener(this);
mediaPlayer.setOnErrorListener(this);
try {
AssetFileDescriptor file = activity.getResources().openRawResourceFd(R.raw.beep);
try {
@ -97,6 +93,9 @@ final class BeepManager implements
} finally {
file.close();
}
mediaPlayer.setOnErrorListener(this);
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setLooping(false);
mediaPlayer.setVolume(BEEP_VOLUME, BEEP_VOLUME);
mediaPlayer.prepare();
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
public synchronized boolean onError(MediaPlayer mp, int what, int extra) {
if (what == MediaPlayer.MEDIA_ERROR_SERVER_DIED) {
@ -120,8 +113,7 @@ final class BeepManager implements
activity.finish();
} else {
// possibly media player error, so release and recreate
mp.release();
mediaPlayer = null;
close();
updatePrefs();
}
return true;

10
pom.xml
View file

@ -210,7 +210,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.6.1</version>
<version>3.0.0</version>
<configuration>
<filesets>
<fileset>
@ -277,7 +277,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.2</version>
<version>2.5.3</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.scm</groupId>
@ -328,7 +328,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<version>2.19</version>
<configuration>
<forkCount>0.5C</forkCount>
<systemPropertyVariables>
@ -362,7 +362,7 @@
</executions>
<configuration>
<sdk>
<platform>23</platform>
<platform>22</platform>
</sdk>
<proguard>
<skip>true</skip>
@ -417,7 +417,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.16</version>
<version>2.17</version>
<configuration>
<configLocation>src/checkstyle/checkstyle.xml</configLocation>
<!-- Android generated files -->

View file

@ -61,7 +61,7 @@
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.4.RC0</version>
<version>9.3.5.v20151012</version>
<configuration>
<webAppSourceDirectory>src/web</webAppSourceDirectory>
</configuration>