Project

General

Profile

« Previous | Next » 

Revision 0a9adc31

Added by Leszek Koltunski 8 months ago

Themes almost finished.

View differences:

src/main/java/org/distorted/dialogs/RubikDialogAbstract.java
11 11

  
12 12
import android.app.Dialog;
13 13
import android.content.DialogInterface;
14
import android.content.res.ColorStateList;
15
import android.graphics.Color;
16
import android.graphics.drawable.ColorDrawable;
14 17
import android.os.Bundle;
15 18
import android.util.DisplayMetrics;
16 19
import android.util.TypedValue;
......
25 28
import androidx.appcompat.app.AppCompatDialogFragment;
26 29
import androidx.fragment.app.FragmentActivity;
27 30

  
31
import org.distorted.helpers.BaseActivity;
28 32
import org.distorted.main.MainActivity;
29 33
import org.distorted.main.R;
30 34

  
......
147 151

  
148 152
    if( window!=null )
149 153
      {
154
      BaseActivity bact = (BaseActivity) act;
155
      int m = bact.getMediumColor();
156
      window.setBackgroundDrawableResource(m);
150 157
      window.getDecorView().setSystemUiVisibility(MainActivity.FLAGS);
151 158
      }
152 159

  
src/main/java/org/distorted/dialogs/RubikDialogScoresView.java
20 20
import android.widget.LinearLayout;
21 21
import android.widget.TextView;
22 22

  
23
import org.distorted.main.MainActivity;
23 24
import org.distorted.main.R;
24 25
import org.distorted.external.RubikScores;
25 26

  
......
90 91
    String theirTime;
91 92
    int theirCountryID;
92 93

  
94
    MainActivity mact = (MainActivity) act;
95
    int selected = mact.getSelectedColor();
93 96
    int height = (int)(mHeight*SCORES_ITEM_TEXT);
94 97
    int white = res.getColor(R.color.white);
95
    int red   = res.getColor(R.color.red);
98
    int red   = res.getColor(selected);
96 99
    boolean equals;
97 100

  
98 101
    for(int j=0; j<MAX_PLACES-1; j++)
src/main/java/org/distorted/helpers/BaseActivity.java
46 46
    protected int mHeightLowerBar, mHeightUpperBar;
47 47
    protected float mDensity;
48 48
    protected int mVeryDarkC, mDarkC, mNormalC, mMediumC, mLightC, mPassedC;
49
    protected int mDarkT, mLightT, mSelectC;
49 50
    protected SharedPreferences mPreferences;
50 51

  
51 52
///////////////////////////////////////////////////////////////////////////////////////////////////
......
67 68
                           mMediumC  = R.color.mediumWhite;
68 69
                           mLightC   = R.color.lightWhite;
69 70
                           mPassedC  = R.color.passedWhite;
71
                           mDarkT    = R.color.transDWhite;
72
                           mLightT   = R.color.transLWhite;
73
                           mSelectC  = R.color.selectWhite;
70 74
                           break;
71 75
        case THEME_GREEN : setTheme(R.style.GreenTheme);
72 76
                           mVeryDarkC= R.color.veryDarkGreen;
......
75 79
                           mMediumC  = R.color.mediumGreen;
76 80
                           mLightC   = R.color.lightGreen;
77 81
                           mPassedC  = R.color.passedGreen;
82
                           mDarkT    = R.color.transDGreen;
83
                           mLightT   = R.color.transLGreen;
84
                           mSelectC  = R.color.selectGreen;
78 85
                           break;
79 86
        default          : setTheme(R.style.GreyTheme);
80 87
                           mVeryDarkC= R.color.veryDarkGrey;
......
83 90
                           mMediumC  = R.color.mediumGrey;
84 91
                           mLightC   = R.color.lightGrey;
85 92
                           mPassedC  = R.color.passedGrey;
86
                           break;
93
                           mDarkT    = R.color.transDGrey;
94
                           mLightT   = R.color.transLGrey;
95
                           mSelectC  = R.color.selectGrey;
96
            break;
87 97
        }
88 98

  
89 99
      super.onCreate(savedState);
......
124 134
      return mLightC;
125 135
      }
126 136

  
137
///////////////////////////////////////////////////////////////////////////////////////////////////
138

  
139
    public int getDarkTrans()
140
    {
141
        return mDarkT;
142
    }
143

  
144
///////////////////////////////////////////////////////////////////////////////////////////////////
145

  
146
    public int getLightTrans()
147
    {
148
        return mLightT;
149
    }
150

  
151
///////////////////////////////////////////////////////////////////////////////////////////////////
152

  
153
    public int getSelectedColor()
154
    {
155
        return mSelectC;
156
    }
157

  
127 158
///////////////////////////////////////////////////////////////////////////////////////////////////
128 159

  
129 160
    public void setUpBackgroundColor(DistortedFramebuffer df)
src/main/java/org/distorted/main/MainObjectPopup.java
14 14
import android.content.Context;
15 15
import android.content.res.ColorStateList;
16 16
import android.content.res.Resources;
17
import android.graphics.drawable.ColorDrawable;
17 18
import android.util.TypedValue;
18 19
import android.view.Gravity;
19 20
import android.view.LayoutInflater;
......
52 53
    mPopup.setContentView(layout);
53 54
    mPopup.setFocusable(true);
54 55

  
56
    Resources res = act.getResources();
57
    int l = res.getColor(act.getLightTrans());
58
    mPopup.setBackgroundDrawable(new ColorDrawable(l));
59

  
55 60
    mObjectOrdinal = ordinal;
56 61
    boolean firstButtonShown = false;
57 62

  
src/main/java/org/distorted/main/MainSettingsPopup.java
11 11

  
12 12
import android.content.Context;
13 13
import android.content.res.Resources;
14
import android.graphics.drawable.ColorDrawable;
14 15
import android.os.Build;
15 16
import android.view.Gravity;
16 17
import android.view.LayoutInflater;
......
95 96

  
96 97
    LayoutInflater layoutInflater = (LayoutInflater) act.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
97 98
    final View layout = layoutInflater.inflate(id, null);
99
    final View title  = layout.findViewById(R.id.settingsTitle);
98 100

  
99 101
    mPopup = new PopupWindow(act);
100 102
    mPopup.setContentView(layout);
101 103
    mPopup.setFocusable(true);
102 104

  
105
    Resources res = act.getResources();
106
    int d = res.getColor(act.getDarkTrans());
107
    int l = res.getColor(act.getLightTrans());
108

  
109
    mPopup.setBackgroundDrawable(new ColorDrawable(l));
110
    title.setBackground(new ColorDrawable(d));
111
    mPopup.setElevation(100);
112

  
103 113
    Spinner sortSpinner  = layout.findViewById(R.id.sortMethod);
104 114
    sortSpinner.setOnItemSelectedListener(this);
105 115

  
src/main/java/org/distorted/solverui/ScreenSolver.java
374 374
    for(int b=0; b<mNumColors; b++)
375 375
      {
376 376
      Drawable d = mColorButton[b].getBackground();
377

  
378
      if( b==mCurrentButton )
379
        {
380
        d.setColorFilter(ContextCompat.getColor(act,R.color.red), PorterDuff.Mode.MULTIPLY);
381
        }
382
      else
383
        {
384
        d.clearColorFilter();
385
        }
377
      int s = b==mCurrentButton ? act.getSelectedColor() : act.getNormalColor();
378
      d.setColorFilter(ContextCompat.getColor(act,s), PorterDuff.Mode.MULTIPLY);
386 379
      }
387 380
    }
388 381

  
src/main/res/drawable/badge_circle.xml
1 1
<shape xmlns:android="http://schemas.android.com/apk/res/android"
2 2
  android:shape="rectangle">
3 3
  <corners
4
    android:radius="10dip"/>
4
    android:radius="10dp"/>
5 5
  <solid
6
    android:color="#F00" />
6
    android:color="?selectC" />
7 7
  <stroke
8
    android:width="2dip"
9
    android:color="#FFF" />
8
    android:width="2dp"
9
    android:color="@color/white" />
10 10
  <padding
11
    android:left="8dip"
12
    android:right="8dip"
13
    android:top="5dip"
14
    android:bottom="5dip" />
11
    android:left="8dp"
12
    android:right="8dp"
13
    android:top="5dp"
14
    android:bottom="5dp" />
15 15
</shape>
16 16

  
17 17

  
src/main/res/layout/dialog_about.xml
2 2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 3
    android:layout_width="match_parent"
4 4
    android:layout_height="wrap_content"
5
    android:background="?normalC"
5
    android:background="?mediumC"
6 6
    android:orientation="vertical">
7 7

  
8 8
    <LinearLayout
src/main/res/layout/dialog_delete_object.xml
3 3
    android:layout_width="match_parent"
4 4
    android:layout_height="match_parent"
5 5
    android:gravity="center_horizontal"
6
    android:background="?normalC"
6 7
    android:orientation="vertical">
7 8

  
8 9
    <LinearLayout
src/main/res/layout/dialog_save_object.xml
3 3
    android:layout_width="match_parent"
4 4
    android:layout_height="match_parent"
5 5
    android:gravity="center_horizontal"
6
    android:background="?normalC"
6 7
    android:orientation="vertical">
7 8

  
8 9
    <LinearLayout
src/main/res/layout/dialog_scores_downloading.xml
5 5
  android:layout_height="match_parent"
6 6
  android:textSize="32sp"
7 7
  android:gravity="center"
8
  android:background="?darkC"
8 9
  android:padding="10dp"/>
src/main/res/layout/dialog_scrollable_panes.xml
3 3
    android:id="@+id/updates_scroll"
4 4
    android:layout_width="match_parent"
5 5
    android:layout_height="match_parent"
6
    android:background="?darkC"
6
    android:background="?mediumC"
7 7
    android:paddingLeft="10dp"
8 8
    android:paddingRight="10dp">
9 9

  
src/main/res/layout/dialog_tutorial_row.xml
3 3
    android:layout_width="fill_parent"
4 4
    android:layout_height="fill_parent"
5 5
    android:gravity="center|fill_horizontal"
6
    android:background="?normalC"
6
    android:background="?mediumC"
7 7
    android:orientation="vertical">
8 8

  
9 9
    <TextView
src/main/res/layout/main.xml
142 142
                android:layout_alignTop="@+id/buttonUpdates"
143 143
                android:layout_alignEnd="@+id/buttonUpdates"
144 144
                android:scaleType="fitCenter"
145
                android:textColor="#FFF"
145
                android:textColor="@color/white"
146 146
                android:textSize="16sp"
147 147
                android:textStyle="bold"
148 148
                android:background="@drawable/badge_circle"/>
src/main/res/layout/settings_popup.xml
12 12
        android:layout_height="wrap_content"
13 13
        android:text="@string/settings_title"
14 14
        android:textSize="34sp"
15
        android:background="?lightC"
16 15
        android:gravity="center"/>
17 16

  
18 17
   <GridLayout
src/main/res/layout/settings_popup_android25.xml
12 12
        android:layout_height="wrap_content"
13 13
        android:text="@string/settings_title"
14 14
        android:textSize="34sp"
15
        android:background="?lightC"
16 15
        android:gravity="center"/>
17 16

  
18 17
   <GridLayout
src/main/res/layout/settings_spinner_item.xml
10 10
    android:textSize="24sp"
11 11
    android:gravity="start"
12 12
    android:singleLine="true"
13
    android:textColor="#FFFFFF"
13
    android:textColor="@color/white"
14
    android:background="?veryDarkC"
14 15
    />
src/main/res/layout/spinner_item.xml
6 6
    android:layout_height="wrap_content"
7 7
    android:textSize="30sp"
8 8
    android:gravity="center"
9
    android:textColor="#FFFFFF"
10
    android:padding="5dip"
9
    android:textColor="@color/white"
10
    android:background="?veryDarkC"
11
    android:padding="5dp"
11 12
    />
src/main/res/layout/tutorial.xml
4 4
    android:layout_height="match_parent"
5 5
    android:layout_marginLeft="0dp"
6 6
    android:layout_marginRight="0dp"
7
    android:background="@android:color/transparent"
7
    android:background="?lightC"
8 8
    android:orientation="vertical" >
9 9

  
10 10
    <WebView
11 11
        android:id="@+id/tutorialVideoView"
12 12
        android:layout_width="match_parent"
13 13
        android:layout_height="0dp"
14
        android:layout_weight="1"/>
14
        android:layout_weight="1"
15
        android:background="?lightC"/>
15 16

  
16 17
    <RelativeLayout
17 18
        android:id="@+id/tutorialLowerPart"
src/main/res/layout/tutorial_no_webview.xml
4 4
    android:layout_height="match_parent"
5 5
    android:layout_marginLeft="0dp"
6 6
    android:layout_marginRight="0dp"
7
    android:background="@android:color/transparent"
7
    android:background="?lightC"
8 8
    android:orientation="vertical" >
9 9

  
10 10
    <TextView
src/main/res/values/attr.xml
7 7
<attr name="mediumC" format="reference|color" />
8 8
<attr name="lightC" format="reference|color" />
9 9
<attr name="passedC" format="reference|color" />
10
<attr name="lightT" format="reference|color" />
11
<attr name="passedT" format="reference|color" />
12
<attr name="selectC" format="reference|color" />
10 13

  
11 14
</resources>
src/main/res/values/colors.xml
1 1
<?xml version="1.0" encoding="utf-8"?>
2 2
<resources>
3 3

  
4
    <color name="red">#ffff0000</color>
5 4
    <color name="white">#ffffffff</color>
6 5

  
7
    <color name="veryDarkGreen">#ff004400</color>
8
    <color name="darkGreen">#ff007700</color>
6
    <color name="veryDarkGreen">#ff003000</color>
7
    <color name="darkGreen">#ff005500</color>
9 8
    <color name="normalGreen">#ff009000</color>
10
    <color name="mediumGreen">#ff00aa00</color>
11
    <color name="lightGreen">#ff00cc00</color>
9
    <color name="mediumGreen">#ff00a500</color>
10
    <color name="lightGreen">#ff00bb00</color>
12 11
    <color name="passedGreen">#ff333333</color>
12
    <color name="transLGreen">#e0008000</color>
13
    <color name="transDGreen">#cc005500</color>
14
    <color name="selectGreen">#ffff0000</color>
13 15

  
14 16
    <color name="veryDarkGrey">#ff111111</color>
15 17
    <color name="darkGrey">#ff222222</color>
......
17 19
    <color name="mediumGrey">#ff444444</color>
18 20
    <color name="lightGrey">#ff555555</color>
19 21
    <color name="passedGrey">#ff00a000</color>
22
    <color name="transLGrey">#e0333333</color>
23
    <color name="transDGrey">#cc202020</color>
24
    <color name="selectGrey">#ffff0000</color>
20 25

  
21 26
    <color name="veryDarkWhite">#ff080808</color>
22 27
    <color name="darkWhite">#ffa0a0a0</color>
......
24 29
    <color name="mediumWhite">#ffe0e0e0</color>
25 30
    <color name="lightWhite">#ffffffff</color>
26 31
    <color name="passedWhite">#ff00a000</color>
32
    <color name="transLWhite">#ccffffff</color>
33
    <color name="transDWhite">#cca0a0a0</color>
34
    <color name="selectWhite">#ffff0000</color>
27 35
</resources>
src/main/res/values/styles.xml
19 19
        <item name="mediumC">@color/mediumGrey</item>
20 20
        <item name="lightC">@color/lightGrey</item>
21 21
        <item name="passedC">@color/passedGrey</item>
22
        <item name="selectC">@color/selectGrey</item>
22 23
   </style>
23 24

  
24 25
   <style name="WhiteTheme" parent="@style/BaseMaterialThemeNoActionBar">
......
28 29
        <item name="mediumC">@color/mediumWhite</item>
29 30
        <item name="lightC">@color/lightWhite</item>
30 31
        <item name="passedC">@color/passedWhite</item>
32
        <item name="selectC">@color/selectWhite</item>
31 33
   </style>
32 34

  
33 35
   <style name="GreenTheme" parent="@style/BaseMaterialThemeNoActionBar">
......
37 39
        <item name="mediumC">@color/mediumGreen</item>
38 40
        <item name="lightC">@color/lightGreen</item>
39 41
        <item name="passedC">@color/passedGreen</item>
42
        <item name="selectC">@color/selectGreen</item>
40 43
   </style>
41 44

  
42 45
   <style name="NegativeButtonStyle" parent="Widget.MaterialComponents.Button.TextButton.Dialog">

Also available in: Unified diff