app/src/main/java/com/smedic/tubtub/MainActivity.java
private void loadColor() {
        SharedPreferences sp = PreferenceManager
                .getDefaultSharedPreferences(this);
        int backgroundColor = sp.getInt("BACKGROUND_COLOR", -1);
        int textColor = sp.getInt("TEXT_COLOR", -1);

        if (backgroundColor != -1 && textColor != -1) {
            setColors(backgroundColor, textColor);
        } else {
            initialColors = new int[]{
                    ContextCompat.getColor(this, R.color.colorPrimary),
                    ContextCompat.getColor(this, R.color.textColorPrimary)};
        }
    }
/**
     * Loads app theme color saved in preferences
     */
Loads app theme color saved in preferences
Loads app theme color saved in preferences
private void loadColor() {
        SharedPreferences sp = PreferenceManager
                .getDefaultSharedPreferences(this);
        int backgroundColor = sp.getInt("BACKGROUND_COLOR", -1);
        int textColor = sp.getInt("TEXT_COLOR", -1);
        if (backgroundColor != -1 && textColor != -1) {
            setColors(backgroundColor, textColor);
        } else {
            initialColors = new int[]{
                    ContextCompat.getColor(this, R.color.colorPrimary),
                    ContextCompat.getColor(this, R.color.textColorPrimary)};
        }
    }
private void loadColor ( ) { SharedPreferences sp = PreferenceManager . getDefaultSharedPreferences ( this ) ; int backgroundColor = sp . getInt ( "BACKGROUND_COLOR" , - 1 ) ; int textColor = sp . getInt ( "TEXT_COLOR" , - 1 ) ; if ( backgroundColor != - 1 && textColor != - 1 ) { setColors ( backgroundColor , textColor ) ; } else { initialColors = new int [ ] { ContextCompat . getColor ( this , R . color . colorPrimary ) , ContextCompat . getColor ( this , R . color . textColorPrimary ) } ; } }
Loads app theme color saved in preferences
Loads app theme color saved in preferences