Revision 8c4e4bf4
Added by Leszek Koltunski 24 days ago
src/main/java/org/distorted/helpers/BaseActivity.java | ||
---|---|---|
22 | 22 |
import androidx.appcompat.app.AppCompatActivity; |
23 | 23 |
import androidx.preference.PreferenceManager; |
24 | 24 |
|
25 |
import org.distorted.library.main.DistortedFramebuffer; |
|
25 | 26 |
import org.distorted.main.R; |
26 | 27 |
|
27 | 28 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
44 | 45 |
protected int mScreenWidth, mScreenHeight; |
45 | 46 |
protected int mHeightLowerBar, mHeightUpperBar; |
46 | 47 |
protected float mDensity; |
47 |
protected int mDarkC, mNormalC, mMediumC, mLightC;
|
|
48 |
protected int mVeryDarkC, mDarkC, mNormalC, mMediumC, mLightC, mPassedC;
|
|
48 | 49 |
protected SharedPreferences mPreferences; |
49 | 50 |
|
50 | 51 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
60 | 61 |
switch(mCurrentTheme) |
61 | 62 |
{ |
62 | 63 |
case THEME_WHITE : setTheme(R.style.WhiteTheme); |
63 |
mDarkC = R.color.darkWhite; |
|
64 |
mNormalC = R.color.normalWhite; |
|
65 |
mMediumC = R.color.mediumWhite; |
|
66 |
mLightC = R.color.lightWhite; |
|
64 |
mVeryDarkC= R.color.veryDarkWhite; |
|
65 |
mDarkC = R.color.darkWhite; |
|
66 |
mNormalC = R.color.normalWhite; |
|
67 |
mMediumC = R.color.mediumWhite; |
|
68 |
mLightC = R.color.lightWhite; |
|
69 |
mPassedC = R.color.passedWhite; |
|
67 | 70 |
break; |
68 | 71 |
case THEME_GREEN : setTheme(R.style.GreenTheme); |
69 |
mDarkC = R.color.darkGreen; |
|
70 |
mNormalC = R.color.normalGreen; |
|
71 |
mMediumC = R.color.mediumGreen; |
|
72 |
mLightC = R.color.lightGreen; |
|
72 |
mVeryDarkC= R.color.veryDarkGreen; |
|
73 |
mDarkC = R.color.darkGreen; |
|
74 |
mNormalC = R.color.normalGreen; |
|
75 |
mMediumC = R.color.mediumGreen; |
|
76 |
mLightC = R.color.lightGreen; |
|
77 |
mPassedC = R.color.passedGreen; |
|
73 | 78 |
break; |
74 | 79 |
default : setTheme(R.style.GreyTheme); |
75 |
mDarkC = R.color.darkGrey; |
|
76 |
mNormalC = R.color.normalGrey; |
|
77 |
mMediumC = R.color.mediumGrey; |
|
78 |
mLightC = R.color.lightGrey; |
|
80 |
mVeryDarkC= R.color.veryDarkGrey; |
|
81 |
mDarkC = R.color.darkGrey; |
|
82 |
mNormalC = R.color.normalGrey; |
|
83 |
mMediumC = R.color.mediumGrey; |
|
84 |
mLightC = R.color.lightGrey; |
|
85 |
mPassedC = R.color.passedGrey; |
|
79 | 86 |
break; |
80 | 87 |
} |
81 | 88 |
|
82 | 89 |
super.onCreate(savedState); |
83 | 90 |
} |
84 | 91 |
|
92 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
93 |
|
|
94 |
public int getVeryDarkColor() |
|
95 |
{ |
|
96 |
return mVeryDarkC; |
|
97 |
} |
|
98 |
|
|
99 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
100 |
|
|
101 |
public int getDarkColor() |
|
102 |
{ |
|
103 |
return mDarkC; |
|
104 |
} |
|
105 |
|
|
106 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
107 |
|
|
108 |
public int getNormalColor() |
|
109 |
{ |
|
110 |
return mNormalC; |
|
111 |
} |
|
112 |
|
|
113 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
114 |
|
|
115 |
public int getMediumColor() |
|
116 |
{ |
|
117 |
return mMediumC; |
|
118 |
} |
|
119 |
|
|
120 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
121 |
|
|
122 |
public int getLightColor() |
|
123 |
{ |
|
124 |
return mLightC; |
|
125 |
} |
|
126 |
|
|
127 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
128 |
|
|
129 |
public void setUpBackgroundColor(DistortedFramebuffer df) |
|
130 |
{ |
|
131 |
int color = getResources().getColor(mLightC); |
|
132 |
int r = (color>>16) & 0xff; |
|
133 |
int g = (color>> 8) & 0xff; |
|
134 |
int b = (color ) & 0xff; |
|
135 |
|
|
136 |
float rC = (float)r/255; |
|
137 |
float gC = (float)g/255; |
|
138 |
float bC = (float)b/255; |
|
139 |
|
|
140 |
df.glClearColor(rC, gC, bC, 1.0f); |
|
141 |
} |
|
142 |
|
|
85 | 143 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
86 | 144 |
|
87 | 145 |
public void changeThemeTo(int theme) |
Also available in: Unified diff
progress with colors in styles