Skip to content

Commit f08140d

Browse files
authored
Merge pull request #11 from intik/update
Update version 2.0.0
2 parents 76f88b2 + e4b2165 commit f08140d

File tree

5 files changed

+50
-35
lines changed

5 files changed

+50
-35
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ Some layout with RecyclerView and OverflowPagerIndicator
5454
android:layout_width="wrap_content"
5555
android:layout_height="wrap_content"
5656
android:layout_gravity="center_horizontal|bottom"
57+
app:dotFillColor="#FF0000"
58+
app:dotStrokeColor="#0000FF"
5759
/>
5860

5961
</FrameLayout>
@@ -89,6 +91,18 @@ or even some custom logic which will call:
8991
OverflowPagerIndicator#onPageSelected(int position)
9092
```
9193

94+
### Customization
95+
96+
You can easily change dot fill color and dot stroke color via xml attributes like this:
97+
```xml
98+
<cz.intik.overflowindicator.OverflowPagerIndicator
99+
app:dotFillColor="#FF0000"
100+
app:dotStrokeColor="@color/heavenlyBlue"
101+
/>
102+
```
103+
92104
### Changelog
93105

106+
2.0.0 Migrate to AndroidX, add color customization options (big thanks [Javi Chaqués](https://github.com/javichaques))
107+
94108
1.2.1 bugfix (thanks [Sajad Abasi](https://github.com/sajadabasi))

library/build.gradle

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apply plugin: 'com.android.library'
33
ext {
44
PUBLISH_GROUP_ID = 'cz.intik'
55
PUBLISH_ARTIFACT_ID = 'overflow-pager-indicator'
6-
PUBLISH_VERSION = '1.2.1'
6+
PUBLISH_VERSION = '2.0.0'
77

88
// gradlew clean build generateRelease
99
}
@@ -12,10 +12,10 @@ android {
1212
compileSdkVersion 28
1313

1414
defaultConfig {
15-
minSdkVersion 19
15+
minSdkVersion 16
1616
targetSdkVersion 28
17-
versionCode 1
18-
versionName "1.0"
17+
versionCode 2
18+
versionName "2.0.0"
1919
}
2020
buildTypes {
2121
release {
@@ -26,9 +26,7 @@ android {
2626
}
2727

2828
dependencies {
29-
implementation fileTree(dir: 'libs', include: ['*.jar'])
30-
31-
implementation "androidx.appcompat:appcompat:1.0.0"
29+
implementation "androidx.appcompat:appcompat:1.0.2"
3230
implementation "androidx.recyclerview:recyclerview:1.0.0"
3331

3432
implementation "com.andkulikov:transitionseverywhere:1.8.0"

library/src/main/java/cz/intik/overflowindicator/OverflowPagerIndicator.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44
import android.content.res.TypedArray;
55
import android.graphics.drawable.Drawable;
66
import android.graphics.drawable.GradientDrawable;
7-
import android.transition.ChangeBounds;
8-
import android.transition.Fade;
9-
import android.transition.Transition;
10-
import android.transition.TransitionManager;
11-
import android.transition.TransitionSet;
127
import android.util.AttributeSet;
138
import android.util.DisplayMetrics;
149
import android.util.TypedValue;
1510
import android.view.View;
1611
import android.widget.LinearLayout;
1712

13+
import com.transitionseverywhere.ChangeBounds;
14+
import com.transitionseverywhere.Fade;
15+
import com.transitionseverywhere.Transition;
16+
import com.transitionseverywhere.TransitionManager;
17+
import com.transitionseverywhere.TransitionSet;
18+
1819
import java.util.Arrays;
1920

2021
import androidx.annotation.Nullable;
@@ -33,23 +34,23 @@
3334
* created 07.06.2017.
3435
*/
3536
public class OverflowPagerIndicator extends LinearLayout {
36-
private static final int MAX_INDICATORS = 9;
37-
private static final int INDICATOR_SIZE_DIP = 12;
37+
private static final int MAX_INDICATORS = 9;
38+
private static final int INDICATOR_SIZE_DIP = 12;
3839
private static final int INDICATOR_MARGIN_DIP = 2;
3940

4041
// State also represents indicator scale factor
41-
private static final float STATE_GONE = 0;
42+
private static final float STATE_GONE = 0;
4243
private static final float STATE_SMALLEST = 0.2f;
43-
private static final float STATE_SMALL = 0.4f;
44-
private static final float STATE_NORMAL = 0.6f;
44+
private static final float STATE_SMALL = 0.4f;
45+
private static final float STATE_NORMAL = 0.6f;
4546
private static final float STATE_SELECTED = 1.0f;
4647

4748
private int mIndicatorCount;
4849
private int mLastSelected;
4950
private int mIndicatorSize;
5051
private int mIndicatorMargin;
5152

52-
private RecyclerView mRecyclerView;
53+
private RecyclerView mRecyclerView;
5354
private OverflowDataObserver mDataObserver;
5455

5556
private int dotStrokeColor;
@@ -163,7 +164,7 @@ private void updateOverflowState(int position) {
163164
float[] positionStates = new float[mIndicatorCount + 1];
164165
Arrays.fill(positionStates, STATE_GONE);
165166

166-
int start = position - MAX_INDICATORS + 4;
167+
int start = position - MAX_INDICATORS + 4;
167168
int realStart = Math.max(0, start);
168169

169170
if (realStart + MAX_INDICATORS > mIndicatorCount) {
@@ -199,7 +200,7 @@ private void updateOverflowState(int position) {
199200

200201
private void updateIndicators(float[] positionStates) {
201202
for (int i = 0; i < mIndicatorCount; i++) {
202-
View v = getChildAt(i);
203+
View v = getChildAt(i);
203204
float state = positionStates[i];
204205

205206
if (state == STATE_GONE) {

sample-app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ android {
77
applicationId "cz.intik.overflowpagerindicator"
88
minSdkVersion 21
99
targetSdkVersion 28
10-
versionCode 1
11-
versionName "1.0"
10+
versionCode 2
11+
versionName "2.0.0"
1212
}
1313

1414
buildTypes {
@@ -20,7 +20,7 @@ android {
2020
}
2121

2222
dependencies {
23-
implementation "androidx.appcompat:appcompat:1.0.0"
23+
implementation "androidx.appcompat:appcompat:1.0.2"
2424
implementation "androidx.recyclerview:recyclerview:1.0.0"
2525

2626
implementation project(path: ':library')
Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:tools="http://schemas.android.com/tools"
4-
android:layout_width="match_parent"
5-
android:layout_height="match_parent"
6-
xmlns:app="http://schemas.android.com/apk/res-auto"
7-
android:background="@color/dot_stroke"
8-
android:orientation="vertical"
9-
tools:context=".MainActivity">
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
android:layout_width="match_parent"
6+
android:layout_height="match_parent"
7+
android:background="@color/dot_stroke"
8+
android:orientation="vertical"
9+
tools:context=".MainActivity">
1010

1111
<FrameLayout
1212
android:layout_width="match_parent"
@@ -16,13 +16,13 @@
1616
<androidx.recyclerview.widget.RecyclerView
1717
android:id="@+id/recycler_view"
1818
android:layout_width="match_parent"
19-
android:layout_height="120dp" />
19+
android:layout_height="120dp"/>
2020

2121
<cz.intik.overflowindicator.OverflowPagerIndicator
2222
android:id="@+id/view_pager_indicator"
2323
android:layout_width="wrap_content"
2424
android:layout_height="wrap_content"
25-
android:layout_gravity="center" />
25+
android:layout_gravity="center"/>
2626
</FrameLayout>
2727

2828
<FrameLayout
@@ -33,14 +33,16 @@
3333
<androidx.recyclerview.widget.RecyclerView
3434
android:id="@+id/recycler_view_simple"
3535
android:layout_width="match_parent"
36-
android:layout_height="120dp" />
36+
android:layout_height="120dp"/>
3737

3838
<cz.intik.overflowindicator.OverflowPagerIndicator
3939
android:id="@+id/view_pager_indicator_simple"
4040
android:layout_width="wrap_content"
4141
android:layout_height="wrap_content"
4242
android:layout_gravity="center"
43-
app:dotFillColor="#FF0000"
44-
app:dotStrokeColor="#0000FF" />
43+
app:dotFillColor="@color/colorAccent"
44+
app:dotStrokeColor="#0000FF"
45+
/>
4546
</FrameLayout>
47+
4648
</LinearLayout>

0 commit comments

Comments
 (0)