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

Material Design 3 migration (V2) #927

Open
wants to merge 62 commits into
base: master
Choose a base branch
from
Open

Conversation

newhinton
Copy link

@newhinton newhinton commented Jan 31, 2024

Closes #872

This PR is based on, and superseeds @Bnyro 's Material 3 implementation. It takes the UI a step further, and makes heavy use of the Material You colors.

This was implemented and improved with @Bnyro support, consent and collaboration.

Edit:
For more info about what this pr does, look in this discussion: https://github.com/Bnyro/Transportr/pull/1

@cla-bot cla-bot bot added the cla-signed ✔️ The Contributor Licence Agreement was signed by all contributors. label Feb 7, 2024
@ialokim
Copy link
Collaborator

ialokim commented Feb 7, 2024

Thanks @newhinton and @Bnyro! The screenshots in the linked PR already look very promising!

I will try to test your changes in the coming days and provide some initial feedback.

Copy link
Collaborator

@ialokim ialokim left a comment

Choose a reason for hiding this comment

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

Hi @newhinton and @Bnyro, I've now gone through the code and left some comments below. Thanks again for this work!

Comment on lines 39 to 41
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks like some unrelated changes which should be left out of the PR.

Copy link
Author

Choose a reason for hiding this comment

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

@ialokim I have never (manually) touched those files. Should IDE-config files be in this repository anyhow?

Comment on lines -112 to +115
KeyboardUtil.hideKeyboard(activity)
val imm = activity?.getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager?
imm?.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, 0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would vote for having our own KeyboardUtil.kt that encapsulates this rather ugly piece of code.

Comment on lines +104 to +106
InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
View currentFocus = getCurrentFocus();
if (currentFocus != null) imm.hideSoftInputFromWindow(currentFocus.getWindowToken(), 0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

As before, I would move this to KeyboardUtils.

Comment on lines +99 to +100
FullScreenUtil.Companion.drawBehindStatusbar(this);
FullScreenUtil.Companion.applyTopInset(findViewById(R.id.searchCardView), 16);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This misbehaves on my device, see screenshots.

android:layout_marginTop="32dp"
android:fitsSystemWindows="true">

<LinearLayout
Copy link
Collaborator

Choose a reason for hiding this comment

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

Couldn't we use a ConstrainedLayout instead of nested LinearLayouts?


<TextView
android:id="@+id/via"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="middle"
android:singleLine="true"
android:textColor="?android:textColorPrimary"
Copy link
Collaborator

Choose a reason for hiding this comment

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

As said before, not a fan of having Material You-adapted text colors.

Copy link
Author

Choose a reason for hiding this comment

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

This is different than the above one. Here we actually re-set the text color via the FavoriteCardForeground-style. That sets the text color. Removing the coloring makes it look like this:

image
We will have to set the text color anyway to fix the tinting. What color would you like?

Comment on lines +4 to +5
<color name="md_theme_primary">@android:color/system_accent1_200</color>
<color name="md_theme_onPrimary">@android:color/system_accent1_0</color>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where did you get these values from? Some online tool?

Copy link
Contributor

Choose a reason for hiding this comment

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

</style>

<style name="AppDayNightTheme" parent="AppBaseTheme">
<item name="colorControlNormal">@color/drawableTintLight</item>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this still be set somewhere or is it provided by MD3 somehow automatically? (You've used it in several places)

Copy link
Contributor

Choose a reason for hiding this comment

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

It's automatically set by Android

Comment on lines -82 to -83
`when`(resources.getColor(R.color.md_green_500)).thenReturn(GREEN)
`when`(resources.getColor(R.color.md_red_500)).thenReturn(RED)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Have you tried that the test still runs through?

@ialokim
Copy link
Collaborator

ialokim commented Feb 14, 2024

  • Select Location from main searchbar, dismiss bottom sheet. Re-select location. Left side of bottom sheet has padding

I haven't encountered that one.

  • Drop shadow of navigation also has padding after above flow
  • Navigation Drawer is invisible below status bar when opened
  • Three State Bottom Sheet has buggy behaviour

But those ones yes.

  • Select Location on map. Start navigation via FAB. New Activity has favorite locations instead of empty list (already present in 2.2.1)

Given this is not a regression, I wouldn't further consider it for this PR.

  • Trip Details toolbar menu does not show up

This one still happens here.

@ialokim
Copy link
Collaborator

ialokim commented Feb 14, 2024

Additionally, I've found the following issues while testing:

  • Text color looks strange when selected via Material You:
  • Issues with transport mode selection: not MD3 dialog, icon alignment
  • DatePicker dialog has different shape
  • map attribution is partly covered by "home screen bar"
  • I don't think the back button needs to be as prominent, I'd just leave it in the onSurface color:
  • text color issue on network selection page, also unnecessary high top bar
  • invisible icons in several places of the app

@ialokim
Copy link
Collaborator

ialokim commented Feb 14, 2024

This definitely needs some more cleanup work, but I do think this is going into the right direction!

Personally, I'm not fully convinced on giving up on the nice Transportr red altogether, given that it's part of the branding, but it seems that's what Material You is suggesting to do?

@Bnyro
Copy link
Contributor

Bnyro commented Feb 15, 2024

Personally, I'm not fully convinced on giving up on the nice Transportr red altogether, given that it's part of the branding, but it seems that's what Material You is suggesting to do?

Yes, it does. It would be possible to add s preference to toggle the red vs material you colors though.

@Altonss
Copy link
Collaborator

Altonss commented Feb 15, 2024

Personally, I'm not fully convinced on giving up on the nice Transportr red altogether, given that it's part of the branding, but it seems that's what Material You is suggesting to do?

+1 for trying to keep the Transportr red identity by default if possible :)

@michaelblyons
Copy link

It would be possible to add a preference to toggle the red vs Material You colors though.

I think this is what Trail Sense is doing.

@newhinton
Copy link
Author

DatePicker dialog has different shape

This is actually not a regression, it is also present in the current design. It is just a bit more visible in this PR.

Personally, I'm not fully convinced on giving up on the nice Transportr red altogether, given that it's part of the branding, but it seems that's what Material You is suggesting to do?

Yes it is. Though i recommend not to introduce a toggle ability, it would require quite a bit of code to make it work properly. It will lead to bugs. And i don't think i want to spend time on implementing that, especially since there is still a bit to do with the base-proposal.

@newhinton
Copy link
Author

newhinton commented Feb 19, 2024

Todo:

  • Work through code annotations
  • Popup Menu - no icons
  • Network-Selection coloring
  • Mapview Backbutton
  • Map-attribution behind bottombar
  • transport mode selection dialog theme
  • Select Location from main searchbar, dismiss bottom sheet. Re-select location. Left side of bottom sheet has padding
  • Drop shadow of navigation also has padding after above flow
  • Navigation Drawer is invisible below status bar when opened
  • Three State Bottom Sheet has buggy behaviour
  • Trip Details toolbar menu does not show up

i dont think its a Todo:

  • Datepicker-style
  • Select Location on map. Start navigation via FAB. New Activity has favorite locations instead of empty list (already present in 2.2.1)

@newhinton
Copy link
Author

@ialokim @Altonss

I have improved on many of the things you noted. However, there are still some things broken, like the three-state-bottomsheet.

I also found that some issues are very likely due to older libraries beeing used. That opened an entire different can of worms. As an example: I have tried to manually calculate the statusbar height so that i can adjust the backButton in the tripview, with less than optimal results. In newer libraries there is an enableEdgeToEdge() function for Activity. I tried updating the dependency, but that also requires an update to kotlin, which deprecates kotlin-android-extensions which means that we have to switch to viewbindings.

This is rapidly exploding the size of this PR, but i also don't think that we should continue without upgrading the libraries, which are at this point 2-4 years old and up to 5 versions behind.

How should i continue?

@Altonss
Copy link
Collaborator

Altonss commented May 12, 2024

@ialokim @Altonss

I have improved on many of the things you noted. However, there are still some things broken, like the three-state-bottomsheet.

I also found that some issues are very likely due to older libraries beeing used. That opened an entire different can of worms. As an example: I have tried to manually calculate the statusbar height so that i can adjust the backButton in the tripview, with less than optimal results. In newer libraries there is an enableEdgeToEdge() function for Activity. I tried updating the dependency, but that also requires an update to kotlin, which deprecates kotlin-android-extensions which means that we have to switch to viewbindings.

This is rapidly exploding the size of this PR, but i also don't think that we should continue without upgrading the libraries, which are at this point 2-4 years old and up to 5 versions behind.

How should i continue?

I think #902 is a step in the right direction regarding the issues you mentionned. We just need to review/merge it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed ✔️ The Contributor Licence Agreement was signed by all contributors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants