Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AMOLED theme #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions src/main/java/trikita/talalarmo/SettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,32 @@ public class SettingsActivity extends Activity
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
if (App.getState().settings().theme() == 0) {
setTheme(android.R.style.Theme_Holo_Light);
} else {
setTheme(android.R.style.Theme_Holo);
switch (App.getState().settings().theme()) {
case 0:
setTheme(android.R.style.Theme_Holo_Light);
break;
case 1:
setTheme(android.R.style.Theme_Holo);
break;
case 2:
setTheme(R.style.AMOLED);
break;
default:
setTheme(android.R.style.Theme_Holo_Light);
}
} else {
if (App.getState().settings().theme() == 0) {
setTheme(android.R.style.Theme_Material_Light);
} else {
setTheme(android.R.style.Theme_Material);
switch (App.getState().settings().theme()) {
case 0:
setTheme(android.R.style.Theme_Material_Light);
break;
case 1:
setTheme(android.R.style.Theme_Material);
break;
case 2:
setTheme(R.style.AMOLED);
break;
default:
setTheme(android.R.style.Theme_Holo_Light);
}
}

Expand Down
17 changes: 12 additions & 5 deletions src/main/java/trikita/talalarmo/ui/Theme.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ public enum Theme {
LIGHT(0xffffffff, 0x0f555555, 0xff666666, 0xff0097a7, 0xff00bcd4,
0xff212121, 0xff727272, true),
DARK(0xff002b36, 0x40002129, 0xffcbd2d2, 0xff002129, 0xffe91e63,
0xddfdf6e3, 0xff93a1a1, true);
0xddfdf6e3, 0xff93a1a1, true),
AMOLED(0xff000000, 0xff0a0a0a, 0xffcccccc, 0xff000000, 0xffc51162,
0xffcccccc, 0xffbbbbbb, true);

public final int backgroundColor;
public final int backgroundTranslucentColor;
Expand All @@ -33,10 +35,15 @@ public enum Theme {
}

public static Theme get(int index) {
if (index == 0) {
return LIGHT;
} else {
return DARK;
switch (index) {
case 0:
return LIGHT;
case 1:
return DARK;
case 2:
return AMOLED;
default:
return LIGHT;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
<string-array name="settings_themes">
<item>ライト</item>
<item>ダーク</item>
<item>AMOLED</item>
</string-array>
</resources>
1 change: 1 addition & 0 deletions src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
<string-array name="settings_themes">
<item>Светлая тема</item>
<item>Темная тема</item>
<item>AMOLED</item>
</string-array>
</resources>
1 change: 1 addition & 0 deletions src/main/res/values-uk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
<string-array name="settings_themes">
<item>Світла</item>
<item>Темна</item>
<item>AMOLED</item>
</string-array>
</resources>
7 changes: 7 additions & 0 deletions src/main/res/values-v21/styles.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="android:Theme.Material.NoActionBar" />

<style name="AMOLED" parent="android:Theme.Material" >
<item name="android:windowBackground">@android:color/background_dark</item>
<item name="android:colorBackground">@android:color/black</item>
<item name="android:textColorPrimary">@android:color/secondary_text_dark</item>
<item name="android:colorAccent">#c51162</item>
</style>
</resources>
2 changes: 2 additions & 0 deletions src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
<string-array name="settings_themes">
<item>Light</item>
<item>Dark</item>
<item>AMOLED</item>
</string-array>
<string-array name="settings_themes_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
</resources>
7 changes: 7 additions & 0 deletions src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="android:Theme.Holo.NoActionBar" />

<style name="AMOLED" parent="android:Theme.Holo" >
<item name="android:windowBackground">@android:color/background_dark</item>
<item name="android:colorBackground">@android:color/black</item>
<item name="android:textColorPrimary">@android:color/secondary_text_dark</item>
<item name="android:colorAccent">#c51162</item>
</style>
</resources>