Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding ability to change title text color and description text color #177

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=tango
POM_DEVELOPER_NAME=Tango Agency
POM_DEVELOPER_NAME=Tango Agency
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

public class SlideFragment extends ParallaxFragment {
private final static String BACKGROUND_COLOR = "background_color";
private final static String TITLE_COLOR = "title_color";
private final static String DESCRIPTION_COLOR = "description_color";
private static final String BUTTONS_COLOR = "buttons_color";
private static final String TITLE = "title";
private static final String DESCRIPTION = "description";
Expand All @@ -28,6 +30,9 @@ public class SlideFragment extends ParallaxFragment {
private static final int PERMISSIONS_REQUEST_CODE = 15621;

private int backgroundColor;
private int titleColor;
private int descriptionColor;

private int buttonsColor;
private int image;
private String title;
Expand All @@ -44,6 +49,8 @@ public static SlideFragment createInstance(SlideFragmentBuilder builder) {

Bundle bundle = new Bundle();
bundle.putInt(BACKGROUND_COLOR, builder.backgroundColor);
bundle.putInt(TITLE_COLOR, builder.titleColor);
bundle.putInt(DESCRIPTION_COLOR, builder.descriptionColor);
bundle.putInt(BUTTONS_COLOR, builder.buttonsColor);
bundle.putInt(IMAGE, builder.image);
bundle.putString(TITLE, builder.title);
Expand Down Expand Up @@ -73,6 +80,8 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
public void initializeView() {
Bundle bundle = getArguments();
backgroundColor = bundle.getInt(BACKGROUND_COLOR);
titleColor=bundle.getInt(TITLE_COLOR);
descriptionColor=bundle.getInt(DESCRIPTION_COLOR);
buttonsColor = bundle.getInt(BUTTONS_COLOR);
image = bundle.getInt(IMAGE, 0);
title = bundle.getString(TITLE);
Expand Down Expand Up @@ -113,7 +122,9 @@ public String cantMoveFurtherErrorMessage() {

private void updateViewWithValues() {
titleTextView.setText(title);
titleTextView.setTextColor(titleColor);
descriptionTextView.setText(description);
descriptionTextView.setTextColor(descriptionColor);

if (image != 0) {
imageView.setImageDrawable(ContextCompat.getDrawable(getActivity(), image));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
@SuppressWarnings({"unused", "WeakerAccess"})
public class SlideFragmentBuilder {
int backgroundColor;
int titleColor;
int descriptionColor;
int buttonsColor;
String title;
String description;
Expand All @@ -18,6 +20,16 @@ public SlideFragmentBuilder backgroundColor(@ColorRes int backgroundColor) {
return this;
}

public SlideFragmentBuilder titleColor(@ColorRes int titleColor) {
this.titleColor = titleColor;
return this;
}

public SlideFragmentBuilder descriptionColor(@ColorRes int descriptionColor) {
this.descriptionColor = descriptionColor;
return this;
}

public SlideFragmentBuilder buttonsColor(@ColorRes int buttonsColor) {
this.buttonsColor = buttonsColor;
return this;
Expand Down