// Path: vor-android/mobile/src/main/java/com/futurice/vor/utils/ToiletUtils.java
// public class ToiletUtils {
//     /**
//      * Implementation of the click listener to show methane level
//      *
//      * @param json the json string
//      */
//     public static void setClickListener(String json, Context context) {
//         if (json != null) {
//             try {
//                 JSONObject jsonData = new JSONObject(json);
//                 Integer methane = jsonData.getInt(METHANE_KEY);
//                 showMethaneToast(methane, context);
//             } catch (JSONException e) {
//                 e.printStackTrace();
//             }
//         }
//     }
// 
//     public static void updateView(SharedPreferences sharedPreferences, String key, View view, Context context) {
//         String json = sharedPreferences.getString(key, null);
//         if (json != null) {
//             try {
//                 JSONObject jsonData = new JSONObject(json);
//                 updateToiletBackground(view, jsonData.getBoolean(RESERVED_KEY), context);
//             } catch (JSONException e) {
//                 e.printStackTrace();
//             }
//         }
//     }
// 
//     /**
//      * Updates the background of the view depending on toilet availability
//      *
//      * @param view the view
//      * @param reserved the state of the toilet
//      */
//     public static void updateToiletBackground(View view, Boolean reserved, Context context) {
//         Drawable freeBg = ContextCompat.getDrawable(context, R.drawable.toilet_free_bg);
//         Drawable takenBg = ContextCompat.getDrawable(context, R.drawable.toilet_taken_bg);
//         view.setBackground(reserved ? takenBg : freeBg);
//     }
// 
//     /**
//      * Shows a toast with the methane level
//      *
//      * @param methane the methane level
//      *
//      * @param context the context
//      */
//     public static void showMethaneToast(Integer methane, Context context) {
//         String message = "Methane level: " + Integer.toString(methane);
//         Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
//     }
// }


import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import com.futurice.vor.R;
import com.futurice.vor.Toilet;
import com.futurice.vor.utils.ToiletUtils;
import java.util.ArrayList;
import butterknife.Bind;
import butterknife.ButterKnife;
package com.futurice.vor.fragment;





public class Floor8Fragment extends Fragment {
    @Bind(R.id.toilet8AM) RelativeLayout mToilet8AM;
    @Bind(R.id.toilet8AW) RelativeLayout mToilet8AW;
    @Bind(R.id.toilet8BM) RelativeLayout mToilet8BM;
    @Bind(R.id.toilet8BW) RelativeLayout mToilet8BW;
    @Bind(R.id.toilet8CM) RelativeLayout mToilet8CM;
    @Bind(R.id.toilet8CW) RelativeLayout mToilet8CW;

    Activity mActivity;

    ArrayList<String> mIds = new ArrayList<>();
    ArrayList<RelativeLayout> mRelativeLayouts = new ArrayList<>();
    ArrayList<SharedPreferences> mSharedPreferences = new ArrayList<>();
    ArrayList<OnSharedPreferenceChangeListener> mOnSharedPreferenceChangeListeners = new ArrayList<>();

    public Floor8Fragment() {
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mActivity = getActivity();

        mIds.add(Toilet.AM8.getId());
        mIds.add(Toilet.AW8.getId());
        mIds.add(Toilet.BM8.getId());
        mIds.add(Toilet.BW8.getId());
        mIds.add(Toilet.CM8.getId());
        mIds.add(Toilet.CW8.getId());

// Path: vor-android/mobile/src/main/java/com/futurice/vor/utils/ToiletUtils.java
// public class ToiletUtils {
//     /**
//      * Implementation of the click listener to show methane level
//      *
//      * @param json the json string
//      */
//     public static void setClickListener(String json, Context context) {
//         if (json != null) {
//             try {
//                 JSONObject jsonData = new JSONObject(json);
//                 Integer methane = jsonData.getInt(METHANE_KEY);
//                 showMethaneToast(methane, context);
//             } catch (JSONException e) {
//                 e.printStackTrace();
//             }
//         }
//     }
// 
//     public static void updateView(SharedPreferences sharedPreferences, String key, View view, Context context) {
//         String json = sharedPreferences.getString(key, null);
//         if (json != null) {
//             try {
//                 JSONObject jsonData = new JSONObject(json);
//                 updateToiletBackground(view, jsonData.getBoolean(RESERVED_KEY), context);
//             } catch (JSONException e) {
//                 e.printStackTrace();
//             }
//         }
//     }
// 
//     /**
//      * Updates the background of the view depending on toilet availability
//      *
//      * @param view the view
//      * @param reserved the state of the toilet
//      */
//     public static void updateToiletBackground(View view, Boolean reserved, Context context) {
//         Drawable freeBg = ContextCompat.getDrawable(context, R.drawable.toilet_free_bg);
//         Drawable takenBg = ContextCompat.getDrawable(context, R.drawable.toilet_taken_bg);
//         view.setBackground(reserved ? takenBg : freeBg);
//     }
// 
//     /**
//      * Shows a toast with the methane level
//      *
//      * @param methane the methane level
//      *
//      * @param context the context
//      */
//     public static void showMethaneToast(Integer methane, Context context) {
//         String message = "Methane level: " + Integer.toString(methane);
//         Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
//     }
// }


// Path: vor-android/mobile/src/main/java/com/futurice/vor/fragment/Floor8Fragment.java
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import com.futurice.vor.R;
import com.futurice.vor.Toilet;
import com.futurice.vor.utils.ToiletUtils;
import java.util.ArrayList;
import butterknife.Bind;
import butterknife.ButterKnife;

package com.futurice.vor.fragment;





public class Floor8Fragment extends Fragment {
    @Bind(R.id.toilet8AM) RelativeLayout mToilet8AM;
    @Bind(R.id.toilet8AW) RelativeLayout mToilet8AW;
    @Bind(R.id.toilet8BM) RelativeLayout mToilet8BM;
    @Bind(R.id.toilet8BW) RelativeLayout mToilet8BW;
    @Bind(R.id.toilet8CM) RelativeLayout mToilet8CM;
    @Bind(R.id.toilet8CW) RelativeLayout mToilet8CW;

    Activity mActivity;

    ArrayList<String> mIds = new ArrayList<>();
    ArrayList<RelativeLayout> mRelativeLayouts = new ArrayList<>();
    ArrayList<SharedPreferences> mSharedPreferences = new ArrayList<>();
    ArrayList<OnSharedPreferenceChangeListener> mOnSharedPreferenceChangeListeners = new ArrayList<>();

    public Floor8Fragment() {
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mActivity = getActivity();

        mIds.add(Toilet.AM8.getId());
        mIds.add(Toilet.AW8.getId());
        mIds.add(Toilet.BM8.getId());
        mIds.add(Toilet.BW8.getId());
        mIds.add(Toilet.CM8.getId());
        mIds.add(Toilet.CW8.getId());

        for (String id : mIds) {