Add dark theme
app/src/main/java/eu/lepiller/nani/MainActivity.java
| 76 | 76 | ||
| 77 | 77 | Button radical_button = findViewById(R.id.radical_button); | |
| 78 | 78 | ||
| 79 | - | pagerAdapter = new ResultPagerAdapter(this.getApplicationContext()); | |
| 79 | + | pagerAdapter = new ResultPagerAdapter(this); | |
| 80 | 80 | pagerAdapter.setReadingStyle(readingStyle); | |
| 81 | 81 | pagerAdapter.notifyDataSetChanged(); | |
| 82 | 82 | viewPager2.setAdapter(pagerAdapter); |
app/src/main/java/eu/lepiller/nani/PitchDiagramView.java
| 1 | 1 | package eu.lepiller.nani; | |
| 2 | 2 | ||
| 3 | 3 | import android.content.Context; | |
| 4 | + | import android.content.res.Configuration; | |
| 4 | 5 | import android.content.res.TypedArray; | |
| 5 | 6 | import android.graphics.Canvas; | |
| 6 | 7 | import android.graphics.Color; | |
… | |||
| 45 | 46 | ||
| 46 | 47 | private void setDefaults() { | |
| 47 | 48 | textColor = getContext().getResources().getColor(android.R.color.tab_indicator_text); | |
| 48 | - | pitchColor = getContext().getResources().getColor(android.R.color.background_dark); | |
| 49 | + | int mode = getContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; | |
| 50 | + | if(mode == Configuration.UI_MODE_NIGHT_NO) { | |
| 51 | + | pitchColor = getContext().getResources().getColor(android.R.color.background_dark); | |
| 52 | + | } else if(mode == Configuration.UI_MODE_NIGHT_YES) { | |
| 53 | + | pitchColor = getContext().getResources().getColor(android.R.color.background_light); | |
| 54 | + | } | |
| 49 | 55 | textSize = new TextView(getContext()).getTextSize(); | |
| 50 | 56 | } | |
| 51 | 57 | ||
app/src/main/res/drawable-night/ic_pause.xml unknown status 1
| 1 | + | <vector xmlns:android="http://schemas.android.com/apk/res/android" | |
| 2 | + | android:width="32dp" | |
| 3 | + | android:height="32dp" | |
| 4 | + | android:viewportWidth="32" | |
| 5 | + | android:viewportHeight="32"> | |
| 6 | + | <path | |
| 7 | + | android:pathData="M6,2h8v28h-8z" | |
| 8 | + | android:strokeWidth="0.22660473" | |
| 9 | + | android:fillColor="#dddddd"/> | |
| 10 | + | <path | |
| 11 | + | android:pathData="M18,2h8v28h-8z" | |
| 12 | + | android:strokeWidth="0.22660473" | |
| 13 | + | android:fillColor="#dddddd"/> | |
| 14 | + | </vector> |
app/src/main/res/drawable-night/ic_pitch_border.xml unknown status 1
| 1 | + | <?xml version="1.0" encoding="utf-8"?> | |
| 2 | + | <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> | |
| 3 | + | <solid android:color="@android:color/black" /> | |
| 4 | + | <stroke android:width="1dip" android:color="#444"/> | |
| 5 | + | </shape> | |
| 5 | < | ||
| 0 | 6 | < | \ No newline at end of file |
app/src/main/res/layout/activity_help_pitch.xml
| 124 | 124 | android:orientation="vertical" | |
| 125 | 125 | android:layout_width="wrap_content" | |
| 126 | 126 | android:layout_height="wrap_content" | |
| 127 | - | android:background="@android:color/white"> | |
| 127 | + | android:background="@color/colorWhite"> | |
| 128 | 128 | ||
| 129 | 129 | <eu.lepiller.nani.PitchDiagramView | |
| 130 | 130 | android:layout_width="wrap_content" | |
… | |||
| 180 | 180 | android:orientation="vertical" | |
| 181 | 181 | android:layout_width="wrap_content" | |
| 182 | 182 | android:layout_height="wrap_content" | |
| 183 | - | android:background="@android:color/white"> | |
| 183 | + | android:background="@color/colorWhite"> | |
| 184 | 184 | ||
| 185 | 185 | <eu.lepiller.nani.PitchDiagramView | |
| 186 | 186 | android:layout_width="wrap_content" | |
… | |||
| 258 | 258 | android:orientation="vertical" | |
| 259 | 259 | android:layout_width="wrap_content" | |
| 260 | 260 | android:layout_height="wrap_content" | |
| 261 | - | android:background="@android:color/white"> | |
| 261 | + | android:background="@color/colorWhite"> | |
| 262 | 262 | ||
| 263 | 263 | <eu.lepiller.nani.PitchDiagramView | |
| 264 | 264 | android:layout_width="wrap_content" | |
… | |||
| 359 | 359 | <LinearLayout | |
| 360 | 360 | android:layout_width="wrap_content" | |
| 361 | 361 | android:layout_height="wrap_content" | |
| 362 | - | android:background="@android:color/white" | |
| 362 | + | android:background="@color/colorWhite" | |
| 363 | 363 | android:orientation="vertical"> | |
| 364 | 364 | ||
| 365 | 365 | <eu.lepiller.nani.PitchDiagramView | |
app/src/main/res/layout/activity_help_radical.xml
| 125 | 125 | tools:ignore="HardcodedText" /> | |
| 126 | 126 | </TableRow> | |
| 127 | 127 | <TableRow | |
| 128 | - | android:background="@android:color/white" | |
| 128 | + | android:background="@color/colorWhite" | |
| 129 | 129 | android:layout_width="wrap_content" | |
| 130 | 130 | android:layout_height="wrap_content"> | |
| 131 | 131 | <TextView | |
… | |||
| 216 | 216 | tools:ignore="HardcodedText" /> | |
| 217 | 217 | </TableRow> | |
| 218 | 218 | <TableRow | |
| 219 | - | android:background="@android:color/white" | |
| 219 | + | android:background="@color/colorWhite" | |
| 220 | 220 | android:layout_width="wrap_content" | |
| 221 | 221 | android:layout_height="wrap_content"> | |
| 222 | 222 | <TextView | |
… | |||
| 314 | 314 | tools:ignore="HardcodedText" /> | |
| 315 | 315 | </TableRow> | |
| 316 | 316 | <TableRow | |
| 317 | - | android:background="@android:color/white" | |
| 317 | + | android:background="@color/colorWhite" | |
| 318 | 318 | android:layout_width="wrap_content" | |
| 319 | 319 | android:layout_height="wrap_content"> | |
| 320 | 320 | <TextView | |
app/src/main/res/layout/activity_help_romaji.xml
| 43 | 43 | android:layout_height="wrap_content" | |
| 44 | 44 | android:layout_marginBottom="16dp"> | |
| 45 | 45 | <TableRow | |
| 46 | - | android:background="@android:color/white"> | |
| 46 | + | android:background="@color/colorWhite"> | |
| 47 | 47 | <LinearLayout | |
| 48 | 48 | android:layout_width="wrap_content" | |
| 49 | 49 | android:layout_height="wrap_content" | |
… | |||
| 383 | 383 | </LinearLayout> | |
| 384 | 384 | </TableRow> | |
| 385 | 385 | <TableRow | |
| 386 | - | android:background="@android:color/white"> | |
| 386 | + | android:background="@color/colorWhite"> | |
| 387 | 387 | <LinearLayout | |
| 388 | 388 | android:layout_width="wrap_content" | |
| 389 | 389 | android:layout_height="wrap_content" | |
… | |||
| 785 | 785 | </LinearLayout> | |
| 786 | 786 | </TableRow> | |
| 787 | 787 | <TableRow | |
| 788 | - | android:background="@android:color/white"> | |
| 788 | + | android:background="@color/colorWhite"> | |
| 789 | 789 | <LinearLayout | |
| 790 | 790 | android:layout_width="wrap_content" | |
| 791 | 791 | android:layout_height="wrap_content" | |
… | |||
| 1264 | 1264 | </LinearLayout> | |
| 1265 | 1265 | </TableRow> | |
| 1266 | 1266 | <TableRow | |
| 1267 | - | android:background="@android:color/white"> | |
| 1267 | + | android:background="@color/colorWhite"> | |
| 1268 | 1268 | <LinearLayout | |
| 1269 | 1269 | android:layout_width="wrap_content" | |
| 1270 | 1270 | android:layout_height="wrap_content" | |
… | |||
| 1576 | 1576 | </LinearLayout> | |
| 1577 | 1577 | </TableRow> | |
| 1578 | 1578 | <TableRow | |
| 1579 | - | android:background="@android:color/white"> | |
| 1579 | + | android:background="@color/colorWhite"> | |
| 1580 | 1580 | <LinearLayout | |
| 1581 | 1581 | android:layout_width="wrap_content" | |
| 1582 | 1582 | android:layout_height="wrap_content" | |
… | |||
| 1957 | 1957 | </LinearLayout> | |
| 1958 | 1958 | </TableRow> | |
| 1959 | 1959 | <TableRow | |
| 1960 | - | android:background="@android:color/white"> | |
| 1960 | + | android:background="@color/colorWhite"> | |
| 1961 | 1961 | <LinearLayout | |
| 1962 | 1962 | android:layout_width="wrap_content" | |
| 1963 | 1963 | android:layout_height="wrap_content" | |
… | |||
| 2331 | 2331 | </LinearLayout> | |
| 2332 | 2332 | </TableRow> | |
| 2333 | 2333 | <TableRow | |
| 2334 | - | android:background="@android:color/white"> | |
| 2334 | + | android:background="@color/colorWhite"> | |
| 2335 | 2335 | <LinearLayout | |
| 2336 | 2336 | android:layout_width="wrap_content" | |
| 2337 | 2337 | android:layout_height="wrap_content" | |
… | |||
| 2648 | 2648 | </LinearLayout> | |
| 2649 | 2649 | </TableRow> | |
| 2650 | 2650 | <TableRow | |
| 2651 | - | android:background="@android:color/white"> | |
| 2651 | + | android:background="@color/colorWhite"> | |
| 2652 | 2652 | <LinearLayout | |
| 2653 | 2653 | android:layout_width="wrap_content" | |
| 2654 | 2654 | android:layout_height="wrap_content" | |
… | |||
| 2806 | 2806 | tools:ignore="HardcodedText" /> | |
| 2807 | 2807 | </TableRow> | |
| 2808 | 2808 | <TableRow | |
| 2809 | - | android:background="@android:color/white"> | |
| 2809 | + | android:background="@color/colorWhite"> | |
| 2810 | 2810 | <TextView | |
| 2811 | 2811 | android:layout_width="wrap_content" | |
| 2812 | 2812 | android:layout_height="wrap_content" | |
… | |||
| 2844 | 2844 | tools:ignore="HardcodedText" /> | |
| 2845 | 2845 | </TableRow> | |
| 2846 | 2846 | <TableRow | |
| 2847 | - | android:background="@android:color/white"> | |
| 2847 | + | android:background="@color/colorWhite"> | |
| 2848 | 2848 | <TextView | |
| 2849 | 2849 | android:layout_width="wrap_content" | |
| 2850 | 2850 | android:layout_height="wrap_content" | |
… | |||
| 2882 | 2882 | tools:ignore="HardcodedText" /> | |
| 2883 | 2883 | </TableRow> | |
| 2884 | 2884 | <TableRow | |
| 2885 | - | android:background="@android:color/white"> | |
| 2885 | + | android:background="@color/colorWhite"> | |
| 2886 | 2886 | <TextView | |
| 2887 | 2887 | android:layout_width="wrap_content" | |
| 2888 | 2888 | android:layout_height="wrap_content" | |
app/src/main/res/values-night/colors.xml unknown status 1
| 1 | + | <?xml version="1.0" encoding="utf-8"?> | |
| 2 | + | <resources> | |
| 3 | + | <color name="colorPrimary">#008577</color> | |
| 4 | + | <color name="colorPrimaryDark">#00574B</color> | |
| 5 | + | <color name="colorAccent">#D81B60</color> | |
| 6 | + | <color name="colorWhite">#000000</color> | |
| 7 | + | <color name="colorGrey">#111111</color> | |
| 8 | + | <color name="colorUpdate">#F4DE96</color> | |
| 9 | + | <color name="colorDarkerGrey">#1f1f1f</color> | |
| 10 | + | <color name="colorDarkGrey">#2a2a2a</color> | |
| 11 | + | <color name="colorTextGrey">#909090</color> | |
| 12 | + | <color name="colorBlack">#505050</color> | |
| 13 | + | <color name="colorLang">#925424</color> | |
| 14 | + | </resources> |
app/src/main/res/values/colors.xml
| 3 | 3 | <color name="colorPrimary">#008577</color> | |
| 4 | 4 | <color name="colorPrimaryDark">#00574B</color> | |
| 5 | 5 | <color name="colorAccent">#D81B60</color> | |
| 6 | + | <color name="colorWhite">#FFFFFF</color> | |
| 6 | 7 | <color name="colorGrey">#EEF2EE</color> | |
| 7 | 8 | <color name="colorUpdate">#F4DE96</color> | |
| 8 | 9 | <color name="colorDarkerGrey">#e0e3e0</color> |
app/src/main/res/values/styles.xml
| 1 | 1 | <resources> | |
| 2 | 2 | ||
| 3 | 3 | <!-- Base application theme. --> | |
| 4 | - | <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> | |
| 4 | + | <style name="AppTheme" parent="Theme.AppCompat.DayNight"> | |
| 5 | 5 | <!-- Customize your theme here. --> | |
| 6 | 6 | <item name="colorPrimary">@color/colorPrimary</item> | |
| 7 | 7 | <item name="colorPrimaryDark">@color/colorPrimaryDark</item> |