Merge remote-tracking branch 'ns/compileSdk34' into dev

This commit is contained in:
Milos Kozak 2023-09-24 14:58:24 +02:00
commit 405fc985a8
14 changed files with 28 additions and 22 deletions

View file

@ -235,7 +235,8 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
if (filter != "") updateFilterVisibility(filter, preferenceScreen) if (filter != "") updateFilterVisibility(filter, preferenceScreen)
} }
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) { override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {
key ?: return
rxBus.send(EventPreferenceChange(key)) rxBus.send(EventPreferenceChange(key))
if (key == rh.gs(info.nightscout.core.ui.R.string.key_language)) { if (key == rh.gs(info.nightscout.core.ui.R.string.key_language)) {
rxBus.send(EventRebuildTabs(true)) rxBus.send(EventRebuildTabs(true))

View file

@ -17,7 +17,7 @@ buildscript {
fragmentktx_version = '1.6.1' fragmentktx_version = '1.6.1'
ormLite_version = '4.46' ormLite_version = '4.46'
gson_version = '2.10.1' gson_version = '2.10.1'
nav_version = '2.6.0' nav_version = '2.7.0'
appcompat_version = '1.6.1' appcompat_version = '1.6.1'
material_version = '1.9.0' material_version = '1.9.0'
gridlayout_version = '1.0.0' gridlayout_version = '1.0.0'

View file

@ -1,5 +1,5 @@
android { android {
compileSdk 33 compileSdk 34
defaultConfig { defaultConfig {
minSdkVersion 28 minSdkVersion 28
targetSdkVersion 28 targetSdkVersion 28

View file

@ -40,7 +40,7 @@ public class InsightPairingInformationActivity extends DaggerAppCompatActivity {
} else { } else {
serialNumber.setText(connectionService.getPumpSystemIdentification().getSerialNumber()); serialNumber.setText(connectionService.getPumpSystemIdentification().getSerialNumber());
manufacturingDate.setText(connectionService.getPumpSystemIdentification().getManufacturingDate()); manufacturingDate.setText(connectionService.getPumpSystemIdentification().getManufacturingDate());
systemIdAppendix.setText(connectionService.getPumpSystemIdentification().getSystemIdAppendix() + ""); systemIdAppendix.setText(String.valueOf(connectionService.getPumpSystemIdentification().getSystemIdAppendix()));
releaseSWVersion.setText(connectionService.getPumpFirmwareVersions().getReleaseSWVersion()); releaseSWVersion.setText(connectionService.getPumpFirmwareVersions().getReleaseSWVersion());
uiProcSWVersion.setText(connectionService.getPumpFirmwareVersions().getUiProcSWVersion()); uiProcSWVersion.setText(connectionService.getPumpFirmwareVersions().getUiProcSWVersion());
pcProcSWVersion.setText(connectionService.getPumpFirmwareVersions().getPcProcSWVersion()); pcProcSWVersion.setText(connectionService.getPumpFirmwareVersions().getPcProcSWVersion());

View file

@ -57,7 +57,7 @@ public class AppLayerMessage implements Comparable<AppLayerMessage> {
Class<? extends AppLayerMessage> clazz = AppCommandIDs.IDS.getType(command); Class<? extends AppLayerMessage> clazz = AppCommandIDs.IDS.getType(command);
if (clazz == null) throw new UnknownAppCommandException(); if (clazz == null) throw new UnknownAppCommandException();
if (version != VERSION) throw new IncompatibleAppVersionException(); if (version != VERSION) throw new IncompatibleAppVersionException();
AppLayerMessage message = clazz.newInstance(); AppLayerMessage message = clazz.getDeclaredConstructor().newInstance();
if (ServiceIDs.IDS.getType(service) == null) throw new UnknownServiceException(); if (ServiceIDs.IDS.getType(service) == null) throw new UnknownServiceException();
if (error != 0) { if (error != 0) {
Class<? extends AppLayerErrorException> exceptionClass = AppErrorIDs.IDS.getType(error); Class<? extends AppLayerErrorException> exceptionClass = AppErrorIDs.IDS.getType(error);

View file

@ -33,7 +33,7 @@ public class ReadParameterBlockMessage extends AppLayerMessage {
@Override @Override
protected void parse(ByteBuf byteBuf) throws Exception { protected void parse(ByteBuf byteBuf) throws Exception {
parameterBlock = ParameterBlockIDs.IDS.getType(byteBuf.readUInt16LE()).newInstance(); parameterBlock = ParameterBlockIDs.IDS.getType(byteBuf.readUInt16LE()).getDeclaredConstructor().newInstance();
byteBuf.shift(2); //Restriction level byteBuf.shift(2); //Restriction level
parameterBlock.parse(byteBuf); parameterBlock.parse(byteBuf);
} }

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.insight.app_layer.history.history_events; package info.nightscout.androidaps.plugins.pump.insight.app_layer.history.history_events;
import java.lang.reflect.InvocationTargetException;
import info.nightscout.androidaps.plugins.pump.insight.ids.HistoryEventIDs; import info.nightscout.androidaps.plugins.pump.insight.ids.HistoryEventIDs;
import info.nightscout.androidaps.plugins.pump.insight.utils.BOCUtil; import info.nightscout.androidaps.plugins.pump.insight.utils.BOCUtil;
import info.nightscout.androidaps.plugins.pump.insight.utils.ByteBuf; import info.nightscout.androidaps.plugins.pump.insight.utils.ByteBuf;
@ -22,8 +24,8 @@ public class HistoryEvent implements Comparable<HistoryEvent> {
if (eventClass == null) event = new HistoryEvent(); if (eventClass == null) event = new HistoryEvent();
else { else {
try { try {
event = eventClass.newInstance(); event = eventClass.getDeclaredConstructor().newInstance();
} catch (IllegalAccessException | InstantiationException e) { } catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e) {
//log.error("Unhandled exception", e); //log.error("Unhandled exception", e);
event = new HistoryEvent(); event = new HistoryEvent();
} }

View file

@ -107,8 +107,8 @@ public abstract class SatlMessage {
if (clazz == null) throw new InvalidSatlCommandException(); if (clazz == null) throw new InvalidSatlCommandException();
SatlMessage message; SatlMessage message;
try { try {
message = clazz.newInstance(); message = clazz.getDeclaredConstructor().newInstance();
} catch (Exception exception) { } catch (Exception ignored) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
message.parse(ByteBuf.from(payload)); message.parse(ByteBuf.from(payload));
@ -138,8 +138,8 @@ public abstract class SatlMessage {
if (clazz == null) throw new InvalidSatlCommandException(); if (clazz == null) throw new InvalidSatlCommandException();
SatlMessage message; SatlMessage message;
try { try {
message = clazz.newInstance(); message = clazz.getDeclaredConstructor().newInstance();
} catch (Exception exception) { } catch (Exception ignored) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
message.parse(ByteBuf.from(payload)); message.parse(ByteBuf.from(payload));

View file

@ -25,7 +25,7 @@ class SWPreference(injector: HasAndroidInjector, private val definition: SWDefin
} }
private fun addConfiguration(layout: LinearLayout, xml: Int) { private fun addConfiguration(layout: LinearLayout, xml: Int) {
(Class.forName(uiInteraction.myPreferenceFragment.name).newInstance() as Fragment).also { fragment -> (Class.forName(uiInteraction.myPreferenceFragment.name).getDeclaredConstructor().newInstance() as Fragment).also { fragment ->
fragment.arguments = Bundle().also { it.putInt("id", xml) } fragment.arguments = Bundle().also { it.putInt("id", xml) }
definition.activity.supportFragmentManager.beginTransaction().run { definition.activity.supportFragmentManager.beginTransaction().run {
replace(layout.id, fragment) replace(layout.id, fragment)

View file

@ -35,7 +35,7 @@ dependencies {
// OpenHuman // OpenHuman
api "com.squareup.okhttp3:okhttp:$okhttp3_version" api "com.squareup.okhttp3:okhttp:$okhttp3_version"
api "com.squareup.retrofit2:retrofit:$retrofit2_version" api "com.squareup.retrofit2:retrofit:$retrofit2_version"
api "androidx.browser:browser:1.5.0" api "androidx.browser:browser:1.6.0"
api "androidx.work:work-runtime-ktx:$work_version" api "androidx.work:work-runtime-ktx:$work_version"
api "com.google.android.material:material:$material_version" api "com.google.android.material:material:$material_version"

View file

@ -125,10 +125,11 @@ class AlarmRegistry @Inject constructor() : IAlarmRegistry {
private fun registerOsAlarm(alarmCode: AlarmCode, triggerTime: Long): Maybe<AlarmCode> { private fun registerOsAlarm(alarmCode: AlarmCode, triggerTime: Long): Maybe<AlarmCode> {
return Maybe.fromCallable { return Maybe.fromCallable {
cancelOsAlarmInternal(alarmCode) cancelOsAlarmInternal(alarmCode)
val pendingIntent = createPendingIntent(alarmCode, 0) createPendingIntent(alarmCode, 0)?.let { pendingIntent ->
aapsLogger.debug("[${alarmCode}] OS Alarm added. ${dateUtil.toISOString(triggerTime)}") aapsLogger.debug("[${alarmCode}] OS Alarm added. ${dateUtil.toISOString(triggerTime)}")
mOsAlarmManager.setAlarmClock(AlarmClockInfo(triggerTime, pendingIntent), pendingIntent) mOsAlarmManager.setAlarmClock(AlarmClockInfo(triggerTime, pendingIntent), pendingIntent)
alarmCode alarmCode
}
} }
} }

View file

@ -53,7 +53,7 @@ class TreatmentsActivity : TranslatedDaggerAppCompatActivity() {
5 -> TreatmentsCareportalFragment::class.java 5 -> TreatmentsCareportalFragment::class.java
else -> TreatmentsUserEntryFragment::class.java else -> TreatmentsUserEntryFragment::class.java
} }
setFragment(fragment.newInstance()) setFragment(fragment.getDeclaredConstructor().newInstance())
supportActionBar?.title = tab.contentDescription supportActionBar?.title = tab.contentDescription
} }

View file

@ -43,7 +43,7 @@ def generateGitBuild = { ->
} }
android { android {
compileSdk 33 compileSdk 34
defaultConfig { defaultConfig {
minSdkVersion 25 minSdkVersion 25
@ -103,7 +103,7 @@ dependencies {
implementation 'androidx.legacy:legacy-support-v13:1.0.0' implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation "androidx.preference:preference-ktx:$preferencektx_version" implementation "androidx.preference:preference-ktx:$preferencektx_version"
implementation 'androidx.wear:wear:1.3.0' implementation 'androidx.wear:wear:1.3.0'
implementation 'androidx.wear.tiles:tiles:1.1.0' implementation 'androidx.wear.tiles:tiles:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation project(':shared:tests') testImplementation project(':shared:tests')

View file

@ -21,6 +21,7 @@ class WearApp : DaggerApplication(), OnSharedPreferenceChangeListener {
@Inject lateinit var aapsLogger: AAPSLogger @Inject lateinit var aapsLogger: AAPSLogger
@Inject lateinit var rxBus: RxBus @Inject lateinit var rxBus: RxBus
@Suppress("unused")
@Inject lateinit var dataHandlerWear: DataHandlerWear // instantiate only @Inject lateinit var dataHandlerWear: DataHandlerWear // instantiate only
@Inject lateinit var exceptionHandlerWear: ExceptionHandlerWear @Inject lateinit var exceptionHandlerWear: ExceptionHandlerWear
@ -38,7 +39,8 @@ class WearApp : DaggerApplication(), OnSharedPreferenceChangeListener {
.application(this) .application(this)
.build() .build()
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) { override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {
key ?: return
// We trigger update on Complications // We trigger update on Complications
LocalBroadcastManager.getInstance(this).sendBroadcast(Intent(DataLayerListenerServiceWear.INTENT_NEW_DATA)) LocalBroadcastManager.getInstance(this).sendBroadcast(Intent(DataLayerListenerServiceWear.INTENT_NEW_DATA))
rxBus.send(EventWearPreferenceChange(key)) rxBus.send(EventWearPreferenceChange(key))