-
Notifications
You must be signed in to change notification settings - Fork 544
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
Fix part of #5661: Add Missing style Attributes to TextViews #5682
base: develop
Are you sure you want to change the base?
Changes from 4 commits
5ea3aaa
1c14e4f
0d8c29e
282cdd0
d7a2d8a
4000f70
f5325bc
21c408d
c7f5fc5
cc75485
fa663b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,9 @@ | |
|
||
<TextView | ||
android:id="@+id/onboarding_language_text_view" | ||
style="@style/OnboardingLanguageTextViewStyle" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:fontFamily="sans-serif" | ||
android:padding="@dimen/onboarding_shared_padding_medium" | ||
android:textColor="@color/component_color_onboarding_shared_text_color" | ||
android:textSize="@dimen/onboarding_shared_text_size_medium" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
android:text="Language" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This hardcoded string was not part of the original attributes. Why has it been added? |
||
/> | ||
</FrameLayout> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,6 @@ | |
|
||
<TextView | ||
android:id="@+id/test_text_view" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:fontFamily="sans-serif-medium" | ||
android:padding="10dp" | ||
android:text="@string/app_name" | ||
android:textSize="18sp" /> | ||
</layout> | ||
style="@style/TestTextViewStyle" | ||
android:text="@string/app_name" /> | ||
</layout> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add an extra line at the end of the file, same for the rest. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,13 +58,11 @@ | |
|
||
<TextView | ||
android:id="@+id/walkthrough_final_no_text_view" | ||
style="@style/WalkthroughFinalNoTextViewStyle" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center_horizontal" | ||
android:fontFamily="sans-serif" | ||
android:text="@string/no" | ||
android:textColor="@color/component_color_shared_primary_text_color" | ||
android:textSize="20sp" /> | ||
android:text="@string/no" /> | ||
|
||
<TextView | ||
android:id="@+id/walkthrough_final_no_center_text_view" | ||
|
@@ -93,13 +91,12 @@ | |
|
||
<TextView | ||
android:id="@+id/walkthrough_final_yes_text_view" | ||
style="@style/WalkthroughFinalYesTextViewStyle" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center_horizontal" | ||
android:fontFamily="sans-serif" | ||
android:text="@string/yes" | ||
android:textColor="@color/component_color_shared_secondary_6_text_color" | ||
android:textSize="20sp" /> | ||
android:text="@string/yes" /> | ||
|
||
|
||
<TextView | ||
android:id="@+id/walkthrough_final_yes_center_text_view" | ||
|
@@ -134,16 +131,11 @@ | |
|
||
<TextView | ||
android:id="@+id/walkthrough_final_title_text_view" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
style="@style/WalkthroughFinalTitleTextViewStyle" | ||
android:layout_marginTop="32dp" | ||
android:fontFamily="sans-serif" | ||
android:text="@string/great" | ||
android:textColor="@color/component_color_shared_primary_text_color" | ||
android:textSize="24sp" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
</ScrollView> | ||
</layout> | ||
</layout> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Always add an extra line at the end of the file |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -826,4 +826,62 @@ | |
<item name="endIconDrawable">@drawable/ic_arrow_drop_down_black_24dp</item> | ||
<item name="endIconTint">@color/component_color_shared_black_background_color</item> | ||
</style> | ||
|
||
<style name="WalkthroughFinalNoTextViewStyle" parent="TextView.Common1"> | ||
adhiamboperes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<item name="android:fontFamily">sans-serif</item> | ||
<item name="android:textSize">16sp</item> | ||
<item name="android:textColor">@color/component_color_shared_primary_text_color</item> | ||
</style> | ||
|
||
<style name="WalkthroughFinalYesTextViewStyle" parent="TextView.Common1"> | ||
<item name="android:fontFamily">sans-serif</item> | ||
<item name="android:textSize">20sp</item> | ||
<item name="android:textColor">@color/component_color_shared_secondary_6_text_color</item> | ||
</style> | ||
|
||
<style name="DeveloperOptionsTextViewStyle" parent="TextView.Common1"> | ||
<item name="android:fontFamily">sans-serif-medium</item> | ||
<item name="android:textSize">14sp</item> | ||
<item name="android:textColor">@color/component_color_shared_primary_dark_text_color</item> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. textColor is not needed |
||
</style> | ||
|
||
<style name="OnboardingLanguageTextViewStyle" parent="TextView.Common1"> | ||
<item name="android:layout_width">wrap_content</item> | ||
<item name="android:layout_height">wrap_content</item> | ||
Comment on lines
+849
to
+850
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These attributes are duplicated in the view using this style. Android will prioritize the attributes added directly to the view over the ones from the style, and if they are the same, then these here become redudant |
||
<item name="android:textSize">16sp</item> | ||
<item name="android:textColor">@color/component_color_shared_primary_text_color</item> | ||
<item name="android:fontFamily">sans-serif</item> | ||
<item name="android:padding">8dp</item> | ||
</style> | ||
|
||
<style name="WalkthroughFinalTitleTextViewStyle" parent="TextView.Common1"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
<item name="android:layout_width">wrap_content</item> | ||
<item name="android:layout_height">wrap_content</item> | ||
<item name="android:textSize">24sp</item> | ||
<item name="android:textColor">@color/component_color_shared_primary_text_color</item> | ||
<item name="android:fontFamily">sans-serif</item> | ||
</style> | ||
|
||
<style name="ChapterIndexTextViewStyle" parent="TextView.Common1"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This style is used in 4 places, but it contains some attributes that dont have the same values for the different screens, e.g |
||
<item name="android:layout_width">wrap_content</item> | ||
<item name="android:layout_height">match_parent</item> | ||
<item name="android:textSize">20sp</item> | ||
<item name="android:textColor">@color/component_color_shared_secondary_4_text_color</item> | ||
<item name="android:fontFamily">sans-serif</item> | ||
<item name="android:gravity">center</item> | ||
<item name="android:minWidth">60dp</item> | ||
<item name="android:minHeight">48dp</item> | ||
<item name="android:paddingStart">8dp</item> | ||
<item name="android:paddingEnd">8dp</item> | ||
</style> | ||
|
||
<style name="TestTextViewStyle" parent="TextView.Common1"> | ||
<item name="android:layout_width">wrap_content</item> | ||
<item name="android:layout_height">wrap_content</item> | ||
<item name="android:fontFamily">sans-serif-medium</item> | ||
<item name="android:padding">10dp</item> | ||
<item name="android:textSize">18sp</item> | ||
<item name="android:textColor">@color/component_color_shared_primary_text_color</item> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. textColor attribute not needed |
||
</style> | ||
|
||
</resources> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is preferrable to keep constraints here instead of in styles, because it makes maintenance easier, and for reusability. Another vioew using this style will likely not have the same constraints.