Skip to content

Commit

Permalink
Apply suggestions from review
Browse files Browse the repository at this point in the history
  • Loading branch information
proneon267 committed Feb 22, 2025
1 parent 8ea31a7 commit 57620c7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions android/src/toga_android/widgets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,17 @@ def set_font(self, font):
# By default, font can't be changed
pass

# Although setBackgroundColor is defined in the View base class, we can't use it as
# a default implementation because it often overwrites other aspects of the widget's
# appearance. So each widget must decide how to implement this method, possibly
# using one of the utility functions below.
def set_background_color(self, color):
self.native_toplevel.setBackground(
None if color in (None, TRANSPARENT) else ColorDrawable(native_color(color))
)

def set_background_filter(self, color):
# Although setBackgroundColor is defined in the View base class, we can't
# use it as a default implementation on some widgets(e.g. Button), because
# it often overwrites other aspects of the widget's appearance. For example,
# when setBackgroundColor is used on a Button, it changes the background behind
# the button rather than the button's actual color.
self.native.getBackground().setColorFilter(
None
if color is None
Expand Down

0 comments on commit 57620c7

Please sign in to comment.