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

Manually including im.dlg:android-dialer:1.2.5 #7142

Merged
merged 5 commits into from
Sep 26, 2022

Conversation

ouchadam
Copy link
Contributor

@ouchadam ouchadam commented Sep 15, 2022

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

  • Moves all external modules to the library/external/ directory (jsonview, dialpad and diff_match_patch)
  • Manually includes the contents of im.dlg:android-dialer:1.2.5 as a dedicated module in library/external/dialpad. It turns out the classes we use are entirely AOSP.
  • Replaces AppCompat usages with stock Widgets, the build tools automatically convert these to androidx variants

Motivation and context

To allow us to avoid using the jetifier and enable Paparazzi screenshot tests within the vector module

  • Avoids using appcompat
  • avoids using an artifact without a source repository

Screenshots / GIFs

No UI changes!

Before After
before-dailpad after-dial-pad

Tests

  • Force the dial pad to be displayed via the debug settings
  • Open the dial pad tab

Tested devices

  • Physical
  • Emulator
  • OS version(s): 28

@ouchadam ouchadam requested review from a team and jmartinesp and removed request for a team September 15, 2022 13:43
@@ -0,0 +1,20 @@
apply plugin: 'com.android.library'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

a minimal build file for the module, technically it could apply the java plugin, for consistency it uses kotlin

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there's no longer any dependency on the appcompat / legacy support library

@@ -58,5 +58,5 @@ dependencies {
// Pref theme
implementation libs.androidx.preferenceKtx
// dialpad dimen
implementation 'im.dlg:android-dialer:1.2.5'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

im.dlg:android-dialer:1.2.5 is now replaced by the local module

Copy link
Member

Choose a reason for hiding this comment

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

I guess we could avoid having this dependency now, but this is not really a big deal. Same for the String resource, they could be extracted from the module dialpad module.

* to a larger default, for the dialpad we use this class to more precisely render characters
* according to the precise amount of space they need.
*/
public class DialpadTextView extends TextView {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this has been changed from extends AppCompatTextView

import com.android.dialer.widget.ResizingTextEditText;

/** EditText which suppresses IME show up. */
public class DigitsEditText extends ResizingTextEditText {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this has been changed from extends AppCompatEditText

@ouchadam
Copy link
Contributor Author

will exclude lint from this module as it's not our code

@ouchadam ouchadam force-pushed the feature/adm/dialpad-lib branch 2 times, most recently from 9b56ee6 to 7abcdd4 Compare September 15, 2022 15:12
@ouchadam ouchadam mentioned this pull request Sep 15, 2022
6 tasks
Copy link
Member

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

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

It seems to work fine, so I'll trust the changes to the original library were minimal and say it LGTM 😅.

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.
When I do this type of import, I usually split into several commits for clarity.
First commit is importing the stuff, without editing anything. In this commit's comment, it's also good to link the original source location.
Next commit(s) are modification to fix issue, make the code compile, tweak the code, etc.
Doing like may also help in the future to investigate was has been changed from the original source.

@@ -58,5 +58,5 @@ dependencies {
// Pref theme
implementation libs.androidx.preferenceKtx
// dialpad dimen
implementation 'im.dlg:android-dialer:1.2.5'
Copy link
Member

Choose a reason for hiding this comment

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

I guess we could avoid having this dependency now, but this is not really a big deal. Same for the String resource, they could be extracted from the module dialpad module.


afterEvaluate {
tasks.findAll { it.name.startsWith("lint") }.each {
it.enabled = false
Copy link
Member

Choose a reason for hiding this comment

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

lint is disabled here, because there are too many issues reported?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't sure on our stance, do we want to fix lint issues from external projects?

Copy link
Member

Choose a reason for hiding this comment

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

I can't remember the exact amount, but there were lots of lint issues about API versions, unused resources, etc. Since it's not really our code (we're just forking it to solve the mentioned issues) fixing all of those didn't seem to be worth the effort.

Copy link
Member

Choose a reason for hiding this comment

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

This is maybe not clear enough for everyone that this is external project, since it's in the library folder. Maybe create another folder like library_external, or a subfolder library/external.
But I agree, that we do not want to spend time to fix issues on all our dep.

Copy link
Contributor Author

@ouchadam ouchadam Sep 16, 2022

Choose a reason for hiding this comment

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

sounds good 👍 Should I move jsonviewer as well? as I guess that technically originates from an external repository~

Copy link
Member

Choose a reason for hiding this comment

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

yes, please, and diff_match_patch too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

a9298c7 moves the modules to library/external

@ouchadam ouchadam force-pushed the feature/adm/dialpad-lib branch from 7abcdd4 to a9298c7 Compare September 16, 2022 10:50
@ouchadam
Copy link
Contributor Author

@bmarty I've updated the commits to split the change from the import f923edf

@ElementBot
Copy link

ElementBot commented Sep 16, 2022

Warnings
⚠️

library/external/jsonviewer/src/main/res/layout/item_jv_base_value.xml#L7 - Possible overdraw: Root element paints background ?attr/selectableItemBackground with a theme that also paints a background (inferred theme is @android:style/Theme.Holo)

⚠️

library/external/jsonviewer/src/main/res/layout/item_jv_base_value.xml#L7 - Possible overdraw: Root element paints background ?attr/selectableItemBackground with a theme that also paints a background (inferred theme is @android:style/Theme.Holo)

Generated by 🚫 dangerJS against 2168362

@ouchadam ouchadam force-pushed the feature/adm/dialpad-lib branch from a9298c7 to 739a513 Compare September 16, 2022 14:15
@bmarty
Copy link
Member

bmarty commented Sep 19, 2022

I need this to try to try to remove jetifier from the project. Currently on develop, using this plugin id "com.dipien.byebyejetifier" version "1.2.2" and running this command: ./gradlew canISayByeByeJetifier -Pandroid.enableJetifier=false outputs:

Execution failed for task ':canISayByeByeJetifier'.
> Could not resolve all dependencies for configuration ':vector:debugAndroidTestCompileClasspath'.
   > Could not find com.android.support:support-annotations:25.3.1.
     Required by:
         project :vector > im.dlg:android-dialer:1.2.5
   > Could not find com.android.support:appcompat-v7:25.3.1.
     Required by:
         project :vector > im.dlg:android-dialer:1.2.5
   > Could not find com.android.support:design:25.3.1.
     Required by:
         project :vector > im.dlg:android-dialer:1.2.5

@ouchadam
Copy link
Contributor Author

FYI @bmarty @jmartinesp I've had to include appcompat as a dependency 2168362 as some tasks (like sonar) were attempting to compile all variants of the module but colorPrimary only existed if the parent app module was also compiled

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug B 3 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 16 Code Smells

0.0% 0.0% Coverage
1.9% 1.9% Duplication

@ouchadam ouchadam merged commit 2c1eef7 into develop Sep 26, 2022
@ouchadam ouchadam deleted the feature/adm/dialpad-lib branch September 26, 2022 09:14
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.

4 participants