Skip to content
This repository was archived by the owner on Jun 19, 2021. It is now read-only.
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ public void loadTutorial() {
}

private ArrayList<TutorialItem> getTutorialItems(Context context) {
TutorialItem tutorialItem1 = new TutorialItem(context.getString(R.string.slide_1_african_story_books), context.getString(R.string.slide_1_african_story_books_subtitle),
TutorialItem tutorialItem1 = new TutorialItem(R.string.slide_1_african_story_books, R.string.slide_1_african_story_books,
R.color.slide_1, R.drawable.tut_page_1_front, R.drawable.tut_page_1_background);

TutorialItem tutorialItem2 = new TutorialItem(context.getString(R.string.slide_2_volunteer_professionals), context.getString(R.string.slide_2_volunteer_professionals_subtitle),
TutorialItem tutorialItem2 = new TutorialItem(R.string.slide_2_volunteer_professionals, R.string.slide_2_volunteer_professionals_subtitle,
R.color.slide_2, R.drawable.tut_page_2_front, R.drawable.tut_page_2_background);

TutorialItem tutorialItem3 = new TutorialItem(context.getString(R.string.slide_3_download_and_go), null,
R.color.slide_3, R.drawable.tut_page_3_foreground);

TutorialItem tutorialItem4 = new TutorialItem(context.getString(R.string.slide_4_different_languages), context.getString(R.string.slide_4_different_languages_subtitle),
TutorialItem tutorialItem4 = new TutorialItem(R.string.slide_4_different_languages, R.string.slide_4_different_languages_subtitle,
R.color.slide_4, R.drawable.tut_page_4_foreground, R.drawable.tut_page_4_background);

ArrayList<TutorialItem> tutorialItems = new ArrayList<>();
Expand Down
7 changes: 5 additions & 2 deletions materialhelptutorial/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ android {
}

dependencies {
final SUPPORT_LIBRARY_VERSION = '23.1.1'

compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:percent:23.1.0'
compile "com.android.support:appcompat-v7:$SUPPORT_LIBRARY_VERSION"
compile "com.android.support:percent:$SUPPORT_LIBRARY_VERSION"
compile "com.android.support:support-annotations:$SUPPORT_LIBRARY_VERSION"
compile 'com.github.bumptech.glide:glide:3.6.0'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,13 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
TextView textView = (TextView) v.findViewById(R.id.fragment_help_tutorial_text);
if (!TextUtils.isEmpty(tutorialItem.getTitleText())) {
textView.setText(tutorialItem.getTitleText());
} else if (tutorialItem.getTitleTextRes() != -1) {
textView.setText(tutorialItem.getTitleTextRes());
}
if (!TextUtils.isEmpty(tutorialItem.getSubTitleText())) {
textViewSubTitle.setText(tutorialItem.getSubTitleText());
} else if (tutorialItem.getSubTitleTextRes() != -1) {
textViewSubTitle.setText(tutorialItem.getSubTitleTextRes());
}
if (tutorialItem.getBackgroundImageRes() != -1) {
Glide.with(this).load(tutorialItem.getBackgroundImageRes()).into(imageViewBack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,51 @@

import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;

public class TutorialItem implements Parcelable {
private String titleText;
private String subTitleText;
private int backgroundColor;
private int foregroundImageRes;
private int foregroundImageRes = -1;
private int backgroundImageRes = -1;
private int titleTextRes = -1;
private int subTitleTextRes = -1;

public TutorialItem(String titleText, String subTitleText, int backgroundColor, int foregroundImageRes, int backgroundImageRes) {
public TutorialItem(@NonNull String titleText, @Nullable String subTitleText, @ColorRes int backgroundColor, @DrawableRes int foregroundImageRes, @DrawableRes int backgroundImageRes) {
this.titleText = titleText;
this.subTitleText = subTitleText;
this.backgroundColor = backgroundColor;
this.foregroundImageRes = foregroundImageRes;
this.backgroundImageRes = backgroundImageRes;
}

public TutorialItem(String titleText, String subTitleText, int backgroundColor, int foregroundImageRes) {
public TutorialItem(@NonNull String titleText, @Nullable String subTitleText, @ColorRes int backgroundColor, @DrawableRes int foregroundImageRes) {
this.titleText = titleText;
this.subTitleText = subTitleText;
this.backgroundColor = backgroundColor;
this.foregroundImageRes = foregroundImageRes;
}

public TutorialItem(@StringRes int titleTextRes, @StringRes int subTitleTextRes, @ColorRes int backgroundColor, @DrawableRes int foregroundImageRes, @DrawableRes int backgroundImageRes) {
this.titleTextRes = titleTextRes;
this.subTitleTextRes = subTitleTextRes;
this.backgroundColor = backgroundColor;
this.foregroundImageRes = foregroundImageRes;
this.backgroundImageRes = backgroundImageRes;
}

public TutorialItem(@StringRes int titleTextRes, @StringRes int subTitleTextRes, @ColorRes int backgroundColor, @DrawableRes int foregroundImageRes) {
this.subTitleTextRes = titleTextRes;
this.subTitleTextRes = subTitleTextRes;
this.backgroundColor = backgroundColor;
this.foregroundImageRes = foregroundImageRes;
}

public String getTitleText() {
return titleText;
}
Expand All @@ -46,6 +68,14 @@ public int getBackgroundImageRes() {
return backgroundImageRes;
}

public int getTitleTextRes() {
return titleTextRes;
}

public int getSubTitleTextRes() {
return subTitleTextRes;
}

@Override
public int describeContents() {
return 0;
Expand All @@ -58,6 +88,8 @@ public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.backgroundColor);
dest.writeInt(this.foregroundImageRes);
dest.writeInt(this.backgroundImageRes);
dest.writeInt(this.titleTextRes);
dest.writeInt(this.subTitleTextRes);
}

protected TutorialItem(Parcel in) {
Expand All @@ -66,6 +98,8 @@ protected TutorialItem(Parcel in) {
this.backgroundColor = in.readInt();
this.foregroundImageRes = in.readInt();
this.backgroundImageRes = in.readInt();
this.titleTextRes = in.readInt();
this.subTitleTextRes = in.readInt();
}

public static final Parcelable.Creator<TutorialItem> CREATOR = new Parcelable.Creator<TutorialItem>() {
Expand Down