Fix linter errors

This commit is contained in:
Arjan Schrijver 2024-02-13 10:54:12 +01:00
parent 874bb1a14e
commit d637b9263c
4 changed files with 16 additions and 16 deletions

View File

@ -58,8 +58,8 @@ public class MiBandDateConverter {
value[offset + 5]);
int offsetInHours = MiBandCoordinator.getDeviceTimeOffsetHours(deviceAddress);
if(offsetInHours != 0)
timestamp.add(Calendar.HOUR_OF_DAY,-offsetInHours);
if (offsetInHours != 0)
timestamp.add(Calendar.HOUR_OF_DAY, -offsetInHours);
return timestamp;
}
@ -83,8 +83,8 @@ public class MiBandDateConverter {
// shift to -8, so at 6am the device thinks it's still 10pm
// of the day before.
int offsetInHours = MiBandCoordinator.getDeviceTimeOffsetHours(deviceAddress);
if(offsetInHours != 0)
timestamp.add(Calendar.HOUR_OF_DAY,offsetInHours);
if (offsetInHours != 0)
timestamp.add(Calendar.HOUR_OF_DAY, offsetInHours);
return new byte[]{
(byte) (timestamp.get(Calendar.YEAR) - 2000),

View File

@ -19,6 +19,9 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.util;
import static nodomain.freeyourgadget.gadgetbridge.GBApplication.isRunningOreoOrLater;
import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.EXTRA_RECORDED_DATA_TYPES;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationChannel;
@ -28,12 +31,10 @@ import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.text.Html;
import android.text.SpannableString;
import android.util.Log;
import android.widget.Toast;
import androidx.annotation.NonNull;
@ -48,8 +49,6 @@ import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Collections;
import java.util.List;
@ -63,10 +62,6 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceService;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceCommunicationService;
import nodomain.freeyourgadget.gadgetbridge.util.GBPrefs;
import static nodomain.freeyourgadget.gadgetbridge.GBApplication.isRunningOreoOrLater;
import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.EXTRA_RECORDED_DATA_TYPES;
public class GB {
@ -305,7 +300,11 @@ public class GB {
public static void notify(int id, @NonNull Notification notification, Context context) {
createNotificationChannels(context);
NotificationManagerCompat.from(context).notify(id, notification);
try {
NotificationManagerCompat.from(context).notify(id, notification);
} catch (SecurityException e) {
toast(context.getString(R.string.warning_missing_notification_permission), Toast.LENGTH_SHORT, WARN);
}
}
public static void removeNotification(int id, Context context) {

View File

@ -3,7 +3,7 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#7E7E7E">
android:tint="#7E7E7E"
android:autoMirrored="true">
<path
android:fillColor="@android:color/white"

View File

@ -496,8 +496,8 @@
<string name="zetime_signaling_beep_twice">Beep twice</string>
<string name="zetime_signaling_vibrate_beep_once">Vibrate and beep once</string>
<!-- pixoo specific settings -->
<string name="clap_hands_to_wakeup_device">Clap hands to turn up screen</string>"
<string name="clap_hands_to_wakeup_device_summary">Clapping again will turn off the screen</string>"
<string name="clap_hands_to_wakeup_device">Clap hands to turn up screen</string>
<string name="clap_hands_to_wakeup_device_summary">Clapping again will turn off the screen</string>
<string name="pixoo_power_saving_summary">The screen will turn off after the microphone has detected silence for a while</string>
<!-- Device specific settings -->
<string name="title_activity_device_specific_settings">Device specific settings</string>
@ -2677,4 +2677,5 @@
<string name="pref_force_connection_type_ble_value" translatable="false">BLE</string>
<string name="pref_force_connection_type_bt_classic_value" translatable="false">BT_CLASSIC</string>
<string name="activity_info">Activity info</string>
<string name="warning_missing_notification_permission">Could not post ongoing notification due to missing permission</string>
</resources>