Skip to content

Commit

Permalink
Draw preview in edit mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita Olifer committed Apr 28, 2018
1 parent 4b04291 commit 1a00b90
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
4 changes: 0 additions & 4 deletions demo/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

</resources>
3 changes: 1 addition & 2 deletions scrollingpagerindicator/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ru.tinkoff.scrollingpagerindicator" />
<manifest package="ru.tinkoff.scrollingpagerindicator" />
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ public ScrollingPagerIndicator(Context context) {
}

public ScrollingPagerIndicator(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, R.style.ScrollingPagerIndicator);
this(context, attrs, 0);
}

public ScrollingPagerIndicator(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);

TypedArray attributes = context.obtainStyledAttributes(
attrs, R.styleable.ScrollingPagerIndicator, 0, R.style.ScrollingPagerIndicator);
attrs, R.styleable.ScrollingPagerIndicator, defStyleAttr, R.style.ScrollingPagerIndicator);
dotColor = attributes.getColor(R.styleable.ScrollingPagerIndicator_spi_dotColor, 0);
selectedDotColor = attributes.getColor(R.styleable.ScrollingPagerIndicator_spi_dotSelectedColor, dotColor);
dotNormalSize = attributes.getDimensionPixelSize(R.styleable.ScrollingPagerIndicator_spi_dotSize, 0);
Expand All @@ -78,6 +78,11 @@ public ScrollingPagerIndicator(Context context, @Nullable AttributeSet attrs, in

paint = new Paint();
paint.setAntiAlias(true);

if (isInEditMode()) {
setDotCount(visibleDotCount);
onPageScrolled(visibleDotCount / 2, 0);
}
}

/**
Expand Down
1 change: 0 additions & 1 deletion scrollingpagerindicator/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="ScrollingPagerIndicator">
<item name="spi_dotColor">@android:color/darker_gray</item>
<item name="spi_dotSelectedColor">@android:color/darker_gray</item>
Expand Down

0 comments on commit 1a00b90

Please sign in to comment.