ProxySettingsActivity: properly implement edge-to-edge

This commit is contained in:
adbenitez
2025-11-26 00:31:12 +01:00
parent 342d820095
commit d4aa90cc0c
2 changed files with 12 additions and 13 deletions
@@ -30,6 +30,7 @@ import org.thoughtcrime.securesms.connect.DcEventCenter;
import org.thoughtcrime.securesms.connect.DcHelper;
import org.thoughtcrime.securesms.util.DynamicTheme;
import org.thoughtcrime.securesms.util.Util;
import org.thoughtcrime.securesms.util.ViewUtil;
import java.util.LinkedList;
@@ -50,13 +51,17 @@ public class ProxySettingsActivity extends BaseActionBarActivity
if (actionBar != null) {
actionBar.setTitle(R.string.proxy_settings);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setElevation(0); // TODO: use custom toolbar instead
}
proxySwitch = findViewById(R.id.proxy_switch);
ListView proxyList = findViewById(R.id.proxy_list);
ViewUtil.applyWindowInsets(proxySwitch, true, false, true, false);
ViewUtil.applyWindowInsets(proxyList, true, false, true, true);
adapter = new ProxyListAdapter(this);
adapter.setItemClickListener(this);
proxySwitch = findViewById(R.id.proxy_switch);
proxySwitch.setChecked(DcHelper.getInt(this, CONFIG_PROXY_ENABLED) == 1);
proxySwitch.setOnClickListener(l -> {
if (proxySwitch.isChecked() && adapter.getCount() == 0) {
@@ -67,7 +72,6 @@ public class ProxySettingsActivity extends BaseActionBarActivity
}
});
ListView proxyList = findViewById(R.id.proxy_list);
proxyList.setAdapter(adapter);
proxyList.addHeaderView(View.inflate(this, R.layout.proxy_list_header, null), null, false);
View footer = View.inflate(this, R.layout.proxy_list_footer, null);
@@ -1,19 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:background="?attr/colorPrimary"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/windowBackground"
android:orientation="vertical"
tools:context=".proxy.ProxySettingsActivity">
<include layout="@layout/status_bar_background"/>
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/proxy_switch"
android:layout_width="match_parent"
@@ -21,12 +16,12 @@
android:padding="16dp"
android:text="@string/proxy_use_proxy" />
<!-- clipToPadding is needed so ViewUtil.applyWindowInsets() works properly -->
<ListView
android:id="@+id/proxy_list"
android:paddingTop="10dp"
android:clipToPadding="false"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>