Skip to content

Commit

Permalink
filled README.md file and also fix problem with xml render issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Gavryschuk Yaroslav committed May 10, 2017
1 parent 32faf1c commit e533f07
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Add IndicatorView to your xml layout
app:iv_size="@dimen/item_size"
app:iv_text_color="@android:color/white"
app:iv_text_size="@dimen/text_size"
app:iv_action="hung_down|look_up"
app:iv_action="hang_down"
app:iv_item_amount="6"/>
```

Expand All @@ -47,7 +47,7 @@ You can customize view like you want, through this attributes
* app:iv_size - indicator item size
* app:iv_text_color - indicator item text color
* app:iv_text_size - indicator item text size
* app:iv_action - indicator item show action type
* app:iv_action - type of animation to show each item, by default hang_down (hang_down|look_up)
* app:iv_item_amount - visible items amount

Don`t forget to initialize IndicatorView and attach ViewPager to it
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
app:iv_size="@dimen/item_size"
app:iv_text_color="@android:color/white"
app:iv_text_size="@dimen/text_size"
app:iv_action="hung_down"
app:iv_action="hang_down"
app:iv_item_amount="6"/>
</RelativeLayout>
28 changes: 14 additions & 14 deletions library/src/main/java/steelkiwi/com/library/view/IndicatorView.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package steelkiwi.com.library.view;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.TypedArray;
Expand All @@ -18,7 +16,6 @@
import java.util.ArrayList;
import java.util.List;

import steelkiwi.com.library.utils.IndicatorType;
import steelkiwi.com.library.R;
import steelkiwi.com.library.drawable.DrawableDecorator;
import steelkiwi.com.library.drawable.HangDownDrawable;
Expand All @@ -27,6 +24,7 @@
import steelkiwi.com.library.factory.DrawableFactory;
import steelkiwi.com.library.interpolator.BounceInterpolator;
import steelkiwi.com.library.utils.DrawableTouchListener;
import steelkiwi.com.library.utils.IndicatorType;
import steelkiwi.com.library.utils.OnPageChangeListener;
import steelkiwi.com.library.utils.Position;

Expand Down Expand Up @@ -309,17 +307,19 @@ private void drawBarBackground(final Canvas canvas) {
}

private void drawIndicator(final Canvas canvas) {
int leftMargin = 0;
int left = canvasWidth / 2 - calculateAllItemsWidth() / 2;
int top = getHalfCanvasHeight() - getHalfIndicatorSize();
int bottom = (getHalfCanvasHeight() - getHalfIndicatorSize()) + getIndicatorSize() - getIndicatorMargin();
for (int i = getStartIndex(); i < getSize(); i++) {
IndicatorDrawable drawable = getDrawable(i);
drawable.setPosition(i + 1);
drawable.setBounds(left + getIndicatorSize() * leftMargin, top,
(left + getIndicatorSize() + (getIndicatorSize() * leftMargin)) - getIndicatorMargin(), bottom);
drawable.draw(canvas);
leftMargin++;
if(!allDrawables.isEmpty()) {
int leftMargin = 0;
int left = canvasWidth / 2 - calculateAllItemsWidth() / 2;
int top = getHalfCanvasHeight() - getHalfIndicatorSize();
int bottom = (getHalfCanvasHeight() - getHalfIndicatorSize()) + getIndicatorSize() - getIndicatorMargin();
for (int i = getStartIndex(); i < getSize(); i++) {
IndicatorDrawable drawable = getDrawable(i);
drawable.setPosition(i + 1);
drawable.setBounds(left + getIndicatorSize() * leftMargin, top,
(left + getIndicatorSize() + (getIndicatorSize() * leftMargin)) - getIndicatorMargin(), bottom);
drawable.draw(canvas);
leftMargin++;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion library/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<attr name="iv_corner_radius" format="dimension"/>
<attr name="iv_text_size" format="dimension"/>
<attr name="iv_action">
<enum name="hung_down" value="0"/>
<enum name="hang_down" value="0"/>
<enum name="look_up" value="1"/>
</attr>
<attr name="iv_item_amount" format="integer"/>
Expand Down

0 comments on commit e533f07

Please sign in to comment.