├── .gitignore
├── .travis.yml
├── LICENSE
├── README.md
├── build.gradle
├── example
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── github
│ │ └── ivbaranov
│ │ └── mfb
│ │ └── example
│ │ └── MainActivity.java
│ └── res
│ ├── drawable-hdpi
│ ├── ic_event_available_black_24dp.png
│ ├── ic_event_busy_black_24dp.png
│ └── ic_settings_black_24dp.png
│ ├── layout
│ ├── activity_main.xml
│ └── content_main.xml
│ ├── menu
│ └── menu_main.xml
│ ├── mipmap-hdpi
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxxhdpi
│ └── ic_launcher.png
│ ├── values-v21
│ └── styles.xml
│ ├── values-w820dp
│ └── dimens.xml
│ └── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── materialfavoritebutton
├── build.gradle
├── gradle.properties
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── github
│ │ └── ivbaranov
│ │ └── mfb
│ │ └── ApplicationTest.java
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── github
│ │ └── ivbaranov
│ │ └── mfb
│ │ ├── MaterialFavoriteButton.java
│ │ └── Utils.java
│ └── res
│ ├── drawable-hdpi
│ ├── ic_favorite_black_24dp.png
│ ├── ic_favorite_border_black_24dp.png
│ ├── ic_favorite_border_white_24dp.png
│ ├── ic_favorite_white_24dp.png
│ ├── ic_star_black_24dp.png
│ ├── ic_star_border_black_24dp.png
│ ├── ic_star_border_white_24dp.png
│ └── ic_star_white_24dp.png
│ ├── drawable-mdpi
│ ├── ic_favorite_black_24dp.png
│ ├── ic_favorite_border_black_24dp.png
│ ├── ic_favorite_border_white_24dp.png
│ ├── ic_favorite_white_24dp.png
│ ├── ic_star_black_24dp.png
│ ├── ic_star_border_black_24dp.png
│ ├── ic_star_border_white_24dp.png
│ └── ic_star_white_24dp.png
│ ├── drawable-xhdpi
│ ├── ic_favorite_black_24dp.png
│ ├── ic_favorite_border_black_24dp.png
│ ├── ic_favorite_border_white_24dp.png
│ ├── ic_favorite_white_24dp.png
│ ├── ic_star_black_24dp.png
│ ├── ic_star_border_black_24dp.png
│ ├── ic_star_border_white_24dp.png
│ └── ic_star_white_24dp.png
│ ├── drawable-xxhdpi
│ ├── ic_favorite_black_24dp.png
│ ├── ic_favorite_border_black_24dp.png
│ ├── ic_favorite_border_white_24dp.png
│ ├── ic_favorite_white_24dp.png
│ ├── ic_star_black_24dp.png
│ ├── ic_star_border_black_24dp.png
│ ├── ic_star_border_white_24dp.png
│ └── ic_star_white_24dp.png
│ ├── drawable-xxxhdpi
│ ├── ic_favorite_black_24dp.png
│ ├── ic_favorite_border_black_24dp.png
│ ├── ic_favorite_border_white_24dp.png
│ ├── ic_favorite_white_24dp.png
│ ├── ic_star_black_24dp.png
│ ├── ic_star_border_black_24dp.png
│ ├── ic_star_border_white_24dp.png
│ └── ic_star_white_24dp.png
│ └── values
│ ├── attrs.xml
│ └── strings.xml
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | .idea
4 | .DS_Store
5 | build/
6 | /captures
7 | *.iml
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: android
2 | android:
3 | components:
4 | - platform-tools
5 | - tools
6 | - build-tools-28
7 | - android-28
8 | - extra-android-support
9 | - extra-android-m2repository
10 |
11 | before_install:
12 | - yes | sdkmanager "platforms;android-27"
13 |
14 | before_script:
15 | - chmod +x gradlew
16 |
17 | script:
18 | ./gradlew build
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
203 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Material Favorite Button
2 | ========================
3 |
4 | Material spinning favorite/star/like button.
5 |
6 | [](http://android-arsenal.com/details/1/2612) [](https://travis-ci.org/IvBaranov/MaterialFavoriteButton)
7 |
8 | ![Demo Image][1]
9 |
10 | Download
11 | --------
12 |
13 | ```groovy
14 | compile 'com.github.ivbaranov:materialfavoritebutton:0.1.5'
15 | ```
16 |
17 |
18 | Usage
19 | -----
20 |
21 | Declare in XML (see xml attributes below for customization):
22 |
23 | ```xml
24 |
27 | ```
28 |
29 | Or static initializer (see xml attributes below for customization):
30 |
31 | ```java
32 | MaterialFavoriteButton favorite = new MaterialFavoriteButton.Builder(this)
33 | .create();
34 | ```
35 |
36 |
37 |
38 | Configure using xml attributes or setters in code:
39 |
40 | ```java
41 | app:mfb_state="false" // default button state
42 | app:mfb_animate_favorite="true" // to animate favoriting
43 | app:mfb_animate_unfavorite="false" // to animate unfavoriting
44 | app:mfb_padding="12" // image padding
45 | app:mfb_favorite_image="@drawable/ic_fav" // custom favorite resource
46 | app:mfb_not_favorite_image="@drawable/ic_not_fav"// custom not favorite resource
47 | app:mfb_rotation_duration="400" // rotation duration
48 | app:mfb_rotation_angle="360" // rotation angle
49 | app:mfb_bounce_duration="300" // bounce duration
50 | app:mfb_color="black" // black or white default resources (enum)
51 | app:mfb_type="star" // star or heart shapes (enum)
52 | app:mfb_size="48" // button size
53 | ```
54 | Make sure:
55 | - you are using either (`mfb_favorite_image` and `mfb_not_favorite_image`) or (`mfb_color` and `mfb_type`).
56 | - if you change `mfb_size` attribute you should also provide your own combination of `mfb_favorite_image` and `mfb_favorite_image` resources and `mfb_padding` attribute that will fit your new dimensions, otherwise you can get blurred icon
57 |
58 |
59 | Set an `OnFavoriteChangeListener` to `MaterialFavoriteButton`:
60 |
61 | ```java
62 | favorite.setOnFavoriteChangeListener(
63 | new MaterialFavoriteButton.OnFavoriteChangeListener() {
64 | @Override
65 | public void onFavoriteChanged(MaterialFavoriteButton buttonView, boolean favorite) {
66 | //
67 | }
68 | });
69 | ```
70 |
71 | Set an `OnFavoriteAnimationEndListener` to `MaterialFavoriteButton`:
72 |
73 | ```java
74 | favorite.setOnFavoriteAnimationEndListener(
75 | new MaterialFavoriteButton.OnFavoriteAnimationEndListener() {
76 | @Override
77 | public void onAnimationEnd(MaterialFavoriteButton buttonView, boolean favorite) {
78 | //
79 | }
80 | });
81 | ```
82 |
83 | ##### Usage in RecyclerView
84 | To avoid triggering animation while re-rendering item view make sure you set favorite button state in `onBindViewHolder` without animation:
85 |
86 | ```java
87 | favoriteButton.setFavorite(isFavorite(data.get(position)));
88 | ```
89 |
90 |
91 | Developed By
92 | ------------
93 | Ivan Baranov
94 |
95 | License
96 | -------
97 |
98 | ```
99 | Copyright 2015 Ivan Baranov
100 |
101 | Licensed under the Apache License, Version 2.0 (the "License");
102 | you may not use this file except in compliance with the License.
103 | You may obtain a copy of the License at
104 |
105 | http://www.apache.org/licenses/LICENSE-2.0
106 |
107 | Unless required by applicable law or agreed to in writing, software
108 | distributed under the License is distributed on an "AS IS" BASIS,
109 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
110 | See the License for the specific language governing permissions and
111 | limitations under the License.
112 | ```
113 |
114 | [1]: https://cloud.githubusercontent.com/assets/6000572/10363036/ad97cfae-6dba-11e5-980a-1f5d82afd773.gif
115 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | ext {
2 | minSdkVersion = 11
3 | minSdkVersionApp = 14
4 | compileSdkVersion = 28
5 | buildToolsVersion = '28'
6 | }
7 |
8 | buildscript {
9 | repositories {
10 | jcenter()
11 | google()
12 | }
13 | dependencies {
14 | classpath "com.android.tools.build:gradle:$GRADLE_PLUGIN_VERSION"
15 | classpath "com.novoda:bintray-release:$BINTRAY_RELEASE"
16 | }
17 | }
18 |
19 | allprojects {
20 | repositories {
21 | jcenter()
22 | google()
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/example/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion rootProject.ext.compileSdkVersion
5 | buildToolsVersion rootProject.ext.buildToolsVersion
6 |
7 | defaultConfig {
8 | applicationId "com.github.ivbaranov.mfb.example"
9 | minSdkVersion rootProject.ext.minSdkVersionApp
10 | targetSdkVersion rootProject.ext.compileSdkVersion
11 | versionCode 1
12 | versionName VERSION_NAME
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | implementation project(':materialfavoritebutton')
24 | implementation "com.android.support:appcompat-v7:$SUPPORT_LIBRARY_VERSION"
25 | implementation "com.android.support:design:$SUPPORT_LIBRARY_VERSION"
26 | implementation "com.android.support:cardview-v7:$SUPPORT_LIBRARY_VERSION"
27 | }
28 |
--------------------------------------------------------------------------------
/example/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/ivbaranov/Documents/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/example/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/example/src/main/java/com/github/ivbaranov/mfb/example/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.github.ivbaranov.mfb.example;
2 |
3 | import android.os.Bundle;
4 | import android.support.design.widget.Snackbar;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.support.v7.widget.Toolbar;
7 | import android.view.Menu;
8 | import android.view.MenuItem;
9 | import android.widget.TextView;
10 | import com.github.ivbaranov.mfb.MaterialFavoriteButton;
11 |
12 | public class MainActivity extends AppCompatActivity {
13 | private TextView niceCounter;
14 | private int niceCounterValue = 37;
15 |
16 | @Override protected void onCreate(Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | setContentView(R.layout.activity_main);
19 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
20 | setSupportActionBar(toolbar);
21 |
22 | //in the toolbar
23 | MaterialFavoriteButton toolbarFavorite = new MaterialFavoriteButton.Builder(this) //
24 | .favorite(true)
25 | .color(MaterialFavoriteButton.STYLE_WHITE)
26 | .type(MaterialFavoriteButton.STYLE_HEART)
27 | .rotationDuration(400)
28 | .create();
29 | toolbar.addView(toolbarFavorite);
30 | toolbarFavorite.setOnFavoriteChangeListener(
31 | new MaterialFavoriteButton.OnFavoriteChangeListener() {
32 | @Override
33 | public void onFavoriteChanged(MaterialFavoriteButton buttonView, boolean favorite) {
34 | Snackbar.make(buttonView, getString(R.string.toolbar_favorite_snack) + favorite,
35 | Snackbar.LENGTH_SHORT).show();
36 | }
37 | });
38 |
39 | //nice cardview
40 | niceCounter = (TextView) findViewById(R.id.counter_value);
41 | niceCounter.setText(String.valueOf(niceCounterValue));
42 | MaterialFavoriteButton materialFavoriteButtonNice =
43 | (MaterialFavoriteButton) findViewById(R.id.favorite_nice);
44 | materialFavoriteButtonNice.setFavorite(true, false);
45 | materialFavoriteButtonNice.setOnFavoriteChangeListener(
46 | new MaterialFavoriteButton.OnFavoriteChangeListener() {
47 | @Override
48 | public void onFavoriteChanged(MaterialFavoriteButton buttonView, boolean favorite) {
49 | if (favorite) {
50 | niceCounterValue++;
51 | } else {
52 | niceCounterValue--;
53 | }
54 | }
55 | });
56 | materialFavoriteButtonNice.setOnFavoriteAnimationEndListener(
57 | new MaterialFavoriteButton.OnFavoriteAnimationEndListener() {
58 | @Override
59 | public void onAnimationEnd(MaterialFavoriteButton buttonView, boolean favorite) {
60 | niceCounter.setText(String.valueOf(niceCounterValue));
61 | }
62 | });
63 | }
64 |
65 | @Override public boolean onCreateOptionsMenu(Menu menu) {
66 | // Inflate the menu; this adds items to the action bar if it is present.
67 | getMenuInflater().inflate(R.menu.menu_main, menu);
68 | return true;
69 | }
70 |
71 | @Override public boolean onOptionsItemSelected(MenuItem item) {
72 | // Handle action bar item clicks here. The action bar will
73 | // automatically handle clicks on the Home/Up button, so long
74 | // as you specify a parent activity in AndroidManifest.xml.
75 | int id = item.getItemId();
76 |
77 | //noinspection SimplifiableIfStatement
78 | if (id == R.id.action_settings) {
79 | return true;
80 | }
81 |
82 | return super.onOptionsItemSelected(item);
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/example/src/main/res/drawable-hdpi/ic_event_available_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/example/src/main/res/drawable-hdpi/ic_event_available_black_24dp.png
--------------------------------------------------------------------------------
/example/src/main/res/drawable-hdpi/ic_event_busy_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/example/src/main/res/drawable-hdpi/ic_event_busy_black_24dp.png
--------------------------------------------------------------------------------
/example/src/main/res/drawable-hdpi/ic_settings_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/example/src/main/res/drawable-hdpi/ic_settings_black_24dp.png
--------------------------------------------------------------------------------
/example/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/example/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
17 |
18 |
22 |
23 |
27 |
28 |
34 |
35 |
40 |
41 |
44 |
45 |
46 |
47 |
48 |
49 |
53 |
54 |
58 |
59 |
65 |
66 |
71 |
72 |
75 |
76 |
83 |
84 |
91 |
92 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
112 |
113 |
117 |
118 |
121 |
122 |
128 |
129 |
139 |
140 |
141 |
142 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
--------------------------------------------------------------------------------
/example/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
12 |
--------------------------------------------------------------------------------
/example/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/example/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/example/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/example/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/example/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/example/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
8 |
10 |
11 |
--------------------------------------------------------------------------------
/example/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/example/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/example/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 16dp
6 | 8dp
7 | 8dp
8 | 8dp
9 | 16dp
10 | 6dp
11 |
12 |
--------------------------------------------------------------------------------
/example/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | MaterialFavoriteButton
3 | Settings
4 | On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue.
5 | In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.
6 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
7 | Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
8 | Starred:
9 | Favorite
10 | "Toolbar favorite clicked: "
11 |
12 |
--------------------------------------------------------------------------------
/example/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
15 |
17 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # suppress inspection "UnusedProperty" for whole file
2 |
3 | # Current library version
4 | VERSION_NAME=0.1.5
5 |
6 | # Dependency versions (library)
7 | SUPPORT_LIBRARY_VERSION=28.0.0-rc01
8 |
9 | # Dependency versions (plugins)
10 | GRADLE_PLUGIN_VERSION=3.1.4
11 | BINTRAY_RELEASE=0.8.0
12 |
13 | # Maven
14 | GROUP=com.github.ivbaranov
15 | ARTIFACT_ID=materialfavoritebutton
16 |
17 | POM_DESCRIPTION=Material spinning favorite/star button
18 | POM_URL=https://github.com/ivbaranov/MaterialFavoriteButton
19 | POM_SCM_URL=https://github.com/ivbaranov/MaterialFavoriteButton
20 | POM_SCM_CONNECTION=scm:git@github.com:ivbaranov/MaterialFavoriteButton.git
21 | POM_SCM_DEV_CONNECTION=scm:git@github.com:ivbaranov/MaterialFavoriteButton.git
22 | POM_LICENCE_NAME=Apache-2.0
23 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
24 | POM_LICENCE_DIST=repo
25 | POM_DEVELOPER_ID=ivbaranov
26 | POM_DEVELOPER_NAME=Ivan Baranov
27 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Sep 03 12:39:44 MSK 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/materialfavoritebutton/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.novoda.bintray-release'
3 |
4 | android {
5 | compileSdkVersion rootProject.ext.compileSdkVersion
6 | buildToolsVersion rootProject.ext.buildToolsVersion
7 |
8 | defaultConfig {
9 | minSdkVersion rootProject.ext.minSdkVersion
10 | targetSdkVersion rootProject.ext.compileSdkVersion
11 | versionName VERSION_NAME
12 | }
13 | }
14 |
15 | dependencies {}
16 |
17 | publish {
18 | groupId = GROUP
19 | artifactId = ARTIFACT_ID
20 | publishVersion = VERSION_NAME
21 | desc = POM_DESCRIPTION
22 | licences = [POM_LICENCE_NAME]
23 | website = POM_URL
24 | }
25 |
26 | apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
--------------------------------------------------------------------------------
/materialfavoritebutton/gradle.properties:
--------------------------------------------------------------------------------
1 | POM_NAME=MaterialFavoriteButton
2 | POM_ARTIFACT_ID=materialfavoritebutton
3 | POM_PACKAGING=aar
--------------------------------------------------------------------------------
/materialfavoritebutton/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/ivbaranov/Documents/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/materialfavoritebutton/src/androidTest/java/com/github/ivbaranov/mfb/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.github.ivbaranov.mfb;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/java/com/github/ivbaranov/mfb/MaterialFavoriteButton.java:
--------------------------------------------------------------------------------
1 | package com.github.ivbaranov.mfb;
2 |
3 | import android.animation.Animator;
4 | import android.animation.AnimatorListenerAdapter;
5 | import android.animation.AnimatorSet;
6 | import android.animation.ObjectAnimator;
7 | import android.content.Context;
8 | import android.content.res.TypedArray;
9 | import android.util.AttributeSet;
10 | import android.view.View;
11 | import android.view.animation.AccelerateInterpolator;
12 | import android.view.animation.OvershootInterpolator;
13 | import android.widget.ImageView;
14 |
15 | public class MaterialFavoriteButton extends ImageView {
16 | public static final int STYLE_BLACK = 0;
17 | public static final int STYLE_WHITE = 1;
18 | public static final int STYLE_STAR = 0;
19 | public static final int STYLE_HEART = 1;
20 |
21 | private static final int DEFAULT_BUTTON_SIZE = 48;
22 | private static final int DEFAULT_PADDING = 12;
23 | private static final boolean DEFAULT_FAVORITE = false;
24 | private static final boolean DEFAULT_ANIMATE_FAVORITE = true;
25 | private static final boolean DEFAULT_ANIMATE_UNFAVORITE = false;
26 | private static final int DEFAULT_ROTATION_DURATION = 400;
27 | private static final int DEFAULT_ROTATION_ANGLE = 360;
28 | private static final int DEFAULT_BOUNCE_DURATION = 300;
29 | private static final int FAVORITE_STAR_BLACK = R.drawable.ic_star_black_24dp;
30 | private static final int FAVORITE_STAR_BORDER_BLACK = R.drawable.ic_star_border_black_24dp;
31 | private static final int FAVORITE_STAR_WHITE = R.drawable.ic_star_white_24dp;
32 | private static final int FAVORITE_STAR_BORDER_WHITE = R.drawable.ic_star_border_white_24dp;
33 | private static final int FAVORITE_HEART_BLACK = R.drawable.ic_favorite_black_24dp;
34 | private static final int FAVORITE_HEART_BORDER_BLACK = R.drawable.ic_favorite_border_black_24dp;
35 | private static final int FAVORITE_HEART_WHITE = R.drawable.ic_favorite_white_24dp;
36 | private static final int FAVORITE_HEART_BORDER_WHITE = R.drawable.ic_favorite_border_white_24dp;
37 | private static final AccelerateInterpolator ACCELERATE_INTERPOLATOR =
38 | new AccelerateInterpolator();
39 | private static final OvershootInterpolator OVERSHOOT_INTERPOLATOR = new OvershootInterpolator(4);
40 |
41 | private int mButtonSize;
42 | private int mPadding;
43 | private boolean mFavorite;
44 | private boolean mAnimateFavorite;
45 | private boolean mAnimateUnfavorite;
46 | private int mFavoriteResource;
47 | private int mNotFavoriteResource;
48 | private int mRotationDuration;
49 | private int mRotationAngle;
50 | private int mBounceDuration;
51 | private int mColor;
52 | private int mType;
53 |
54 | private OnFavoriteChangeListener mOnFavoriteChangeListener;
55 | private OnFavoriteAnimationEndListener mOnFavoriteAnimationEndListener;
56 | private boolean mBroadcasting;
57 |
58 | public MaterialFavoriteButton(Context context) {
59 | super(context);
60 | init(context, null);
61 | }
62 |
63 | public MaterialFavoriteButton(Context context, AttributeSet attrs) {
64 | super(context, attrs);
65 | init(context, attrs);
66 | }
67 |
68 | public MaterialFavoriteButton(Context context, AttributeSet attrs, int defStyleAttr) {
69 | super(context, attrs, defStyleAttr);
70 | init(context, attrs);
71 | }
72 |
73 | /**
74 | * Interface definition for a callback to be invoked when the favorite state is changed.
75 | */
76 | public interface OnFavoriteChangeListener {
77 | /**
78 | * Called when the favorite state is changed.
79 | *
80 | * @param buttonView the button view whose state has changed
81 | * @param favorite the favorite state
82 | */
83 | void onFavoriteChanged(MaterialFavoriteButton buttonView, boolean favorite);
84 | }
85 |
86 | /**
87 | * Set a listener will be called when the favorite state is changed.
88 | *
89 | * @param listener the {@link MaterialFavoriteButton.OnFavoriteChangeListener} will be called
90 | */
91 | public void setOnFavoriteChangeListener(OnFavoriteChangeListener listener) {
92 | mOnFavoriteChangeListener = listener;
93 | }
94 |
95 | /**
96 | * Interface definition for a callback to be invoked when the favorite animation ends.
97 | */
98 | public interface OnFavoriteAnimationEndListener {
99 | /**
100 | * Called when the favorite animation ended.
101 | *
102 | * @param buttonView the button view whose animation ended
103 | * @param favorite the favorite state
104 | */
105 | void onAnimationEnd(MaterialFavoriteButton buttonView, boolean favorite);
106 | }
107 |
108 | /**
109 | * Set a listener will be called when the favorite state is changed.
110 | *
111 | * @param listener the {@link MaterialFavoriteButton.OnFavoriteAnimationEndListener} will be
112 | * called
113 | */
114 | public void setOnFavoriteAnimationEndListener(OnFavoriteAnimationEndListener listener) {
115 | mOnFavoriteAnimationEndListener = listener;
116 | }
117 |
118 | /**
119 | * Initialize the default values
120 | *
121 | * - state = false
122 | * - size = 48 dp
123 | * - padding = 12 dp
124 | * - is mFavorite = false
125 | * - animated = true
126 | * - default drawables - stars
127 | * - rotation duration = 300 ms
128 | * - rotation angle = 360 degrees
129 | * - bounce duration = 300 ms
130 | * - color of default icon = black
131 | * - type of default icon = star
132 | *
133 | */
134 | private void init(Context context, AttributeSet attrs) {
135 | mButtonSize = Utils.dpToPx(DEFAULT_BUTTON_SIZE, getResources());
136 | mPadding = Utils.dpToPx(DEFAULT_PADDING, getResources());
137 | mFavorite = DEFAULT_FAVORITE;
138 | mAnimateFavorite = DEFAULT_ANIMATE_FAVORITE;
139 | mAnimateUnfavorite = DEFAULT_ANIMATE_UNFAVORITE;
140 | mFavoriteResource = FAVORITE_STAR_BLACK;
141 | mNotFavoriteResource = FAVORITE_STAR_BORDER_BLACK;
142 | mRotationDuration = DEFAULT_ROTATION_DURATION;
143 | mRotationAngle = DEFAULT_ROTATION_ANGLE;
144 | mBounceDuration = DEFAULT_BOUNCE_DURATION;
145 | mColor = STYLE_BLACK;
146 | mType = STYLE_STAR;
147 | if (!isInEditMode()) {
148 | if (attrs != null) {
149 | initAttributes(context, attrs);
150 | }
151 | setOnClickListener(new OnClickListener() {
152 | @Override public void onClick(View v) {
153 | toggleFavorite();
154 | }
155 | });
156 | }
157 | if (mFavorite) {
158 | setImageResource(mFavoriteResource);
159 | } else {
160 | setImageResource(mNotFavoriteResource);
161 | }
162 | setPadding(mPadding, mPadding, mPadding, mPadding);
163 | }
164 |
165 | private void initAttributes(Context context, AttributeSet attributeSet) {
166 | TypedArray attr = getTypedArray(context, attributeSet, R.styleable.MaterialFavoriteButton);
167 | if (attr != null) {
168 | try {
169 | mFavorite =
170 | attr.getBoolean(R.styleable.MaterialFavoriteButton_mfb_state, mAnimateUnfavorite);
171 | mButtonSize = Utils.dpToPx(
172 | attr.getInt(R.styleable.MaterialFavoriteButton_mfb_size, DEFAULT_BUTTON_SIZE),
173 | getResources());
174 | mAnimateFavorite = attr.getBoolean(R.styleable.MaterialFavoriteButton_mfb_animate_favorite,
175 | mAnimateFavorite);
176 | mAnimateUnfavorite =
177 | attr.getBoolean(R.styleable.MaterialFavoriteButton_mfb_animate_unfavorite,
178 | mAnimateUnfavorite);
179 | mPadding = Utils.dpToPx(
180 | attr.getInt(R.styleable.MaterialFavoriteButton_mfb_padding, DEFAULT_PADDING),
181 | getResources());
182 | if (attr.getResourceId(R.styleable.MaterialFavoriteButton_mfb_favorite_image, 0) != 0
183 | && attr.getResourceId(R.styleable.MaterialFavoriteButton_mfb_not_favorite_image, 0)
184 | != 0) {
185 | mFavoriteResource =
186 | attr.getResourceId(R.styleable.MaterialFavoriteButton_mfb_favorite_image,
187 | FAVORITE_STAR_BLACK);
188 | mNotFavoriteResource =
189 | attr.getResourceId(R.styleable.MaterialFavoriteButton_mfb_not_favorite_image,
190 | FAVORITE_STAR_BORDER_BLACK);
191 | } else {
192 | setTheme(attr.getInt(R.styleable.MaterialFavoriteButton_mfb_color, STYLE_BLACK),
193 | attr.getInt(R.styleable.MaterialFavoriteButton_mfb_type, STYLE_STAR));
194 | }
195 |
196 | mRotationDuration = attr.getInt(R.styleable.MaterialFavoriteButton_mfb_rotation_duration,
197 | mRotationDuration);
198 | mRotationAngle =
199 | attr.getInt(R.styleable.MaterialFavoriteButton_mfb_rotation_angle, mRotationAngle);
200 | mBounceDuration =
201 | attr.getInt(R.styleable.MaterialFavoriteButton_mfb_bounce_duration, mBounceDuration);
202 | } finally {
203 | attr.recycle();
204 | }
205 | }
206 | }
207 |
208 | private TypedArray getTypedArray(Context context, AttributeSet attributeSet, int[] attr) {
209 | return context.obtainStyledAttributes(attributeSet, attr, 0, 0);
210 | }
211 |
212 | private void setTheme(int color, int type) {
213 | if (color == STYLE_BLACK) {
214 | if (type == STYLE_STAR) {
215 | mFavoriteResource = FAVORITE_STAR_BLACK;
216 | mNotFavoriteResource = FAVORITE_STAR_BORDER_BLACK;
217 | } else {
218 | mFavoriteResource = FAVORITE_HEART_BLACK;
219 | mNotFavoriteResource = FAVORITE_HEART_BORDER_BLACK;
220 | }
221 | } else {
222 | if (type == STYLE_STAR) {
223 | mFavoriteResource = FAVORITE_STAR_WHITE;
224 | mNotFavoriteResource = FAVORITE_STAR_BORDER_WHITE;
225 | } else {
226 | mFavoriteResource = FAVORITE_HEART_WHITE;
227 | mNotFavoriteResource = FAVORITE_HEART_BORDER_WHITE;
228 | }
229 | }
230 | }
231 |
232 | private void setResources() {
233 | if (mFavorite) {
234 | setImageResource(mFavoriteResource);
235 | } else {
236 | setImageResource(mNotFavoriteResource);
237 | }
238 | }
239 |
240 | @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
241 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
242 | setMeasuredDimension(mButtonSize, mButtonSize);
243 | }
244 |
245 | /**
246 | * Returns favorite state.
247 | *
248 | * @return true if button is in favorite state, false if not
249 | */
250 | public boolean isFavorite() {
251 | return mFavorite;
252 | }
253 |
254 | /**
255 | * Changes the favorite state of this button without animation.
256 | *
257 | * @param favorite true to favorite the button, false to uncheck it
258 | */
259 | public void setFavorite(boolean favorite) {
260 | updateFavoriteButton(favorite, false, false);
261 | }
262 |
263 | /**
264 | * Changes the favorite state of this button with animation.
265 | *
266 | * @param favorite true to favorite the button, false to uncheck it
267 | */
268 | public void setFavoriteAnimated(boolean favorite) {
269 | updateFavoriteButton(favorite, true, false);
270 | }
271 |
272 | /**
273 | * Changes the favorite state of this button without calling OnFavoriteChangeListener.
274 | *
275 | * @param favorite true to favorite the button, false to uncheck it
276 | */
277 | public void setFavoriteSuppressListener(boolean favorite) {
278 | updateFavoriteButton(favorite, mAnimateFavorite, true);
279 | }
280 |
281 | /**
282 | * Changes the favorite state of this button.
283 | *
284 | * @param favorite true to favorite the button, false to uncheck it
285 | * @param animated true to force animated change, false to force not animated one
286 | */
287 | @Deprecated public void setFavorite(boolean favorite, boolean animated) {
288 | updateFavoriteButton(favorite, animated, false);
289 | }
290 |
291 | /**
292 | * Toggle the favorite state of this button.
293 | */
294 | public void toggleFavorite() {
295 | setFavorite(!mFavorite);
296 | }
297 |
298 | /**
299 | * Toggle the favorite state of this button.
300 | *
301 | * @param animated true to force animated toggle, false to force not animated one
302 | */
303 | public void toggleFavorite(boolean animated) {
304 | if (!mFavorite) {
305 | boolean orig = mAnimateFavorite;
306 | mAnimateFavorite = animated;
307 | setFavorite(!mFavorite);
308 | mAnimateFavorite = orig;
309 | } else {
310 | boolean orig = mAnimateUnfavorite;
311 | mAnimateUnfavorite = animated;
312 | setFavorite(!mFavorite);
313 | mAnimateUnfavorite = orig;
314 | }
315 | }
316 |
317 | private void updateFavoriteButton(boolean favorite, boolean animate, boolean suppressOnChange) {
318 | if (mFavorite != favorite) {
319 | mFavorite = favorite;
320 | // Avoid infinite recursions if setChecked() is called from a listener
321 | if (mBroadcasting) {
322 | return;
323 | }
324 |
325 | mBroadcasting = true;
326 | if (mOnFavoriteChangeListener != null && !suppressOnChange) {
327 | mOnFavoriteChangeListener.onFavoriteChanged(this, mFavorite);
328 | }
329 | if (favorite) {
330 | if (animate) {
331 | animateButton(favorite);
332 | } else {
333 | super.setImageResource(mFavoriteResource);
334 | if (mOnFavoriteAnimationEndListener != null) {
335 | mOnFavoriteAnimationEndListener.onAnimationEnd(this, mFavorite);
336 | }
337 | }
338 | } else {
339 | if (animate) {
340 | animateButton(favorite);
341 | } else {
342 | super.setImageResource(mNotFavoriteResource);
343 | if (mOnFavoriteAnimationEndListener != null) {
344 | mOnFavoriteAnimationEndListener.onAnimationEnd(this, mFavorite);
345 | }
346 | }
347 | }
348 | mBroadcasting = false;
349 | }
350 | }
351 |
352 | private void animateButton(boolean toFavorite) {
353 | final int startAngle = 0;
354 | int endAngle;
355 | float startBounce;
356 | float endBounce;
357 | if (toFavorite) {
358 | endAngle = mRotationAngle;
359 | startBounce = 0.2f;
360 | endBounce = 1.0f;
361 | } else {
362 | endAngle = -mRotationAngle;
363 | startBounce = 1.3f;
364 | endBounce = 1.0f;
365 | }
366 |
367 | AnimatorSet animatorSet = new AnimatorSet();
368 | ObjectAnimator rotationAnim = ObjectAnimator.ofFloat(this, "rotation", startAngle, endAngle);
369 | rotationAnim.setDuration(mRotationDuration);
370 | rotationAnim.setInterpolator(ACCELERATE_INTERPOLATOR);
371 |
372 | ObjectAnimator bounceAnimX = ObjectAnimator.ofFloat(this, "scaleX", startBounce, endBounce);
373 | bounceAnimX.setDuration(mBounceDuration);
374 | bounceAnimX.setInterpolator(OVERSHOOT_INTERPOLATOR);
375 |
376 | ObjectAnimator bounceAnimY = ObjectAnimator.ofFloat(this, "scaleY", startBounce, endBounce);
377 | bounceAnimY.setDuration(mBounceDuration);
378 | bounceAnimY.setInterpolator(OVERSHOOT_INTERPOLATOR);
379 | bounceAnimY.addListener(new AnimatorListenerAdapter() {
380 | @Override public void onAnimationStart(Animator animation) {
381 | if (mFavorite) {
382 | setImageResource(mFavoriteResource);
383 | } else {
384 | setImageResource(mNotFavoriteResource);
385 | }
386 | }
387 | });
388 |
389 | animatorSet.play(rotationAnim);
390 | animatorSet.play(bounceAnimX).with(bounceAnimY).after(rotationAnim);
391 |
392 | animatorSet.addListener(new AnimatorListenerAdapter() {
393 | @Override public void onAnimationEnd(Animator animation) {
394 | if (mOnFavoriteAnimationEndListener != null) {
395 | mOnFavoriteAnimationEndListener.onAnimationEnd(MaterialFavoriteButton.this, mFavorite);
396 | }
397 | }
398 | });
399 |
400 | animatorSet.start();
401 | }
402 |
403 | /**
404 | * Builder.
405 | */
406 | public static final class Builder {
407 | private final Context context;
408 |
409 | private int mButtonSize = DEFAULT_BUTTON_SIZE;
410 | private int mPadding = DEFAULT_PADDING;
411 | private boolean mFavorite = DEFAULT_FAVORITE;
412 | private boolean mAnimateFavorite = DEFAULT_ANIMATE_FAVORITE;
413 | private boolean mAnimateUnfavorite = DEFAULT_ANIMATE_UNFAVORITE;
414 | private int mFavoriteResource = FAVORITE_STAR_BLACK;
415 | private int mNotFavoriteResource = FAVORITE_STAR_BORDER_BLACK;
416 | private int mRotationDuration = DEFAULT_ROTATION_DURATION;
417 | private int mRotationAngle = DEFAULT_ROTATION_ANGLE;
418 | private int mBounceDuration = DEFAULT_BOUNCE_DURATION;
419 | private int mColor = STYLE_WHITE;
420 | private int mType = STYLE_BLACK;
421 | private boolean mCustomResources = false;
422 |
423 | public Builder(Context context) {
424 | this.context = context;
425 | }
426 |
427 | public Builder size(int size) {
428 | this.mButtonSize = size;
429 | return this;
430 | }
431 |
432 | public Builder padding(int padding) {
433 | this.mPadding = padding;
434 | return this;
435 | }
436 |
437 | public Builder favorite(boolean favorite) {
438 | this.mFavorite = favorite;
439 | return this;
440 | }
441 |
442 | public Builder animateFavorite(boolean animation) {
443 | this.mAnimateFavorite = animation;
444 | return this;
445 | }
446 |
447 | public Builder animateUnfavorite(boolean animation) {
448 | this.mAnimateUnfavorite = animation;
449 | return this;
450 | }
451 |
452 | public Builder favoriteResource(int resource) {
453 | this.mFavoriteResource = resource;
454 | mCustomResources = true;
455 | return this;
456 | }
457 |
458 | public Builder notFavoriteResource(int recsource) {
459 | this.mNotFavoriteResource = recsource;
460 | mCustomResources = true;
461 | return this;
462 | }
463 |
464 | public Builder rotationDuration(int rotationDuration) {
465 | this.mRotationDuration = rotationDuration;
466 | return this;
467 | }
468 |
469 | public Builder rotationAngle(int rotationAngle) {
470 | this.mRotationAngle = rotationAngle;
471 | return this;
472 | }
473 |
474 | public Builder bounceDuration(int bounceDuration) {
475 | this.mBounceDuration = bounceDuration;
476 | return this;
477 | }
478 |
479 | public Builder color(int color) {
480 | this.mColor = color;
481 | mCustomResources = false;
482 | return this;
483 | }
484 |
485 | public Builder type(int type) {
486 | this.mType = type;
487 | mCustomResources = false;
488 | return this;
489 | }
490 |
491 | public MaterialFavoriteButton create() {
492 | MaterialFavoriteButton materialFavoriteButton = new MaterialFavoriteButton(context);
493 | materialFavoriteButton.setSize(mButtonSize);
494 | materialFavoriteButton.setPadding(mPadding);
495 | materialFavoriteButton.setFavorite(mFavorite, false);
496 | materialFavoriteButton.setAnimateFavorite(mAnimateFavorite);
497 | materialFavoriteButton.setAnimateUnfavorite(mAnimateUnfavorite);
498 | materialFavoriteButton.setFavoriteResource(mFavoriteResource);
499 | materialFavoriteButton.setNotFavoriteResource(mNotFavoriteResource);
500 | materialFavoriteButton.setRotationDuration(mRotationDuration);
501 | materialFavoriteButton.setRotationAngle(mRotationAngle);
502 | materialFavoriteButton.setBounceDuration(mBounceDuration);
503 | if (!mCustomResources) {
504 | materialFavoriteButton.setColor(mColor);
505 | materialFavoriteButton.setType(mType);
506 | }
507 | materialFavoriteButton.setResources();
508 |
509 | return materialFavoriteButton;
510 | }
511 | }
512 |
513 | public void setSize(int size) {
514 | this.mButtonSize = Utils.dpToPx(size, getResources());
515 | }
516 |
517 | public void setPadding(int padding) {
518 | this.mPadding = Utils.dpToPx(padding, getResources());
519 | setPadding(mPadding, mPadding, mPadding, mPadding);
520 | }
521 |
522 | public void setAnimateFavorite(boolean animation) {
523 | this.mAnimateFavorite = animation;
524 | }
525 |
526 | public void setAnimateUnfavorite(boolean animation) {
527 | this.mAnimateUnfavorite = animation;
528 | }
529 |
530 | public void setFavoriteResource(int favoriteResource) {
531 | this.mFavoriteResource = favoriteResource;
532 | }
533 |
534 | public void setNotFavoriteResource(int notFavoriteResource) {
535 | this.mNotFavoriteResource = notFavoriteResource;
536 | }
537 |
538 | public void setRotationDuration(int rotationDuration) {
539 | this.mRotationDuration = rotationDuration;
540 | }
541 |
542 | public void setRotationAngle(int rotationAngle) {
543 | this.mRotationAngle = rotationAngle;
544 | }
545 |
546 | public void setBounceDuration(int bounceDuration) {
547 | this.mBounceDuration = bounceDuration;
548 | }
549 |
550 | public void setColor(int color) {
551 | this.mColor = color;
552 | setTheme(color, mType);
553 | }
554 |
555 | public void setType(int type) {
556 | this.mType = type;
557 | setTheme(mColor, type);
558 | }
559 | }
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/java/com/github/ivbaranov/mfb/Utils.java:
--------------------------------------------------------------------------------
1 | package com.github.ivbaranov.mfb;
2 |
3 | import android.content.res.Resources;
4 | import android.util.TypedValue;
5 |
6 | public class Utils {
7 | /**
8 | * Convert Dp to Pixel
9 | */
10 | public static int dpToPx(float dp, Resources resources) {
11 | float px =
12 | TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, resources.getDisplayMetrics());
13 | return (int) px;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-hdpi/ic_favorite_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-hdpi/ic_favorite_black_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-hdpi/ic_favorite_border_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-hdpi/ic_favorite_border_black_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-hdpi/ic_favorite_border_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-hdpi/ic_favorite_border_white_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-hdpi/ic_favorite_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-hdpi/ic_favorite_white_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-hdpi/ic_star_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-hdpi/ic_star_black_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-hdpi/ic_star_border_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-hdpi/ic_star_border_black_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-hdpi/ic_star_border_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-hdpi/ic_star_border_white_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-hdpi/ic_star_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-hdpi/ic_star_white_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-mdpi/ic_favorite_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-mdpi/ic_favorite_black_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-mdpi/ic_favorite_border_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-mdpi/ic_favorite_border_black_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-mdpi/ic_favorite_border_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-mdpi/ic_favorite_border_white_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-mdpi/ic_favorite_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-mdpi/ic_favorite_white_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-mdpi/ic_star_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-mdpi/ic_star_black_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-mdpi/ic_star_border_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-mdpi/ic_star_border_black_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-mdpi/ic_star_border_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-mdpi/ic_star_border_white_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-mdpi/ic_star_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-mdpi/ic_star_white_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xhdpi/ic_favorite_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xhdpi/ic_favorite_black_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xhdpi/ic_favorite_border_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xhdpi/ic_favorite_border_black_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xhdpi/ic_favorite_border_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xhdpi/ic_favorite_border_white_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xhdpi/ic_favorite_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xhdpi/ic_favorite_white_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xhdpi/ic_star_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xhdpi/ic_star_black_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xhdpi/ic_star_border_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xhdpi/ic_star_border_black_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xhdpi/ic_star_border_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xhdpi/ic_star_border_white_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xhdpi/ic_star_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xhdpi/ic_star_white_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xxhdpi/ic_favorite_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xxhdpi/ic_favorite_black_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xxhdpi/ic_favorite_border_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xxhdpi/ic_favorite_border_black_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xxhdpi/ic_favorite_border_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xxhdpi/ic_favorite_border_white_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xxhdpi/ic_favorite_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xxhdpi/ic_favorite_white_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xxhdpi/ic_star_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xxhdpi/ic_star_black_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xxhdpi/ic_star_border_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xxhdpi/ic_star_border_black_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xxhdpi/ic_star_border_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xxhdpi/ic_star_border_white_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xxhdpi/ic_star_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xxhdpi/ic_star_white_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xxxhdpi/ic_favorite_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xxxhdpi/ic_favorite_black_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xxxhdpi/ic_favorite_border_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xxxhdpi/ic_favorite_border_black_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xxxhdpi/ic_favorite_border_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xxxhdpi/ic_favorite_border_white_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xxxhdpi/ic_favorite_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xxxhdpi/ic_favorite_white_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xxxhdpi/ic_star_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xxxhdpi/ic_star_black_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xxxhdpi/ic_star_border_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xxxhdpi/ic_star_border_black_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xxxhdpi/ic_star_border_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xxxhdpi/ic_star_border_white_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/drawable-xxxhdpi/ic_star_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IvBaranov/MaterialFavoriteButton/46d0dcdabdbc6ce057e5b458f7fac1dff0a3d91e/materialfavoritebutton/src/main/res/drawable-xxxhdpi/ic_star_white_24dp.png
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/materialfavoritebutton/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | MaterialFavoriteButton
3 |
4 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':example', ':materialfavoritebutton'
2 |
--------------------------------------------------------------------------------