// Path: tableview/src/main/java/de/codecrafters/tableview/model/TableColumnModel.java
// public interface TableColumnModel {
// 
//     /**
//      * Gives the column count of this model.
//      *
//      * @return The number of columns that is currently set.
//      */
//     int getColumnCount();
// 
//     /**
//      * Sets the column count to this model.
//      *
//      * @param columnCount The number of columns that shall be set.
//      */
//     void setColumnCount(int columnCount);
// 
//     /**
//      * Gives the column width of the given index.
//      *
//      * @param columnIndex    The index of the column.
//      * @param tableWidthInPx The width of the table where it should be used.
//      * @return The width of the column with the given index.
//      */
//     int getColumnWidth(int columnIndex, int tableWidthInPx);
// }
// 
// Path: tableview/src/main/java/de/codecrafters/tableview/providers/SortStateViewProvider.java
// public interface SortStateViewProvider {
// 
//     int NO_IMAGE = 0;
// 
//     /**
//      * Gives the drawable resource for the given {@link SortState}.
//      *
//      * @param state The {@link SortState} to return the drawable resource for.
//      * @return The drawable resource for the given {@link SortState}.
//      */
//     int getSortStateViewResource(final SortState state);
// 
// }
// 
// Path: tableview/src/main/java/de/codecrafters/tableview/toolkit/SortStateViewProviders.java
// public final class SortStateViewProviders {
// 
//     private SortStateViewProviders() {
//         //no instance
//     }
// 
//     /**
//      * Gives a {@link SortStateViewProvider} that will provide dark (transparent black) arrows.
//      *
//      * @return The described {@link SortStateViewProvider}.
//      */
//     public static SortStateViewProvider darkArrows() {
//         return new DarkSortStateViewProvider();
//     }
// 
//     /**
//      * Gives a {@link SortStateViewProvider} that will provide bright (transparent white) arrows.
//      *
//      * @return The described {@link SortStateViewProvider}.
//      */
//     public static SortStateViewProvider brightArrows() {
//         return new BrightSortStateViewProvider();
//     }
// 
// 
//     private static class DarkSortStateViewProvider implements SortStateViewProvider {
// 
//         @Override
//         public int getSortStateViewResource(final SortState state) {
//             switch (state) {
//                 case SORTABLE:
//                     return R.mipmap.ic_dark_sortable;
//                 case SORTED_ASC:
//                     return R.mipmap.ic_dark_sorted_asc;
//                 case SORTED_DESC:
//                     return R.mipmap.ic_dark_sorted_desc;
//                 default:
//                     return NO_IMAGE;
//             }
//         }
//     }
// 
// 
//     private static class BrightSortStateViewProvider implements SortStateViewProvider {
// 
//         @Override
//         public int getSortStateViewResource(final SortState state) {
//             switch (state) {
//                 case SORTABLE:
//                     return R.mipmap.ic_light_sortable;
//                 case SORTED_ASC:
//                     return R.mipmap.ic_light_sorted_asc;
//                 case SORTED_DESC:
//                     return R.mipmap.ic_light_sorted_desc;
//                 default:
//                     return NO_IMAGE;
//             }
//         }
//     }
// 
// }


import android.content.Context;
import android.content.res.Resources;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import de.codecrafters.tableview.model.TableColumnModel;
import de.codecrafters.tableview.providers.SortStateViewProvider;
import de.codecrafters.tableview.toolkit.SortStateViewProviders;

    }

    /**
     * Gives the current {@link SortStateViewProvider} of this SortableTableHeaderView.
     *
     * @return The {@link SortStateViewProvider} that is currently used to render the sort views.
     */
    public SortStateViewProvider getSortStateViewProvider() {
        return sortStateViewProvider;
    }

    /**
     * Sets the given {@link SortStateViewProvider} to this SortableTableHeaderView.
     *
     * @param provider The {@link SortStateViewProvider} that shall be used to render the sort views.
     */
    public void setSortStateViewProvider(final SortStateViewProvider provider) {
        sortStateViewProvider = provider;
        invalidate();
    }

    @Override
    public void invalidate() {
        if (getAdapter() != null) {
            getAdapter().notifyDataSetChanged();
        }
        super.invalidate();
    }

    @Override

// Path: tableview/src/main/java/de/codecrafters/tableview/model/TableColumnModel.java
// public interface TableColumnModel {
// 
//     /**
//      * Gives the column count of this model.
//      *
//      * @return The number of columns that is currently set.
//      */
//     int getColumnCount();
// 
//     /**
//      * Sets the column count to this model.
//      *
//      * @param columnCount The number of columns that shall be set.
//      */
//     void setColumnCount(int columnCount);
// 
//     /**
//      * Gives the column width of the given index.
//      *
//      * @param columnIndex    The index of the column.
//      * @param tableWidthInPx The width of the table where it should be used.
//      * @return The width of the column with the given index.
//      */
//     int getColumnWidth(int columnIndex, int tableWidthInPx);
// }
// 
// Path: tableview/src/main/java/de/codecrafters/tableview/providers/SortStateViewProvider.java
// public interface SortStateViewProvider {
// 
//     int NO_IMAGE = 0;
// 
//     /**
//      * Gives the drawable resource for the given {@link SortState}.
//      *
//      * @param state The {@link SortState} to return the drawable resource for.
//      * @return The drawable resource for the given {@link SortState}.
//      */
//     int getSortStateViewResource(final SortState state);
// 
// }
// 
// Path: tableview/src/main/java/de/codecrafters/tableview/toolkit/SortStateViewProviders.java
// public final class SortStateViewProviders {
// 
//     private SortStateViewProviders() {
//         //no instance
//     }
// 
//     /**
//      * Gives a {@link SortStateViewProvider} that will provide dark (transparent black) arrows.
//      *
//      * @return The described {@link SortStateViewProvider}.
//      */
//     public static SortStateViewProvider darkArrows() {
//         return new DarkSortStateViewProvider();
//     }
// 
//     /**
//      * Gives a {@link SortStateViewProvider} that will provide bright (transparent white) arrows.
//      *
//      * @return The described {@link SortStateViewProvider}.
//      */
//     public static SortStateViewProvider brightArrows() {
//         return new BrightSortStateViewProvider();
//     }
// 
// 
//     private static class DarkSortStateViewProvider implements SortStateViewProvider {
// 
//         @Override
//         public int getSortStateViewResource(final SortState state) {
//             switch (state) {
//                 case SORTABLE:
//                     return R.mipmap.ic_dark_sortable;
//                 case SORTED_ASC:
//                     return R.mipmap.ic_dark_sorted_asc;
//                 case SORTED_DESC:
//                     return R.mipmap.ic_dark_sorted_desc;
//                 default:
//                     return NO_IMAGE;
//             }
//         }
//     }
// 
// 
//     private static class BrightSortStateViewProvider implements SortStateViewProvider {
// 
//         @Override
//         public int getSortStateViewResource(final SortState state) {
//             switch (state) {
//                 case SORTABLE:
//                     return R.mipmap.ic_light_sortable;
//                 case SORTED_ASC:
//                     return R.mipmap.ic_light_sorted_asc;
//                 case SORTED_DESC:
//                     return R.mipmap.ic_light_sorted_desc;
//                 default:
//                     return NO_IMAGE;
//             }
//         }
//     }
// 
// }


// Path: tableview/src/main/java/de/codecrafters/tableview/SortableTableHeaderView.java
import android.content.Context;
import android.content.res.Resources;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import de.codecrafters.tableview.model.TableColumnModel;
import de.codecrafters.tableview.providers.SortStateViewProvider;
import de.codecrafters.tableview.toolkit.SortStateViewProviders;

    }

    /**
     * Gives the current {@link SortStateViewProvider} of this SortableTableHeaderView.
     *
     * @return The {@link SortStateViewProvider} that is currently used to render the sort views.
     */
    public SortStateViewProvider getSortStateViewProvider() {
        return sortStateViewProvider;
    }

    /**
     * Sets the given {@link SortStateViewProvider} to this SortableTableHeaderView.
     *
     * @param provider The {@link SortStateViewProvider} that shall be used to render the sort views.
     */
    public void setSortStateViewProvider(final SortStateViewProvider provider) {
        sortStateViewProvider = provider;
        invalidate();
    }

    @Override
    public void invalidate() {
        if (getAdapter() != null) {
            getAdapter().notifyDataSetChanged();
        }
        super.invalidate();
    }

    @Override

    public TableHeaderAdapter getAdapter() {
