- Better implementation of Tools.ignoreNotch to work with all activities.

This commit is contained in:
SerpentSpirale 2021-01-31 18:57:27 +01:00
parent 4ebf4cde5c
commit 12009282d4
4 changed files with 10 additions and 8 deletions

View File

@ -5,6 +5,8 @@ import android.os.*;
import androidx.appcompat.app.*;
import net.kdt.pojavlaunch.utils.*;
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.PREF_IGNORE_NOTCH;
public class BaseActivity extends AppCompatActivity
{
@Override
@ -24,4 +26,10 @@ public class BaseActivity extends AppCompatActivity
super.startActivity(i);
new Throwable("StartActivity").printStackTrace();
}
@Override
protected void onPostResume() {
super.onPostResume();
Tools.ignoreNotch(PREF_IGNORE_NOTCH,this);
}
}

View File

@ -18,7 +18,7 @@ import java.io.*;
import net.kdt.pojavlaunch.prefs.*;
import net.kdt.pojavlaunch.customcontrols.*;
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.PREF_IGNORE_NOTCH;
public class CustomControlsActivity extends BaseActivity
{
@ -35,8 +35,6 @@ public class CustomControlsActivity extends BaseActivity
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.control_mapping);
Tools.ignoreNotch(PREF_IGNORE_NOTCH, this);
mPref = PreferenceManager.getDefaultSharedPreferences(this);

View File

@ -11,7 +11,6 @@ import java.io.*;
import com.google.gson.*;
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.DEFAULT_PREF;
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.PREF_IGNORE_NOTCH;
public class MainActivity extends BaseMainActivity {
private ControlLayout mControlLayout;
@ -24,7 +23,6 @@ public class MainActivity extends BaseMainActivity {
super.onCreate(savedInstanceState);
initLayout(R.layout.main_with_customctrl);
Tools.ignoreNotch(PREF_IGNORE_NOTCH, this);
mClickListener = new View.OnClickListener(){
@Override

View File

@ -66,7 +66,6 @@ import net.kdt.pojavlaunch.prefs.LauncherPreferences;
import net.kdt.pojavlaunch.utils.JREUtils;
import net.kdt.pojavlaunch.utils.LocaleUtils;
import net.kdt.pojavlaunch.value.MinecraftAccount;
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.PREF_IGNORE_NOTCH;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
import org.apache.commons.compress.compressors.xz.XZCompressorInputStream;
@ -99,8 +98,7 @@ public class PojavLoginActivity extends BaseActivity
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState); // false);
Tools.ignoreNotch(PREF_IGNORE_NOTCH, this);
Tools.updateWindowSize(this);
/*
ControlData.pixelOf2dp = (int) Tools.dpToPx(2);