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

Upgrade androidx activity and fragment to 1.5.0 #6436

Merged
merged 15 commits into from
Jul 6, 2022

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Jul 1, 2022

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Upgrade androidx activity and fragment to 1.5.0

The main work done here is the management of the menu, to avoid using deprecated methods.
Did a quick smoke test, everything is fine so far.
Will test the PiP behavior.

Motivation and context

Being up to date with the latest dependencies!

Screenshots / GIFs

Tests

  • Smoke test

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

dependabot bot and others added 7 commits June 29, 2022 23:10
Bumps activity from 1.4.0 to 1.5.0.

---
updated-dependencies:
- dependency-name: androidx.activity:activity
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps `fragment` from 1.4.1 to 1.5.0.

Updates `fragment-ktx` from 1.4.1 to 1.5.0

Updates `fragment-testing` from 1.4.1 to 1.5.0

---
updated-dependencies:
- dependency-name: androidx.fragment:fragment-ktx
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: androidx.fragment:fragment-testing
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
…tivity-activity-1.5.0

Bump activity from 1.4.0 to 1.5.0
@bmarty bmarty requested review from a team and ouchadam and removed request for a team July 1, 2022 15:08
@@ -53,6 +53,7 @@ android {

dependencies {
implementation libs.androidx.appCompat
implementation libs.androidx.fragmentKtx
Copy link
Member Author

Choose a reason for hiding this comment

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

To be able to useaddMenuProvider in DebugMaterialThemeActivity

this@DebugMaterialThemeActivity,
"Menu ${menuItem.title} clicked!",
Toast.LENGTH_SHORT
).show()
Copy link
Member Author

Choose a reason for hiding this comment

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

Added this toast to have a visual feedback

### Please use the MenuProvider interface now
onCreateOptionsMenu
onOptionsItemSelected
onPrepareOptionsMenu
Copy link
Member Author

Choose a reason for hiding this comment

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

This is not deprecated (yet?) on Activities, and better to avoid using a mix of solutions (this was not working well)

@@ -249,6 +253,30 @@ abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), Maver
}
}

private fun setupMenu() {
// Always add a MenuProvider to handle the back action from the Toolbar
Copy link
Member Author

@bmarty bmarty Jul 1, 2022

Choose a reason for hiding this comment

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

I mean even if getMenuRes() returns -1

state.displayMode is RoomDevToolViewState.Mode.EditEventContent ||
state.displayMode is RoomDevToolViewState.Mode.SendEventForm
}
else -> true
Copy link
Member Author

Choose a reason for hiding this comment

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

This is quite dirty and would deserve a rework...

Copy link
Member Author

Choose a reason for hiding this comment

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

@bmarty bmarty force-pushed the feature/bma/activity_fragment_1_5_0 branch from 20e8061 to f7a0615 Compare July 1, 2022 15:41
@bmarty
Copy link
Member Author

bmarty commented Jul 4, 2022

(FTR I will try to update our API to manage menu).

EDIT Done in the latest commits.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 4, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@ouchadam ouchadam left a comment

Choose a reason for hiding this comment

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

thanks for the update 💯 I didn't notice any new issues with a smoke test across the app

I wonder if we should be using nulls rather than -1 to highlight the absence of menus but not a blocker since that was the existing convention

@bmarty
Copy link
Member Author

bmarty commented Jul 6, 2022

I wonder if we should be using nulls rather than -1 to highlight the absence of menus but not a blocker since that was the existing convention

Yes, probably a bit better. the only case where we use "-1" is here https://github.com/vector-im/element-android/blob/944b447d938b117bc422feaec38f59dd60af046f/vector/src/main/java/im/vector/app/features/call/transfer/CallTransferPagerAdapter.kt#L51

@bmarty bmarty merged commit 7616912 into develop Jul 6, 2022
@bmarty bmarty deleted the feature/bma/activity_fragment_1_5_0 branch July 6, 2022 09:44
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.

2 participants