wip: start working on dark theme
I've been toying around #86 and would like to add support a dark theme based on the system DayNight theme.
It's not extremely clear to me what should be done but this is the gist of it
- move theming to values (I think we could do without but Android Studio complains)
- inherit from appcompat DayNight to support system dark mode
at the moment the appTheme is not even populated but there you can put the values for the style of views and then apply the style on the single elements.
So let's see the bad news; when changing this I get some strange error about not finding the Main_Activity so this is definitely something related to the android runtime and how appcompat expect things to be done.
Here's the log for this error, unfortunately I don't have that much experience so I'm not sure how to proceed
Error while executing: am start -n "de.j4velin.pedometer/de.j4velin.pedometer.ui.Activity_Main" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=de.j4velin.pedometer/.ui.Activity_Main }
Error type 3
Error: Activity class {de.j4velin.pedometer/de.j4velin.pedometer.ui.Activity_Main} does not exist.
Error while Launching activity
Installing on a virtual device got me further and now the error is caused by setting the action bar so definitely my bad. If you know how to fix this further please let me know
E/AndroidRuntime: FATAL EXCEPTION: main
Process: de.j4velin.pedometer, PID: 3647
java.lang.RuntimeException: Unable to resume activity {de.j4velin.pedometer/de.j4velin.pedometer.ui.Activity_Main}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3581)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3621)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2862)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference
at de.j4velin.pedometer.ui.Fragment_Overview.onResume(Fragment_Overview.java:116)
at android.app.Fragment.performResume(Fragment.java:2554)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1322)
at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1557)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1618)
at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3027)
at android.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:2989)
at android.app.FragmentController.dispatchResume(FragmentController.java:200)
at android.app.Activity.performResume(Activity.java:7138)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3556)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3621)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2862)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)