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

Unify button appearance #5217

Merged
merged 1 commit into from
Oct 18, 2023
Merged

Unify button appearance #5217

merged 1 commit into from
Oct 18, 2023

Conversation

Pururun
Copy link
Contributor

@Pururun Pururun commented Oct 1, 2023

  • Make almost all button depend on 3 standard buttons
  • Replace surface and onSurface with our own custom theme color

This is part of the design system overhaul.


This change is Reviewable

@Pururun Pururun added the Android Issues related to Android label Oct 1, 2023
@Pururun Pururun requested a review from Rawa October 1, 2023 20:52
@linear
Copy link

linear bot commented Oct 1, 2023

DROID-379 Unify buttons

Simplify and unify button appearance

@Pururun Pururun force-pushed the unify-buttons-droid-379 branch 2 times, most recently from 8f6d184 to 47aec55 Compare October 2, 2023 06:47
Copy link
Contributor

@Rawa Rawa left a comment

Choose a reason for hiding this comment

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

Reviewed 33 of 34 files at r1, all commit messages.
Reviewable status: 33 of 34 files reviewed, 1 unresolved discussion (waiting on @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/MullvadButton.kt line 74 at r1 (raw file):

    text: String,
    modifier: Modifier = Modifier,
    background: Color = MaterialTheme.colorScheme.background,

Would be nice if we could avoid passing backgrounds into the button. I know we overlay do alpha dance with it but, is it really necessary? Can we assume it is always colorScheme.background until we get rid of the alpha?

@mullmat
Copy link
Contributor

mullmat commented Oct 2, 2023

Tried this out (after getting it sent to me by @Pururun ) and it was really nice to have the buttons unified! 🎉
It was easy to use and it is makes it easier to change button details if needs be (such as padding, adding icon, etc).

@Pururun Pururun force-pushed the unify-buttons-droid-379 branch from 47aec55 to a1b323b Compare October 2, 2023 08:41
Copy link
Contributor Author

@Pururun Pururun left a comment

Choose a reason for hiding this comment

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

Reviewable status: 33 of 34 files reviewed, 1 unresolved discussion (waiting on @Rawa)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/MullvadButton.kt line 74 at r1 (raw file):

Previously, Rawa (David Göransson) wrote…

Would be nice if we could avoid passing backgrounds into the button. I know we overlay do alpha dance with it but, is it really necessary? Can we assume it is always colorScheme.background until we get rid of the alpha?

I removed it for NegativeButton as it was using the default value as always, not sure about what do with the VariantButton though as it is actually used on different backgrounds.

Copy link
Contributor

@Rawa Rawa left a comment

Choose a reason for hiding this comment

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

Reviewable status: 33 of 34 files reviewed, 1 unresolved discussion (waiting on @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/MullvadButton.kt line 74 at r1 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

I removed it for NegativeButton as it was using the default value as always, not sure about what do with the VariantButton though as it is actually used on different backgrounds.

We should let design decide on a color to use to avoid involving the transparency at all I think.

Copy link
Contributor

@Rawa Rawa left a comment

Choose a reason for hiding this comment

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

Reviewable status: 33 of 34 files reviewed, 1 unresolved discussion (waiting on @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/MullvadButton.kt line 74 at r1 (raw file):

Previously, Rawa (David Göransson) wrote…

We should let design decide on a color to use to avoid involving the transparency at all I think.

maybe that is out of scope for now though?

@Pururun Pururun force-pushed the unify-buttons-droid-379 branch 6 times, most recently from 9d2c720 to 9e8a00a Compare October 4, 2023 07:24
Copy link
Contributor

@Rawa Rawa left a comment

Choose a reason for hiding this comment

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

Reviewable status: 17 of 37 files reviewed, 3 unresolved discussions (waiting on @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/MullvadButton.kt line 164 at r4 (raw file):

    modifier: Modifier = Modifier,
    isEnabled: Boolean = true,
    icon: Int? = null,

Should or BaseButton be more generic than having a fixed option of passing an Int resource? Would be nice we could slot it instead with optional lambdas.

@Composable () -> Unit


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/MullvadButton.kt line 175 at r4 (raw file):

        modifier =
            modifier
                .height(Dimens.buttonHeight)

We should avoid setting height of button, if user sets a big font on their font the text will not render properly.


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/MullvadButton.kt line 193 at r4 (raw file):

            )
            icon?.let {
                Image(

Should maybe Icon instead of Image with a tint of contentColor? Then it would always have the same color as the text.

@Pururun Pururun force-pushed the unify-buttons-droid-379 branch from 9e8a00a to 977786e Compare October 4, 2023 11:19
Copy link
Contributor Author

@Pururun Pururun left a comment

Choose a reason for hiding this comment

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

Reviewable status: 13 of 39 files reviewed, 2 unresolved discussions (waiting on @Rawa)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/MullvadButton.kt line 74 at r1 (raw file):

Previously, Rawa (David Göransson) wrote…

maybe that is out of scope for now though?

Yeah maybe.


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/MullvadButton.kt line 164 at r4 (raw file):

Previously, Rawa (David Göransson) wrote…

Should or BaseButton be more generic than having a fixed option of passing an Int resource? Would be nice we could slot it instead with optional lambdas.

@Composable () -> Unit

Done


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/MullvadButton.kt line 175 at r4 (raw file):

Previously, Rawa (David Göransson) wrote…

We should avoid setting height of button, if user sets a big font on their font the text will not render properly.

This seems to cause side effects that some button just take up alla available space, will try to figure out why.


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/MullvadButton.kt line 193 at r4 (raw file):

Previously, Rawa (David Göransson) wrote…

Should maybe Icon instead of Image with a tint of contentColor? Then it would always have the same color as the text.

Done

@Pururun Pururun force-pushed the unify-buttons-droid-379 branch 4 times, most recently from 6676b96 to 77351b5 Compare October 13, 2023 09:18
Copy link
Contributor

@Rawa Rawa left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 10 files at r3, 12 of 14 files at r4, 1 of 1 files at r5, 8 of 8 files at r6, 1 of 1 files at r7, 12 of 14 files at r8, all commit messages.
Reviewable status: 38 of 40 files reviewed, 4 unresolved discussions (waiting on @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/MullvadButton.kt line 175 at r4 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

This seems to cause side effects that some button just take up alla available space, will try to figure out why.

Done


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeviceRemovalDialog.kt line 69 at r8 (raw file):

            PrimaryButton(
                modifier = Modifier.focusRequester(FocusRequester()),
                onClick = { onDismiss() },

Why this?


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialog.kt line 173 at r8 (raw file):

                PrimaryButton(
                    modifier = Modifier.padding(top = mediumPadding),
                    onClick = { onAttemptToSave() },

Same


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialog.kt line 181 at r8 (raw file):

                    PrimaryButton(
                        modifier = Modifier.padding(top = mediumPadding),
                        onClick = { onRemove() },

Same


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialog.kt line 188 at r8 (raw file):

                PrimaryButton(
                    modifier = Modifier.padding(top = mediumPadding),
                    onClick = { onDismiss() },

Same

@Pururun Pururun force-pushed the unify-buttons-droid-379 branch 3 times, most recently from b9d0797 to 8dc813a Compare October 16, 2023 12:03
Copy link
Contributor Author

@Pururun Pururun left a comment

Choose a reason for hiding this comment

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

Reviewable status: 33 of 41 files reviewed, 4 unresolved discussions (waiting on @Rawa)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialog.kt line 173 at r8 (raw file):

Previously, Rawa (David Göransson) wrote…

Same

Done


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialog.kt line 181 at r8 (raw file):

Previously, Rawa (David Göransson) wrote…

Same

Done


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialog.kt line 188 at r8 (raw file):

Previously, Rawa (David Göransson) wrote…

Same

Done

Copy link
Contributor Author

@Pururun Pururun left a comment

Choose a reason for hiding this comment

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

Reviewable status: 33 of 41 files reviewed, 4 unresolved discussions (waiting on @Rawa)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeviceRemovalDialog.kt line 69 at r8 (raw file):

Previously, Rawa (David Göransson) wrote…

Why this?

Done.

Copy link
Contributor

@Rawa Rawa left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 6 of 6 files at r9.
Reviewable status: 37 of 41 files reviewed, all discussions resolved

@Pururun Pururun force-pushed the unify-buttons-droid-379 branch 6 times, most recently from 0a81e45 to e028e64 Compare October 17, 2023 13:28
Copy link
Contributor

@Rawa Rawa left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 4 files at r10, 13 of 16 files at r11, 3 of 3 files at r12, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

- Make almost all button depend on 3 standard buttons
- Replace surface and onSurface with our own custom theme color
- Set button standard height to material design default
- Support bigger font sizes for buttons
@Pururun Pururun force-pushed the unify-buttons-droid-379 branch from e028e64 to 4bdd28f Compare October 18, 2023 06:54
@Pururun Pururun merged commit c26729e into main Oct 18, 2023
12 checks passed
@Pururun Pururun deleted the unify-buttons-droid-379 branch October 18, 2023 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android Issues related to Android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants