mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-06-05 21:49:48 +02:00
Add lint baseline, enable linting on CI, fix some reported errors (#3291)
This PR: - fixes some errors reported by `gradlew lint` and the Android Studio "Code Inspection" tool - adds a snapshot file `lint-baseline.xml` of the remaining lint errors and warnings to be used by the linter as baseline - adds a job for CI to run `gradlew lint` on every build Reviewed-on: https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/3291 Reviewed-by: José Rebelo <joserebelo@noreply.codeberg.org> Co-authored-by: Arjan Schrijver <a_gadgetbridge@anymore.nl> Co-committed-by: Arjan Schrijver <a_gadgetbridge@anymore.nl>
This commit is contained in:
committed by
Arjan Schrijver
parent
7359186cee
commit
557bfea35c
@@ -17,6 +17,7 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package nodomain.freeyourgadget.gadgetbridge.util;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ContentUris;
|
||||
@@ -124,6 +125,7 @@ public class AndroidUtils {
|
||||
dynamicColorContext = DynamicColors.wrapContextIfAvailable(context, R.style.GadgetbridgeThemeDynamicLight);
|
||||
}
|
||||
int[] attrsToResolve = {R.attr.colorOnSurface};
|
||||
@SuppressLint("ResourceType")
|
||||
TypedArray ta = dynamicColorContext.obtainStyledAttributes(attrsToResolve);
|
||||
color = ta.getColor(0, 0);
|
||||
ta.recycle();
|
||||
@@ -149,6 +151,7 @@ public class AndroidUtils {
|
||||
dynamicColorContext = DynamicColors.wrapContextIfAvailable(context, R.style.GadgetbridgeThemeDynamicLight);
|
||||
}
|
||||
int[] attrsToResolve = {R.attr.colorSurface};
|
||||
@SuppressLint("ResourceType")
|
||||
TypedArray ta = dynamicColorContext.obtainStyledAttributes(attrsToResolve);
|
||||
color = ta.getColor(0, 0);
|
||||
ta.recycle();
|
||||
|
||||
@@ -143,7 +143,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.coordinators
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.coordinators.SonyWH1000XM4Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.sonyswr12.SonySWR12DeviceCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.tlw64.TLW64Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.um25.Coordinator.BinarySensorCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.binary_sensor.coordinator.BinarySensorCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.um25.Coordinator.UM25Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.vesc.VescCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.vibratissimo.VibratissimoCoordinator;
|
||||
|
||||
@@ -29,7 +29,6 @@ import org.slf4j.LoggerFactory;
|
||||
import java.util.List;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.Widget;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
|
||||
public class WidgetPreferenceStorage {
|
||||
@@ -97,7 +96,6 @@ public class WidgetPreferenceStorage {
|
||||
}
|
||||
SharedPreferences.Editor editor = sharedPrefs.edit();
|
||||
editor.putString(PREFS_WIDGET_SETTINGS, savedWidgetsPreferencesDataArray.toString());
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
@@ -127,7 +125,6 @@ public class WidgetPreferenceStorage {
|
||||
|
||||
SharedPreferences.Editor editor = sharedPrefs.edit();
|
||||
editor.putString(PREFS_WIDGET_SETTINGS, savedWidgetsPreferencesDataArray.toString());
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
@@ -139,7 +136,6 @@ public class WidgetPreferenceStorage {
|
||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
SharedPreferences.Editor editor = sharedPrefs.edit();
|
||||
editor.putString(PREFS_WIDGET_SETTINGS, "");
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ package nodomain.freeyourgadget.gadgetbridge.util.dialogs;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -33,7 +32,7 @@ public class MaterialDialogFragment extends DialogFragment {
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity());
|
||||
theDialogView = onCreateView(LayoutInflater.from(requireContext()), null, savedInstanceState);
|
||||
theDialogView = onCreateView(getLayoutInflater(), null, savedInstanceState);
|
||||
builder.setView(theDialogView);
|
||||
|
||||
return builder.create();
|
||||
|
||||
Reference in New Issue
Block a user