- Added deprecated FileObserver Constructor for older APIs

This commit is contained in:
SerpentSpirale 2021-02-04 11:12:44 +01:00
parent 4fcfbd2ab8
commit 5a5dc351f0

View file

@ -105,15 +105,26 @@ public class MainActivity extends BaseMainActivity {
}
};
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P){
fileObserver = new FileObserver(new File(Tools.DIR_GAME_NEW + "/options.txt"), FileObserver.MODIFY) {
@Override
public void onEvent(int i, @Nullable String s) {
//FIXME Make sure the multithreading nature of this event doesn't cause any problems ?
MCOptionUtils.load();
getMcScale();
}
};
}else{
fileObserver = new FileObserver(Tools.DIR_GAME_NEW + "/options.txt", FileObserver.MODIFY) {
@Override
public void onEvent(int i, @Nullable String s) {
//FIXME Make sure the multithreading nature of this event doesn't cause any problems ?
MCOptionUtils.load();
getMcScale();
}
};
}
fileObserver = new FileObserver(new File(Tools.DIR_GAME_NEW + "/options.txt"), FileObserver.MODIFY) {
@Override
public void onEvent(int i, @Nullable String s) {
//FIXME Make sure the multithreading nature of this event doesn't cause any problems ?
MCOptionUtils.load();
getMcScale();
}
};
fileObserver.startWatching();
ControlData[] specialButtons = ControlData.getSpecialButtons();