1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-04 17:27:24 +01:00

try to satisfy lgtm

This commit is contained in:
Andreas Shimokawa 2018-12-18 10:26:29 +01:00
parent 6645dd6236
commit a354bdca30
4 changed files with 8 additions and 7 deletions

View File

@ -25,7 +25,6 @@ import android.media.MediaPlayer;
import android.media.RingtoneManager; import android.media.RingtoneManager;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.RemoteInput;
import android.support.v4.content.LocalBroadcastManager; import android.support.v4.content.LocalBroadcastManager;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
@ -36,8 +35,6 @@ import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceService;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
public class FindPhoneActivity extends AbstractGBActivity { public class FindPhoneActivity extends AbstractGBActivity {
@ -100,9 +97,13 @@ public class FindPhoneActivity extends AbstractGBActivity {
mp.prepare(); mp.prepare();
mp.start(); mp.start();
} catch (IOException ignore) { } catch (IOException ignore) {
LOG.warn("problem playing ringtone");
} }
mAudioManager.setStreamVolume(AudioManager.STREAM_ALARM, mAudioManager.getStreamMaxVolume(AudioManager.STREAM_ALARM), AudioManager.FLAG_PLAY_SOUND);
if (mAudioManager != null) {
userVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_ALARM);
mAudioManager.setStreamVolume(AudioManager.STREAM_ALARM, mAudioManager.getStreamMaxVolume(AudioManager.STREAM_ALARM), AudioManager.FLAG_PLAY_SOUND);
}
} }
public void stopSound() { public void stopSound() {

View File

@ -74,7 +74,7 @@ public class WeekSleepChartFragment extends AbstractWeekChartFragment {
@Override @Override
protected String getBalanceMessage(long balance, int targetValue) { protected String getBalanceMessage(long balance, int targetValue) {
if (balance > 0) { if (balance > 0) {
final long totalBalance = balance - (targetValue * TOTAL_DAYS); final long totalBalance = balance - ((long)targetValue * TOTAL_DAYS);
if (totalBalance > 0) if (totalBalance > 0)
return getString(R.string.overslept, getHM(totalBalance)); return getString(R.string.overslept, getHM(totalBalance));
else else

View File

@ -105,7 +105,7 @@ public class WeekStepsChartFragment extends AbstractWeekChartFragment {
@Override @Override
protected String getBalanceMessage(long balance, int targetValue) { protected String getBalanceMessage(long balance, int targetValue) {
if (balance > 0) { if (balance > 0) {
final long totalBalance = balance - (targetValue * TOTAL_DAYS); final long totalBalance = balance - ((long)targetValue * TOTAL_DAYS);
if (totalBalance > 0) if (totalBalance > 0)
return getString(R.string.overstep, Math.abs(totalBalance)); return getString(R.string.overstep, Math.abs(totalBalance));
else else

View File

@ -239,7 +239,7 @@ public class NotificationListener extends NotificationListenerService {
} }
// Ignore too frequent notifications, according to user preference // Ignore too frequent notifications, according to user preference
long min_timeout = prefs.getInt("notifications_timeout", 0) * 1000; long min_timeout = (long)prefs.getInt("notifications_timeout", 0) * 1000L;
long cur_time = System.currentTimeMillis(); long cur_time = System.currentTimeMillis();
if (notificationBurstPrevention.containsKey(source)) { if (notificationBurstPrevention.containsKey(source)) {
long last_time = notificationBurstPrevention.get(source); long last_time = notificationBurstPrevention.get(source);