// Path: indicator/src/main/java/com/fuzz/indicator/style/MigratoryRange.java
// public final class MigratoryRange<T extends Number & Comparable<T>> {
// 
//     public static abstract class Operator<T> {
//         @NonNull
//         public abstract T add(T lower, T offset);
//     }
// 
//     public static final Operator<Float> FLOAT_OPERATOR
//             = new Operator<Float>() {
//         @NonNull
//         @Override
//         public Float add(Float lower, Float offset) {
//             return lower + offset;
//         }
//     };
// 
//     public static final Operator<Integer> INTEGER_OPERATOR
//             = new Operator<Integer>() {
//         @NonNull
//         @Override
//         public Integer add(Integer lower, Integer offset) {
//             return lower + offset;
//         }
//     };
// 
//     public static MigratoryRange<Float> from(float lower, float upper) {
//         return new MigratoryRange<>(lower, upper, FLOAT_OPERATOR);
//     }
// 
//     public static MigratoryRange<Integer> from(int lower, int upper) {
//         return new MigratoryRange<>(lower, upper, INTEGER_OPERATOR);
//     }
// 
//     @NonNull
//     private final T lower;
//     @NonNull
//     private final T upper;
//     @NonNull
//     private final Operator<T> operator;
// 
//     public MigratoryRange(@NonNull T lower, @NonNull T upper, @NonNull Operator<T> operator) {
//         this.lower = lower;
//         this.upper = upper;
//         this.operator = operator;
// 
//         if (lower.compareTo(upper) > 0) {
//             throw new IllegalArgumentException("Migratory ranges may not have an upper bound below their lower bound.");
//         }
//     }
// 
//     @NonNull
//     public T getLower() {
//         return lower;
//     }
// 
//     @NonNull
//     public T getUpper() {
//         return upper;
//     }
// 
//     /**
//      * If the parameter is within this range it will be
//      * returned unaltered. If it isn't, the closest value
//      * within the range (e.g. {@link #getLower()} or
//      * {@link #getUpper()}) will be returned.
//      *
//      * @param value any non-null value of type T
//      * @return a value guaranteed to be within this range
//      */
//     @NonNull
//     public T clamp(@NonNull T value) {
//         if (value.compareTo(lower) < 0) {
//             return lower;
//         } else if (value.compareTo(upper) > 0) {
//             return upper;
//         } else {
//             return value;
//         }
//     }
// 
//     public double diff() {
//         return upper.doubleValue() - lower.doubleValue();
//     }
// 
//     public MigratoryRange<T> translate(@NonNull T offset) {
//         T newLower = operator.add(lower, offset);
//         T newUpper = operator.add(upper, offset);
//         return new MigratoryRange<>(newLower, newUpper, operator);
//     }
// }
// 
// Path: indicator/src/main/java/com/fuzz/indicator/text/TextCellGenerator.java
// public abstract class TextCellGenerator implements CutoutCellGenerator {
//     @NonNull
//     @Override
//     public CutoutCell createCellFor(@NonNull ViewGroup parent, int position) {
//         CutoutViewLayoutParams lp = ((CutoutViewIndicator) parent).generateDefaultLayoutParams();
// 
//         TextView child = new TextView(parent.getContext());
//         child.setText(getTextFor(parent.getContext(), position));
//         child.setLayoutParams(lp);
// 
//         return new CutoutTextCell(child);
//     }
// 
//     @NonNull
//     protected abstract Spannable getTextFor(@NonNull Context context, int position);
// 
//     @Override
//     public void onBindChild(@NonNull View child, @NonNull CutoutViewLayoutParams lp, @Nullable View originator) {
//         child.setBackgroundResource(lp.cellBackgroundId);
//     }
// }


import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import com.fuzz.indicator.style.MigratoryRange;
import com.fuzz.indicator.style.MigratoryStyleSpan;
import com.fuzz.indicator.text.TextCellGenerator;
import static android.graphics.Typeface.BOLD;
/*
 * Copyright 2016 Philip Cohn-Cort
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.fuzz.emptyhusk;




/**
 * Simple TextViewGenerator that styles text in a bold sort of way.
 *
 * @author Philip Cohn-Cort (Fuzz)
 */
public class BoldTextCellGenerator extends TextCellGenerator {
    @NonNull
    @Override
    protected Spannable getTextFor(@NonNull Context context, int position) {
        String[] introStrings = context.getResources().getStringArray(R.array.introductory_messages);

        SpannableString ssb = new SpannableString(introStrings[position]);
        MigratoryStyleSpan span = new MigratoryStyleSpan(BOLD);

        // Order matters when setting spans. The base color must be in place first

        ForegroundColorSpan colorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.colorSecondary));
// Path: indicator/src/main/java/com/fuzz/indicator/style/MigratoryRange.java
// public final class MigratoryRange<T extends Number & Comparable<T>> {
// 
//     public static abstract class Operator<T> {
//         @NonNull
//         public abstract T add(T lower, T offset);
//     }
// 
//     public static final Operator<Float> FLOAT_OPERATOR
//             = new Operator<Float>() {
//         @NonNull
//         @Override
//         public Float add(Float lower, Float offset) {
//             return lower + offset;
//         }
//     };
// 
//     public static final Operator<Integer> INTEGER_OPERATOR
//             = new Operator<Integer>() {
//         @NonNull
//         @Override
//         public Integer add(Integer lower, Integer offset) {
//             return lower + offset;
//         }
//     };
// 
//     public static MigratoryRange<Float> from(float lower, float upper) {
//         return new MigratoryRange<>(lower, upper, FLOAT_OPERATOR);
//     }
// 
//     public static MigratoryRange<Integer> from(int lower, int upper) {
//         return new MigratoryRange<>(lower, upper, INTEGER_OPERATOR);
//     }
// 
//     @NonNull
//     private final T lower;
//     @NonNull
//     private final T upper;
//     @NonNull
//     private final Operator<T> operator;
// 
//     public MigratoryRange(@NonNull T lower, @NonNull T upper, @NonNull Operator<T> operator) {
//         this.lower = lower;
//         this.upper = upper;
//         this.operator = operator;
// 
//         if (lower.compareTo(upper) > 0) {
//             throw new IllegalArgumentException("Migratory ranges may not have an upper bound below their lower bound.");
//         }
//     }
// 
//     @NonNull
//     public T getLower() {
//         return lower;
//     }
// 
//     @NonNull
//     public T getUpper() {
//         return upper;
//     }
// 
//     /**
//      * If the parameter is within this range it will be
//      * returned unaltered. If it isn't, the closest value
//      * within the range (e.g. {@link #getLower()} or
//      * {@link #getUpper()}) will be returned.
//      *
//      * @param value any non-null value of type T
//      * @return a value guaranteed to be within this range
//      */
//     @NonNull
//     public T clamp(@NonNull T value) {
//         if (value.compareTo(lower) < 0) {
//             return lower;
//         } else if (value.compareTo(upper) > 0) {
//             return upper;
//         } else {
//             return value;
//         }
//     }
// 
//     public double diff() {
//         return upper.doubleValue() - lower.doubleValue();
//     }
// 
//     public MigratoryRange<T> translate(@NonNull T offset) {
//         T newLower = operator.add(lower, offset);
//         T newUpper = operator.add(upper, offset);
//         return new MigratoryRange<>(newLower, newUpper, operator);
//     }
// }
// 
// Path: indicator/src/main/java/com/fuzz/indicator/text/TextCellGenerator.java
// public abstract class TextCellGenerator implements CutoutCellGenerator {
//     @NonNull
//     @Override
//     public CutoutCell createCellFor(@NonNull ViewGroup parent, int position) {
//         CutoutViewLayoutParams lp = ((CutoutViewIndicator) parent).generateDefaultLayoutParams();
// 
//         TextView child = new TextView(parent.getContext());
//         child.setText(getTextFor(parent.getContext(), position));
//         child.setLayoutParams(lp);
// 
//         return new CutoutTextCell(child);
//     }
// 
//     @NonNull
//     protected abstract Spannable getTextFor(@NonNull Context context, int position);
// 
//     @Override
//     public void onBindChild(@NonNull View child, @NonNull CutoutViewLayoutParams lp, @Nullable View originator) {
//         child.setBackgroundResource(lp.cellBackgroundId);
//     }
// }


// Path: mobile/src/main/java/com/fuzz/emptyhusk/BoldTextCellGenerator.java
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import com.fuzz.indicator.style.MigratoryRange;
import com.fuzz.indicator.style.MigratoryStyleSpan;
import com.fuzz.indicator.text.TextCellGenerator;
import static android.graphics.Typeface.BOLD;

/*
 * Copyright 2016 Philip Cohn-Cort
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.fuzz.emptyhusk;




/**
 * Simple TextViewGenerator that styles text in a bold sort of way.
 *
 * @author Philip Cohn-Cort (Fuzz)
 */
public class BoldTextCellGenerator extends TextCellGenerator {
    @NonNull
    @Override
    protected Spannable getTextFor(@NonNull Context context, int position) {
        String[] introStrings = context.getResources().getStringArray(R.array.introductory_messages);

        SpannableString ssb = new SpannableString(introStrings[position]);
        MigratoryStyleSpan span = new MigratoryStyleSpan(BOLD);

        // Order matters when setting spans. The base color must be in place first

        ForegroundColorSpan colorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.colorSecondary));
        ssb.setSpan(colorSpan, 0, ssb.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);