Project

General

Profile

« Previous | Next » 

Revision be65535e

Added by Leszek Koltunski over 2 years ago

Progress with colors in the main menu.

View differences:

src/main/java/org/distorted/screens/RubikScreenPlay.java
24 24
import android.app.Activity;
25 25
import android.content.Context;
26 26
import android.content.SharedPreferences;
27
import android.content.res.ColorStateList;
27 28
import android.content.res.Resources;
28
import android.graphics.drawable.Drawable;
29 29
import android.os.Build;
30 30
import android.os.Bundle;
31 31
import android.util.TypedValue;
......
40 40
import android.widget.RelativeLayout;
41 41
import android.widget.TextView;
42 42

  
43
import androidx.core.content.ContextCompat;
44

  
45 43
import org.distorted.dialogs.RubikDialogUpdates;
46 44
import org.distorted.external.RubikNetwork;
47 45
import org.distorted.external.RubikScores;
......
525 523
    int dbLevel = RubikObjectList.getDBLevel(currObject);
526 524
    RubikScores scores = RubikScores.getInstance();
527 525
    Resources res = act.getResources();
528
    int colorG = res.getColor(R.color.green);
526
    ColorStateList colorG = ColorStateList.valueOf(res.getColor(R.color.green));
527
    ColorStateList colorD = ColorStateList.valueOf(res.getColor(R.color.dark_grey));
529 528

  
530 529
    for(int i=0; i<=LEVELS_SHOWN; i++)
531 530
      {
532 531
      int level = i<LEVELS_SHOWN ? i : dbLevel;
533 532
      boolean isSolved = scores.isSolved(currObject,level);
534
      if( isSolved ) mLevel[i].setBackgroundColor(colorG);
533
      mLevel[i].setBackgroundTintList( isSolved ? colorG : colorD);
535 534
      }
536 535
    }
537 536

  

Also available in: Unified diff