forked from chyrta/AndroidOnboarder
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change background color on scroll, started implementing circle indica…
…tors
- Loading branch information
Dzmitry Chyrta
committed
Apr 3, 2016
1 parent
a13b909
commit d9d1dcf
Showing
8 changed files
with
144 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
onboarder/src/main/java/com/chyrta/onboarder/utils/ColorsArrayBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.chyrta.onboarder.utils; | ||
|
||
import android.content.Context; | ||
import android.support.v4.content.ContextCompat; | ||
|
||
import com.chyrta.onboarder.OnboarderPage; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class ColorsArrayBuilder { | ||
|
||
public static Integer[] getPageBackgroundColors(Context context, List<OnboarderPage> pages) { | ||
List<Integer> colorsList = new ArrayList<>(); | ||
for (OnboarderPage page : pages) { | ||
colorsList.add(ContextCompat.getColor(context, page.getBackgroundColor())); | ||
} | ||
return colorsList.toArray(new Integer[pages.size()]); | ||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
onboarder/src/main/java/com/chyrta/onboarder/views/CircleIndicatorView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.chyrta.onboarder.views; | ||
|
||
import android.content.Context; | ||
import android.graphics.Canvas; | ||
import android.graphics.Color; | ||
import android.graphics.Paint; | ||
import android.graphics.drawable.shapes.OvalShape; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
public class CircleIndicatorView extends View { | ||
|
||
OvalShape oval; | ||
|
||
public CircleIndicatorView(Context context) { | ||
super(context); | ||
Canvas canvas = new Canvas(); | ||
Paint paint = new Paint(); | ||
oval = new OvalShape(); | ||
oval.draw(canvas, paint); | ||
} | ||
|
||
@Override | ||
protected void onDraw(Canvas canvas) { | ||
super.onDraw(canvas); | ||
canvas.drawColor(Color.WHITE); | ||
} | ||
|
||
@Override | ||
public void setLayoutParams(ViewGroup.LayoutParams params) { | ||
super.setLayoutParams(params); | ||
params.height = 8; | ||
params.width = 8; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
<resources> | ||
<string name="app_name">Android Onboarder</string> | ||
<string name="button.finish">Finish</string> | ||
<string name="button.next">Next</string> | ||
<string name="button.skip">Skip</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters