// Path: mobile/src/main/java/com/fuzz/emptyhusk/BoldTextCellGenerator.java
// 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);
// 
//         // Only then should custom MigratorySpans be set.
// 
//         MigratoryRange<Integer> coverage = span.getCoverage(ssb);
//         int start = coverage.getLower();
//         int end = coverage.getUpper();
//         ssb.setSpan(span, start, end, span.preferredFlags(0));
// 
//         MigratoryForegroundColorSpan boldColorSpan = new MigratoryForegroundColorSpan(ContextCompat.getColor(context, R.color.colorAccent));
//         ssb.setSpan(boldColorSpan, start, end, boldColorSpan.preferredFlags(0));
// 
//         return ssb;
//     }
// 
// }
// 
// Path: indicator/src/main/java/com/fuzz/indicator/clip/SequentialCellGenerator.java
// public class SequentialCellGenerator extends ImageCellGenerator {
// 
//     @NonNull
//     private String textMask = "~|%d|~";
// 
//     public SequentialCellGenerator() {
//     }
// 
//     public SequentialCellGenerator(@NonNull Context context, @NonNull AttributeSet attrs, int defAttr) {
//         TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CutoutViewIndicator, defAttr, 0);
//         String textMask = a.getString(R.styleable.CutoutViewIndicator_rcv_generator_text_mask);
//         if (textMask != null) {
//             setTextMask(textMask);
//         }
//         a.recycle();
//     }
// 
//     @NonNull
//     @Override
//     protected ImageView createChildFor(@NonNull ViewGroup parent, int position) {
//         return new TextClippedImageView(parent.getContext());
//     }
// 
//     @Override
//     public void onBindChild(@NonNull View child, @NonNull CutoutViewLayoutParams lp, @Nullable View originator) {
//         child.setBackgroundResource(lp.cellBackgroundId);
//         if (child instanceof TextClippedImageView) {
//             if (!((TextClippedImageView)child).hasTextMask()) {
//                 // Child mask is not set - propagate our default value
//                 String mask = getMaskFor(lp);
//                 ((TextClippedImageView) child).setTextMaskPath(mask);
//             }
//             bindImageToChild((ImageView) child, lp);
//         } else {
//             super.onBindChild(child, lp, originator);
//         }
//     }
// 
//     /**
//      * Set a new string to be used as base mask by {@link #getMaskFor(CutoutViewLayoutParams)}.
//      *
//      * @param textMask    a string, with at most one {@code %d} where the position should go.
//      */
//     public void setTextMask(@NonNull String textMask) {
//         this.textMask = textMask;
//     }
// 
//     /**
//      * The returned string will be used as a sort of clipping path for child views,
//      * provided that the children are instances of {@link TextClippedImageView}.
//      *
//      * @param lp    the layout params of the associated view
//      * @return a string used for masking. return an empty string and
//      * the child view will draw absolutely nothing
//      * @see TextClippedImageView#setTextMaskPath(String)
//      */
//     @NonNull
//     public String getMaskFor(@NonNull CutoutViewLayoutParams lp) {
//         return String.format(Locale.getDefault(), textMask, lp.position);
//     }
// }
// 
// Path: indicator/src/main/java/com/fuzz/indicator/clip/ClippedImageCellGenerator.java
// public class ClippedImageCellGenerator extends ImageCellGenerator {
//     @NonNull
//     @Override
//     protected ImageView createChildFor(@NonNull ViewGroup parent, int position) {
//         return new ClippedImageView(parent.getContext());
//     }
// }


import java.util.List;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.fuzz.emptyhusk.BoldTextCellGenerator;
import com.fuzz.emptyhusk.R;
import com.fuzz.indicator.ImageCellGenerator;
import com.fuzz.indicator.CutoutCellGenerator;
import com.fuzz.indicator.clip.SequentialCellGenerator;
import com.fuzz.indicator.clip.ClippedImageCellGenerator;
import java.util.ArrayList;
/*
 * 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.choosegenerator;




/**
 * @author Philip Cohn-Cort (Fuzz)
 */
public class GeneratorChoiceAdapter extends RecyclerView.Adapter {

    @NonNull
    private List<GeneratorChoice> choices = new ArrayList<>();

    @NonNull
    private Class<? extends CutoutCellGenerator> chosen = ImageCellGenerator.class;

    public GeneratorChoiceAdapter() {
        choices.add(new GeneratorChoice(ImageCellGenerator.class, "Creates simple ImageViews. These are offset with X or Y translations. A classic choice with static background and dynamic content."));
        choices.add(new GeneratorChoice(ClippedImageCellGenerator.class, "Creates ClippedImageViews. These are offset with X or Y translations. Stylish, yet ever so slightly heavier memory-wise than ImageCellGenerator."));
// Path: mobile/src/main/java/com/fuzz/emptyhusk/BoldTextCellGenerator.java
// 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);
// 
//         // Only then should custom MigratorySpans be set.
// 
//         MigratoryRange<Integer> coverage = span.getCoverage(ssb);
//         int start = coverage.getLower();
//         int end = coverage.getUpper();
//         ssb.setSpan(span, start, end, span.preferredFlags(0));
// 
//         MigratoryForegroundColorSpan boldColorSpan = new MigratoryForegroundColorSpan(ContextCompat.getColor(context, R.color.colorAccent));
//         ssb.setSpan(boldColorSpan, start, end, boldColorSpan.preferredFlags(0));
// 
//         return ssb;
//     }
// 
// }
// 
// Path: indicator/src/main/java/com/fuzz/indicator/clip/SequentialCellGenerator.java
// public class SequentialCellGenerator extends ImageCellGenerator {
// 
//     @NonNull
//     private String textMask = "~|%d|~";
// 
//     public SequentialCellGenerator() {
//     }
// 
//     public SequentialCellGenerator(@NonNull Context context, @NonNull AttributeSet attrs, int defAttr) {
//         TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CutoutViewIndicator, defAttr, 0);
//         String textMask = a.getString(R.styleable.CutoutViewIndicator_rcv_generator_text_mask);
//         if (textMask != null) {
//             setTextMask(textMask);
//         }
//         a.recycle();
//     }
// 
//     @NonNull
//     @Override
//     protected ImageView createChildFor(@NonNull ViewGroup parent, int position) {
//         return new TextClippedImageView(parent.getContext());
//     }
// 
//     @Override
//     public void onBindChild(@NonNull View child, @NonNull CutoutViewLayoutParams lp, @Nullable View originator) {
//         child.setBackgroundResource(lp.cellBackgroundId);
//         if (child instanceof TextClippedImageView) {
//             if (!((TextClippedImageView)child).hasTextMask()) {
//                 // Child mask is not set - propagate our default value
//                 String mask = getMaskFor(lp);
//                 ((TextClippedImageView) child).setTextMaskPath(mask);
//             }
//             bindImageToChild((ImageView) child, lp);
//         } else {
//             super.onBindChild(child, lp, originator);
//         }
//     }
// 
//     /**
//      * Set a new string to be used as base mask by {@link #getMaskFor(CutoutViewLayoutParams)}.
//      *
//      * @param textMask    a string, with at most one {@code %d} where the position should go.
//      */
//     public void setTextMask(@NonNull String textMask) {
//         this.textMask = textMask;
//     }
// 
//     /**
//      * The returned string will be used as a sort of clipping path for child views,
//      * provided that the children are instances of {@link TextClippedImageView}.
//      *
//      * @param lp    the layout params of the associated view
//      * @return a string used for masking. return an empty string and
//      * the child view will draw absolutely nothing
//      * @see TextClippedImageView#setTextMaskPath(String)
//      */
//     @NonNull
//     public String getMaskFor(@NonNull CutoutViewLayoutParams lp) {
//         return String.format(Locale.getDefault(), textMask, lp.position);
//     }
// }
// 
// Path: indicator/src/main/java/com/fuzz/indicator/clip/ClippedImageCellGenerator.java
// public class ClippedImageCellGenerator extends ImageCellGenerator {
//     @NonNull
//     @Override
//     protected ImageView createChildFor(@NonNull ViewGroup parent, int position) {
//         return new ClippedImageView(parent.getContext());
//     }
// }


// Path: mobile/src/main/java/com/fuzz/emptyhusk/choosegenerator/GeneratorChoiceAdapter.java
import java.util.List;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.fuzz.emptyhusk.BoldTextCellGenerator;
import com.fuzz.emptyhusk.R;
import com.fuzz.indicator.ImageCellGenerator;
import com.fuzz.indicator.CutoutCellGenerator;
import com.fuzz.indicator.clip.SequentialCellGenerator;
import com.fuzz.indicator.clip.ClippedImageCellGenerator;
import java.util.ArrayList;

/*
 * 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.choosegenerator;




/**
 * @author Philip Cohn-Cort (Fuzz)
 */
public class GeneratorChoiceAdapter extends RecyclerView.Adapter {

    @NonNull
    private List<GeneratorChoice> choices = new ArrayList<>();

    @NonNull
    private Class<? extends CutoutCellGenerator> chosen = ImageCellGenerator.class;

    public GeneratorChoiceAdapter() {
        choices.add(new GeneratorChoice(ImageCellGenerator.class, "Creates simple ImageViews. These are offset with X or Y translations. A classic choice with static background and dynamic content."));
        choices.add(new GeneratorChoice(ClippedImageCellGenerator.class, "Creates ClippedImageViews. These are offset with X or Y translations. Stylish, yet ever so slightly heavier memory-wise than ImageCellGenerator."));
        choices.add(new GeneratorChoice(BoldTextCellGenerator.class, "Creates TextViews with bold text. The bold sections are offset in a dynamic manner within the TextViews' text. Rather new and difficult to master."));