<commit_before>
## SAutoBgButton for Android

A subclass of the Button widget that automatically darkens the button's background when pressed, and sets it to transparent when disabled. This is inspired by iOS' automatic handling of custom background images for buttons.


### Usage

1. Copy and paste the `net` folder into your Android project's `src` folder.
2. Replace your button declarations to use `net.shikii.widgets.SAutoBgButton` instead of just `Button`:

    From this:

        <Button
          android:layout_width="wrap_content" android:layout_height="wrap_content"
          android:background="@drawable/button_blue_bg"
          android:text="Button with background image" />

    To this:

        <net.shikii.widgets.SAutoBgButton
          android:layout_width="wrap_content" android:layout_height="wrap_content"
          android:background="@drawable/button_blue_bg"
          android:text="Button with background image" />
<commit_msg>Updated README. Added link to blog and sample output image.<commit_after>## SAutoBgButton for Android

A subclass of the Button widget that automatically darkens the button's background when pressed, and sets it to transparent when disabled. This is inspired by iOS' automatic handling of custom background images for buttons.

See the blog post [here](http://shikii.net/blog/android-button-background-image-pressedhighlighted-and-disabled-states-without-using-multiple-images/)

### Usage

1. Copy and paste the `net` folder into your Android project's `src` folder.
2. Replace your button declarations to use `net.shikii.widgets.SAutoBgButton` instead of just `Button`:

    From this:

        <Button
          android:layout_width="wrap_content" android:layout_height="wrap_content"
          android:background="@drawable/button_blue_bg"
          android:text="Button with background image" />

    To this:

        <net.shikii.widgets.SAutoBgButton
          android:layout_width="wrap_content" android:layout_height="wrap_content"
          android:background="@drawable/button_blue_bg"
          android:text="Button with background image" />

Here's a sample output using this custom button:

![](http://shikii.net/blog/wp-content/uploads/2012/03/android-autobgbutton-screen.jpg)
{'fraction_non_alphanumeric': 0.08759448643841708, 'fraction_numerical': 0.004446420631391729, 'mean_word_length': 4.044843049327354, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1709304', 'n_tokens_mistral': 630, 'n_tokens_neox': 578, 'n_words': 191}