Skip to content

[Theming] Dynamically use server color - #1031

Merged
AndyScherzinger merged 102 commits into
masterfrom
userTheming
Jul 13, 2017
Merged

AndyScherzinger merged 102 commits into
masterfrom
userTheming

Conversation

@tobiasKaminsky

@tobiasKaminsky tobiasKaminsky commented May 22, 2017 •

Copy link
Copy Markdown
Member

This overwrites the default server color and uses the color provided via theming app.

TODO:

  • Common
    • change font color based on background color: Server & Mobil App Theme Color Integration ios#166 (comment)
    • compute lighter / darker color
    • change color of headerbar
    • test with disabled theming app
    • test with older nc version (10,11)
    • test with older android version
    • test changing on the fly
    • refactor: move all theming functions into ThemingUtil
    • loading spinner
    • all empty messages grey, except of folder (blue) and star icon (yellow)
  • UserInfoActivity
    • use background image for user info toolbar background
    • handle background color for drawer (if image in theming app is disabled)
    • change color of user info icons -> use the correct color of the account
    • wrong aspect ratio
  • ManageAccountActivity
    • change color of font and active icon in accounts list
  • FileDisplayActivity
    • change color of FAB
    • search hint and search input text is not black/white
    • change color of folder icons
    • show server name instead of Nextcloud when browsing root folder
    • update slogan right after account changing
  • Drawer
  • use background image for drawer
    • handle background color for drawer (if image in theming app is disabled)
    • preserve aspect ratio
    • show image right after setup / account switching
    • background image url is "/index.php/apps/theming/loginbackground?v=43": verify that new image is downloaded after changing image
  • image is scaled server-side to max 1920p @ 75%
  • PassCode
  • FingerPrintActivity

OPEN / UNRESOLVED:

  • change color of main FAB button -> currently not supported in library
  • toolbar: changed only after restart or entering and leaving multiselect
  • UploadFilesActivity: "select all" in overflow menu: not colored and wrong icon(?!)
  • ShareDialog: theming header of DatePicker not possible, only with https://github.com/wdullaer/MaterialDateTimePicker
  • AutoUpload: uploadBehaviour: bullet points of dialog. Canntot use theme: Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor.
  • SwitchPreference not possible

@tobiasKaminsky

Copy link
Copy Markdown
Member Author

In theming app on server we only define one basic color.
But in android we use some more:

  • primary
  • primary dark
  • color accent

How can we get these colors? color accent is a bit lighter, the other one darker.
Shall this be auto-generated? If so, how? As I am not a designer something rgb transformation rule would be nice.

@AndyScherzinger

AndyScherzinger commented May 22, 2017 •

Copy link
Copy Markdown
Member
  • use background image for drawer (do we need a scaled version for this?)
    • definitely, that is why right now we ship a scaled version, since letting Android OS scale the original image at runtime is a real performance killer (drawer open/close starts to hang...!)
  • handle background color for drawer (if image in theming app is disabled)
    • this is either primary or primary dark at the moment

How can we get these colors?

We are more or less free to choose how they get calculated since they do not really follow Material Design guidelines (simply since we do not use a truly different accent color but a slightly lighter one). Maybe @juliushaertl has an idea on color calculation here since he is the server side color calculation hero 😃

@AndyScherzinger AndyScherzinger added the needs info Waiting for info from user(s). Issues with this label will auto-stale. label May 22, 2017
@juliusknorr

juliusknorr commented May 22, 2017 •

Copy link
Copy Markdown
Member

We are more or less free to choose how they get calculated since they do not really follow Material Design guidelines (simply since we do not use a truly different accent color but a slightly lighter one). Maybe @juliushaertl has an idea on color calculation here since he is the server side color calculation hero 

It should work quite well if you convert the RGB value to the HSL color space and then either increase or decrease the lightness (L) component to get brighter/darker color tones.

Unfortunately android sdk doesn't seem to support HSL out of the box or at least I can't find it at the moment. But conversion is not that hard, see: https://tips4java.wordpress.com/2009/07/05/hsl-color/

@AndyScherzinger
AndyScherzinger force-pushed the colorFolderNew branch 4 times, most recently from 17b227b to 3d772ab Compare May 24, 2017 07:46
@AndyScherzinger

Copy link
Copy Markdown
Member

primary_dark should be the fallback for drawer and user info screen background image in case no background image could be retrieved from server

@tobiasKaminsky

Copy link
Copy Markdown
Member Author

@juliushaertl thanks for pointing out with HSL.
There is a native way with ColorUtils; currently I am testing with +/- 0.2 for L.

@tobiasKaminsky

Copy link
Copy Markdown
Member Author

The bullet points are now grey as discussed as we cannot dynamically theme them.

@AndyScherzinger

Copy link
Copy Markdown
Member

regarding colored links in participate view: which language do you use? The strings need to be changed on transifex, and I can only do this for en-us (the default) in github, so en-gb and german will not work currently.

@tobiasKaminsky than I guess that is the reason for it since I run English (Germany) on my device 😁

int trackColor = Color.argb(77, Color.red(color), Color.green(color), Color.blue(color));

// setting the thumb color
DrawableCompat.setTintList(switchView.getThumbDrawable(), new ColorStateList(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs an API check since we support 14+ while getThumbDrawable() is v16+

new int[]{color, Color.WHITE}));

// setting the track color
DrawableCompat.setTintList(switchView.getTrackDrawable(), new ColorStateList(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs an API check since we support 14+ while getTrackDrawable() is v16+

@AndyScherzinger

Copy link
Copy Markdown
Member

Awesome fix @tobiasKaminsky - very minor thing which we can ignore: The settings switches are slightly lighter colored than the "regular ones, see screenshot mix:

device-2017-07-11-122915

@tobiasKaminsky

Copy link
Copy Markdown
Member Author

Feel free to try to set the color to a better value ;-)

@AndyScherzinger

Copy link
Copy Markdown
Member

I'll have a look!

@AndyScherzinger

AndyScherzinger commented Jul 11, 2017 •

Copy link
Copy Markdown
Member

👍 fine with all the changes and by now thoroughly tested on dev releases and also by me - @mario feel free to review/approve/merge :)

Approved with PullApprove

@juliusknorr

Copy link
Copy Markdown
Member

Great work everyone, works really nice in the dev release 👏

@AndyScherzinger

Copy link
Copy Markdown
Member

@mario @tobiasKaminsky in case we get this merged today I' might be able to update the auto upload branch this evening if there aren't too many conflicts to resolve. :D

@mario

mario commented Jul 12, 2017

Copy link
Copy Markdown
Contributor

@AndyScherzinger if you feel like this is ok, feel free to merge - I will not be able to review it in a while. Thanks.

@AndyScherzinger

AndyScherzinger commented Jul 13, 2017 •

Copy link
Copy Markdown
Member

👍 Updated to latest master and ran a final test 👍

Approved with PullApprove

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants