Skip to content

Commit 4b4d532

Browse files
committed
Fix #2 : Add attribute to remove default padding
1 parent 0db893a commit 4b4d532

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

fliptabs/src/main/java/com/jem/fliptabs/FlipTab.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class FlipTab : FrameLayout {
2020
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
2121
initialize(attrs)
2222
}
23+
2324
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
2425
context,
2526
attrs,
@@ -103,13 +104,13 @@ class FlipTab : FrameLayout {
103104
WOBBLE_RETURN_ANIMATION_DURATION
104105
)
105106
wobbleAngle = getFloat(R.styleable.FlipTab_wobbleAngle, WOBBLE_ANGLE)
106-
if(hasValue(R.styleable.FlipTab_overallColor)) {
107+
if (hasValue(R.styleable.FlipTab_overallColor)) {
107108
setOverallColor(getColor(R.styleable.FlipTab_overallColor, OVERALL_COLOR))
108109
} else {
109110
setTextColor(getColor(R.styleable.FlipTab_textColor, OVERALL_COLOR))
110111
setHighlightColor(getColor(R.styleable.FlipTab_highlightColor, OVERALL_COLOR))
111112
}
112-
if (typedArray.getInt(R.styleable.FlipTab_startingTab, 0)==1) {
113+
if (typedArray.getInt(R.styleable.FlipTab_startingTab, 0) == 1) {
113114
isLeftSelected = false
114115
tab_selected_container.rotationY = 180f
115116
tab_selected.background = rightSelectedDrawable
@@ -120,6 +121,9 @@ class FlipTab : FrameLayout {
120121
tab_selected.background = leftSelectedDrawable
121122
tab_selected.scaleX = 1f
122123
}
124+
if (typedArray.getBoolean(R.styleable.FlipTab_removeDefaultPadding, false)) {
125+
base_fliptab_container.setPadding(0, 0, 0, 0)
126+
}
123127
setLeftTabText(getString(R.styleable.FlipTab_leftTabText) ?: "Left tab")
124128
setRightTabText(getString(R.styleable.FlipTab_rightTabText) ?: "Right tab")
125129
}

fliptabs/src/main/res/values/attrs.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
33
<declare-styleable name="FlipTab">
4+
<attr name="removeDefaultPadding" format="boolean" />
45
<attr name="flipAnimationDuration" format="integer" />
56
<attr name="wobbleReturnAnimationDuration" format="integer" />
67
<attr name="wobbleAngle" format="float" />

0 commit comments

Comments
 (0)