Skip to content

Commit

Permalink
fix: paddingLeft/paddingRight -> paddingStart/paddingEnd
Browse files Browse the repository at this point in the history
there is no lint that reliably catches these apparently, this
was an AndroidStudio search for paddingLeft/paddingRight and altering
all returned items
  • Loading branch information
mikehardy committed Dec 26, 2024
1 parent 63486a3 commit 8458b3d
Show file tree
Hide file tree
Showing 17 changed files with 26 additions and 28 deletions.
2 changes: 1 addition & 1 deletion AnkiDroid/src/main/java/com/ichi2/anki/FieldEditLine.kt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class FieldEditLine : FrameLayout {
setExpanderBackgroundImage()
expandButton.setOnClickListener { toggleExpansionState() }
editText.init()
label.setPadding(getDensityAdjustedValue(context, 3.4f).toInt(), 0, 0, 0)
label.setPaddingRelative(getDensityAdjustedValue(context, 3.4f).toInt(), 0, 0, 0)
}

private fun toggleExpansionState() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class WhiteBoardWidthDialog(
fun showStrokeWidthDialog() {
val layout = LinearLayout(context)
layout.orientation = LinearLayout.VERTICAL
layout.setPadding(6, 6, 6, 6)
layout.setPaddingRelative(6, 6, 6, 6)
strokeWidthText = FixedTextView(context)
strokeWidthText!!.gravity = Gravity.CENTER_HORIZONTAL
strokeWidthText!!.textSize = 30f
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ class TagsArrayAdapter(
// shift according to the level
val lp = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)
lp.setMargins(HIERARCHY_SHIFT_BASE * holder.node.level, 0, 0, 0)
lp.setMarginStart(HIERARCHY_SHIFT_BASE * holder.node.level)
lp.setMarginEnd(0)
holder.expandButton.layoutParams = lp
} else {
// do not add padding if there is no visible nested tag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class AudioRecordingController(
FixedTextView(this).apply {
text = field?.text
textSize = 16f
setPadding(16, 0, 16, 24)
setPaddingRelative(16, 0, 16, 24)
previewLayout.addView(this)
}
hasTextContents = hasTextContents or !field?.text.isNullOrBlank()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class Toolbar : FrameLayout {
params.gravity = Gravity.CENTER
button.layoutParams = params
val twoDp = ceil((2 / context.resources.displayMetrics.density).toDouble()).toInt()
button.setPadding(twoDp, twoDp, twoDp, twoDp)
button.setPaddingRelative(twoDp, twoDp, twoDp, twoDp)
// end apply style
val shouldScroll =
AnkiDroidApp.instance
Expand Down
6 changes: 3 additions & 3 deletions AnkiDroid/src/main/java/com/ichi2/anki/widgets/DeckAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,17 @@ class DeckAdapter(
val node = filteredDeckList[position]
// Set the expander icon and padding according to whether or not there are any subdecks
val deckLayout = holder.deckLayout
val rightPadding = deckLayout.resources.getDimension(R.dimen.deck_picker_right_padding).toInt()
val endPadding = deckLayout.resources.getDimension(R.dimen.deck_picker_right_padding).toInt()
if (hasSubdecks) {
val smallPadding = deckLayout.resources.getDimension(R.dimen.deck_picker_left_padding_small).toInt()
deckLayout.setPadding(smallPadding, 0, rightPadding, 0)
deckLayout.setPaddingRelative(smallPadding, 0, endPadding, 0)
holder.deckExpander.visibility = View.VISIBLE
// Create the correct expander for this deck
runBlocking { setDeckExpander(holder.deckExpander, holder.indentView, node) }
} else {
holder.deckExpander.visibility = View.GONE
val normalPadding = deckLayout.resources.getDimension(R.dimen.deck_picker_left_padding).toInt()
deckLayout.setPadding(normalPadding, 0, rightPadding, 0)
deckLayout.setPaddingRelative(normalPadding, 0, endPadding, 0)
}
if (node.children.isNotEmpty()) {
holder.deckExpander.tag = node.did
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/ic_baseline_check_box_24"
android:paddingLeft="12dp" />
android:paddingStart="12dp" />
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/ic_baseline_check_box_outline_blank_24"
android:paddingLeft="12dp" />
android:paddingStart="12dp" />
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/ic_baseline_indeterminate_check_box_24"
android:paddingLeft="12dp" />
android:paddingStart="12dp" />
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:paddingTop="8dp"
android:paddingLeft="32dp"
android:paddingRight="32dp"
android:paddingStart="32dp"
android:paddingEnd="32dp"
android:paddingBottom="8dp">

<ImageButton
Expand Down
2 changes: 0 additions & 2 deletions AnkiDroid/src/main/res/layout/card_item_browser.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:paddingStart="3dp"
android:paddingEnd="3dp"
android:paddingVertical="1dp"
Expand Down
4 changes: 2 additions & 2 deletions AnkiDroid/src/main/res/layout/dialog_generic_text_input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_vertical_padding"
android:paddingLeft="32dp"
android:paddingRight="32dp"
android:paddingStart="32dp"
android:paddingEnd="32dp"
android:paddingBottom="4dp"
app:errorEnabled="true"
android:paddingTop="16dp">
Expand Down
8 changes: 4 additions & 4 deletions AnkiDroid/src/main/res/layout/feedback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:paddingTop="10dp" >

<ScrollView
Expand Down Expand Up @@ -41,8 +41,8 @@
android:fillViewport="true" >

<com.ichi2.ui.FixedTextView
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:id="@+id/tvFeedbackDisclaimer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
2 changes: 0 additions & 2 deletions AnkiDroid/src/main/res/layout/material_dialog_list_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:paddingStart="32dp"
android:paddingLeft="32dp"
android:paddingEnd="32dp"
android:paddingRight="32dp"
android:gravity="start|center_vertical"
android:textAlignment="viewStart"
android:background="?attr/selectableItemBackground"
Expand Down
4 changes: 2 additions & 2 deletions AnkiDroid/src/main/res/layout/media_check_dialog_body.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
android:minHeight="48dp"
android:minWidth="48dp"
android:paddingBottom="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:paddingTop="5dp"
android:scrollbars="vertical"
android:textColor="?attr/checkMediaListForeground"
Expand Down
4 changes: 2 additions & 2 deletions AnkiDroid/src/main/res/layout/reviewer_topbar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
android:id="@+id/top_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/side_margin"
android:paddingRight="@dimen/side_margin"
android:paddingStart="@dimen/side_margin"
android:paddingEnd="@dimen/side_margin"
android:paddingTop="2dp"
android:paddingBottom="3dp"
android:gravity="center_vertical"
Expand Down
4 changes: 2 additions & 2 deletions AnkiDroid/src/main/res/layout/studyoptions_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
app:layout_constraintStart_toEndOf="@id/studyoptions_gradient"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/studyoptions_start"
android:paddingLeft="@dimen/study_options_padding"
android:paddingRight="@dimen/study_options_padding"
android:paddingStart="@dimen/study_options_padding"
android:paddingEnd="@dimen/study_options_padding"
android:paddingBottom="16dp"
android:fadeScrollbars="false" >
<LinearLayout
Expand Down

0 comments on commit 8458b3d

Please sign in to comment.