Skip to content

Commit 100fdbc

Browse files
ADFA-2686: Address CodeRabbit nitpicks on feedback FAB
- feedback_fab.xml: use app:elevation and app:srcCompat (Material-recommended attributes) instead of android:elevation / android:src. - Centralize the FAB margin: add @dimen/feedback_fab_margin (16dp) and reference it from all 7 feedback-FAB includes (editor/main/about/preferences/plugin_manager plus about land/sw600dp variants) instead of hardcoding 16dp. - OnboardingActivity: read the same dimen via getDimensionPixelSize instead of a hardcoded 16dp TypedValue conversion, so the margin lives in one place.
1 parent 7f3ff75 commit 100fdbc

10 files changed

Lines changed: 12 additions & 15 deletions

File tree

‎app/src/main/java/com/itsaky/androidide/activities/OnboardingActivity.kt‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package com.itsaky.androidide.activities
1919

2020
import android.content.Intent
2121
import android.os.Bundle
22-
import android.util.TypedValue
2322
import android.view.View
2423
import android.view.ViewTreeObserver
2524
import android.view.animation.Animation
@@ -182,11 +181,8 @@ class OnboardingActivity : AppIntro2() {
182181
).apply {
183182
startToStart = ConstraintLayout.LayoutParams.PARENT_ID
184183
bottomToBottom = ConstraintLayout.LayoutParams.PARENT_ID
185-
val marginInPx = TypedValue.applyDimension(
186-
TypedValue.COMPLEX_UNIT_DIP,
187-
16f,
188-
resources.displayMetrics
189-
).toInt()
184+
val marginInPx =
185+
resources.getDimensionPixelSize(R.dimen.feedback_fab_margin)
190186
setMargins(marginInPx, marginInPx, marginInPx, marginInPx)
191187
}
192188
}

‎app/src/main/res/layout-land/activity_about.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
layout="@layout/feedback_fab"
124124
android:layout_width="wrap_content"
125125
android:layout_height="wrap_content"
126-
android:layout_margin="16dp"
126+
android:layout_margin="@dimen/feedback_fab_margin"
127127
android:layout_gravity="bottom|start" />
128128

129129
</androidx.coordinatorlayout.widget.CoordinatorLayout>

‎app/src/main/res/layout-sw600dp/activity_about.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
layout="@layout/feedback_fab"
124124
android:layout_width="wrap_content"
125125
android:layout_height="wrap_content"
126-
android:layout_margin="16dp"
126+
android:layout_margin="@dimen/feedback_fab_margin"
127127
android:layout_gravity="bottom|start" />
128128

129129
</androidx.coordinatorlayout.widget.CoordinatorLayout>

‎app/src/main/res/layout/activity_about.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
layout="@layout/feedback_fab"
102102
android:layout_width="wrap_content"
103103
android:layout_height="wrap_content"
104-
android:layout_margin="16dp"
104+
android:layout_margin="@dimen/feedback_fab_margin"
105105
android:layout_gravity="bottom|start" />
106106

107107
</androidx.coordinatorlayout.widget.CoordinatorLayout>

‎app/src/main/res/layout/activity_editor.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
layout="@layout/feedback_fab"
7474
android:layout_width="wrap_content"
7575
android:layout_height="wrap_content"
76-
android:layout_margin="16dp"
76+
android:layout_margin="@dimen/feedback_fab_margin"
7777
app:layout_constraintBottom_toBottomOf="parent"
7878
app:layout_constraintStart_toStartOf="parent" />
7979

‎app/src/main/res/layout/activity_main.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
layout="@layout/feedback_fab"
8989
android:layout_width="wrap_content"
9090
android:layout_height="wrap_content"
91-
android:layout_margin="16dp"
91+
android:layout_margin="@dimen/feedback_fab_margin"
9292
app:layout_constraintBottom_toBottomOf="parent"
9393
app:layout_constraintStart_toStartOf="parent" />
9494

‎app/src/main/res/layout/activity_plugin_manager.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
layout="@layout/feedback_fab"
8484
android:layout_width="wrap_content"
8585
android:layout_height="wrap_content"
86-
android:layout_margin="16dp"
86+
android:layout_margin="@dimen/feedback_fab_margin"
8787
android:layout_gravity="bottom|start" />
8888

8989
</androidx.coordinatorlayout.widget.CoordinatorLayout>

‎app/src/main/res/layout/activity_preferences.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@
5555
android:layout_width="wrap_content"
5656
android:layout_height="wrap_content"
5757
android:layout_gravity="bottom|start"
58-
android:layout_margin="16dp" />
58+
android:layout_margin="@dimen/feedback_fab_margin" />
5959

6060
</androidx.coordinatorlayout.widget.CoordinatorLayout>

‎app/src/main/res/layout/feedback_fab.xml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
android:layout_width="wrap_content"
1313
android:layout_height="wrap_content"
1414
android:contentDescription="@string/send_feedback"
15-
android:elevation="16dp"
16-
android:src="@drawable/baseline_feedback_64"
15+
app:elevation="16dp"
16+
app:srcCompat="@drawable/baseline_feedback_64"
1717
app:fabCustomSize="@dimen/feedback_fab_size"
1818
app:maxImageSize="@dimen/feedback_fab_icon_size" />

‎resources/src/main/res/values/dimens.xml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@
1414
feedback_fab_icon_size controls how snugly the icon fills the circle. -->
1515
<dimen name="feedback_fab_size">32dp</dimen>
1616
<dimen name="feedback_fab_icon_size">26dp</dimen>
17+
<dimen name="feedback_fab_margin">16dp</dimen>
1718
</resources>

0 commit comments

Comments
 (0)