1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-17 22:11:35 +02:00

fixed Android 12 installation errors and crashes

This commit is contained in:
oliexdev
2021-11-12 20:28:11 +01:00
parent fc02ea3008
commit 77960dced1
3 changed files with 16 additions and 8 deletions

View File

@@ -33,23 +33,24 @@
<activity
android:name=".gui.MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
android:theme="@style/AppTheme.NoActionBar"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".gui.slides.AppIntroActivity" android:theme="@style/AppTheme.NoActionBar"/>
<activity android:name=".gui.slides.SlideToNavigationAdapter" android:theme="@style/AppTheme.NoActionBar"/>
<activity android:name=".gui.slides.AppIntroActivity" android:theme="@style/AppTheme.NoActionBar" android:exported="true"/>
<activity android:name=".gui.slides.SlideToNavigationAdapter" android:theme="@style/AppTheme.NoActionBar" android:exported="true"/>
<receiver android:name=".core.alarm.ReminderBootReceiver" android:enabled="false">
<receiver android:name=".core.alarm.ReminderBootReceiver" android:enabled="false" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<receiver android:name=".gui.widget.WidgetProvider">
<receiver android:name=".gui.widget.WidgetProvider" android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
@@ -57,7 +58,7 @@
android:resource="@xml/widget_info" />
</receiver>
<activity android:name=".gui.widget.WidgetConfigure">
<activity android:name=".gui.widget.WidgetConfigure" android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
</intent-filter>

View File

@@ -102,6 +102,7 @@ public class BluetoothSettingsFragment extends Fragment {
if (PermissionHelper.requestBluetoothPermission(this)) {
startBluetoothDiscovery();
}
super.onResume();
}
@@ -404,6 +405,13 @@ public class BluetoothSettingsFragment extends Fragment {
} else {
Timber.d("At least one Bluetooth permission was not granted");
Toast.makeText(requireContext(), R.string.permission_not_granted, Toast.LENGTH_SHORT).show();
if (getActivity().findViewById(R.id.nav_host_fragment) != null){
Navigation.findNavController(requireActivity(), R.id.nav_host_fragment).getPreviousBackStackEntry().getSavedStateHandle().set("update", true);
Navigation.findNavController(requireActivity(), R.id.nav_host_fragment).navigateUp();
} else {
getActivity().finish();
}
}
break;
}

View File

@@ -72,6 +72,7 @@ public class PermissionHelper {
Timber.d("SDK >= 31 request for Bluetooth Scan and Bluetooth connect permissions");
requiredPermissions = new String[]{Manifest.permission.BLUETOOTH_SCAN, Manifest.permission.BLUETOOTH_CONNECT};
fragment.requestPermissions(requiredPermissions, PERMISSIONS_REQUEST_ACCESS_BLUETOOTH);
return false;
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && targetSdkVersion >= Build.VERSION_CODES.Q) {
Timber.d("SDK >= 29 request for Access fine location permission");
return requestLocationPermission(fragment, new String[]{Manifest.permission.ACCESS_FINE_LOCATION});
@@ -79,8 +80,6 @@ public class PermissionHelper {
Timber.d("SDK < 29 request for coarse location permission");
return requestLocationPermission(fragment, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION});
}
return true;
}
private static boolean requestLocationPermission(final Fragment fragment, String[] requiredPermissions) {