Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.content.SharedPreferences;
import android.graphics.Color;

import java.util.HashMap;

public class Main {
    /**
     * This function returns a hashmap which contains the colors for each face of the cube
     */
    public static HashMap<Character, Integer> getColorLetterHashMap(SharedPreferences sp) {
        HashMap<Character, Integer> hashMap = new HashMap<>(7);
        hashMap.put('Y', Color.parseColor("#" + sp.getString("cubeDown", "FDD835")));
        hashMap.put('R', Color.parseColor("#" + sp.getString("cubeRight", "EC0000")));
        hashMap.put('G', Color.parseColor("#" + sp.getString("cubeFront", "02D040")));
        hashMap.put('B', Color.parseColor("#" + sp.getString("cubeBack", "304FFE")));
        hashMap.put('O', Color.parseColor("#" + sp.getString("cubeLeft", "FF8B24")));
        hashMap.put('W', Color.parseColor("#" + sp.getString("cubeTop", "FFFFFF")));
        hashMap.put('N', Color.parseColor("#9E9E9E"));
        return hashMap;
    }
}