Skip to content

Commit a103ed6

Browse files
author
Alexander Vlasov
committed
Merge pull request Cleveroad#8 from Cleveroad/develop
* marked all resource as private
2 parents 7925c15 + e9b667c commit a103ed6

15 files changed

+78
-55
lines changed

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ All you need to do is:
1717
First, add gradle dependency with command:<br>
1818
```groovy
1919
dependencies {
20-
compile 'com.cleveroad:slidingtutorial:0.9.3'
20+
compile 'com.cleveroad:slidingtutorial:0.9.4'
2121
}
2222
```
2323

@@ -129,11 +129,28 @@ public class CustomPresentationPagerFragment extends PresentationPagerFragment {
129129

130130
| Version | Changes |
131131
| --- | --- |
132+
| v.0.9.4 | Renamed all attributes; all resources marked as private |
132133
| v.0.9.3 | Fixed issue with wrong page showed at startup if pages count not equals 3 |
133134
| v.0.9.2 | Added onSkipButtonClicked method and SimplePagerFragment |
134135
| v.0.9.1 | Added infinite scroll behavior |
135136
| v.0.9 | First public release |
136137

138+
## Migrations from v.0.9.3 to v.0.9.4
139+
* All resources marked as private. Make sure you're not using any resource (strings, dimens, etc) from this library.
140+
* All attributes were renamed, prefix `st_` added. Add this prefix to any custom XML attribute you used. Example:
141+
```XML
142+
<com.cleveroad.slidingtutorial.CirclePageIndicator
143+
android:id="@+id/indicator"
144+
android:layout_width="match_parent"
145+
android:layout_height="wrap_content"
146+
android:layout_gravity="center"
147+
app:st_fillColor="@android:color/white"
148+
app:st_pageColor="@android:color/secondary_text_light_nodisable"
149+
app:st_radius="4dp"
150+
app:st_strokeColor="#00000000"
151+
app:st_strokeWidth="0dp"/>
152+
```
153+
137154
## Migrations from v.0.9 to v.0.9.1
138155
####CirclePageIndicator
139156
This class is final now. Make sure you're not extending from it.

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
VERSION_NAME=0.9.3
2-
VERSION_CODE=4
1+
VERSION_NAME=0.9.4
2+
VERSION_CODE=5
33
GROUP=com.cleveroad
44

55
POM_DESCRIPTION=Sliding tutorial is simple library that help other developers easy create great tutotial

lib/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ android {
1616
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
1717
}
1818
}
19+
20+
resourcePrefix "st_"
1921
}
2022

2123
dependencies {
2224
compile fileTree(dir: 'libs', include: ['*.jar'])
2325
testCompile 'junit:junit:4.12'
24-
compile 'com.android.support:appcompat-v7:23.1.1'
26+
compile 'com.android.support:appcompat-v7:23.2.0'
2527
}
2628

2729
apply from: './gradle-mvn-push.gradle'

lib/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.cleveroad.slidingtutorial">
33

4-
<application android:allowBackup="true" android:label="@string/app_name"
4+
<application android:allowBackup="true" android:label="@string/st_app_name"
55
android:supportsRtl="true">
66

77
</application>

lib/src/main/java/com/cleveroad/slidingtutorial/CirclePageIndicator.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,29 +69,29 @@ public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
6969

7070
//Load defaults from resources
7171
final Resources res = getResources();
72-
final int defaultPageColor = ContextCompat.getColor(context, R.color.default_circle_indicator_page_color);
73-
final int defaultFillColor = ContextCompat.getColor(context, R.color.default_circle_indicator_fill_color);
74-
final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
75-
final int defaultStrokeColor = ContextCompat.getColor(context, R.color.default_circle_indicator_stroke_color);
76-
final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);
77-
final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius);
78-
final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
79-
final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);
72+
final int defaultPageColor = ContextCompat.getColor(context, R.color.st_default_circle_indicator_page_color);
73+
final int defaultFillColor = ContextCompat.getColor(context, R.color.st_default_circle_indicator_fill_color);
74+
final int defaultOrientation = res.getInteger(R.integer.st_default_circle_indicator_orientation);
75+
final int defaultStrokeColor = ContextCompat.getColor(context, R.color.st_default_circle_indicator_stroke_color);
76+
final float defaultStrokeWidth = res.getDimension(R.dimen.st_default_circle_indicator_stroke_width);
77+
final float defaultRadius = res.getDimension(R.dimen.st_default_circle_indicator_radius);
78+
final boolean defaultCentered = res.getBoolean(R.bool.st_default_circle_indicator_centered);
79+
final boolean defaultSnap = res.getBoolean(R.bool.st_default_circle_indicator_snap);
8080

8181
//Retrieve styles attributes
8282
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0);
8383

84-
mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
84+
mCentered = a.getBoolean(R.styleable.CirclePageIndicator_st_centered, defaultCentered);
8585
mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
8686
mPaintPageFill.setStyle(Style.FILL);
87-
mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
87+
mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_st_pageColor, defaultPageColor));
8888
mPaintStroke.setStyle(Style.STROKE);
89-
mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
90-
mPaintStroke.setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
89+
mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_st_strokeColor, defaultStrokeColor));
90+
mPaintStroke.setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_st_strokeWidth, defaultStrokeWidth));
9191
mPaintFill.setStyle(Style.FILL);
92-
mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
93-
mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
94-
mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);
92+
mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_st_fillColor, defaultFillColor));
93+
mRadius = a.getDimension(R.styleable.CirclePageIndicator_st_radius, defaultRadius);
94+
mSnap = a.getBoolean(R.styleable.CirclePageIndicator_st_snap, defaultSnap);
9595

9696
Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
9797
if (background != null) {

lib/src/main/java/com/cleveroad/slidingtutorial/PageFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected int getBackgroundColorResId() {
6464
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
6565
View view = inflater.inflate(getLayoutResId(), container, false);
6666
holder = new LayersHolder(view, provideTransformItems());
67-
view.setTag(R.id.page_fragment, this);
67+
view.setTag(R.id.st_page_fragment, this);
6868
return view;
6969
}
7070

lib/src/main/java/com/cleveroad/slidingtutorial/PresentationPagerFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ public int getCount() {
241241
private class FragmentTransformer implements ViewPager.PageTransformer {
242242

243243
public void transformPage(View view, float position) {
244-
Object obj = view.getTag(R.id.page_fragment);
244+
Object obj = view.getTag(R.id.st_page_fragment);
245245
if (obj instanceof PageFragment) {
246246
((PageFragment) obj).transformPage(view, position);
247247
}

lib/src/main/java/com/cleveroad/slidingtutorial/SimplePagerFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public abstract class SimplePagerFragment extends PresentationPagerFragment {
77

88
@Override
99
public int getLayoutResId() {
10-
return R.layout.fragment_presentation;
10+
return R.layout.st_fragment_presentation;
1111
}
1212

1313
@Override

lib/src/main/res/layout/fragment_presentation.xml renamed to lib/src/main/res/layout/st_fragment_presentation.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
android:layout_marginRight="10dp"
3232
android:fontFamily="sans-serif-light"
3333
android:padding="10dp"
34-
android:text="@string/skip"
34+
android:text="@string/st_skip"
3535
android:textColor="@android:color/white"
3636
android:textSize="21sp"
3737
tools:ignore="UnusedAttribute"/>
@@ -41,11 +41,11 @@
4141
android:layout_width="match_parent"
4242
android:layout_height="wrap_content"
4343
android:layout_gravity="center"
44-
app:fillColor="@android:color/white"
45-
app:pageColor="@android:color/secondary_text_light_nodisable"
46-
app:radius="4dp"
47-
app:strokeColor="#00000000"
48-
app:strokeWidth="0dp"/>
44+
app:st_fillColor="@android:color/white"
45+
app:st_pageColor="@android:color/secondary_text_light_nodisable"
46+
app:st_radius="4dp"
47+
app:st_strokeColor="#00000000"
48+
app:st_strokeWidth="0dp"/>
4949
</FrameLayout>
5050

5151
</FrameLayout>

lib/src/main/res/values/attr_pager_indicator.xml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<resources>
3-
<attr name="centered" format="boolean" />
4-
<attr name="selectedColor" format="color" />
5-
<attr name="strokeWidth" format="dimension" />
6-
<attr name="unselectedColor" format="color" />
2+
<resources xmlns:tools="http://schemas.android.com/tools">
3+
<attr name="st_centered" format="boolean" />
4+
<attr name="st_selectedColor" format="color" />
5+
<attr name="st_strokeWidth" format="dimension" />
6+
<attr name="st_unselectedColor" format="color" />
77

8-
<declare-styleable name="CirclePageIndicator">
8+
<declare-styleable name="CirclePageIndicator" tools:ignore="ResourceName">
99
<!-- Whether or not the indicators should be centered. -->
10-
<attr name="centered" />
10+
<attr name="st_centered" />
1111
<!-- Color of the filled circle that represents the current page. -->
12-
<attr name="fillColor" format="color" />
12+
<attr name="st_fillColor" format="color" />
1313
<!-- Color of the filled circles that represents pages. -->
14-
<attr name="pageColor" format="color" />
14+
<attr name="st_pageColor" format="color" />
1515
<!-- Orientation of the indicator. -->
1616
<attr name="android:orientation"/>
1717
<!-- Radius of the circles. This is also the spacing between circles. -->
18-
<attr name="radius" format="dimension" />
18+
<attr name="st_radius" format="dimension" />
1919
<!-- Whether or not the selected indicator snaps to the circles. -->
20-
<attr name="snap" format="boolean" />
20+
<attr name="st_snap" format="boolean" />
2121
<!-- Color of the open circles. -->
22-
<attr name="strokeColor" format="color" />
22+
<attr name="st_strokeColor" format="color" />
2323
<!-- Width of the stroke used to draw the circles. -->
24-
<attr name="strokeWidth" />
24+
<attr name="st_strokeWidth" />
2525
<!-- View background -->
2626
<attr name="android:background"/>
2727
</declare-styleable>
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<bool name="default_circle_indicator_centered">true</bool>
4-
<color name="default_circle_indicator_fill_color">#FFFFFFFF</color>
5-
<color name="default_circle_indicator_page_color">#00000000</color>
6-
<integer name="default_circle_indicator_orientation">0</integer>
7-
<dimen name="default_circle_indicator_radius">3dp</dimen>
8-
<bool name="default_circle_indicator_snap">false</bool>
9-
<color name="default_circle_indicator_stroke_color">#FFDDDDDD</color>
10-
<dimen name="default_circle_indicator_stroke_width">1dp</dimen>
3+
<bool name="st_default_circle_indicator_centered">true</bool>
4+
<color name="st_default_circle_indicator_fill_color">#FFFFFFFF</color>
5+
<color name="st_default_circle_indicator_page_color">#00000000</color>
6+
<integer name="st_default_circle_indicator_orientation">0</integer>
7+
<dimen name="st_default_circle_indicator_radius">3dp</dimen>
8+
<bool name="st_default_circle_indicator_snap">false</bool>
9+
<color name="st_default_circle_indicator_stroke_color">#FFDDDDDD</color>
10+
<dimen name="st_default_circle_indicator_stroke_width">1dp</dimen>
1111
</resources>

lib/src/main/res/values/ids.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<item name="page_fragment" type="id" />
3+
<item name="st_page_fragment" type="id" />
44
</resources>

lib/src/main/res/values/public.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<public type="string" name="st_app_name" />
4+
</resources>

lib/src/main/res/values/strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<resources>
2-
<string name="app_name">SlidingTutorialLibrary</string>
3-
<string name="skip">Skip</string>
2+
<string name="st_app_name">SlidingTutorialLibrary</string>
3+
<string name="st_skip">Skip</string>
44
</resources>

sample/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
<application
66
android:allowBackup="true"
77
android:icon="@mipmap/s_0_1"
8-
android:label="@string/app_name"
8+
android:label="@string/st_app_name"
99
android:theme="@style/AppTheme" >
1010
<activity
1111
android:name=".MainActivity"
12-
android:label="@string/app_name" >
12+
android:label="@string/st_app_name" >
1313
<intent-filter>
1414
<action android:name="android.intent.action.MAIN" />
1515

0 commit comments

Comments
 (0)