Skip to content

Commit cd9887a

Browse files
kasnderclaude
andcommitted
Fix doubled top inset gap on Insights toolbar
The navigation-bar overlap fix in #558 added fitsSystemWindows="true" to the Insights CoordinatorLayout. Because Insights uses the theme's window-decor action bar (not an in-layout AppBarLayout), the status bar inset was effectively counted twice and a large empty gap appeared between the toolbar and the hero card. Mirror the approach already used for Settings/Timeline in c50bea9: drop fitsSystemWindows from the layout root and instead apply only the bottom system-bar inset to the ScrollView so the original nav-bar overlap fix still holds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f70e9ca commit cd9887a

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

app/src/main/java/net/kollnig/missioncontrol/InsightsActivity.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,15 @@ import android.view.View
3535
import android.view.animation.DecelerateInterpolator
3636
import android.widget.LinearLayout
3737
import android.widget.ProgressBar
38+
import android.widget.ScrollView
3839
import android.widget.TextView
3940
import android.widget.Toast
4041
import androidx.appcompat.app.AppCompatActivity
4142
import androidx.core.content.ContextCompat
4243
import androidx.core.content.FileProvider
44+
import androidx.core.graphics.Insets
45+
import androidx.core.view.ViewCompat
46+
import androidx.core.view.WindowInsetsCompat
4347
import androidx.lifecycle.lifecycleScope
4448
import com.google.android.material.floatingactionbutton.FloatingActionButton
4549
import eu.faircode.netguard.Util
@@ -111,6 +115,16 @@ class InsightsActivity : AppCompatActivity() {
111115
shareInsights()
112116
}
113117

118+
// Pad the scroll content so the last card isn't hidden behind the navigation bar.
119+
val scroll = findViewById<ScrollView>(R.id.insightsScroll)
120+
scroll.clipToPadding = false
121+
val scrollInitialBottom = scroll.paddingBottom
122+
ViewCompat.setOnApplyWindowInsetsListener(scroll) { v, insets ->
123+
val sysBars: Insets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
124+
v.setPadding(v.paddingLeft, v.paddingTop, v.paddingRight, scrollInitialBottom + sysBars.bottom)
125+
insets
126+
}
127+
114128
dataProvider = InsightsDataProvider(this)
115129

116130
loadData()

app/src/main/res/layout/activity_insights.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
xmlns:tools="http://schemas.android.com/tools"
55
android:layout_width="match_parent"
66
android:layout_height="match_parent"
7-
android:fitsSystemWindows="true"
87
android:background="?android:attr/colorBackground">
98

109
<ScrollView
10+
android:id="@+id/insightsScroll"
1111
android:layout_width="match_parent"
1212
android:layout_height="match_parent"
1313
android:fillViewport="true">

0 commit comments

Comments
 (0)