Simpler fix for the launcher activity

This commit is contained in:
Jules Aguillon
2024-12-26 17:36:25 +01:00
parent ede983aef7
commit cc3d2591a7
3 changed files with 2 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true"> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true" android:fitsSystemWindows="true">
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical">
<TextView style="@style/paragraph" android:text="@string/launcher_description"/> <TextView style="@style/paragraph" android:text="@string/launcher_description"/>
<Button style="@style/paragraph" android:text="@string/launcher_button_imesettings" android:onClick="launch_imesettings" android:layout_width="wrap_content"/> <Button style="@style/paragraph" android:text="@string/launcher_button_imesettings" android:onClick="launch_imesettings" android:layout_width="wrap_content"/>

View File

@@ -36,9 +36,7 @@ public class LauncherActivity extends Activity implements Handler.Callback
public void onCreate(Bundle savedInstanceState) public void onCreate(Bundle savedInstanceState)
{ {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
View content_view = View.inflate(this, R.layout.launcher_activity, null); setContentView(R.layout.launcher_activity);
setContentView(content_view);
Utils.enable_edge_to_edge(content_view);
_tryhere_text = (TextView)findViewById(R.id.launcher_tryhere_text); _tryhere_text = (TextView)findViewById(R.id.launcher_tryhere_text);
_tryhere_area = (EditText)findViewById(R.id.launcher_tryhere_area); _tryhere_area = (EditText)findViewById(R.id.launcher_tryhere_area);
if (VERSION.SDK_INT >= 28) if (VERSION.SDK_INT >= 28)

View File

@@ -59,20 +59,4 @@ public final class Utils
int res_id = res.getIdentifier("config_navBarInteractionMode", "integer", "android"); int res_id = res.getIdentifier("config_navBarInteractionMode", "integer", "android");
return (res_id > 0 && res.getInteger(res_id) == 2); return (res_id > 0 && res.getInteger(res_id) == 2);
} }
public static void enable_edge_to_edge(View v)
{
/* Edge-to-edge became enabled by default on API 35. */
if (VERSION.SDK_INT < 35)
return;
v.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener(){
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets wi)
{
Insets i = wi.getInsets(WindowInsets.Type.systemBars());
v.setPadding(i.left, i.top, i.right, i.bottom);
return WindowInsets.CONSUMED;
}
});
}
} }