├── .gitignore ├── .travis.yml ├── LICENSE-2.0.txt ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.txt └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── shamanland │ │ └── facebook │ │ └── likebutton │ │ └── example │ │ ├── LikeAdapter.java │ │ ├── ListLikeActivity.java │ │ ├── MainActivity.java │ │ └── OpenUrlDialogFragment.java │ └── res │ ├── drawable-hdpi │ └── ic_launcher.png │ ├── drawable-mdpi │ └── ic_launcher.png │ ├── drawable-xhdpi │ └── ic_launcher.png │ ├── drawable-xxhdpi │ ├── blog.png │ └── ic_launcher.png │ ├── layout │ ├── activity_list_like.xml │ ├── activity_main.xml │ └── list_item.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── lib ├── build.gradle ├── gradle.properties └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── shamanland │ │ └── facebook │ │ └── likebutton │ │ ├── CalloutPath.java │ │ ├── FacebookLikeActivity.java │ │ ├── FacebookLikeBox.java │ │ ├── FacebookLikeButton.java │ │ ├── FacebookLikeOptions.java │ │ ├── FacebookLikePlugin.java │ │ ├── FacebookLinkStatProcessor.java │ │ └── FacebookLinkStatTask.java │ └── res │ ├── drawable-hdpi │ └── com_shamanland_facebook_inverse_icon.png │ ├── drawable-mdpi │ └── com_shamanland_facebook_inverse_icon.png │ ├── drawable-xhdpi │ └── com_shamanland_facebook_inverse_icon.png │ ├── drawable │ └── com_shamanland_facebook_button_blue.xml │ ├── layout │ └── com_shamanland_facebook_like_activity_progress.xml │ ├── values-hdpi │ └── styles.xml │ ├── values-xhdpi │ └── styles.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── ids.xml │ ├── strings.xml │ ├── styleable.xml │ ├── styles.xml │ └── themes.xml ├── readme.md └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | .idea 3 | *.iml 4 | build 5 | */gen 6 | *~ 7 | *.tmp 8 | *.log 9 | *.bak 10 | local.properties 11 | 12 | # files from device 13 | traces.txt 14 | 15 | # reports 16 | reports/ 17 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | script: ./gradlew build 3 | -------------------------------------------------------------------------------- /LICENSE-2.0.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'android-sdk-manager' 2 | apply plugin: 'android' 3 | 4 | android { 5 | compileSdkVersion 19 6 | buildToolsVersion '19.1.0' 7 | 8 | defaultConfig { 9 | minSdkVersion 10 10 | targetSdkVersion 19 11 | versionCode 1 12 | versionName '1.0' 13 | } 14 | } 15 | 16 | dependencies { 17 | compile 'com.android.support:appcompat-v7:19.1.0' 18 | compile project(':lib') 19 | } 20 | -------------------------------------------------------------------------------- /app/proguard-rules.txt: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /home/main/Software/android-studio/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the ProGuard 5 | # include property in project.properties. 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 | #} -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/shamanland/facebook/likebutton/example/LikeAdapter.java: -------------------------------------------------------------------------------- 1 | package com.shamanland.facebook.likebutton.example; 2 | 3 | import android.view.LayoutInflater; 4 | import android.view.View; 5 | import android.view.ViewGroup; 6 | import android.widget.BaseAdapter; 7 | import android.widget.TextView; 8 | 9 | import com.shamanland.facebook.likebutton.FacebookLikeButton; 10 | 11 | public class LikeAdapter extends BaseAdapter { 12 | private static final String[] sTitles = { 13 | "Facebook Like Button", 14 | "Android FontIcon Library", 15 | "Android FontIcon library available from Maven Central", 16 | "Android Dashboards - June, 4th", 17 | "Facebook SDK available from Maven repository", 18 | "Android Dashboards - May, 1st", 19 | "FontIcon Library now supports ColorStateList", 20 | "Android Dashboards - March, 3", 21 | "Android Dashboards. February 4th. Gingerbread still alive.", 22 | "Android. Support library. Nested fragments and startActivityForResult()", 23 | "Android Dashboards - Statistics of first 7 days of 2014 year", 24 | "How to redirect raw stream to logcat?", 25 | "Font-icon technique in Android. Critical issue!", 26 | "Android Dashboards - December, 2", 27 | "Naming convention for Android layout resources", 28 | "How to use icon-fonts in Android", 29 | "Android Dashboards - November, 1", 30 | "Hello world", 31 | }; 32 | 33 | private static final String[] sUrls = { 34 | "http://blog.shamanland.com/p/facebook-like-button.html", 35 | "http://blog.shamanland.com/p/android-fonticon-library.html", 36 | "http://blog.shamanland.com/2014/06/android-fonticon-library-available-from.html", 37 | "http://blog.shamanland.com/2014/06/android-dashboards-june-4th.html", 38 | "http://blog.shamanland.com/2014/05/add-facebook-sdk-to-project.html", 39 | "http://blog.shamanland.com/2014/05/android-dashboards-may-1st.html", 40 | "http://blog.shamanland.com/2014/04/fonticon-color-selector.html", 41 | "http://blog.shamanland.com/2014/03/android-dashboards-march-3.html", 42 | "http://blog.shamanland.com/2014/02/android-dashboards-february-4th.html", 43 | "http://blog.shamanland.com/2014/01/nested-fragments-for-result.html", 44 | "http://blog.shamanland.com/2014/01/android-dashboards-january-2014.html", 45 | "http://blog.shamanland.com/2013/12/redirect-stream-to-logcat.html", 46 | "http://blog.shamanland.com/2013/12/font-icon-technic-in-android-critical.html", 47 | "http://blog.shamanland.com/2013/12/android-dashboards-december-2.html", 48 | "http://blog.shamanland.com/2013/11/naming-convention-for-android-layout.html", 49 | "http://blog.shamanland.com/2013/11/how-to-use-icon-fonts-in-android.html", 50 | "http://blog.shamanland.com/2013/11/android-dashboards.html", 51 | "http://blog.shamanland.com/2013/10/test.html", 52 | }; 53 | 54 | private static final String[] sContents = { 55 | "Implementation of Facebook social plugin 'Like' for Android. Official Facebook SDK does not provide such component for Android.", 56 | "Android FontIcon is simple library which use font-based icons in Android.", 57 | "The latest version of FontIcon library for Android is available from Maven Central repository. It's easy to include it in project: Gradle repositories { mavenCentral() } dependencies { compile 'com.shamanland:fonticon:0.1.6' } Links Sources Project page", 58 | "This month Honeycomb devices are disappeared from official statistics about Android devices. There are three stable groups of API versions: Gingerbread (API 10) - 15% Ice Cream Sandwich and Jelly Bean (API 15-18) - 70% KitKat (API 19) - 14% Check details in this public spreadsheet.", 59 | "I don't know why Facebook still not published theirs SDK to Maven Central. Well, nobody forbids us to deploy it to Sonatype repository!", 60 | "Latest statistics about Android devices is available on developer.android.com. As usual we publish additional statistics in public Google document. You can check previous history and forecast for next month.", 61 | "New feature added to the FontIcon Library latest version 0.1.1. Now it's possible to set color-selector for icons. FontIconDrawable will handle changing the state, propagated from parental Button, TextView, etc.", 62 | "Latest statistics about Android devices is available on developer.android.com. As usual we publish additional statistics in public Google document. You can check previous history and forecast for next month.", 63 | "Google published new statistics about active Android versions. The most important information is about Gingerbread. Many developers dream to stop support it. But it's still alive! Last month we made forecast and it was wrong. Check updated document and make your own conclusion: support it or not.", 64 | "This post will be dedicated for nested Fragments from support library and for their big issue. There are available methods inside Fragment: startActivityForResult() and onActivityResult(). First one just delegates invocation to FragmentActivty.startActivityFromFragment(), and second one is called from FragmentActivity.onActivityResult(). If this behavior just wrapped around Activity, then how result is delivered into Fragment instance?", 65 | "Android developers still should care about Gingerbread users. Every month Google publishes platform statistics collected from Play Store. We are keeping previous statistics and it's quite easy to make some forecast. Month ago we made such forecast for January. Let's check it...", 66 | "Sometimes there is necessary to redirect lot of data, such as xml-file or something else, to logcat output. Especially useful to see HTTP traffic of your interaction with RESTful server (obviously in debug-mode only). Let's try to wrap and re-direct Java-stream to Android Logcat!", 67 | "This post oriented for those who already read and used font-icon drawables from previous post. During testing our application we found big issue - on some devices font-icons were invisible in ActionBar. This issue threatens this solution to be deleted from our project.", 68 | "Android lost Gingerbread users as usual by 2% per month. Detailed statistics and forecast for next month is available here. Data originally captured from developer.android.com.", 69 | "Every time when I was creating new layout resource there was issue: how to name it?", 70 | "There is popular web-technique for creating awesome icons - generate font with custom glyphs and use single unicode character with specified typeface. Look here for example and let’s try to use this technique in Android.", 71 | "Android Gingerbread lost again 2% of users. See detailed statistics and forecast to the next month in this public document. Data originally captured from developer.android.com.", 72 | "Today I started my blog!", 73 | }; 74 | 75 | private static final String[] sTimes = { 76 | "June 09, 2014", 77 | "June 09, 2014", 78 | "June 07, 2014", 79 | "June 07, 2014", 80 | "May 19, 2014", 81 | "May 05, 2014", 82 | "April 23, 2014", 83 | "March 05, 2014", 84 | "February 07, 2014", 85 | "January 14, 2014", 86 | "January 12, 2014", 87 | "December 23, 2013", 88 | "December 19, 2013", 89 | "December 09, 2013", 90 | "November 25, 2013", 91 | "November 13, 2013", 92 | "November 03, 2013", 93 | "October 31, 2013", 94 | }; 95 | 96 | @Override 97 | public int getCount() { 98 | return sTitles.length; 99 | } 100 | 101 | @Override 102 | public String getItem(int position) { 103 | return sUrls[position]; 104 | } 105 | 106 | @Override 107 | public long getItemId(int position) { 108 | return 0; 109 | } 110 | 111 | @Override 112 | public View getView(int position, View convertView, ViewGroup parent) { 113 | final View result; 114 | 115 | if (convertView == null) { 116 | result = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false); 117 | } else { 118 | result = convertView; 119 | } 120 | 121 | ViewHolder holder = ViewHolder.obtain(result); 122 | 123 | holder.title.setText(sTitles[position]); 124 | holder.time.setText(sTimes[position]); 125 | holder.content.setText(sContents[position]); 126 | holder.like.setPageUrl(sUrls[position]); 127 | holder.like.setPageTitle(sTitles[position]); 128 | holder.like.setPageText(sContents[position]); 129 | 130 | return result; 131 | } 132 | 133 | static class ViewHolder { 134 | TextView title; 135 | TextView time; 136 | TextView content; 137 | FacebookLikeButton like; 138 | 139 | ViewHolder(View view) { 140 | title = (TextView) view.findViewById(R.id.title); 141 | time = (TextView) view.findViewById(R.id.time); 142 | content = (TextView) view.findViewById(R.id.content); 143 | like = (FacebookLikeButton) view.findViewById(R.id.com_shamanland_facebook_like); 144 | } 145 | 146 | static ViewHolder obtain(View view) { 147 | final ViewHolder result; 148 | 149 | Object tag = view.getTag(); 150 | if (tag instanceof ViewHolder) { 151 | result = (ViewHolder) tag; 152 | } else { 153 | result = new ViewHolder(view); 154 | view.setTag(result); 155 | } 156 | 157 | return result; 158 | } 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /app/src/main/java/com/shamanland/facebook/likebutton/example/ListLikeActivity.java: -------------------------------------------------------------------------------- 1 | package com.shamanland.facebook.likebutton.example; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.ActionBarActivity; 5 | import android.view.MenuItem; 6 | import android.view.View; 7 | import android.widget.AdapterView; 8 | import android.widget.ListView; 9 | 10 | public class ListLikeActivity extends ActionBarActivity { 11 | @Override 12 | protected void onCreate(Bundle state) { 13 | super.onCreate(state); 14 | 15 | setContentView(R.layout.activity_list_like); 16 | 17 | ListView listView = (ListView) findViewById(android.R.id.list); 18 | listView.setAdapter(new LikeAdapter()); 19 | listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { 20 | @Override 21 | public void onItemClick(AdapterView adapterView, View view, int i, long l) { 22 | ListLikeActivity.this.onItemClick((String) adapterView.getAdapter().getItem(i)); 23 | } 24 | }); 25 | 26 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 27 | } 28 | 29 | protected void onItemClick(String url) { 30 | Bundle args = new Bundle(); 31 | args.putString("url", url); 32 | 33 | OpenUrlDialogFragment fragment = new OpenUrlDialogFragment(); 34 | fragment.setArguments(args); 35 | fragment.show(getSupportFragmentManager(), "open.url"); 36 | } 37 | 38 | @Override 39 | public boolean onOptionsItemSelected(MenuItem item) { 40 | switch (item.getItemId()) { 41 | case android.R.id.home: 42 | finish(); 43 | return true; 44 | } 45 | 46 | return super.onOptionsItemSelected(item); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/shamanland/facebook/likebutton/example/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.shamanland.facebook.likebutton.example; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.v4.view.MenuItemCompat; 6 | import android.support.v7.app.ActionBarActivity; 7 | import android.view.Menu; 8 | import android.view.MenuItem; 9 | import android.view.View; 10 | import android.widget.TextView; 11 | 12 | public class MainActivity extends ActionBarActivity { 13 | @Override 14 | protected void onCreate(Bundle state) { 15 | super.onCreate(state); 16 | setContentView(R.layout.activity_main); 17 | 18 | View.OnClickListener urlClickListener = new View.OnClickListener() { 19 | @Override 20 | public void onClick(View view) { 21 | onProjectPageClicked(((TextView) view.findViewById(android.R.id.text1)).getText().toString()); 22 | } 23 | }; 24 | 25 | findViewById(R.id.project_page).setOnClickListener(urlClickListener); 26 | findViewById(R.id.sources).setOnClickListener(urlClickListener); 27 | } 28 | 29 | @Override 30 | public boolean onCreateOptionsMenu(Menu menu) { 31 | MenuItem item = menu.add(Menu.NONE, android.R.id.list, Menu.NONE, R.string.list); 32 | MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); 33 | return true; 34 | } 35 | 36 | @Override 37 | public boolean onOptionsItemSelected(MenuItem item) { 38 | switch (item.getItemId()) { 39 | case android.R.id.list: 40 | startActivity(new Intent(this, ListLikeActivity.class)); 41 | return true; 42 | } 43 | 44 | return super.onOptionsItemSelected(item); 45 | } 46 | 47 | protected void onProjectPageClicked(String url) { 48 | Bundle args = new Bundle(); 49 | args.putString("url", url); 50 | 51 | OpenUrlDialogFragment fragment = new OpenUrlDialogFragment(); 52 | fragment.setArguments(args); 53 | fragment.show(getSupportFragmentManager(), "open.url"); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/shamanland/facebook/likebutton/example/OpenUrlDialogFragment.java: -------------------------------------------------------------------------------- 1 | package com.shamanland.facebook.likebutton.example; 2 | 3 | import android.app.AlertDialog; 4 | import android.app.Dialog; 5 | import android.content.DialogInterface; 6 | import android.content.Intent; 7 | import android.net.Uri; 8 | import android.os.Bundle; 9 | import android.support.v4.app.DialogFragment; 10 | 11 | public class OpenUrlDialogFragment extends DialogFragment { 12 | @Override 13 | public Dialog onCreateDialog(Bundle state) { 14 | return new AlertDialog.Builder(getActivity()) 15 | .setTitle(R.string.open_browser) 16 | .setMessage(getArguments().getString("url")) 17 | .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { 18 | @Override 19 | public void onClick(DialogInterface dialogInterface, int i) { 20 | Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getArguments().getString("url"))); 21 | getActivity().startActivity(intent); 22 | } 23 | }) 24 | .setNegativeButton(android.R.string.no, null) 25 | .create(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shamanland/facebook-like-button/1aed39f8d7f2a9870b6d81f4c4a0f2526d344ca1/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shamanland/facebook-like-button/1aed39f8d7f2a9870b6d81f4c4a0f2526d344ca1/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shamanland/facebook-like-button/1aed39f8d7f2a9870b6d81f4c4a0f2526d344ca1/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/blog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shamanland/facebook-like-button/1aed39f8d7f2a9870b6d81f4c4a0f2526d344ca1/app/src/main/res/drawable-xxhdpi/blog.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shamanland/facebook-like-button/1aed39f8d7f2a9870b6d81f4c4a0f2526d344ca1/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_list_like.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 23 | 24 | 30 | 31 | 40 | 41 | 42 | 49 | 50 | 56 | 57 | 66 | 67 | 68 | 74 | 75 | 82 | 83 | 87 | 88 | 89 | 97 | 98 | 103 | 104 | 112 | 113 | 114 | 122 | 123 | 129 | 130 | 141 | 142 | 143 | 151 | 152 | 163 | 164 | 170 | 171 | 172 | 184 | 185 | 186 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 17 | 18 | 28 | 29 | 38 | 39 | 46 | 47 | 52 | 53 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #00f 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Facebook Like Demo 4 | Open link in browser? 5 | List example 6 | Project page: 7 | Sources: 8 | http://blog.shamanland.com/p/facebook-like-button.html 9 | https://github.com/shamanland/facebook-like-button 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | } 5 | 6 | dependencies { 7 | classpath 'com.android.tools.build:gradle:0.11.0' 8 | classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.10.1' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | mavenCentral() 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | VERSION_NAME=0.1.8-SNAPSHOT 2 | VERSION_CODE=1 3 | GROUP=com.shamanland 4 | 5 | POM_DESCRIPTION=Implementation of Facebook social plugin 'Like' for Android 6 | POM_URL=http://blog.shamanland.com/p/facebook-like-button.html 7 | POM_SCM_URL=https://github.com/shamanland/facebook-like-button 8 | POM_SCM_CONNECTION=scm:git@github.com:shamanland/facebook-like-button.git 9 | POM_SCM_DEV_CONNECTION=scm:git@github.com:shamanland/facebook-like-button.git 10 | POM_LICENCE_NAME=The Apache Software License, Version 2.0 11 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt 12 | POM_LICENCE_DIST=repo 13 | POM_DEVELOPER_ID=shomeser 14 | POM_DEVELOPER_NAME=Oleksii Kropachov 15 | POM_DEVELOPER_EMAIL=o.kropachov@shamanland.com 16 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shamanland/facebook-like-button/1aed39f8d7f2a9870b6d81f4c4a0f2526d344ca1/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 15:27:10 PDT 2013 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-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 | -------------------------------------------------------------------------------- /lib/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'android-sdk-manager' 2 | apply plugin: 'android-library' 3 | 4 | android { 5 | compileSdkVersion 19 6 | buildToolsVersion '19.1.0' 7 | 8 | defaultConfig { 9 | minSdkVersion 10 10 | targetSdkVersion 19 11 | 12 | // workaround for https://code.google.com/p/android/issues/detail?id=52962 13 | buildConfigField 'boolean', 'LOGGING', VERSION_NAME.contains("SNAPSHOT").toString() 14 | } 15 | 16 | lintOptions { 17 | abortOnError false 18 | } 19 | } 20 | 21 | apply from: 'https://raw.github.com/shamanland/gradle-mvn-push/master/gradle-mvn-push.gradle' 22 | -------------------------------------------------------------------------------- /lib/gradle.properties: -------------------------------------------------------------------------------- 1 | POM_NAME=Facebook Like Button 2 | POM_ARTIFACT_ID=facebook-like-button 3 | POM_PACKAGING=aar 4 | -------------------------------------------------------------------------------- /lib/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /lib/src/main/java/com/shamanland/facebook/likebutton/CalloutPath.java: -------------------------------------------------------------------------------- 1 | package com.shamanland.facebook.likebutton; 2 | 3 | import android.graphics.Path; 4 | import android.graphics.RectF; 5 | 6 | public class CalloutPath extends Path { 7 | public static final int MARKER_NONE = 0x0; 8 | public static final int MARKER_LEFT = 0x1; 9 | public static final int MARKER_TOP = 0x2; 10 | public static final int MARKER_RIGHT = 0x4; 11 | public static final int MARKER_BOTTOM = 0x8; 12 | public static final int MARKER_ALL = 0xf; 13 | 14 | private final RectF oval = new RectF(); 15 | 16 | /** 17 | * @param m marker 18 | * @param w width 19 | * @param h height 20 | * @param s stroke thickness 21 | * @param r corners radius 22 | */ 23 | public void build(int m, float w, float h, float s, float r) { 24 | int fl = factor(m, MARKER_LEFT); 25 | int ft = factor(m, MARKER_TOP); 26 | int fr = factor(m, MARKER_RIGHT); 27 | int fb = factor(m, MARKER_BOTTOM); 28 | 29 | float x0 = s + 0f; 30 | float x1 = s + r * fl; 31 | float x2 = s + r + r * fl; 32 | float x3 = w / 2f - r; 33 | float x4 = w / 2f; 34 | float x5 = w / 2f + r; 35 | float x6 = w - 1f - s - r - r * fr; 36 | float x7 = w - 1f - s - r * fr; 37 | float x8 = w - 1f - s; 38 | float y0 = s + 0f; 39 | float y1 = s + r * ft; 40 | float y2 = s + r + r * ft; 41 | float y3 = h / 2f - r; 42 | float y4 = h / 2f; 43 | float y5 = h / 2f + r; 44 | float y6 = h - 1f - s - r - r * fb; 45 | float y7 = h - 1f - s - r * fb; 46 | float y8 = h - 1f - s; 47 | 48 | reset(); 49 | 50 | moveTo(x1, y2); 51 | 52 | oval.set(x2 - r, y2 - r, x2 + r, y2 + r); 53 | arcTo(oval, 180f, 90f); 54 | 55 | if (ft != 0) { 56 | lineTo(x3, y1); 57 | lineTo(x4, y0); 58 | lineTo(x5, y1); 59 | } 60 | 61 | lineTo(x6, y1); 62 | 63 | oval.set(x6 - r, y2 - r, x6 + r, y2 + r); 64 | arcTo(oval, 270f, 90f); 65 | 66 | if (fr != 0) { 67 | lineTo(x7, y3); 68 | lineTo(x8, y4); 69 | lineTo(x7, y5); 70 | } 71 | 72 | lineTo(x7, y6); 73 | 74 | oval.set(x6 - r, y6 - r, x6 + r, y6 + r); 75 | arcTo(oval, 0f, 90f); 76 | 77 | if (fb != 0) { 78 | lineTo(x5, y7); 79 | lineTo(x4, y8); 80 | lineTo(x3, y7); 81 | } 82 | 83 | lineTo(x2, y7); 84 | 85 | oval.set(x2 - r, y6 - r, x2 + r, y6 + r); 86 | arcTo(oval, 90f, 90f); 87 | 88 | if (fl != 0) { 89 | lineTo(x1, y5); 90 | lineTo(x0, y4); 91 | lineTo(x1, y3); 92 | } 93 | 94 | close(); 95 | } 96 | 97 | public static int factor(int marker, int mask) { 98 | return (marker & mask) != 0 ? 1 : 0; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /lib/src/main/java/com/shamanland/facebook/likebutton/FacebookLikeActivity.java: -------------------------------------------------------------------------------- 1 | package com.shamanland.facebook.likebutton; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.app.Activity; 5 | import android.content.Context; 6 | import android.graphics.Bitmap; 7 | import android.graphics.BitmapFactory; 8 | import android.os.Build; 9 | import android.os.Bundle; 10 | import android.os.Message; 11 | import android.text.Html; 12 | import android.util.Base64; 13 | import android.util.Log; 14 | import android.view.MotionEvent; 15 | import android.view.SoundEffectConstants; 16 | import android.view.View; 17 | import android.view.ViewGroup; 18 | import android.view.ViewParent; 19 | import android.webkit.WebChromeClient; 20 | import android.webkit.WebView; 21 | import android.webkit.WebViewClient; 22 | import android.widget.FrameLayout; 23 | import android.widget.Toast; 24 | 25 | import java.io.ByteArrayOutputStream; 26 | import java.net.MalformedURLException; 27 | import java.net.URLEncoder; 28 | import java.util.Iterator; 29 | import java.util.LinkedList; 30 | 31 | import static com.shamanland.facebook.likebutton.BuildConfig.LOGGING; 32 | 33 | public class FacebookLikeActivity extends Activity { 34 | private static final String LOG_TAG = FacebookLikeActivity.class.getSimpleName(); 35 | 36 | public static final String PAGE_URL = "page.url"; 37 | public static final String PAGE_TITLE = "page.title"; 38 | public static final String PAGE_TEXT = "page.text"; 39 | /** 40 | * Use {@link #PAGE_PICTURE_URL} or {@link #PAGE_PICTURE_ID}. 41 | * This param has the lowest priority. 42 | */ 43 | @Deprecated 44 | public static final String PAGE_PICTURE = "page.picture"; 45 | /** 46 | * This param has the highest priority. 47 | */ 48 | public static final String PAGE_PICTURE_URL = "page.picture.url"; 49 | /** 50 | * This param has normal priority. 51 | */ 52 | public static final String PAGE_PICTURE_ID = "page.picture.id"; 53 | public static final String APP_ID = "app.id"; 54 | public static final String CONTENT_VIEW_ID = "content.view.id"; 55 | public static final String OPTIONS = "options"; 56 | 57 | private static final View.OnTouchListener SKIP_TOUCH = new View.OnTouchListener() { 58 | @Override 59 | public boolean onTouch(View v, MotionEvent event) { 60 | return true; 61 | } 62 | }; 63 | 64 | private ViewGroup mContainer; 65 | private final LinkedList mWindows; 66 | private final WebChromeClient mWebChromeClient; 67 | private final WebViewClient mWebViewClient; 68 | 69 | public Context getContext() { 70 | return this; 71 | } 72 | 73 | public FacebookLikeActivity() { 74 | mWindows = new LinkedList(); 75 | 76 | mWebChromeClient = new WebChromeClient() { 77 | @Override 78 | public boolean onCreateWindow(WebView view, boolean isDialog, boolean isUserGesture, Message resultMsg) { 79 | WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj; 80 | if (transport == null) { 81 | return false; 82 | } 83 | 84 | transport.setWebView(createWindow()); 85 | resultMsg.sendToTarget(); 86 | return true; 87 | } 88 | 89 | @Override 90 | public void onCloseWindow(WebView window) { 91 | removeWindow(window); 92 | } 93 | }; 94 | 95 | mWebViewClient = new WebViewClient() { 96 | @Override 97 | public boolean shouldOverrideUrlLoading(WebView view, String url) { 98 | view.loadUrl(url); 99 | return true; 100 | } 101 | 102 | @Override 103 | public void onPageStarted(WebView view, String url, Bitmap favicon) { 104 | View progress = getProgressView(view); 105 | if (progress != null) { 106 | progress.setVisibility(View.VISIBLE); 107 | } 108 | } 109 | 110 | @Override 111 | public void onPageFinished(WebView view, String url) { 112 | View progress = getProgressView(view); 113 | if (progress != null) { 114 | progress.setVisibility(View.GONE); 115 | } 116 | } 117 | 118 | private View getProgressView(WebView view) { 119 | final View progress; 120 | 121 | Object tag = view.getTag(); 122 | if (tag instanceof View) { 123 | progress = (View) tag; 124 | } else { 125 | progress = createProgressBar(view); 126 | view.setTag(progress); 127 | } 128 | 129 | return progress; 130 | } 131 | }; 132 | } 133 | 134 | @Override 135 | protected void onCreate(Bundle state) { 136 | super.onCreate(state); 137 | setContentView(createRoot()); 138 | } 139 | 140 | @Override 141 | protected void onPostCreate(Bundle state) { 142 | super.onPostCreate(state); 143 | 144 | String content = generateContent(); 145 | if (content == null) { 146 | Toast.makeText(getApplication(), R.string.com_shamanland_facebook_like_activity_error, Toast.LENGTH_SHORT).show(); 147 | finish(); 148 | return; 149 | } 150 | 151 | if (LOGGING) { 152 | Log.v(LOG_TAG, "onPostCreate: loadDataWithBaseURL: " + getIntent().getStringExtra(PAGE_URL)); 153 | } 154 | 155 | createWindow().loadDataWithBaseURL(getIntent().getStringExtra(PAGE_URL), content, "text/html", "utf-8", null); 156 | } 157 | 158 | @Override 159 | public void onBackPressed() { 160 | final boolean handled; 161 | 162 | WebView window = mWindows.peekLast(); 163 | if (window.canGoBack()) { 164 | window.goBack(); 165 | handled = true; 166 | } else { 167 | handled = removeWindow(window); 168 | } 169 | 170 | if (handled) { 171 | mContainer.playSoundEffect(SoundEffectConstants.CLICK); 172 | } else { 173 | super.onBackPressed(); 174 | } 175 | } 176 | 177 | @Override 178 | protected void onDestroy() { 179 | super.onDestroy(); 180 | 181 | Iterator it = mWindows.iterator(); 182 | while (it.hasNext()) { 183 | WebView window = it.next(); 184 | it.remove(); 185 | 186 | detachFromParent(window); 187 | window.destroy(); 188 | } 189 | } 190 | 191 | private String generateContent() { 192 | String url = getIntent().getStringExtra(PAGE_URL); 193 | if (url == null) { 194 | return null; 195 | } 196 | 197 | try { 198 | new java.net.URL(url); 199 | } catch (MalformedURLException ex) { 200 | if (LOGGING) { 201 | Log.wtf(LOG_TAG, ex); 202 | } 203 | 204 | return null; 205 | } 206 | 207 | String title = getIntent().getStringExtra(PAGE_TITLE); 208 | String text = getIntent().getStringExtra(PAGE_TEXT); 209 | String appId = getIntent().getStringExtra(APP_ID); 210 | FacebookLikeOptions options = getIntent().getParcelableExtra(OPTIONS); 211 | if (options == null) { 212 | options = new FacebookLikeOptions(); 213 | } 214 | 215 | StringBuilder sb = new StringBuilder(); 216 | sb.append(""); 217 | sb.append(""); 218 | sb.append(""); 219 | 220 | if (title != null) { 221 | sb.append(options.titleOpen); 222 | sb.append(escapeHtml(title)); 223 | sb.append(options.titleClose); 224 | } 225 | 226 | appendImg(options, sb); 227 | 228 | if (text != null) { 229 | sb.append(options.textOpen); 230 | sb.append(escapeHtml(text)); 231 | sb.append(options.textClose); 232 | } 233 | 234 | appendUrl(url, appId, options, sb); 235 | 236 | sb.append(""); 237 | sb.append(""); 238 | 239 | try { 240 | return sb.toString(); 241 | } catch (OutOfMemoryError ex) { 242 | if (LOGGING) { 243 | Log.wtf(LOG_TAG, ex); 244 | } 245 | 246 | return null; 247 | } 248 | } 249 | 250 | private void appendImg(FacebookLikeOptions options, StringBuilder sb) { 251 | int[] size = null; 252 | 253 | CharSequence imgSrc = getIntent().getStringExtra(PAGE_PICTURE_URL); 254 | if (imgSrc == null) { 255 | Bitmap picture = null; 256 | 257 | int pictureId = getIntent().getIntExtra(PAGE_PICTURE_ID, 0); 258 | if (pictureId != 0) { 259 | picture = BitmapFactory.decodeResource(getResources(), pictureId); 260 | } 261 | 262 | if (picture == null) { 263 | //noinspection deprecation 264 | picture = getIntent().getParcelableExtra(PAGE_PICTURE); 265 | } 266 | 267 | if (picture != null) { 268 | StringBuilder tmp = new StringBuilder("data:image/png;base64,"); 269 | String base64 = bitmapToBase64(picture, getPictureSize(), size = new int[2]); 270 | if (base64 != null) { 271 | tmp.append(base64); 272 | imgSrc = tmp; 273 | } 274 | } 275 | } 276 | 277 | if (imgSrc != null) { 278 | sb.append(""); 291 | } 292 | } 293 | 294 | private void appendUrl(String url, String appId, FacebookLikeOptions options, StringBuilder sb) { 295 | sb.append(""); 319 | } 320 | 321 | private View createRoot() { 322 | View result = null; 323 | 324 | int contentViewId = getIntent().getIntExtra(CONTENT_VIEW_ID, 0); 325 | if (contentViewId != 0) { 326 | result = getLayoutInflater().inflate(contentViewId, null); 327 | } 328 | 329 | if (result != null) { 330 | View container = result.findViewById(R.id.com_shamanland_facebook_like_container); 331 | if (container instanceof ViewGroup) { 332 | mContainer = (ViewGroup) container; 333 | } 334 | } 335 | 336 | if (mContainer == null) { 337 | mContainer = new FrameLayout(getContext()); 338 | result = mContainer; 339 | } 340 | 341 | return result; 342 | } 343 | 344 | @SuppressLint("SetJavaScriptEnabled") 345 | @SuppressWarnings("deprecation") 346 | protected WebView createWindow() { 347 | FrameLayout wrapper = new FrameLayout(getContext()); 348 | WebView window = new WebView(getContext()); 349 | window.getSettings().setJavaScriptEnabled(true); 350 | window.getSettings().setSupportMultipleWindows(true); 351 | window.getSettings().setSavePassword(false); 352 | window.setWebChromeClient(mWebChromeClient); 353 | window.setWebViewClient(mWebViewClient); 354 | 355 | wrapper.addView(window); 356 | mWindows.add(window); 357 | mContainer.addView(wrapper); 358 | return window; 359 | } 360 | 361 | protected View createProgressBar(WebView window) { 362 | ViewParent parent = window.getParent(); 363 | if (parent instanceof ViewGroup) { 364 | ViewGroup wrapper = (ViewGroup) parent; 365 | 366 | View result = getLayoutInflater().inflate(R.layout.com_shamanland_facebook_like_activity_progress, wrapper, false); 367 | if (result != null) { 368 | wrapper.addView(result, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); 369 | result.setOnTouchListener(SKIP_TOUCH); 370 | return result; 371 | } 372 | } 373 | 374 | return null; 375 | } 376 | 377 | protected boolean removeWindow(WebView window) { 378 | if (mWindows.size() > 1) { 379 | mWindows.remove(window); 380 | 381 | ViewParent parent = window.getParent(); 382 | if (parent instanceof View) { 383 | mContainer.removeView((View) parent); 384 | } 385 | 386 | detachFromParent(window); 387 | window.destroy(); 388 | return true; 389 | } else { 390 | window.stopLoading(); 391 | window.loadDataWithBaseURL("about:blank", "", "text/html", "utf-8", null); 392 | return false; 393 | } 394 | } 395 | 396 | public static String escapeHtml(String unsecure) { 397 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { 398 | return Html.fromHtml(unsecure).toString(); 399 | } else { 400 | return Html.escapeHtml(unsecure); 401 | } 402 | } 403 | 404 | public static String bitmapToBase64(Bitmap picture, int size, int[] outSize) { 405 | try { 406 | int w = picture.getWidth(); 407 | int h = picture.getHeight(); 408 | 409 | int max = Math.max(w, h); 410 | if (max > size) { 411 | float factor = max / (float) size; 412 | w = (int) (w / factor); 413 | h = (int) (h / factor); 414 | 415 | picture = Bitmap.createScaledBitmap(picture, w, h, false); 416 | } 417 | 418 | outSize[0] = w; 419 | outSize[1] = h; 420 | 421 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); 422 | picture.compress(Bitmap.CompressFormat.PNG, 100, baos); 423 | return Base64.encodeToString(baos.toByteArray(), Base64.DEFAULT); 424 | } catch (Throwable ex) { 425 | if (LOGGING) { 426 | Log.wtf(LOG_TAG, ex); 427 | } 428 | 429 | return null; 430 | } 431 | } 432 | 433 | public static void detachFromParent(View view) { 434 | if (view != null) { 435 | ViewParent parent = view.getParent(); 436 | if (parent instanceof ViewGroup) { 437 | ((ViewGroup) parent).removeView(view); 438 | } 439 | } 440 | } 441 | 442 | @SuppressWarnings("deprecation") 443 | public int getPictureSize() { 444 | return Math.min( 445 | getWindowManager().getDefaultDisplay().getWidth(), 446 | getWindowManager().getDefaultDisplay().getHeight() 447 | ) / 8; 448 | } 449 | } 450 | -------------------------------------------------------------------------------- /lib/src/main/java/com/shamanland/facebook/likebutton/FacebookLikeBox.java: -------------------------------------------------------------------------------- 1 | package com.shamanland.facebook.likebutton; 2 | 3 | import android.content.Context; 4 | import android.content.res.Resources; 5 | import android.content.res.TypedArray; 6 | import android.graphics.Paint; 7 | import android.graphics.drawable.Drawable; 8 | import android.graphics.drawable.LayerDrawable; 9 | import android.graphics.drawable.ShapeDrawable; 10 | import android.graphics.drawable.shapes.PathShape; 11 | import android.os.Build; 12 | import android.os.Handler; 13 | import android.os.HandlerThread; 14 | import android.os.Looper; 15 | import android.os.Message; 16 | import android.os.Process; 17 | import android.util.AttributeSet; 18 | import android.util.Log; 19 | import android.widget.Button; 20 | 21 | import com.shamanland.facebook.likebutton.FacebookLinkStatProcessor.Result; 22 | 23 | import static com.shamanland.facebook.likebutton.BuildConfig.LOGGING; 24 | import static com.shamanland.facebook.likebutton.CalloutPath.MARKER_BOTTOM; 25 | import static com.shamanland.facebook.likebutton.CalloutPath.MARKER_LEFT; 26 | import static com.shamanland.facebook.likebutton.CalloutPath.MARKER_NONE; 27 | import static com.shamanland.facebook.likebutton.CalloutPath.MARKER_RIGHT; 28 | import static com.shamanland.facebook.likebutton.CalloutPath.MARKER_TOP; 29 | import static com.shamanland.facebook.likebutton.CalloutPath.factor; 30 | 31 | public class FacebookLikeBox extends Button { 32 | private static final String LOG_TAG = FacebookLikeBox.class.getSimpleName(); 33 | private static final Looper BACKGROUND; 34 | 35 | static { 36 | HandlerThread thread = new HandlerThread(FacebookLikeBox.class.getSimpleName(), Process.THREAD_PRIORITY_LOWEST); 37 | thread.start(); 38 | BACKGROUND = thread.getLooper(); 39 | } 40 | 41 | private Handler mHandler; 42 | private FacebookLinkStatProcessor mProcessor; 43 | private String mUrl; 44 | private boolean mAttachedToWindow; 45 | 46 | private CalloutPath mPath; 47 | private ShapeDrawable mFill; 48 | private ShapeDrawable mStroke; 49 | private float mCornerRadius; 50 | private int mCalloutMarker; 51 | 52 | public void setProcessor(FacebookLinkStatProcessor processor) { 53 | mProcessor = processor; 54 | } 55 | 56 | public void setPageUrl(String url) { 57 | String old = mUrl; 58 | mUrl = url; 59 | 60 | if (old == null && url != null || old != null && !old.equals(url)) { 61 | onUrlChanged(old, url); 62 | } 63 | } 64 | 65 | @Override 66 | public boolean isAttachedToWindow() { 67 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { 68 | return mAttachedToWindow; 69 | } else { 70 | return super.isAttachedToWindow(); 71 | } 72 | } 73 | 74 | public FacebookLikeBox(Context context) { 75 | super(context); 76 | init(null); 77 | } 78 | 79 | public FacebookLikeBox(Context context, AttributeSet attrs) { 80 | super(context, attrs); 81 | init(attrs); 82 | } 83 | 84 | public FacebookLikeBox(Context context, AttributeSet attrs, int defStyle) { 85 | super(context, attrs, defStyle); 86 | init(attrs); 87 | } 88 | 89 | private void init(AttributeSet attrs) { 90 | mProcessor = new FacebookLinkStatProcessor(); 91 | 92 | mHandler = new Handler(BACKGROUND, new Handler.Callback() { 93 | @Override 94 | public boolean handleMessage(Message msg) { 95 | processUrl((String) msg.obj); 96 | return true; 97 | } 98 | }); 99 | 100 | if (attrs == null) { 101 | return; 102 | } 103 | 104 | Context c = getContext(); 105 | if (c == null) { 106 | return; 107 | } 108 | 109 | TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.FacebookLikeBox); 110 | if (a == null) { 111 | return; 112 | } 113 | 114 | Resources r = getResources(); 115 | if (r == null) { 116 | return; 117 | } 118 | 119 | try { 120 | mPath = new CalloutPath(); 121 | mFill = new ShapeDrawable(); 122 | mFill.getPaint().setStyle(Paint.Style.FILL); 123 | mFill.getPaint().setColor(a.getColor(R.styleable.FacebookLikeBox_boxFillColor, r.getColor(R.color.com_shamanland_facebook_like_box_background_color))); 124 | mStroke = new ShapeDrawable(); 125 | mStroke.getPaint().setStyle(Paint.Style.STROKE); 126 | mStroke.getPaint().setColor(a.getColor(R.styleable.FacebookLikeBox_boxStrokeColor, r.getColor(R.color.com_shamanland_facebook_like_box_text_color))); 127 | mStroke.getPaint().setAntiAlias(true); 128 | mStroke.getPaint().setStrokeWidth(a.getDimension(R.styleable.FacebookLikeBox_boxStrokeWidth, r.getDimension(R.dimen.com_shamanland_facebook_like_box_stroke_width))); 129 | mCornerRadius = a.getDimension(R.styleable.FacebookLikeBox_boxCornersRadius, r.getDimension(R.dimen.com_shamanland_facebook_like_corners_radius)); 130 | mCalloutMarker = a.getInt(R.styleable.FacebookLikeBox_calloutMarker, MARKER_NONE); 131 | 132 | initBackground(); 133 | } finally { 134 | a.recycle(); 135 | } 136 | } 137 | 138 | @SuppressWarnings("deprecation") 139 | private void initBackground() { 140 | int pl = (int) (getPaddingLeft() + factor(mCalloutMarker, MARKER_LEFT) * mCornerRadius); 141 | int pt = (int) (getPaddingTop() + factor(mCalloutMarker, MARKER_TOP) * mCornerRadius); 142 | int pr = (int) (getPaddingRight() + factor(mCalloutMarker, MARKER_RIGHT) * mCornerRadius); 143 | int pb = (int) (getPaddingBottom() + factor(mCalloutMarker, MARKER_BOTTOM) * mCornerRadius); 144 | 145 | Drawable drawable = new LayerDrawable(new Drawable[]{mFill, mStroke}); 146 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { 147 | setBackgroundDrawable(drawable); 148 | } else { 149 | setBackground(drawable); 150 | } 151 | 152 | setPadding(pl, pt, pr, pb); 153 | } 154 | 155 | @Override 156 | protected void onAttachedToWindow() { 157 | super.onAttachedToWindow(); 158 | mAttachedToWindow = true; 159 | } 160 | 161 | @Override 162 | protected void onDetachedFromWindow() { 163 | super.onDetachedFromWindow(); 164 | mAttachedToWindow = false; 165 | } 166 | 167 | @Override 168 | protected void onSizeChanged(int w, int h, int oldW, int oldH) { 169 | mPath.build(mCalloutMarker, w, h, mStroke.getPaint().getStrokeWidth(), mCornerRadius); 170 | PathShape shape = new PathShape(mPath, w, h); 171 | mFill.setShape(shape); 172 | mStroke.setShape(shape); 173 | } 174 | 175 | protected void onUrlChanged(String oldValue, String newValue) { 176 | setText(R.string.com_shamanland_facebook_like_box_text_default); 177 | 178 | if (oldValue != null) { 179 | mHandler.removeMessages(0, oldValue); 180 | } 181 | 182 | if (newValue != null) { 183 | Message msg = Message.obtain(); 184 | if (msg != null) { 185 | msg.obj = newValue; 186 | mHandler.sendMessage(msg); 187 | } 188 | } 189 | } 190 | 191 | /** 192 | * Background thread 193 | */ 194 | protected void processUrl(final String url) { 195 | try { 196 | final Result result = mProcessor.processUrl(url); 197 | post(new Runnable() { 198 | @Override 199 | public void run() { 200 | if (isAttachedToWindow()) { 201 | postProcessUrl(url, result); 202 | } 203 | } 204 | }); 205 | } catch (Throwable ex) { 206 | if (LOGGING) { 207 | Log.wtf(LOG_TAG, ex); 208 | } 209 | } 210 | } 211 | 212 | protected void postProcessUrl(String url, Result result) { 213 | if (url.equals(mUrl)) { 214 | onUrlProcessed(result); 215 | } 216 | } 217 | 218 | protected void onUrlProcessed(Result result) { 219 | setText(prettyNumber(result.shares)); 220 | } 221 | 222 | protected String prettyNumber(long number) { 223 | if (number > 1000000000L) { 224 | return number / 1000000000L + "." + (number % 1000000000L) / 100000000L + "b"; 225 | } else if (number > 1000000L) { 226 | return number / 1000000L + "." + (number % 1000000L) / 100000L + "m"; 227 | } else if (number > 1000L) { 228 | return number / 1000L + "." + (number % 1000L) / 100L + "k"; 229 | } else { 230 | return String.valueOf(number); 231 | } 232 | } 233 | } 234 | -------------------------------------------------------------------------------- /lib/src/main/java/com/shamanland/facebook/likebutton/FacebookLikeButton.java: -------------------------------------------------------------------------------- 1 | package com.shamanland.facebook.likebutton; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.content.res.TypedArray; 6 | import android.graphics.Bitmap; 7 | import android.util.AttributeSet; 8 | import android.view.View; 9 | import android.widget.Button; 10 | 11 | public class FacebookLikeButton extends Button { 12 | public interface OnPageUrlChangeListener { 13 | void onPageUrlChanged(String newValue); 14 | } 15 | 16 | private String mPageUrl; 17 | private String mPageTitle; 18 | private String mPageText; 19 | @Deprecated 20 | private Bitmap mPagePicture; 21 | private String mPagePictureUrl; 22 | private int mPagePictureId; 23 | private String mAppId; 24 | private int mContentViewId; 25 | private FacebookLikeOptions mOptions; 26 | 27 | private OnPageUrlChangeListener mOnPageUrlChangeListener; 28 | 29 | public String getPageUrl() { 30 | return mPageUrl; 31 | } 32 | 33 | public void setPageUrl(String pageUrl) { 34 | mPageUrl = pageUrl; 35 | 36 | if (mOnPageUrlChangeListener != null) { 37 | mOnPageUrlChangeListener.onPageUrlChanged(mPageUrl); 38 | } 39 | } 40 | 41 | public String getPageTitle() { 42 | return mPageTitle; 43 | } 44 | 45 | public void setPageTitle(String pageTitle) { 46 | mPageTitle = pageTitle; 47 | } 48 | 49 | public String getPageText() { 50 | return mPageText; 51 | } 52 | 53 | public void setPageText(String pageText) { 54 | mPageText = pageText; 55 | } 56 | 57 | @Deprecated 58 | public Bitmap getPagePicture() { 59 | //noinspection deprecation 60 | return mPagePicture; 61 | } 62 | 63 | @Deprecated 64 | public void setPagePicture(Bitmap pagePicture) { 65 | //noinspection deprecation 66 | mPagePicture = pagePicture; 67 | } 68 | 69 | public String getPagePictureUrl() { 70 | return mPagePictureUrl; 71 | } 72 | 73 | public void setPagePictureUrl(String pagePictureUrl) { 74 | mPagePictureUrl = pagePictureUrl; 75 | } 76 | 77 | public int getPagePictureId() { 78 | return mPagePictureId; 79 | } 80 | 81 | public void setPagePictureId(int pagePictureId) { 82 | mPagePictureId = pagePictureId; 83 | } 84 | 85 | public String getAppId() { 86 | return mAppId; 87 | } 88 | 89 | public void setAppId(String appId) { 90 | mAppId = appId; 91 | } 92 | 93 | public int getContentViewId() { 94 | return mContentViewId; 95 | } 96 | 97 | public void setContentViewId(int contentViewId) { 98 | mContentViewId = contentViewId; 99 | } 100 | 101 | public FacebookLikeOptions getOptions() { 102 | return mOptions; 103 | } 104 | 105 | public void setOptions(FacebookLikeOptions options) { 106 | mOptions = options; 107 | } 108 | 109 | public void setOnPageUrlChangeListener(OnPageUrlChangeListener listener) { 110 | mOnPageUrlChangeListener = listener; 111 | 112 | if (mOnPageUrlChangeListener != null) { 113 | mOnPageUrlChangeListener.onPageUrlChanged(mPageUrl); 114 | } 115 | } 116 | 117 | public FacebookLikeButton(Context context) { 118 | super(context); 119 | init(null); 120 | } 121 | 122 | public FacebookLikeButton(Context context, AttributeSet attrs) { 123 | super(context, attrs); 124 | init(attrs); 125 | } 126 | 127 | public FacebookLikeButton(Context context, AttributeSet attrs, int defStyle) { 128 | super(context, attrs, defStyle); 129 | init(attrs); 130 | } 131 | 132 | private void initAttrs(AttributeSet attrs) { 133 | if (attrs == null) { 134 | return; 135 | } 136 | 137 | Context c = getContext(); 138 | if (c == null) { 139 | return; 140 | } 141 | 142 | TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.FacebookLikeButton, 0, 0); 143 | if (a == null) { 144 | return; 145 | } 146 | 147 | try { 148 | mPageUrl = a.getString(R.styleable.FacebookLikeButton_pageUrl); 149 | mPageTitle = a.getString(R.styleable.FacebookLikeButton_pageTitle); 150 | mPageText = a.getString(R.styleable.FacebookLikeButton_pageText); 151 | 152 | mPagePictureUrl = a.getString(R.styleable.FacebookLikeButton_pagePictureUrl); 153 | mPagePictureId = a.getResourceId(R.styleable.FacebookLikeButton_pagePictureId, 0); 154 | if (mPagePictureId == 0) { 155 | mPagePictureId = a.getResourceId(R.styleable.FacebookLikeButton_pagePicture, 0); 156 | } 157 | 158 | mAppId = a.getString(R.styleable.FacebookLikeButton_appId); 159 | mContentViewId = a.getResourceId(R.styleable.FacebookLikeButton_contentViewId, 0); 160 | 161 | mOptions = new FacebookLikeOptions(); 162 | mOptions.titleOpen = getString(a, R.styleable.FacebookLikeButton_optTitleOpen, mOptions.titleOpen); 163 | mOptions.titleClose = getString(a, R.styleable.FacebookLikeButton_optTitleClose, mOptions.titleClose); 164 | mOptions.textOpen = getString(a, R.styleable.FacebookLikeButton_optTextOpen, mOptions.textOpen); 165 | mOptions.textClose = getString(a, R.styleable.FacebookLikeButton_optTextClose, mOptions.textClose); 166 | mOptions.pictureAttrs = getString(a, R.styleable.FacebookLikeButton_optPictureAttrs, mOptions.pictureAttrs); 167 | mOptions.layout = FacebookLikeOptions.Layout.values()[a.getInt(R.styleable.FacebookLikeButton_optLayout, 0)]; 168 | mOptions.action = FacebookLikeOptions.Action.values()[a.getInt(R.styleable.FacebookLikeButton_optAction, 0)]; 169 | mOptions.showFaces = a.getBoolean(R.styleable.FacebookLikeButton_optShowFaces, mOptions.showFaces); 170 | mOptions.share = a.getBoolean(R.styleable.FacebookLikeButton_optShare, mOptions.share); 171 | } finally { 172 | a.recycle(); 173 | } 174 | } 175 | 176 | private String getString(TypedArray a, int index, String defValue) { 177 | String read = a.getString(index); 178 | return read != null ? read : defValue; 179 | } 180 | 181 | private void init(AttributeSet attrs) { 182 | if (attrs != null) { 183 | initAttrs(attrs); 184 | } 185 | 186 | setOnClickListener(new OnClickListener() { 187 | @Override 188 | public void onClick(View v) { 189 | performLike(); 190 | } 191 | }); 192 | } 193 | 194 | public void performLike() { 195 | Context c = getContext(); 196 | if (c == null) { 197 | return; 198 | } 199 | 200 | Intent intent = new Intent(c, FacebookLikeActivity.class); 201 | intent.putExtra(FacebookLikeActivity.PAGE_URL, mPageUrl); 202 | intent.putExtra(FacebookLikeActivity.PAGE_TITLE, mPageTitle); 203 | intent.putExtra(FacebookLikeActivity.PAGE_TEXT, mPageText); 204 | intent.putExtra(FacebookLikeActivity.PAGE_PICTURE_URL, mPagePictureUrl); 205 | intent.putExtra(FacebookLikeActivity.PAGE_PICTURE_ID, mPagePictureId); 206 | 207 | //noinspection deprecation 208 | if (mPagePictureUrl == null && mPagePictureId == 0 && mPagePicture != null) { 209 | //noinspection deprecation 210 | intent.putExtra(FacebookLikeActivity.PAGE_PICTURE, mPagePicture); 211 | } 212 | 213 | intent.putExtra(FacebookLikeActivity.APP_ID, mAppId); 214 | intent.putExtra(FacebookLikeActivity.CONTENT_VIEW_ID, mContentViewId); 215 | intent.putExtra(FacebookLikeActivity.OPTIONS, mOptions); 216 | c.startActivity(intent); 217 | } 218 | } 219 | -------------------------------------------------------------------------------- /lib/src/main/java/com/shamanland/facebook/likebutton/FacebookLikeOptions.java: -------------------------------------------------------------------------------- 1 | package com.shamanland.facebook.likebutton; 2 | 3 | import android.os.Parcel; 4 | import android.os.Parcelable; 5 | 6 | import java.util.Locale; 7 | 8 | public final class FacebookLikeOptions implements Parcelable { 9 | public enum Layout { 10 | STANDARD, BOX_COUNT, BUTTON_COUNT, BUTTON 11 | } 12 | 13 | public enum Action { 14 | LIKE, RECOMMEND 15 | } 16 | 17 | public String titleOpen = "

"; 18 | public String titleClose = "

"; 19 | public String textOpen = "

"; 20 | public String textClose = "

"; 21 | public String pictureAttrs = "style='float:left;margin:4px;'"; 22 | public Layout layout = Layout.STANDARD; 23 | public Action action = Action.LIKE; 24 | public boolean showFaces = true; 25 | public boolean share = true; 26 | 27 | public String getLayoutString() { 28 | return (layout != null ? layout : Layout.STANDARD).name().toLowerCase(Locale.US); 29 | } 30 | 31 | public String getActionString() { 32 | return (action != null ? action : Action.LIKE).name().toLowerCase(Locale.US); 33 | } 34 | 35 | public FacebookLikeOptions setTitleOpen(String titleOpen) { 36 | this.titleOpen = titleOpen; 37 | return this; 38 | } 39 | 40 | public FacebookLikeOptions setTitleClose(String titleClose) { 41 | this.titleClose = titleClose; 42 | return this; 43 | } 44 | 45 | public FacebookLikeOptions setTextOpen(String textOpen) { 46 | this.textOpen = textOpen; 47 | return this; 48 | } 49 | 50 | public FacebookLikeOptions setTextClose(String textClose) { 51 | this.textClose = textClose; 52 | return this; 53 | } 54 | 55 | public FacebookLikeOptions setPictureAttrs(String pictureAttrs) { 56 | this.pictureAttrs = pictureAttrs; 57 | return this; 58 | } 59 | 60 | public FacebookLikeOptions setLayout(Layout layout) { 61 | this.layout = layout; 62 | return this; 63 | } 64 | 65 | public FacebookLikeOptions setAction(Action action) { 66 | this.action = action; 67 | return this; 68 | } 69 | 70 | public FacebookLikeOptions setShowFaces(boolean showFaces) { 71 | this.showFaces = showFaces; 72 | return this; 73 | } 74 | 75 | public FacebookLikeOptions setShare(boolean share) { 76 | this.share = share; 77 | return this; 78 | } 79 | 80 | public FacebookLikeOptions() { 81 | super(); 82 | } 83 | 84 | @Override 85 | public boolean equals(Object o) { 86 | if (this == o) return true; 87 | if (o == null || ((Object) this).getClass() != o.getClass()) return false; 88 | 89 | FacebookLikeOptions that = (FacebookLikeOptions) o; 90 | 91 | if (share != that.share) return false; 92 | if (showFaces != that.showFaces) return false; 93 | if (action != that.action) return false; 94 | if (layout != that.layout) return false; 95 | if (pictureAttrs != null ? !pictureAttrs.equals(that.pictureAttrs) : that.pictureAttrs != null) 96 | return false; 97 | if (textClose != null ? !textClose.equals(that.textClose) : that.textClose != null) 98 | return false; 99 | if (textOpen != null ? !textOpen.equals(that.textOpen) : that.textOpen != null) 100 | return false; 101 | if (titleClose != null ? !titleClose.equals(that.titleClose) : that.titleClose != null) 102 | return false; 103 | if (titleOpen != null ? !titleOpen.equals(that.titleOpen) : that.titleOpen != null) 104 | return false; 105 | 106 | return true; 107 | } 108 | 109 | @Override 110 | public int hashCode() { 111 | int result = titleOpen != null ? titleOpen.hashCode() : 0; 112 | result = 31 * result + (titleClose != null ? titleClose.hashCode() : 0); 113 | result = 31 * result + (textOpen != null ? textOpen.hashCode() : 0); 114 | result = 31 * result + (textClose != null ? textClose.hashCode() : 0); 115 | result = 31 * result + (pictureAttrs != null ? pictureAttrs.hashCode() : 0); 116 | result = 31 * result + (layout != null ? layout.hashCode() : 0); 117 | result = 31 * result + (action != null ? action.hashCode() : 0); 118 | result = 31 * result + (showFaces ? 1 : 0); 119 | result = 31 * result + (share ? 1 : 0); 120 | return result; 121 | } 122 | 123 | public int describeContents() { 124 | return 0; 125 | } 126 | 127 | public void writeToParcel(Parcel out, int flags) { 128 | out.writeString(titleOpen); 129 | out.writeString(titleClose); 130 | out.writeString(textOpen); 131 | out.writeString(textClose); 132 | out.writeString(pictureAttrs); 133 | out.writeInt(layout != null ? layout.ordinal() : 0); 134 | out.writeInt(action != null ? action.ordinal() : 0); 135 | out.writeInt(showFaces ? 1 : 0); 136 | out.writeInt(share ? 1 : 0); 137 | } 138 | 139 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { 140 | public FacebookLikeOptions createFromParcel(Parcel in) { 141 | return new FacebookLikeOptions(in); 142 | } 143 | 144 | public FacebookLikeOptions[] newArray(int size) { 145 | return new FacebookLikeOptions[size]; 146 | } 147 | }; 148 | 149 | private FacebookLikeOptions(Parcel in) { 150 | titleOpen = in.readString(); 151 | titleClose = in.readString(); 152 | textOpen = in.readString(); 153 | textClose = in.readString(); 154 | pictureAttrs = in.readString(); 155 | layout = Layout.values()[in.readInt()]; 156 | action = Action.values()[in.readInt()]; 157 | showFaces = in.readInt() == 1; 158 | share = in.readInt() == 1; 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /lib/src/main/java/com/shamanland/facebook/likebutton/FacebookLikePlugin.java: -------------------------------------------------------------------------------- 1 | package com.shamanland.facebook.likebutton; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Context; 5 | import android.content.res.TypedArray; 6 | import android.os.Build; 7 | import android.util.AttributeSet; 8 | import android.view.View; 9 | import android.widget.LinearLayout; 10 | 11 | import com.shamanland.facebook.likebutton.FacebookLikeButton.OnPageUrlChangeListener; 12 | 13 | public class FacebookLikePlugin extends LinearLayout { 14 | private int mLikeId; 15 | private int mBoxId; 16 | 17 | public FacebookLikePlugin(Context context) { 18 | super(context); 19 | init(null); 20 | } 21 | 22 | public FacebookLikePlugin(Context context, AttributeSet attrs) { 23 | super(context, attrs); 24 | init(attrs); 25 | } 26 | 27 | @TargetApi(Build.VERSION_CODES.HONEYCOMB) 28 | public FacebookLikePlugin(Context context, AttributeSet attrs, int defStyle) { 29 | super(context, attrs, defStyle); 30 | init(attrs); 31 | } 32 | 33 | private void init(AttributeSet attrs) { 34 | if (attrs == null) { 35 | return; 36 | } 37 | 38 | Context c = getContext(); 39 | if (c == null) { 40 | return; 41 | } 42 | 43 | TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.FacebookLikePlugin); 44 | if (a == null) { 45 | return; 46 | } 47 | 48 | try { 49 | mLikeId = a.getResourceId(R.styleable.FacebookLikePlugin_likeId, R.id.com_shamanland_facebook_like); 50 | mBoxId = a.getResourceId(R.styleable.FacebookLikePlugin_boxId, R.id.com_shamanland_facebook_like_box); 51 | } finally { 52 | a.recycle(); 53 | } 54 | } 55 | 56 | @Override 57 | protected void onFinishInflate() { 58 | super.onFinishInflate(); 59 | 60 | final View like = findViewById(mLikeId); 61 | final View box = findViewById(mBoxId); 62 | 63 | if (like instanceof FacebookLikeButton && box instanceof FacebookLikeBox) { 64 | ((FacebookLikeButton) like).setOnPageUrlChangeListener(new OnPageUrlChangeListener() { 65 | @Override 66 | public void onPageUrlChanged(String newValue) { 67 | ((FacebookLikeBox) box).setPageUrl(newValue); 68 | } 69 | }); 70 | 71 | box.setOnClickListener(new OnClickListener() { 72 | @Override 73 | public void onClick(View v) { 74 | like.performClick(); 75 | } 76 | }); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/src/main/java/com/shamanland/facebook/likebutton/FacebookLinkStatProcessor.java: -------------------------------------------------------------------------------- 1 | package com.shamanland.facebook.likebutton; 2 | 3 | import android.util.Log; 4 | 5 | import org.json.JSONException; 6 | import org.json.JSONObject; 7 | 8 | import java.io.BufferedReader; 9 | import java.io.IOException; 10 | import java.io.InputStreamReader; 11 | import java.net.HttpURLConnection; 12 | import java.net.URL; 13 | import java.net.URLConnection; 14 | 15 | import static com.shamanland.facebook.likebutton.BuildConfig.LOGGING; 16 | 17 | public class FacebookLinkStatProcessor { 18 | private static final String LOG_TAG = FacebookLinkStatProcessor.class.getSimpleName(); 19 | 20 | public static class Result { 21 | public String url; 22 | public long shares; 23 | public long comments; 24 | } 25 | 26 | protected String getRequestUrl(String url) { 27 | return "https://graph.facebook.com/" + url; 28 | } 29 | 30 | protected Result getResult(String url, JSONObject json) { 31 | Result result = new Result(); 32 | result.url = url; 33 | result.shares = getShares(json); 34 | result.comments = getComments(json); 35 | return result; 36 | } 37 | 38 | protected long getShares(JSONObject json) { 39 | return json.optLong("shares", 0); 40 | } 41 | 42 | protected long getComments(JSONObject json) { 43 | return json.optLong("comments", 0); 44 | } 45 | 46 | public Result processUrl(String url) throws IOException, JSONException { 47 | if (LOGGING) { 48 | Log.v(LOG_TAG, "processUrl: openConnection: " + url); 49 | } 50 | 51 | URLConnection connection = new URL(getRequestUrl(url)).openConnection(); 52 | BufferedReader reader = null; 53 | 54 | try { 55 | reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); 56 | 57 | StringBuilder sb = new StringBuilder(); 58 | String line; 59 | while ((line = reader.readLine()) != null) { 60 | sb.append(line); 61 | } 62 | 63 | return getResult(url, new JSONObject(sb.toString())); 64 | } finally { 65 | if (reader != null) { 66 | reader.close(); 67 | } 68 | 69 | if (connection instanceof HttpURLConnection) { 70 | ((HttpURLConnection) connection).disconnect(); 71 | } 72 | 73 | if (LOGGING) { 74 | Log.v(LOG_TAG, "processUrl: disconnect: " + url); 75 | } 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /lib/src/main/java/com/shamanland/facebook/likebutton/FacebookLinkStatTask.java: -------------------------------------------------------------------------------- 1 | package com.shamanland.facebook.likebutton; 2 | 3 | import android.os.AsyncTask; 4 | 5 | import com.shamanland.facebook.likebutton.FacebookLinkStatProcessor.Result; 6 | 7 | import java.lang.ref.WeakReference; 8 | 9 | public class FacebookLinkStatTask extends AsyncTask { 10 | public interface Listener { 11 | void onPostExecute(Result result); 12 | } 13 | 14 | private final FacebookLinkStatProcessor mProcessor; 15 | private final WeakReference mListener; 16 | 17 | public FacebookLinkStatTask(FacebookLinkStatProcessor processor, Listener listener) { 18 | mProcessor = processor; 19 | mListener = new WeakReference(listener); 20 | } 21 | 22 | @Override 23 | protected Result doInBackground(String... params) { 24 | try { 25 | return mProcessor.processUrl(params[0]); 26 | } catch (Throwable ex) { 27 | return null; 28 | } 29 | } 30 | 31 | @Override 32 | protected void onPostExecute(Result result) { 33 | Listener listener = mListener.get(); 34 | if (listener != null) { 35 | listener.onPostExecute(result); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/src/main/res/drawable-hdpi/com_shamanland_facebook_inverse_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shamanland/facebook-like-button/1aed39f8d7f2a9870b6d81f4c4a0f2526d344ca1/lib/src/main/res/drawable-hdpi/com_shamanland_facebook_inverse_icon.png -------------------------------------------------------------------------------- /lib/src/main/res/drawable-mdpi/com_shamanland_facebook_inverse_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shamanland/facebook-like-button/1aed39f8d7f2a9870b6d81f4c4a0f2526d344ca1/lib/src/main/res/drawable-mdpi/com_shamanland_facebook_inverse_icon.png -------------------------------------------------------------------------------- /lib/src/main/res/drawable-xhdpi/com_shamanland_facebook_inverse_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shamanland/facebook-like-button/1aed39f8d7f2a9870b6d81f4c4a0f2526d344ca1/lib/src/main/res/drawable-xhdpi/com_shamanland_facebook_inverse_icon.png -------------------------------------------------------------------------------- /lib/src/main/res/drawable/com_shamanland_facebook_button_blue.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 13 | 17 | 18 | 19 | 23 | 24 | 25 | 29 | 30 | 31 | 34 | 35 | 36 | 40 | 44 | 45 | 46 | 50 | 51 | 52 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /lib/src/main/res/layout/com_shamanland_facebook_like_activity_progress.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 13 | 14 | -------------------------------------------------------------------------------- /lib/src/main/res/values-hdpi/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /lib/src/main/res/values-xhdpi/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /lib/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #5975b0 4 | #50699e 5 | #7a90bf 6 | #6982b7 7 | #375196 8 | #3b538e 9 | #425d9e 10 | #344a7e 11 | #898f9c 12 | #8fff 13 | #fff 14 | 15 | -------------------------------------------------------------------------------- /lib/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 28sp 4 | 4sp 5 | 0sp 6 | 4sp 7 | 0sp 8 | 2sp 9 | 14sp 10 | 3sp 11 | 40dp 12 | 1dp 13 | 6sp 14 | 3sp 15 | 6sp 16 | 3sp 17 | 18 | -------------------------------------------------------------------------------- /lib/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Facebook 4 | Like 5 | Share 6 | Recommend 7 | 0 8 | Action \'like\' could not be done 9 | 10 | -------------------------------------------------------------------------------- /lib/src/main/res/values/styleable.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /lib/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 26 | 40 | 41 | -------------------------------------------------------------------------------- /lib/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | Facebook Like Button 2 | ==== 3 | 4 | [![Build Status](https://travis-ci.org/shamanland/facebook-like-button.svg?branch=master)](https://travis-ci.org/shamanland/facebook-like-button) 5 | 6 | Implementation of [Facebook 'Like' social plugin][8] for Android. 7 | 8 | Official [Facebook SDK][12] does not provide such component for Android. 9 | 10 | This library uses ``WebView`` to display ``