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

wip: start working on dark theme #138

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

wip: start working on dark theme #138

wants to merge 1 commit into from

Conversation

edoput
Copy link

@edoput edoput commented Jun 29, 2019

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.

- move theming to values
- inherit from appcompat DayNight to support system dark mode
@edoput
Copy link
Author

edoput commented Jun 29, 2019

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

@edoput
Copy link
Author

edoput commented Jun 29, 2019

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:3621at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2862at android.app.ActivityThread.-wrap11(Unknown Source:0at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589at android.os.Handler.dispatchMessage(Handler.java:106at android.os.Looper.loop(Looper.java:164at android.app.ActivityThread.main(ActivityThread.java:6494at java.lang.reflect.Method.invoke(Native Methodat com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants