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