From 1f09a55b4f9c4d6e7fc82e1dce993279834fc1ea Mon Sep 17 00:00:00 2001 From: Muneerah Date: Sun, 24 Feb 2019 12:30:41 +0300 Subject: [PATCH 1/2] adding ability to change title text color and description text color --- .../agency/tango/materialintro/IntroActivity.java | 2 ++ .../tango/materialintroscreen/SlideFragment.java | 11 +++++++++++ .../materialintroscreen/SlideFragmentBuilder.java | 12 ++++++++++++ 3 files changed, 25 insertions(+) diff --git a/app/src/main/java/agency/tango/materialintro/IntroActivity.java b/app/src/main/java/agency/tango/materialintro/IntroActivity.java index 461a4cf..3f79959 100644 --- a/app/src/main/java/agency/tango/materialintro/IntroActivity.java +++ b/app/src/main/java/agency/tango/materialintro/IntroActivity.java @@ -31,7 +31,9 @@ public void translate(View view, @FloatRange(from = 0, to = 1.0) float percentag .buttonsColor(R.color.first_slide_buttons) .image(R.drawable.img_office) .title("Organize your time with us") + .titleColor(R.color.colorAccent) .description("Would you try?") + .descriptionColor(R.color.colorPrimaryDark) .build(), new MessageButtonBehaviour(new View.OnClickListener() { @Override diff --git a/material-intro-screen/src/main/java/agency/tango/materialintroscreen/SlideFragment.java b/material-intro-screen/src/main/java/agency/tango/materialintroscreen/SlideFragment.java index ba15ac6..1263c4a 100644 --- a/material-intro-screen/src/main/java/agency/tango/materialintroscreen/SlideFragment.java +++ b/material-intro-screen/src/main/java/agency/tango/materialintroscreen/SlideFragment.java @@ -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"; @@ -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; @@ -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); @@ -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); @@ -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)); diff --git a/material-intro-screen/src/main/java/agency/tango/materialintroscreen/SlideFragmentBuilder.java b/material-intro-screen/src/main/java/agency/tango/materialintroscreen/SlideFragmentBuilder.java index f32b5ae..28e0899 100644 --- a/material-intro-screen/src/main/java/agency/tango/materialintroscreen/SlideFragmentBuilder.java +++ b/material-intro-screen/src/main/java/agency/tango/materialintroscreen/SlideFragmentBuilder.java @@ -6,6 +6,8 @@ @SuppressWarnings({"unused", "WeakerAccess"}) public class SlideFragmentBuilder { int backgroundColor; + int titleColor; + int descriptionColor; int buttonsColor; String title; String description; @@ -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; From 9af600ba7e5dc179265d81b08b7e1e24297f6b51 Mon Sep 17 00:00:00 2001 From: Muneerah Date: Wed, 27 Feb 2019 21:50:49 +0300 Subject: [PATCH 2/2] fixing build failed --- app/src/main/java/agency/tango/materialintro/IntroActivity.java | 2 -- gradle.properties | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/java/agency/tango/materialintro/IntroActivity.java b/app/src/main/java/agency/tango/materialintro/IntroActivity.java index 3f79959..461a4cf 100644 --- a/app/src/main/java/agency/tango/materialintro/IntroActivity.java +++ b/app/src/main/java/agency/tango/materialintro/IntroActivity.java @@ -31,9 +31,7 @@ public void translate(View view, @FloatRange(from = 0, to = 1.0) float percentag .buttonsColor(R.color.first_slide_buttons) .image(R.drawable.img_office) .title("Organize your time with us") - .titleColor(R.color.colorAccent) .description("Would you try?") - .descriptionColor(R.color.colorPrimaryDark) .build(), new MessageButtonBehaviour(new View.OnClickListener() { @Override diff --git a/gradle.properties b/gradle.properties index 261c16f..113c27c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 \ No newline at end of file +POM_DEVELOPER_NAME=Tango Agency