mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-17 22:11:35 +02:00
use requireActivity instead of getActivity
This commit is contained in:
@@ -65,7 +65,7 @@ public class BluetoothPreferences extends PreferenceFragmentCompat {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
NavDirections action = BluetoothPreferencesDirections.actionNavBluetoothPreferencesToNavBluetoothSettings();
|
||||
Navigation.findNavController(getActivity(), R.id.nav_host_fragment).navigate(action);
|
||||
Navigation.findNavController(requireActivity(), R.id.nav_host_fragment).navigate(action);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
@@ -79,7 +79,7 @@ public class BluetoothPreferences extends PreferenceFragmentCompat {
|
||||
|
||||
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||
|
||||
Navigation.findNavController(getActivity(), R.id.nav_host_fragment).getCurrentBackStackEntry().getSavedStateHandle().getLiveData("update", false).observe(getViewLifecycleOwner(), new Observer<Boolean>() {
|
||||
Navigation.findNavController(requireActivity(), R.id.nav_host_fragment).getCurrentBackStackEntry().getSavedStateHandle().getLiveData("update", false).observe(getViewLifecycleOwner(), new Observer<Boolean>() {
|
||||
@Override
|
||||
public void onChanged(Boolean aBoolean) {
|
||||
if (aBoolean) {
|
||||
|
@@ -352,8 +352,8 @@ public class BluetoothSettingsFragment extends Fragment {
|
||||
Timber.d("Saved Bluetooth device " + device.getName() + " with address " + device.getAddress());
|
||||
|
||||
stopBluetoothDiscovery();
|
||||
Navigation.findNavController(getActivity(), R.id.nav_host_fragment).getPreviousBackStackEntry().getSavedStateHandle().set("update", true);
|
||||
Navigation.findNavController(getActivity(), R.id.nav_host_fragment).navigateUp();
|
||||
Navigation.findNavController(requireActivity(), R.id.nav_host_fragment).getPreviousBackStackEntry().getSavedStateHandle().set("update", true);
|
||||
Navigation.findNavController(requireActivity(), R.id.nav_host_fragment).navigateUp();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user