-
-
Notifications
You must be signed in to change notification settings - Fork 258
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
Issue #660 - NightMode #661
Conversation
…arkTheme(), changed settings default to NightMode=Auto
Ok, now Codacity and I are in disagreement re readability of that if statement - anyways, tomorrow... |
Allright, the entire isDarkMode thing is a bit off anyways, now that I'm thinking about it. Will finally fix tomorrow. |
@AnotherDaniel Great, thank you! :) I'll take a deeper look at it later today! One thing to know about most nextcloud android apps is, that the translations are provided by transifex. Therefore developers can only modify the @AndyScherzinger do you know if it is a problem for transifex that the translations were modified? Or will they be overwritten anyways? |
@David-Development not a problem afaik, transifex will simply overwrite them |
Pushed a hopefully final change to fix the isDarkMode implementation - before I do anything else I will have to figure out how to run Codacity on my own, before I actuall push stuff. |
# Conflicts: # News-Android-App/src/main/res/values/colors.xml # News-Android-App/src/main/res/values/strings.xml # News-Android-App/src/main/res/values/themes.xml
@AnotherDaniel Awesome work! 👍 I did a little refactoring. There is only one mayor thing that I changed.. I added the support for the OLED theme (again). Along with that, I changed the wording a little too. Therefore there are 4 "Themes" available now: 0: Dark / Light (Default) What do you think? If you don't like it, feel free to change it back or give some feedback :) Btw: I merged the master branch in here.. therefore you might need to update Android Studio to 3.2. |
David, thank you for picking this up! Wording, no real opinions - would be helpful if Google had some official guidance on what this kind of feature should be called; I guess I'll look around a bit just in case there is something. I'd like the OLED thing to be a separate boolean switch, a modifier on the dark theme - I will try to create a branch for that the next few days, if that is ok for you! |
@AnotherDaniel Sounds good! However some concerns regarding the OLED Theme.. I'm still a little hesitant with adding an additional switch for OLED (if the user selected the Light or Auto Theme, this flag wouldn't have any effect on the light theme). On the other hand, adding it as a separate flag makes it more customizable for the user. Therefore I'm looking forward to the solution you'll come up with :) And yes, for sure! Feel free to create a new branch! One question: I tested the day/night mode on my device and it just changed the color to "night" mode (at exactly 10pm). This is quite late as it gets dark around 7-8pm here (Germany). Is this okay or should we try to investigate this a little more as well? |
I'll give it a try then :) Re the switching time: 10pm is expected behavior, yes - judging by the Twitter app, which also uses this Android system auto switch feature I think; also happens at 10pm (and back to day at 6am I believe). So we'd be consistent with what android does, and if someone goes to be earlier they can always switch manually ;-) |
@AnotherDaniel Okay, I see! Thanks for the clarification! |
@AnotherDaniel Found some color issues (e.g. podcast fragment) and noticed, that there are a few color variables that we didn't need anymore. I cleaned everything up a little. Hope that's okay with you? :) |
@David-Development you're funny :) - I won't say how little of all those color definitions and dozens of places where some of them are used I actually understand ;) |
@AnotherDaniel ahah.. well, the css file has a different purpose. The rss news that we receive in the news app contain a HTML body content. See REST API (get-items) in the The content is in the HTML format and it contains links, images, videos etc. Therefore the only logical way of displaying it, is by using a webview and rendering the content into a small html-skeleton. That's what's happening in the I think we even might be able to remove a couple more color attributes from the If you have any further questions or if I can clarify some things, let me know! |
@David-Development Thanks for the explanation above; I've another thing now that's opaque to me :( Any pointers as to where the build system is getting the data used to generate this token in values-fr.xml? I'm a bit stumped... |
@AnotherDaniel Yes.. there was an invalid translation in the Single Sign On Repo (Version 0.1). You can edit the |
Hi @David-Development, I've made some progress - unfortunately I'm not quite sure about how to actually work with git/github yet I think. Description:
It is not applied to any popup-kind of dialogs:
It is also not (yet) applied to the built-in webbrowser view for articles. I am quite pleased for the moment - will look at the webbrowser view next, undecided on whether to touch the pop-up dialog things or if I actually like them to stay a bit lighter... |
… background manually
@AnotherDaniel Awesome! Great work! 👍 I don't think that we need to change the left sidebar or any popup dialogs as they're only visible for a short period of time and it would look weird if they were pitch black as well.. Therefore I think it's just fine the way it is right now! :) I did some refactoring (make the oled switch apply the black color to the webview as well). I also used the PR: https://github.com/AnotherDaniel/news-android/pull/2 |
add oled mode to detail view / use theme for oled instead for setting…
@David-Development Right, this a lot more elegant! Ok the next question would be: are you ok with getting that into the next release of the app? :) |
@AnotherDaniel Yes, I'll merge everything later.. I found some issues that the theme is not properly applied sometimes.. (e.g. when you use oled and dark theme and switch back to auto mode the list is still black). If you restart the app manually it's good..
Awesome! 👍Looking forward to answer some questions and to merge pull requests! :)
Yes, for sure! As we did some major layout changes this will be the perfect time for your feature to be released as well! Are you okay with me putting you on the contributor list of this repo? (You'll be mentioned in the changelog as well) |
Looks like the line int nightModeFlags = context.getResources().getConfiguration().uiMode &
Configuration.UI_MODE_NIGHT_MASK; is returning "dark theme" right at the beginning when using auto mode during day-time.. how annoying.. just a couple of milliseconds later, it's changed to "light theme" correctly.. Need to look into it further.. |
@David-Development Hm sounds like something that might vary per device, timing wise - haven't seen this yet, I only had the switch to/from OLED not work once, but couldn't reproduce. I'll also look around a bit... Sure you can mention me in the contributor list - although it would be more honest to credit stackoverflow... |
@AnotherDaniel Haha.. well, that's what every developer does, isn't it? :) Yeah.. I kind of noticed it a couple of times... tried to add some workarounds for the few cases when it occurs... we'll just have to keep an eye on it. |
@David-Development One thing I seem to have forgotten with the oled-mode switch: I think the setting should be 'false' by default - so in the pref_display.xml file, line 17 we should put this: (don't think this is worth a pull request or even a branch commit...) |
oled mode switch
fix theme caching issues / add logging / cleanup
Oledswitch
I'm still having some annoying issues with the auto mode.. When I open the detail view (webview) for the first time (after 10pm) it's using the light theme.. When I go back and open the detail view again, it's using the dark theme.. I think this has something to do with caching on the Android site.. I'm wondering if we can make this more stable somehow.. I wasn't able to find a callback such as |
@David-Development Crap - will also search for solutions |
@David-Development Hm; I've just tried this with forceReloadCache set to true in line 95 of RssItemToHtmlTask.java Got the black browse brackground on the first go. But: this was the first time I've tried this, didn't attempt with forceReloadCache:false - so no idea yet whether it simply works for me, or whether that flag makes a difference 🔨 |
@AnotherDaniel This shouldn't make any difference as we only cache the selected theme (e.g. Auto / Light / Dark). Caching this is fine. When the auto-mode is enabled, it'll try to figure our whether the current theme is dark or light (depending on daytime) - and that's were the problem occurs.. As far as I can tell, the following line causes the problem as it returns the wrong value sometimes.. I think Google is doing some async work in the background to figure out which theme to choose (e.g. check location / fallback to time in our case). Our code is checking that flag before they figured out whether it's day or night.. I'm not 100% sure though.. need to investigate a little more. int nightModeFlags = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; |
@David-Development Do you get that on the device emulator or on your actual mobile? Does it work if you don't go to the detail view immediately after 10pm, but wait for say 2 minutes? |
Can't reproduce it anymore.. Anyways.. I'm writing some tests to automate this kind of testing a little more :) |
@AnotherDaniel I just made some changes to this branch.. (added tests for nightmode including some fixes for bugs that I found during testing / also brought it up to speed with the master branch). I tried to push my changes to your fork but I noticed, that the branch is not there anymore (in your fork). And I also don't have permission to push to your fork. If you give me permission to your fork I might be able to restore the branch by pushing my history to it. As I used the app during the past couple of days the switch between day/night worked reliable. So I guess we can merge this soon :) |
@David-Development thank you very much for tidying up after me - very interested to see what you did! |
@AnotherDaniel Thank you! 👍 I'll close this one and create a new PR as GitHub won't pickup the new branch (changes) automatically (it's a known issue: isaacs/github#168 (comment)). |
changed theme setting to nightmode selection, update isDarkTheme(), changed settings default to NightMode=Auto
Note: this change set only include localization changes for DE and EN languages, as I do not speak any of the others...