/**
 * Copyright 2016 Carl-Philipp Harmant
 * <p/>
 * 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
 * <p/>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p/>
 * 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 fr.cph.chicago.util;

import android.support.annotation.NonNull;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import fr.cph.chicago.App;
import fr.cph.chicago.R;
import fr.cph.chicago.entity.enumeration.TrainLine;

/**
 * Layout util class
 *
 * @author Carl-Philipp Harmant
 * @version 1
 */
public class LayoutUtil {

    private LayoutUtil() {
    }

    @NonNull
    public static RelativeLayout createColoredRoundForFavorites(@NonNull final TrainLine trainLine) {
        final RelativeLayout lineIndication = new RelativeLayout(App.getContext());
        final RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        params.height =  App.getContext().getResources().getDimensionPixelSize(R.dimen.layout_round_height);
        params.width = App.getContext().getResources().getDimensionPixelSize(R.dimen.layout_round_width);
        params.addRule(RelativeLayout.CENTER_VERTICAL);
        lineIndication.setBackgroundColor(trainLine.getColor());
        lineIndication.setLayoutParams(params);
        return lineIndication;
    }

    @NonNull
    public static LinearLayout createColoredRoundForMultiple(@NonNull final TrainLine trainLine) {
        final LinearLayout lineIndication = new LinearLayout(App.getContext());
        final LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        params.height =  App.getContext().getResources().getDimensionPixelSize(R.dimen.layout_round_height);
        params.width = App.getContext().getResources().getDimensionPixelSize(R.dimen.layout_round_width);
        params.setMargins(10, 0, 0, 0);
        lineIndication.setBackgroundColor(trainLine.getColor());
        lineIndication.setLayoutParams(params);
        return lineIndication;
    }
}

@@ -999,16 +999,259 @@
 Util %7B%0A%0A
+    private static final int HEIGHT = App.getContext().getResources().getDimensionPixelSize(R.dimen.layout_round_height);%0A    private static final int WIDTH = App.getContext().getResources().getDimensionPixelSize(R.dimen.layout_round_width);%0A%0A
     priv
@@ -1265,24 +1265,24 @@
 outUtil() %7B%0A
-
     %7D%0A%0A    @
@@ -1661,197 +1661,44 @@
 t = 
- App.getContext().getResources().getDimensionPixelSize(R.dimen.layout_round_height);%0A        params.width = App.getContext().getResources().getDimensionPixelSize(R.dimen.layout_round_width)
+HEIGHT;%0A        params.width = WIDTH
 ;%0A  
@@ -2276,197 +2276,44 @@
 t = 
- App.getContext().getResources().getDimensionPixelSize(R.dimen.layout_round_height);%0A        params.width = App.getContext().getResources().getDimensionPixelSize(R.dimen.layout_round_width)
+HEIGHT;%0A        params.width = WIDTH
 ;%0A  

Refactor code