├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── samples
├── AccountKitSample
│ ├── src
│ │ ├── main
│ │ │ ├── res
│ │ │ │ ├── drawable-hdpi
│ │ │ │ │ ├── dog.jpg
│ │ │ │ │ ├── bicycle.jpg
│ │ │ │ │ ├── reverb_icon.png
│ │ │ │ │ ├── reverb_email.png
│ │ │ │ │ ├── reverb_error.png
│ │ │ │ │ ├── reverb_checkmark.png
│ │ │ │ │ ├── reverb_arrow_purple.png
│ │ │ │ │ ├── reverb_arrow_white.png
│ │ │ │ │ ├── reverb_email_sent.png
│ │ │ │ │ ├── reverb_progress_ring.png
│ │ │ │ │ ├── reverb_rating_bar_selected.png
│ │ │ │ │ └── reverb_rating_bar_unselected.png
│ │ │ │ ├── drawable-mdpi
│ │ │ │ │ ├── dog.jpg
│ │ │ │ │ ├── bicycle.jpg
│ │ │ │ │ ├── reverb_icon.png
│ │ │ │ │ ├── reverb_email.png
│ │ │ │ │ ├── reverb_error.png
│ │ │ │ │ ├── reverb_checkmark.png
│ │ │ │ │ ├── reverb_arrow_purple.png
│ │ │ │ │ ├── reverb_arrow_white.png
│ │ │ │ │ ├── reverb_email_sent.png
│ │ │ │ │ ├── reverb_progress_ring.png
│ │ │ │ │ ├── reverb_rating_bar_selected.png
│ │ │ │ │ └── reverb_rating_bar_unselected.png
│ │ │ │ ├── drawable-xhdpi
│ │ │ │ │ ├── dog.jpg
│ │ │ │ │ ├── bicycle.jpg
│ │ │ │ │ ├── reverb_email.png
│ │ │ │ │ ├── reverb_error.png
│ │ │ │ │ ├── reverb_icon.png
│ │ │ │ │ ├── reverb_arrow_white.png
│ │ │ │ │ ├── reverb_checkmark.png
│ │ │ │ │ ├── reverb_email_sent.png
│ │ │ │ │ ├── reverb_arrow_purple.png
│ │ │ │ │ ├── reverb_progress_ring.png
│ │ │ │ │ ├── reverb_rating_bar_selected.png
│ │ │ │ │ └── reverb_rating_bar_unselected.png
│ │ │ │ ├── drawable-xxhdpi
│ │ │ │ │ ├── dog.jpg
│ │ │ │ │ ├── bicycle.jpg
│ │ │ │ │ ├── reverb_email.png
│ │ │ │ │ ├── reverb_error.png
│ │ │ │ │ ├── reverb_icon.png
│ │ │ │ │ ├── reverb_checkmark.png
│ │ │ │ │ ├── reverb_email_sent.png
│ │ │ │ │ ├── reverb_arrow_purple.png
│ │ │ │ │ ├── reverb_arrow_white.png
│ │ │ │ │ ├── reverb_progress_ring.png
│ │ │ │ │ ├── reverb_rating_bar_selected.png
│ │ │ │ │ └── reverb_rating_bar_unselected.png
│ │ │ │ ├── drawable-xxxhdpi
│ │ │ │ │ ├── dog.jpg
│ │ │ │ │ ├── bicycle.jpg
│ │ │ │ │ ├── reverb_icon.png
│ │ │ │ │ ├── reverb_email.png
│ │ │ │ │ ├── reverb_error.png
│ │ │ │ │ ├── reverb_checkmark.png
│ │ │ │ │ ├── reverb_arrow_white.png
│ │ │ │ │ ├── reverb_email_sent.png
│ │ │ │ │ ├── reverb_arrow_purple.png
│ │ │ │ │ ├── reverb_progress_ring.png
│ │ │ │ │ ├── reverb_rating_bar_selected.png
│ │ │ │ │ └── reverb_rating_bar_unselected.png
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── layout
│ │ │ │ │ ├── fragment_space.xml
│ │ │ │ │ ├── fragment_placeholder.xml
│ │ │ │ │ ├── layout_reverb_switch_login_type.xml
│ │ │ │ │ ├── fragment_reverb_footer_bar.xml
│ │ │ │ │ ├── fragment_reverb_footer_dots.xml
│ │ │ │ │ ├── fragment_reverb_body.xml
│ │ │ │ │ ├── activity_error.xml
│ │ │ │ │ ├── activity_hello_code.xml
│ │ │ │ │ └── activity_hello_token.xml
│ │ │ │ ├── values
│ │ │ │ │ ├── whitelisted_phone_country_codes.xml
│ │ │ │ │ ├── colors.xml
│ │ │ │ │ ├── blacklisted_phone_country_codes.xml
│ │ │ │ │ ├── attrs.xml
│ │ │ │ │ ├── dimens.xml
│ │ │ │ │ ├── styles.xml
│ │ │ │ │ ├── strings.xml
│ │ │ │ │ └── themes.xml
│ │ │ │ ├── drawable
│ │ │ │ │ ├── reverb_progress_rotating_ring.xml
│ │ │ │ │ ├── reverb_rating_bar.xml
│ │ │ │ │ ├── reverb_progress_complete.xml
│ │ │ │ │ ├── placeholder_background.xml
│ │ │ │ │ └── reverb_progress_bar.xml
│ │ │ │ └── values-v17
│ │ │ │ │ └── styles.xml
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── example
│ │ │ │ │ └── accountkitsample
│ │ │ │ │ ├── AccountKitSampleApplication.java
│ │ │ │ │ ├── InflateFragment.java
│ │ │ │ │ ├── ErrorActivity.java
│ │ │ │ │ ├── SpaceFragment.java
│ │ │ │ │ ├── CodeActivity.java
│ │ │ │ │ ├── PlaceholderFragment.java
│ │ │ │ │ ├── ReverbBodyFragment.java
│ │ │ │ │ ├── TokenActivity.java
│ │ │ │ │ ├── ReverbFooterFragment.java
│ │ │ │ │ ├── AccountKitSampleAdvancedUIManager.java
│ │ │ │ │ └── ReverbUIManager.java
│ │ │ └── AndroidManifest.xml
│ │ └── androidTest
│ │ │ ├── AndroidManifest.xml
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── accountkitsample
│ │ │ ├── AccountKitTest.java
│ │ │ ├── MainActivityTest.java
│ │ │ ├── TestUtils.java
│ │ │ ├── phone
│ │ │ ├── PhoneLoginUtil.java
│ │ │ └── PhoneTests.java
│ │ │ └── email
│ │ │ ├── EmailLoginUtil.java
│ │ │ └── EmailTests.java
│ ├── proguard-project.txt
│ └── build.gradle
└── AccountKitSimpleSample
│ ├── src
│ └── main
│ │ ├── res
│ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── layout
│ │ │ ├── activity_main.xml
│ │ │ ├── activity_error.xml
│ │ │ └── activity_hello_token.xml
│ │ └── values
│ │ │ └── strings.xml
│ │ ├── java
│ │ └── com
│ │ │ └── example
│ │ │ └── accountkitsimplesample
│ │ │ ├── AccountKitSimpleSampleApplication.java
│ │ │ ├── ErrorActivity.java
│ │ │ ├── TokenActivity.java
│ │ │ └── MainActivity.java
│ │ └── AndroidManifest.xml
│ ├── proguard-project.txt
│ └── build.gradle
├── constants.gradle
├── CONTRIBUTING.mdown
├── LICENSE
├── README.mdown
├── gradlew.bat
└── gradlew
/settings.gradle:
--------------------------------------------------------------------------------
1 | // AccountKit
2 |
3 | include ':samples:AccountKitSample'
4 | include ':samples:AccountKitSimpleSample'
5 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-hdpi/dog.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-hdpi/dog.jpg
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-mdpi/dog.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-mdpi/dog.jpg
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xhdpi/dog.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xhdpi/dog.jpg
--------------------------------------------------------------------------------
/constants.gradle:
--------------------------------------------------------------------------------
1 | project.ext {
2 | gradleVersion = "3.0.1"
3 | buildTools = "25.0.3"
4 | supportLibraryVersion = "25.3.1"
5 | compileSdk = 25
6 | minSdk = 15
7 | targetSdk = 25
8 | }
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxhdpi/dog.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxhdpi/dog.jpg
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/dog.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/dog.jpg
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-hdpi/bicycle.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-hdpi/bicycle.jpg
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-mdpi/bicycle.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-mdpi/bicycle.jpg
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xhdpi/bicycle.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xhdpi/bicycle.jpg
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxhdpi/bicycle.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxhdpi/bicycle.jpg
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-hdpi/reverb_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-hdpi/reverb_icon.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-mdpi/reverb_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-mdpi/reverb_icon.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/bicycle.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/bicycle.jpg
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-hdpi/reverb_email.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-hdpi/reverb_email.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-hdpi/reverb_error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-hdpi/reverb_error.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-mdpi/reverb_email.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-mdpi/reverb_email.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-mdpi/reverb_error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-mdpi/reverb_error.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xhdpi/reverb_email.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xhdpi/reverb_email.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xhdpi/reverb_error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xhdpi/reverb_error.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xhdpi/reverb_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xhdpi/reverb_icon.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxhdpi/reverb_email.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxhdpi/reverb_email.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxhdpi/reverb_error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxhdpi/reverb_error.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxhdpi/reverb_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxhdpi/reverb_icon.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/reverb_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/reverb_icon.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-hdpi/reverb_checkmark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-hdpi/reverb_checkmark.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-mdpi/reverb_checkmark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-mdpi/reverb_checkmark.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/reverb_email.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/reverb_email.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/reverb_error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/reverb_error.png
--------------------------------------------------------------------------------
/samples/AccountKitSimpleSample/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSimpleSample/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples/AccountKitSimpleSample/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSimpleSample/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples/AccountKitSimpleSample/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSimpleSample/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-hdpi/reverb_arrow_purple.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-hdpi/reverb_arrow_purple.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-hdpi/reverb_arrow_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-hdpi/reverb_arrow_white.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-hdpi/reverb_email_sent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-hdpi/reverb_email_sent.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-mdpi/reverb_arrow_purple.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-mdpi/reverb_arrow_purple.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-mdpi/reverb_arrow_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-mdpi/reverb_arrow_white.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-mdpi/reverb_email_sent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-mdpi/reverb_email_sent.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xhdpi/reverb_arrow_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xhdpi/reverb_arrow_white.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xhdpi/reverb_checkmark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xhdpi/reverb_checkmark.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xhdpi/reverb_email_sent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xhdpi/reverb_email_sent.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxhdpi/reverb_checkmark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxhdpi/reverb_checkmark.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxhdpi/reverb_email_sent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxhdpi/reverb_email_sent.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/reverb_checkmark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/reverb_checkmark.png
--------------------------------------------------------------------------------
/samples/AccountKitSimpleSample/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSimpleSample/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples/AccountKitSimpleSample/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSimpleSample/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-hdpi/reverb_progress_ring.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-hdpi/reverb_progress_ring.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-mdpi/reverb_progress_ring.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-mdpi/reverb_progress_ring.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xhdpi/reverb_arrow_purple.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xhdpi/reverb_arrow_purple.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xhdpi/reverb_progress_ring.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xhdpi/reverb_progress_ring.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxhdpi/reverb_arrow_purple.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxhdpi/reverb_arrow_purple.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxhdpi/reverb_arrow_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxhdpi/reverb_arrow_white.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/reverb_arrow_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/reverb_arrow_white.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/reverb_email_sent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/reverb_email_sent.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxhdpi/reverb_progress_ring.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxhdpi/reverb_progress_ring.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/reverb_arrow_purple.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/reverb_arrow_purple.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/reverb_progress_ring.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/reverb_progress_ring.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-hdpi/reverb_rating_bar_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-hdpi/reverb_rating_bar_selected.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-mdpi/reverb_rating_bar_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-mdpi/reverb_rating_bar_selected.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-hdpi/reverb_rating_bar_unselected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-hdpi/reverb_rating_bar_unselected.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-mdpi/reverb_rating_bar_unselected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-mdpi/reverb_rating_bar_unselected.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xhdpi/reverb_rating_bar_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xhdpi/reverb_rating_bar_selected.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xhdpi/reverb_rating_bar_unselected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xhdpi/reverb_rating_bar_unselected.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxhdpi/reverb_rating_bar_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxhdpi/reverb_rating_bar_selected.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/reverb_rating_bar_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/reverb_rating_bar_selected.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxhdpi/reverb_rating_bar_unselected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxhdpi/reverb_rating_bar_unselected.png
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/reverb_rating_bar_unselected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/account-kit-samples-for-android/HEAD/samples/AccountKitSample/src/main/res/drawable-xxxhdpi/reverb_rating_bar_unselected.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Jan 18 17:09:08 PST 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/CONTRIBUTING.mdown:
--------------------------------------------------------------------------------
1 | Facebook welcomes contributions to our SDKs.
2 |
3 | All contributors must sign a CLA (contributor license agreement) here:
4 |
5 | https://developers.facebook.com/opensource/cla
6 |
7 | To contribute on behalf of your employer, sign the company CLA
8 | To contribute on behalf of yourself, sign the individual CLA
9 |
10 | By contributing to, you agree that your contributions will be licensed
11 | under the LICENSE file in the root directory of this source tree.
12 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/samples/AccountKitSimpleSample/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/samples/AccountKitSimpleSample/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion project.ext.compileSdk
5 | buildToolsVersion project.ext.buildTools
6 |
7 | defaultConfig {
8 | applicationId "com.example.accountkitsimplesample"
9 | minSdkVersion project.ext.minSdk
10 | targetSdkVersion project.ext.targetSdk
11 | }
12 |
13 | lintOptions {
14 | abortOnError false
15 | }
16 |
17 | dependencies {
18 | implementation 'com.facebook.android:account-kit-sdk:5.0.0'
19 | implementation "com.android.support:support-v4:${project.ext.supportLibraryVersion}"
20 | implementation 'com.google.android.gms:play-services-base:11.8.0'
21 | }
22 |
23 | splits {
24 | abi {
25 | enable true
26 | reset()
27 | include 'armeabi', 'armeabi-v7a', 'x86'
28 | universalApk true
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
2 |
3 | You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
4 | copy, modify, and distribute this software in source code or binary form for use
5 | in connection with the web services and APIs provided by Facebook.
6 |
7 | As with any software that integrates with the Facebook platform, your use of
8 | this software is subject to the Facebook Developer Principles and Policies
9 | [http://developers.facebook.com/policy/]. This copyright notice shall be
10 | included in all copies or substantial portions of the software.
11 |
12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
14 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
15 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
16 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
17 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/layout/fragment_space.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
27 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/values/whitelisted_phone_country_codes.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 |
24 | - ID
25 | - US
26 |
27 |
28 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 | #0099E1
24 | #262261
25 | #e9e8ef
26 | #1d2129
27 |
28 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/androidTest/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/values/blacklisted_phone_country_codes.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 |
24 | - ID
25 |
26 |
27 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable/reverb_progress_rotating_ring.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
30 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/androidTest/java/com/example/accountkitsample/AccountKitTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsample;
22 |
23 | import android.os.StrictMode;
24 |
25 | import org.junit.Before;
26 |
27 | public abstract class AccountKitTest {
28 |
29 | @Before
30 | public void disableStrictModeForTesting() {
31 | StrictMode.setThreadPolicy(StrictMode.ThreadPolicy.LAX);
32 | StrictMode.setVmPolicy(StrictMode.VmPolicy.LAX);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion project.ext.compileSdk
5 | buildToolsVersion project.ext.buildTools
6 |
7 | defaultConfig {
8 | applicationId "com.example.accountkitsample"
9 | minSdkVersion project.ext.minSdk
10 | targetSdkVersion project.ext.targetSdk
11 |
12 | // Optional: Specify only the language(s) your app supports to minimize the APK size.
13 | // resConfigs "en", "fr", "pt-rPT"
14 |
15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
16 | }
17 |
18 | dependencies {
19 | implementation 'com.facebook.android:account-kit-sdk:5.0.0'
20 | implementation "com.android.support:support-v4:${project.ext.supportLibraryVersion}"
21 | implementation "com.android.support:support-annotations:${project.ext.supportLibraryVersion}"
22 | implementation 'com.google.android.gms:play-services-base:11.8.0'
23 |
24 | testImplementation 'junit:junit:4.12'
25 |
26 | androidTestImplementation 'com.android.support.test:runner:0.5'
27 | androidTestImplementation 'com.android.support.test:rules:0.5'
28 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
29 | androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
30 | }
31 |
32 | lintOptions {
33 | abortOnError false
34 | }
35 |
36 | splits {
37 | abi {
38 | enable true
39 | reset()
40 | include 'armeabi', 'armeabi-v7a', 'x86'
41 | universalApk true
42 | }
43 | }
44 | }
45 |
46 |
--------------------------------------------------------------------------------
/README.mdown:
--------------------------------------------------------------------------------
1 | Account Kit SDK for Android Samples
2 | ========================
3 |
4 | This repository contains a collection of samples demonstrating how to integrate the Account Kit SDK.
5 |
6 | Learn more about the provided samples, documentation, integrating the SDK into your app, accessing source code, and more at https://developers.facebook.com/docs/accountkit
7 |
8 | GIVE FEEDBACK
9 | -------------
10 | Please report bugs or issues related to the Account Kit SDK to https://developers.facebook.com/bugs/
11 |
12 | You can also join the Facebook Developers Group on Facebook (https://www.facebook.com/groups/fbdevelopers/) or ask questions on Stack Overflow (http://facebook.stackoverflow.com)
13 |
14 | CONTRIBUTING
15 | -------------
16 | We are able to accept contributions to the Account Kit SDK for Android. To contribute please do the following.
17 | - Follow the instructions in the [CONTRIBUTING.mdown](https://github.com/fbsamples/account-kit-samples-for-android/blob/master/CONTRIBUTING.mdown).
18 | - Submit your pull request to the [dev](https://github.com/fbsamples/account-kit-samples-for-android/tree/dev) branch. This allows us to merge your change into our internal master and then push out the change in the next release.
19 |
20 | LICENSE
21 | -------
22 | Except as otherwise noted, the Account Kit SDK Samples for Android are licensed under the Facebook Platform License (https://github.com/fbsamples/account-kit-samples-for-android/blob/master/LICENSE.txt).
23 |
24 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
25 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/layout/fragment_placeholder.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
28 |
35 |
36 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/values-v17/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 |
27 |
28 |
32 |
33 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/layout/layout_reverb_switch_login_type.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
35 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable/reverb_rating_bar.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 |
24 |
28 |
32 |
36 |
37 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable/reverb_progress_complete.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 | -
24 |
30 |
34 |
35 |
36 | -
37 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/layout/fragment_reverb_footer_bar.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
28 |
29 |
37 |
38 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/layout/fragment_reverb_footer_dots.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
26 |
27 |
39 |
40 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable/placeholder_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 | -
24 |
25 |
26 |
27 |
28 | -
34 |
35 |
36 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/androidTest/java/com/example/accountkitsample/MainActivityTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsample;
22 |
23 | import android.support.test.rule.ActivityTestRule;
24 | import android.support.test.runner.AndroidJUnit4;
25 | import android.test.suitebuilder.annotation.SmallTest;
26 |
27 | import com.example.accountkitsample.email.EmailLoginUtil;
28 | import com.example.accountkitsample.phone.PhoneLoginUtil;
29 |
30 | import org.junit.Rule;
31 | import org.junit.Test;
32 | import org.junit.runner.RunWith;
33 |
34 | @RunWith(AndroidJUnit4.class)
35 | @SmallTest
36 | public class MainActivityTest {
37 |
38 | @Rule
39 | public ActivityTestRule mActivityRule =
40 | new ActivityTestRule<>(MainActivity.class);
41 |
42 | @Test
43 | public void phoneButtonTest() {
44 | PhoneLoginUtil.startPhoneLogin();
45 | }
46 |
47 | @Test
48 | public void emailButtonTest() {
49 | EmailLoginUtil.startEmailLogin();
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/drawable/reverb_progress_bar.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 | -
24 |
25 |
26 |
27 |
28 |
29 | -
30 |
31 |
32 |
33 |
34 |
35 | -
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/samples/AccountKitSimpleSample/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
27 |
31 |
37 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/java/com/example/accountkitsample/AccountKitSampleApplication.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsample;
22 |
23 | import android.app.Application;
24 | import android.os.Build;
25 | import android.os.StrictMode;
26 |
27 | public class AccountKitSampleApplication extends Application {
28 | @Override
29 | public void onCreate() {
30 | super.onCreate();
31 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
32 | // Kitkat and lower has a bug that can cause in correct strict mode
33 | // warnings about expected activity counts
34 | enableStrictMode();
35 | }
36 | }
37 |
38 | public void enableStrictMode() {
39 | StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
40 | .detectAll()
41 | .penaltyLog()
42 | .penaltyDeath()
43 | .build());
44 | StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
45 | .detectAll()
46 | .penaltyLog()
47 | .penaltyDeath()
48 | .build());
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/samples/AccountKitSimpleSample/src/main/java/com/example/accountkitsimplesample/AccountKitSimpleSampleApplication.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsimplesample;
22 |
23 | import android.app.Application;
24 | import android.os.Build;
25 | import android.os.StrictMode;
26 |
27 | public class AccountKitSimpleSampleApplication extends Application {
28 | @Override
29 | public void onCreate() {
30 | super.onCreate();
31 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
32 | // Kitkat and lower has a bug that can cause in correct strict mode
33 | // warnings about expected activity counts
34 | enableStrictMode();
35 | }
36 | }
37 |
38 | public void enableStrictMode() {
39 | StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
40 | .detectAll()
41 | .penaltyLog()
42 | .penaltyDeath()
43 | .build());
44 | StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
45 | .detectAll()
46 | .penaltyLog()
47 | .penaltyDeath()
48 | .build());
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 | 16dp
24 | 16dp
25 |
26 | 50dp
27 | 25dp
28 | 25dp
29 | 22dp
30 | 14dp
31 | 360dp
32 | 340dp
33 | 12dp
34 | 14dp
35 | 86dp
36 | 8dp
37 | 3dp
38 | 14dp
39 | 10dp
40 | 20dp
41 | 12sp
42 |
43 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/androidTest/java/com/example/accountkitsample/TestUtils.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsample;
22 |
23 | import android.os.Build;
24 | import android.support.test.uiautomator.UiDevice;
25 | import android.support.test.uiautomator.UiObject;
26 | import android.support.test.uiautomator.UiObjectNotFoundException;
27 | import android.support.test.uiautomator.UiSelector;
28 |
29 | import static android.support.test.InstrumentationRegistry.getInstrumentation;
30 |
31 | public class TestUtils {
32 |
33 | /**
34 | * Accept a permission if the window is shown.
35 | * If no permission window is shown this will just return without doing anything.
36 | */
37 | public static void acceptPermissionsIfNeeded() {
38 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
39 | final UiDevice device = UiDevice.getInstance(getInstrumentation());
40 | final UiObject allowPermissions = device.findObject(new UiSelector().text("Allow"));
41 | if (allowPermissions.exists()) {
42 | try {
43 | allowPermissions.click();
44 | } catch (UiObjectNotFoundException ignored) {
45 | }
46 | }
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/androidTest/java/com/example/accountkitsample/phone/PhoneLoginUtil.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsample.phone;
22 |
23 | import com.example.accountkitsample.R;
24 | import com.example.accountkitsample.TestUtils;
25 |
26 | import static android.support.test.espresso.Espresso.onView;
27 | import static android.support.test.espresso.action.ViewActions.click;
28 | import static android.support.test.espresso.assertion.ViewAssertions.matches;
29 | import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
30 | import static android.support.test.espresso.matcher.ViewMatchers.withText;
31 |
32 | public class PhoneLoginUtil {
33 |
34 | public static final String BAD_PHONE_NUMBER = "5555215554";
35 |
36 | private PhoneLoginUtil() { /* no instances */ }
37 |
38 | public static void startPhoneLogin() {
39 | onView(withText(R.string.log_in_phone_button)).check(matches(isDisplayed()));
40 | onView(withText(R.string.log_in_phone_button)).perform(click());
41 |
42 | //need 2 permissions, SMS and phone
43 | TestUtils.acceptPermissionsIfNeeded();
44 | TestUtils.acceptPermissionsIfNeeded();
45 | onView(withText("Enter your phone number")).check(matches(isDisplayed()));
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/layout/fragment_reverb_body.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
29 |
35 |
41 |
42 |
50 |
51 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/layout/activity_error.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
27 |
28 |
35 |
42 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/java/com/example/accountkitsample/InflateFragment.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsample;
22 |
23 | import android.annotation.TargetApi;
24 | import android.app.Activity;
25 | import android.app.Fragment;
26 | import android.content.Context;
27 | import android.os.Bundle;
28 | import android.util.AttributeSet;
29 |
30 | @SuppressWarnings("All")
31 | class InflateFragment extends Fragment {
32 | @TargetApi(11)
33 | @Override
34 | public void onInflate(final AttributeSet attrs, final Bundle savedInstanceState) {
35 | super.onInflate(attrs, savedInstanceState);
36 | handleAttributes(attrs);
37 | }
38 |
39 | @TargetApi(21)
40 | @Override
41 | public void onInflate(
42 | final Activity activity,
43 | final AttributeSet attrs,
44 | final Bundle savedInstanceState) {
45 | super.onInflate(activity, attrs, savedInstanceState);
46 | handleAttributes(attrs);
47 | }
48 |
49 | @TargetApi(23)
50 | @Override
51 | public void onInflate(
52 | final Context context,
53 | final AttributeSet attrs,
54 | final Bundle savedInstanceState) {
55 | super.onInflate(context, attrs, savedInstanceState);
56 | handleAttributes(attrs);
57 | }
58 |
59 | protected void handleAttributes(final AttributeSet attrs) {
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/samples/AccountKitSimpleSample/src/main/res/layout/activity_error.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
27 |
31 |
38 |
45 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/java/com/example/accountkitsample/ErrorActivity.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsample;
22 |
23 | import android.app.Activity;
24 | import android.os.Bundle;
25 | import android.view.View;
26 | import android.widget.Button;
27 | import android.widget.TextView;
28 |
29 | import com.facebook.accountkit.AccountKit;
30 | import com.facebook.accountkit.AccountKitError;
31 |
32 | public class ErrorActivity extends Activity {
33 | static final String HELLO_TOKEN_ACTIVITY_ERROR_EXTRA =
34 | "HELLO_TOKEN_ACTIVITY_ERROR_EXTRA";
35 |
36 | @Override
37 | public void onCreate(final Bundle savedInstanceState) {
38 | super.onCreate(savedInstanceState);
39 | setContentView(R.layout.activity_error);
40 |
41 | final Button signOut = (Button) findViewById(R.id.log_out_button);
42 | signOut.setOnClickListener(new View.OnClickListener() {
43 | @Override
44 | public void onClick(View v) {
45 | AccountKit.logOut();
46 | finish();
47 | }
48 | });
49 |
50 | final AccountKitError error =
51 | getIntent().getParcelableExtra(HELLO_TOKEN_ACTIVITY_ERROR_EXTRA);
52 |
53 | final TextView errorView = (TextView) findViewById(R.id.error);
54 | if (errorView != null) {
55 | if (error != null) {
56 | errorView.setText(error.toString());
57 | } else {
58 | errorView.setText(R.string.na);
59 | }
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/samples/AccountKitSimpleSample/src/main/java/com/example/accountkitsimplesample/ErrorActivity.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsimplesample;
22 |
23 | import android.app.Activity;
24 | import android.os.Bundle;
25 | import android.view.View;
26 | import android.widget.Button;
27 | import android.widget.TextView;
28 |
29 | import com.facebook.accountkit.AccountKit;
30 | import com.facebook.accountkit.AccountKitError;
31 |
32 | public class ErrorActivity extends Activity {
33 | static final String HELLO_TOKEN_ACTIVITY_ERROR_EXTRA =
34 | "HELLO_TOKEN_ACTIVITY_ERROR_EXTRA";
35 |
36 | @Override
37 | public void onCreate(final Bundle savedInstanceState) {
38 | super.onCreate(savedInstanceState);
39 | setContentView(R.layout.activity_error);
40 |
41 | final Button signOut = (Button) findViewById(R.id.log_out_button);
42 | signOut.setOnClickListener(new View.OnClickListener() {
43 | @Override
44 | public void onClick(View v) {
45 | AccountKit.logOut();
46 | finish();
47 | }
48 | });
49 |
50 | final AccountKitError error =
51 | getIntent().getParcelableExtra(HELLO_TOKEN_ACTIVITY_ERROR_EXTRA);
52 |
53 | final TextView errorView = (TextView) findViewById(R.id.error);
54 | if (errorView != null) {
55 | if (error != null) {
56 | errorView.setText(error.toString());
57 | } else {
58 | errorView.setText(R.string.na);
59 | }
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/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 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
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 Windows 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 |
--------------------------------------------------------------------------------
/samples/AccountKitSimpleSample/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
20 |
21 |
22 | Hello
23 | ak964234977027033
24 | 964234977027033
25 | Account Kit Simple Sample
26 | 799de49b357b77afede08488ced2f721
27 |
28 | Grant permission to read your email address from your device to pre-fill.
29 |
30 | Read Email Address
31 |
32 | Grant permission to read your phone number from your device to pre-fill.
33 |
34 | Read Phone Number
35 |
36 | Grant permission to read your SMS code from your device to pre-fill.
37 |
38 | Read SMS Code
39 | Log In via Email
40 | Log In via Phone
41 | Log Out
42 | Error
43 | Loading…
44 | Account ID
45 | Phone Number
46 | Email
47 | NA
48 |
49 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 |
24 |
25 |
35 |
36 |
37 |
38 |
48 |
49 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/androidTest/java/com/example/accountkitsample/email/EmailLoginUtil.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsample.email;
22 |
23 | import android.support.test.espresso.ViewInteraction;
24 |
25 | import com.example.accountkitsample.R;
26 | import com.example.accountkitsample.TestUtils;
27 |
28 | import static android.support.test.espresso.Espresso.onView;
29 | import static android.support.test.espresso.action.ViewActions.click;
30 | import static android.support.test.espresso.action.ViewActions.typeText;
31 | import static android.support.test.espresso.assertion.ViewAssertions.matches;
32 | import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
33 | import static android.support.test.espresso.matcher.ViewMatchers.withId;
34 | import static android.support.test.espresso.matcher.ViewMatchers.withText;
35 |
36 | public class EmailLoginUtil {
37 |
38 | public static final String EMAIL_ADDRESS = "badEmailAddress@bogus.com";
39 | public static final String INCOMPLETE_EMAIL_ADDRESS = "incompleteEmailAddress";
40 |
41 | private EmailLoginUtil() { /* no instances */ }
42 |
43 | public static void startEmailLogin() {
44 | ViewInteraction emailLoginBtn = onView(withText(R.string.log_in_email_button));
45 | emailLoginBtn.check(matches(isDisplayed()));
46 | emailLoginBtn.perform(click());
47 | TestUtils.acceptPermissionsIfNeeded();
48 | onView(withText("Enter your email address")).check(matches(isDisplayed()));
49 | }
50 |
51 | public static void submitEmailAddress() {
52 | final ViewInteraction emailEditTextInteraction = onView(withId(R.id.com_accountkit_email));
53 | // enter address
54 | emailEditTextInteraction.perform(typeText(EmailLoginUtil.EMAIL_ADDRESS));
55 | emailEditTextInteraction.check(matches(withText(EmailLoginUtil.EMAIL_ADDRESS)));
56 | // submit address
57 | onView(withId(R.id.com_accountkit_next_button)).perform(click());
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/samples/AccountKitSimpleSample/src/main/java/com/example/accountkitsimplesample/TokenActivity.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsimplesample;
22 |
23 | import android.app.Activity;
24 | import android.os.Bundle;
25 | import android.view.View;
26 | import android.widget.Button;
27 | import android.widget.TextView;
28 |
29 | import com.facebook.accountkit.Account;
30 | import com.facebook.accountkit.AccountKit;
31 | import com.facebook.accountkit.AccountKitCallback;
32 | import com.facebook.accountkit.AccountKitError;
33 | import com.facebook.accountkit.PhoneNumber;
34 |
35 | public class TokenActivity extends Activity {
36 |
37 | @Override
38 | public void onCreate(final Bundle savedInstanceState) {
39 | super.onCreate(savedInstanceState);
40 | setContentView(R.layout.activity_hello_token);
41 |
42 | final Button signOut = (Button) findViewById(R.id.log_out_button);
43 | signOut.setOnClickListener(new View.OnClickListener() {
44 | @Override
45 | public void onClick(View v) {
46 | AccountKit.logOut();
47 | finish();
48 | }
49 | });
50 | }
51 |
52 | @Override
53 | protected void onResume() {
54 | super.onResume();
55 |
56 | AccountKit.getCurrentAccount(new AccountKitCallback() {
57 | @Override
58 | public void onSuccess(final Account account) {
59 | final TextView userId = (TextView) findViewById(R.id.user_id);
60 | userId.setText(account.getId());
61 |
62 | final TextView phoneNumber = (TextView) findViewById(R.id.user_phone);
63 | final PhoneNumber number = account.getPhoneNumber();
64 | phoneNumber.setText(number == null ? null : number.toString());
65 |
66 | final TextView email = (TextView) findViewById(R.id.user_email);
67 | email.setText(account.getEmail());
68 | }
69 |
70 | @Override
71 | public void onError(final AccountKitError error) {
72 | }
73 | });
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/samples/AccountKitSimpleSample/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
40 |
41 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
66 |
70 |
71 |
75 |
79 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/java/com/example/accountkitsample/SpaceFragment.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsample;
22 |
23 | import android.app.Activity;
24 | import android.content.res.TypedArray;
25 | import android.os.Bundle;
26 | import android.support.annotation.Nullable;
27 | import android.util.AttributeSet;
28 | import android.view.LayoutInflater;
29 | import android.view.View;
30 | import android.view.ViewGroup;
31 |
32 | public class SpaceFragment extends InflateFragment {
33 |
34 | private static final String HEIGHT_ATTRIBUTE_KEY = "heightAttribute";
35 |
36 | private AttributeSet attributes;
37 |
38 | public static SpaceFragment create(final int heightAttribute) {
39 | final SpaceFragment fragment = new SpaceFragment();
40 | final Bundle arguments = new Bundle();
41 | arguments.putInt(HEIGHT_ATTRIBUTE_KEY, heightAttribute);
42 | fragment.setArguments(arguments);
43 | return fragment;
44 | }
45 |
46 | @Nullable
47 | @Override
48 | public View onCreateView(
49 | final LayoutInflater inflater,
50 | final ViewGroup container,
51 | final Bundle savedInstanceState) {
52 | View view = super.onCreateView(inflater, container, savedInstanceState);
53 | if (view == null) {
54 | view = inflater.inflate(R.layout.fragment_space, container, false);
55 | }
56 | updateHeight(view);
57 | return view;
58 | }
59 |
60 | @Override
61 | protected void handleAttributes(final AttributeSet attrs) {
62 | attributes = attrs;
63 | updateHeight(getView());
64 | }
65 |
66 | private void updateHeight(final View view) {
67 | if (view == null) {
68 | return;
69 | }
70 | final Activity activity = getActivity();
71 | if (activity == null) {
72 | return;
73 | }
74 |
75 | final Bundle arguments = getArguments();
76 | if (arguments == null) {
77 | return;
78 | }
79 |
80 | final int heightAttribute = arguments.getInt(HEIGHT_ATTRIBUTE_KEY, -1);
81 | if (heightAttribute >= 0) {
82 | final TypedArray a = activity.obtainStyledAttributes(
83 | attributes,
84 | R.styleable.Theme_AccountKitSample_Style);
85 | final int heightAttributeValue = a.getDimensionPixelSize(heightAttribute, -1);
86 | a.recycle();
87 | if (heightAttributeValue >= 0) {
88 | view.getLayoutParams().height = heightAttributeValue;
89 | }
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/layout/activity_hello_code.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
27 |
28 |
35 |
42 |
49 |
57 |
64 |
72 |
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/samples/AccountKitSimpleSample/src/main/res/layout/activity_hello_token.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
27 |
31 |
38 |
45 |
52 |
59 |
66 |
73 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/java/com/example/accountkitsample/CodeActivity.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsample;
22 |
23 | import android.app.Activity;
24 | import android.os.Bundle;
25 | import android.view.View;
26 | import android.widget.Button;
27 | import android.widget.TextView;
28 |
29 | import com.facebook.accountkit.AccountKit;
30 |
31 | public class CodeActivity extends Activity {
32 | static final String HELLO_CODE_ACTIVITY_CODE_EXTRA = "HELLO_CODE_ACTIVITY_CODE_EXTRA";
33 | static final String HELLO_CODE_ACTIVITY_FINAL_STATE_EXTRA =
34 | "HELLO_CODE_ACTIVITY_FINAL_STATE_EXTRA";
35 | static final String HELLO_CODE_ACTIVITY_INITIAL_STATE_EXTRA =
36 | "HELLO_CODE_ACTIVITY_INITIAL_STATE_EXTRA";
37 |
38 | @Override
39 | public void onCreate(final Bundle savedInstanceState) {
40 | super.onCreate(savedInstanceState);
41 | setContentView(R.layout.activity_hello_code);
42 |
43 | final String code = getIntent().getStringExtra(HELLO_CODE_ACTIVITY_CODE_EXTRA);
44 | final String finalState =
45 | getIntent().getStringExtra(HELLO_CODE_ACTIVITY_FINAL_STATE_EXTRA);
46 | final String initialState =
47 | getIntent().getStringExtra(HELLO_CODE_ACTIVITY_INITIAL_STATE_EXTRA);
48 |
49 | if (code != null) {
50 | final TextView codeView = (TextView) findViewById(R.id.code);
51 | if (codeView != null) {
52 | codeView.setText(code);
53 | }
54 | }
55 |
56 | if (initialState != null) {
57 | final TextView initialStateView = (TextView) findViewById(R.id.initial_state);
58 | final TextView initialStateLabelView =
59 | (TextView) findViewById(R.id.initial_state_label);
60 | if (initialStateView != null && initialStateLabelView != null) {
61 | initialStateView.setText(initialState);
62 | initialStateView.setVisibility(View.VISIBLE);
63 | initialStateLabelView.setVisibility(View.VISIBLE);
64 | }
65 | }
66 |
67 | if (finalState != null) {
68 | final TextView finalStateView = (TextView) findViewById(R.id.final_state);
69 | final TextView finalStateLabelView =
70 | (TextView) findViewById(R.id.final_state_label);
71 | if (finalStateView != null && finalStateLabelView != null) {
72 | finalStateView.setText(finalState);
73 | finalStateView.setVisibility(View.VISIBLE);
74 | finalStateLabelView.setVisibility(View.VISIBLE);
75 | }
76 | }
77 |
78 | final Button signOut = (Button) findViewById(R.id.log_out_button);
79 | signOut.setOnClickListener(new View.OnClickListener() {
80 | @Override
81 | public void onClick(View v) {
82 | AccountKit.logOut();
83 | finish();
84 | }
85 | });
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
35 |
36 |
45 |
46 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
77 |
81 |
85 |
86 |
90 |
94 |
98 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/androidTest/java/com/example/accountkitsample/phone/PhoneTests.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsample.phone;
22 |
23 |
24 | import android.content.Context;
25 | import android.support.test.InstrumentationRegistry;
26 | import android.support.test.espresso.ViewInteraction;
27 | import android.support.test.rule.ActivityTestRule;
28 | import android.support.test.runner.AndroidJUnit4;
29 | import android.telephony.TelephonyManager;
30 |
31 | import com.example.accountkitsample.AccountKitTest;
32 | import com.example.accountkitsample.MainActivity;
33 | import com.example.accountkitsample.R;
34 |
35 | import org.junit.Before;
36 | import org.junit.Rule;
37 | import org.junit.Test;
38 | import org.junit.runner.RunWith;
39 |
40 | import static android.support.test.espresso.Espresso.onView;
41 | import static android.support.test.espresso.action.ViewActions.click;
42 | import static android.support.test.espresso.action.ViewActions.replaceText;
43 | import static android.support.test.espresso.assertion.ViewAssertions.matches;
44 | import static android.support.test.espresso.matcher.ViewMatchers.hasFocus;
45 | import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
46 | import static android.support.test.espresso.matcher.ViewMatchers.isEnabled;
47 | import static android.support.test.espresso.matcher.ViewMatchers.withId;
48 | import static android.support.test.espresso.matcher.ViewMatchers.withText;
49 | import static org.hamcrest.Matchers.allOf;
50 |
51 | @RunWith(AndroidJUnit4.class)
52 | public class PhoneTests extends AccountKitTest {
53 |
54 | @Rule
55 | public ActivityTestRule mActivityTestRule =
56 | new ActivityTestRule<>(MainActivity.class);
57 |
58 | @Before
59 | public void startPhoneLogin() {
60 | PhoneLoginUtil.startPhoneLogin();
61 | }
62 |
63 | @Test
64 | public void testInitialState() {
65 | TelephonyManager telephonyManager =
66 | (TelephonyManager) InstrumentationRegistry.getTargetContext()
67 | .getSystemService(Context.TELEPHONY_SERVICE);
68 | String phoneNumber = telephonyManager.getLine1Number();
69 | String phoneNumberWithoutCountryCode = phoneNumber.substring(1);
70 |
71 |
72 | // phone number entry
73 | final ViewInteraction phoneNumberEditText =
74 | onView(withId(R.id.com_accountkit_phone_number));
75 | phoneNumberEditText.check(matches(isDisplayed()));
76 | phoneNumberEditText.check(matches(hasFocus()));
77 | phoneNumberEditText.check(matches(withText(phoneNumberWithoutCountryCode)));
78 | // info text
79 | onView(withId(R.id.com_accountkit_text)).check(matches(isDisplayed()));
80 | // next btn
81 | onView(withId(R.id.com_accountkit_next_button)).check(matches(isEnabled()));
82 | }
83 |
84 | @Test
85 | public void testInvalidPhoneNumber() {
86 | final ViewInteraction phoneNumberEditText =
87 | onView(withId(R.id.com_accountkit_phone_number));
88 |
89 | phoneNumberEditText.perform(replaceText(PhoneLoginUtil.BAD_PHONE_NUMBER));
90 | onView(withId(R.id.com_accountkit_next_button)).perform(click());
91 |
92 | ViewInteraction text = onView(allOf(withId(R.id.com_accountkit_title), isDisplayed()));
93 | text.check(matches(withText("Please enter a valid phone number.")));
94 | }
95 |
96 | }
97 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/java/com/example/accountkitsample/PlaceholderFragment.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsample;
22 |
23 | import android.app.Fragment;
24 | import android.os.Bundle;
25 | import android.support.annotation.Nullable;
26 | import android.util.TypedValue;
27 | import android.view.LayoutInflater;
28 | import android.view.View;
29 | import android.view.ViewGroup;
30 | import android.widget.TextView;
31 |
32 | public class PlaceholderFragment extends Fragment {
33 | private static final String HEIGHT_KEY = "height";
34 | private static final String TEXT_KEY = "text";
35 | private static final String TEXT_RESOURCE_ID_KEY = "textResourceId";
36 |
37 | private View.OnClickListener onClickListener;
38 |
39 | public static PlaceholderFragment create(final int height, final String text) {
40 | final PlaceholderFragment fragment = new PlaceholderFragment();
41 | final Bundle arguments = new Bundle();
42 | arguments.putInt(HEIGHT_KEY, height);
43 | arguments.putString(TEXT_KEY, text);
44 | fragment.setArguments(arguments);
45 | return fragment;
46 | }
47 |
48 | public static PlaceholderFragment create(final int height, final int textResourceId) {
49 | final PlaceholderFragment fragment = new PlaceholderFragment();
50 | final Bundle arguments = new Bundle();
51 | arguments.putInt(HEIGHT_KEY, height);
52 | arguments.putInt(TEXT_RESOURCE_ID_KEY, textResourceId);
53 | fragment.setArguments(arguments);
54 | return fragment;
55 | }
56 |
57 | public void setOnClickListener(final View.OnClickListener onClickListener) {
58 | this.onClickListener = onClickListener;
59 | final View view = getView();
60 | if (view != null) {
61 | view.setOnClickListener(onClickListener);
62 | }
63 | }
64 |
65 | @Nullable
66 | @Override
67 | public View onCreateView(
68 | final LayoutInflater inflater,
69 | final ViewGroup container,
70 | @Nullable final Bundle savedInstanceState) {
71 | View view = super.onCreateView(inflater, container, savedInstanceState);
72 | if (view == null) {
73 | view = inflater.inflate(R.layout.fragment_placeholder, container, false);
74 | }
75 |
76 | final Bundle arguments = getArguments();
77 | if (arguments != null) {
78 | final int height = arguments.getInt(HEIGHT_KEY, -1);
79 | if (height >= 0) {
80 | view.getLayoutParams().height = (int) TypedValue.applyDimension(
81 | TypedValue.COMPLEX_UNIT_DIP,
82 | height,
83 | getResources().getDisplayMetrics());
84 | }
85 |
86 | final String text = arguments.getString(TEXT_KEY);
87 | final int textResourceId = arguments.getInt(TEXT_RESOURCE_ID_KEY, -1);
88 | final TextView textView = (TextView) view.findViewById(R.id.text_view);
89 | if (textView != null) {
90 | if (text != null) {
91 | textView.setText(text);
92 | } else if (textResourceId > 0) {
93 | textView.setText(textResourceId);
94 | }
95 | }
96 | }
97 |
98 | if (onClickListener != null) {
99 | view.setOnClickListener(onClickListener);
100 | }
101 |
102 | return view;
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/java/com/example/accountkitsample/ReverbBodyFragment.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsample;
22 |
23 | import android.app.Fragment;
24 | import android.graphics.drawable.Drawable;
25 | import android.os.Bundle;
26 | import android.support.v4.content.ContextCompat;
27 | import android.support.v4.graphics.drawable.DrawableCompat;
28 | import android.view.LayoutInflater;
29 | import android.view.View;
30 | import android.view.ViewGroup;
31 | import android.widget.ImageView;
32 |
33 | public class ReverbBodyFragment extends Fragment {
34 |
35 | private static final String ICON_RESOURCE_ID_KEY = "iconResourceId";
36 | private static final String ICON_TINT_RESOURCE_ID_KEY = "iconTintResourceId";
37 | private static final String SHOW_PROGRESS_SPINNER_KEY = "showProgressSpinner";
38 |
39 | public static ReverbBodyFragment newInstance(
40 | int iconResourceId,
41 | int iconTintResourceId,
42 | boolean showProgressSpinner) {
43 |
44 | Bundle args = new Bundle();
45 | args.putInt(ICON_RESOURCE_ID_KEY, iconResourceId);
46 | args.putInt(ICON_TINT_RESOURCE_ID_KEY, iconTintResourceId);
47 | args.putBoolean(SHOW_PROGRESS_SPINNER_KEY, showProgressSpinner);
48 |
49 | ReverbBodyFragment fragment = new ReverbBodyFragment();
50 | fragment.setArguments(args);
51 | return fragment;
52 | }
53 |
54 | private int iconResourceId;
55 | private int iconTintResourceId;
56 | private boolean showProgressSpinner;
57 |
58 | @Override
59 | public View onCreateView(
60 | final LayoutInflater inflater,
61 | final ViewGroup container,
62 | final Bundle savedInstanceState) {
63 | return inflater.inflate(R.layout.fragment_reverb_body, container, false);
64 | }
65 |
66 | @Override
67 | public void onViewCreated(View view, Bundle savedInstanceState) {
68 | iconResourceId = getArguments().getInt(ICON_RESOURCE_ID_KEY);
69 | iconTintResourceId = getArguments().getInt(ICON_TINT_RESOURCE_ID_KEY);
70 | showProgressSpinner = getArguments().getBoolean(SHOW_PROGRESS_SPINNER_KEY);
71 | updateIcon(view);
72 | }
73 |
74 | private void updateIcon(final View view) {
75 |
76 | final View progressSpinner = view.findViewById(R.id.reverb_progress_spinner);
77 | if (progressSpinner != null) {
78 | progressSpinner.setVisibility(showProgressSpinner ? View.VISIBLE : View.GONE);
79 | }
80 |
81 | final ImageView iconView = (ImageView) view.findViewById(R.id.reverb_icon);
82 | if (iconView != null) {
83 | if (iconResourceId > 0) {
84 |
85 | /*
86 | * Api levels lower than 21 do not support android:tint in xml drawables. Tint can
87 | * be applied with DrawableCompat
88 | */
89 | Drawable icon = getResources().getDrawable(iconResourceId);
90 | if(iconTintResourceId > 0) {
91 | icon = DrawableCompat.wrap(icon);
92 | DrawableCompat.setTint(
93 | icon,
94 | ContextCompat.getColor(view.getContext(), R.color.reverb_dark));
95 | }
96 |
97 | iconView.setImageDrawable(icon);
98 | iconView.setVisibility(View.VISIBLE);
99 | } else {
100 | iconView.setVisibility(View.GONE);
101 | }
102 | }
103 | }
104 |
105 | }
106 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/java/com/example/accountkitsample/TokenActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsample;
22 |
23 | import android.app.Activity;
24 | import android.os.Bundle;
25 | import android.view.View;
26 | import android.widget.Button;
27 | import android.widget.TextView;
28 |
29 | import com.facebook.accountkit.Account;
30 | import com.facebook.accountkit.AccountKit;
31 | import com.facebook.accountkit.AccountKitCallback;
32 | import com.facebook.accountkit.AccountKitError;
33 | import com.facebook.accountkit.PhoneNumber;
34 |
35 | public class TokenActivity extends Activity {
36 | static final String HELLO_TOKEN_ACTIVITY_FINAL_STATE_EXTRA =
37 | "HELLO_TOKEN_ACTIVITY_FINAL_STATE_EXTRA";
38 | static final String HELLO_TOKEN_ACTIVITY_INITIAL_STATE_EXTRA =
39 | "HELLO_TOKEN_ACTIVITY_INITIAL_STATE_EXTRA";
40 |
41 | @Override
42 | public void onCreate(final Bundle savedInstanceState) {
43 | super.onCreate(savedInstanceState);
44 | setContentView(R.layout.activity_hello_token);
45 |
46 | final Button signOut = (Button) findViewById(R.id.log_out_button);
47 | signOut.setOnClickListener(new View.OnClickListener() {
48 | @Override
49 | public void onClick(View v) {
50 | AccountKit.logOut();
51 | finish();
52 | }
53 | });
54 |
55 | final String finalState =
56 | getIntent().getStringExtra(HELLO_TOKEN_ACTIVITY_FINAL_STATE_EXTRA);
57 | final String initialState =
58 | getIntent().getStringExtra(HELLO_TOKEN_ACTIVITY_INITIAL_STATE_EXTRA);
59 |
60 | if (initialState != null) {
61 | final TextView initialStateView = (TextView) findViewById(R.id.initial_state);
62 | final TextView initialStateLabelView =
63 | (TextView) findViewById(R.id.initial_state_label);
64 | if (initialStateView != null && initialStateLabelView != null) {
65 | initialStateView.setText(initialState);
66 | initialStateView.setVisibility(View.VISIBLE);
67 | initialStateLabelView.setVisibility(View.VISIBLE);
68 | }
69 | }
70 |
71 | if (finalState != null) {
72 | final TextView finalStateView = (TextView) findViewById(R.id.final_state);
73 | final TextView finalStateLabelView =
74 | (TextView) findViewById(R.id.final_state_label);
75 | if (finalStateView != null && finalStateLabelView != null) {
76 | finalStateView.setText(finalState);
77 | finalStateView.setVisibility(View.VISIBLE);
78 | finalStateLabelView.setVisibility(View.VISIBLE);
79 | }
80 | }
81 | }
82 |
83 | @Override
84 | protected void onResume() {
85 | super.onResume();
86 |
87 | AccountKit.getCurrentAccount(new AccountKitCallback() {
88 | @Override
89 | public void onSuccess(final Account account) {
90 | final TextView userId = (TextView) findViewById(R.id.user_id);
91 | userId.setText(account.getId());
92 |
93 | final TextView phoneNumber = (TextView) findViewById(R.id.user_phone);
94 | final PhoneNumber number = account.getPhoneNumber();
95 | phoneNumber.setText(number == null ? null : number.toString());
96 |
97 | final TextView email = (TextView) findViewById(R.id.user_email);
98 | email.setText(account.getEmail());
99 | }
100 |
101 | @Override
102 | public void onError(final AccountKitError error) {
103 | }
104 | });
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/layout/activity_hello_token.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
27 |
28 |
35 |
42 |
49 |
56 |
63 |
70 |
77 |
85 |
92 |
100 |
107 |
108 |
109 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/androidTest/java/com/example/accountkitsample/email/EmailTests.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsample.email;
22 |
23 | import android.support.test.espresso.ViewInteraction;
24 | import android.support.test.rule.ActivityTestRule;
25 | import android.support.test.runner.AndroidJUnit4;
26 | import android.test.suitebuilder.annotation.SmallTest;
27 |
28 | import com.example.accountkitsample.AccountKitTest;
29 | import com.example.accountkitsample.MainActivity;
30 | import com.example.accountkitsample.R;
31 |
32 | import org.junit.Before;
33 | import org.junit.Rule;
34 | import org.junit.Test;
35 | import org.junit.runner.RunWith;
36 |
37 | import java.util.concurrent.TimeUnit;
38 |
39 | import static android.support.test.espresso.Espresso.onView;
40 | import static android.support.test.espresso.action.ViewActions.click;
41 | import static android.support.test.espresso.action.ViewActions.typeText;
42 | import static android.support.test.espresso.assertion.ViewAssertions.matches;
43 | import static android.support.test.espresso.matcher.ViewMatchers.hasFocus;
44 | import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
45 | import static android.support.test.espresso.matcher.ViewMatchers.isEnabled;
46 | import static android.support.test.espresso.matcher.ViewMatchers.withId;
47 | import static android.support.test.espresso.matcher.ViewMatchers.withText;
48 | import static org.hamcrest.Matchers.not;
49 |
50 | @RunWith(AndroidJUnit4.class)
51 | @SmallTest
52 | public class EmailTests extends AccountKitTest {
53 |
54 | @Rule
55 | public ActivityTestRule mActivityRule =
56 | new ActivityTestRule<>(MainActivity.class);
57 |
58 | @Before
59 | public void startEmailFlow() {
60 | EmailLoginUtil.startEmailLogin();
61 | }
62 |
63 | @Test
64 | public void testInitialState() {
65 | // email address entry
66 | final ViewInteraction emailEditTextInteraction = onView(withId(R.id.com_accountkit_email));
67 | emailEditTextInteraction.check(matches(isDisplayed()));
68 | emailEditTextInteraction.check(matches(hasFocus()));
69 | emailEditTextInteraction.check(matches(withText("")));
70 | // info text
71 | onView(withId(R.id.com_accountkit_text)).check(matches(isDisplayed()));
72 | // next btn
73 | onView(withId(R.id.com_accountkit_next_button)).check(matches(not(isEnabled())));
74 | }
75 |
76 | @Test
77 | public void testBadEmailAddressEntry() {
78 | final ViewInteraction emailEditTextInteraction = onView(withId(R.id.com_accountkit_email));
79 | // enter address
80 | emailEditTextInteraction.perform(typeText(EmailLoginUtil.INCOMPLETE_EMAIL_ADDRESS));
81 | emailEditTextInteraction.check(matches(withText(EmailLoginUtil.INCOMPLETE_EMAIL_ADDRESS)));
82 | // submit address
83 | onView(withId(R.id.com_accountkit_next_button)).perform(click());
84 | // verify state
85 | emailEditTextInteraction.check(matches(isDisplayed()));
86 | onView(withText(R.string.com_accountkit_email_invalid)).check(matches(isDisplayed()));
87 | }
88 |
89 |
90 | @Test
91 | public void testEnterEmailAddress() {
92 | EmailLoginUtil.submitEmailAddress();
93 | // possible race condition with sending email.
94 | onView(withId(R.id.com_accountkit_icon_view)).check(matches(isDisplayed()));
95 | }
96 |
97 | @Test
98 | public void testOpenEmail() throws InterruptedException {
99 | EmailLoginUtil.submitEmailAddress();
100 | // Looking into Espressos Idling Resource but until then we will just sleep it.
101 | Thread.sleep(TimeUnit.SECONDS.toMillis(2));
102 | onView(withId(R.id.com_accountkit_check_email_button)).check(matches(isDisplayed()));
103 | }
104 |
105 | @Test
106 | public void testResentEmail() throws InterruptedException {
107 | EmailLoginUtil.submitEmailAddress();
108 | // Looking into Espressos Idling Resource but until then we will just sleep it.
109 | Thread.sleep(TimeUnit.SECONDS.toMillis(2));
110 | onView(withId(R.id.com_accountkit_retry_email_button)).perform(click());
111 | onView(withText(R.string.com_accountkit_email_login_retry_title))
112 | .check(matches(isDisplayed()));
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn ( ) {
37 | echo "$*"
38 | }
39 |
40 | die ( ) {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
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 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 | Hello
24 | ak147274049205315
25 | 147274049205315
26 | Account Kit Sample
27 | e4ec8190ade85a467c7f2822a3f63fda
28 | Code
29 | Use advanced UI theming
30 | Confirm button Text
31 | Entry button Text
32 | Enable Client Access Token Flow
33 | Text Position
34 | Theme
35 | Background image
36 | Background Image Tint
37 | Tint Intensity (%1$d%%)
38 | Facebook Notifications Fallback
39 | Allow Voice Call Fallback
40 | Is State Param passed?
41 | Email
42 | Error
43 | An error has occurred.
44 | Final State
45 | Initial State
46 | Loading…
47 | Log In via Email
48 | Log In via Phone
49 | Log Out
50 | NA
51 |
52 | Grant permission to read your email address from your device to pre-fill.
53 |
54 | Read Email Address
55 |
56 | Grant permission to read your phone number from your device to pre-fill.
57 |
58 | Read Phone Number
59 |
60 | Grant permission to read your SMS code from your device to pre-fill.
61 |
62 | Read SMS Code
63 | Phone Number
64 | Read phone number?
65 | Enable initial SMS button?
66 | Receive SMS?
67 | Use manual whitelist/blacklist
68 | Account ID
69 |
70 |
71 | Advanced UI theming is required for Reverb themes. Select a different theme to disable.
72 |
73 |
74 | Advanced UI theming is not allowed for Skin themes. Select a different theme to enable.
75 |
76 | SIGN IN WITH PHONE
77 | SIGN IN WITH EMAIL
78 | Enter your code
79 | Enter your email address
80 | Open the email and confirm your address
81 | We\'re sorry, something went wrong.
82 | Enter your phone number
83 | We\'re sorry. Try these options to continue.
84 | Sending your code…
85 | Sent!
86 | Account verified!
87 | Logging in…
88 |
89 | Done!
90 | Verifying your code…
91 |
92 |
93 | - Classic
94 | - Contemporary
95 | - Translucent
96 | - Salmon
97 | - Yellow
98 | - Red
99 | - Dog
100 | - Bicycle
101 | - Reverb A
102 | - Reverb B
103 | - Reverb C
104 |
105 |
106 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/java/com/example/accountkitsample/ReverbFooterFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsample;
22 |
23 | import android.app.Fragment;
24 | import android.os.Bundle;
25 | import android.support.annotation.Nullable;
26 | import android.view.LayoutInflater;
27 | import android.view.View;
28 | import android.view.ViewGroup;
29 | import android.widget.ProgressBar;
30 | import android.widget.TextView;
31 |
32 | import com.facebook.accountkit.ui.LoginType;
33 |
34 | public class ReverbFooterFragment extends Fragment {
35 | private static final String LOGIN_TYPE_KEY = "loginType";
36 | private static final String PROGRESS_KEY = "progress";
37 | private static final String PROGRESS_TYPE_KEY = "progressType";
38 |
39 | public enum ProgressType {
40 | BAR,
41 | DOTS,
42 | }
43 |
44 | public interface OnSwitchLoginTypeListener {
45 | void onSwitchLoginType();
46 | }
47 |
48 | private LoginType loginType;
49 | private OnSwitchLoginTypeListener onSwitchLoginTypeListener;
50 | private int progress = 0;
51 | private ProgressType progressType = ProgressType.BAR;
52 |
53 | public void setLoginType(final LoginType loginType) {
54 | if (loginType == null) {
55 | return;
56 | }
57 | this.loginType = loginType;
58 | updateButtonText(getView());
59 | }
60 |
61 | public void setOnSwitchLoginTypeListener(
62 | final OnSwitchLoginTypeListener onSwitchLoginTypeListener) {
63 | this.onSwitchLoginTypeListener = onSwitchLoginTypeListener;
64 | updateSwitchLoginTypeListener(getView());
65 | }
66 |
67 | public void setProgress(final int progress) {
68 | this.progress = progress;
69 | updateProgress(getView());
70 | }
71 |
72 | public void setProgressType(final ProgressType progressType) {
73 | if (progressType == null) {
74 | return;
75 | }
76 | this.progressType = progressType;
77 | }
78 |
79 | public View onCreateView(
80 | final LayoutInflater inflater,
81 | final ViewGroup container,
82 | final Bundle savedInstanceState) {
83 | if (savedInstanceState != null) {
84 | final String loginTypeString = savedInstanceState.getString(LOGIN_TYPE_KEY);
85 | loginType = loginTypeString == null ? loginType : LoginType.valueOf(loginTypeString);
86 | progress = savedInstanceState.getInt(PROGRESS_KEY, progress);
87 | final String progressTypeString = savedInstanceState.getString(PROGRESS_TYPE_KEY);
88 | progressType = progressTypeString == null
89 | ? progressType
90 | : ProgressType.valueOf(progressTypeString);
91 | }
92 |
93 | View view = super.onCreateView(inflater, container, savedInstanceState);
94 | if (view == null) {
95 | final int layoutResourceId;
96 | switch (progressType) {
97 | case DOTS:
98 | layoutResourceId = R.layout.fragment_reverb_footer_dots;
99 | break;
100 | case BAR:
101 | default:
102 | layoutResourceId = R.layout.fragment_reverb_footer_bar;
103 | break;
104 | }
105 | view = inflater.inflate(layoutResourceId, container, false);
106 | }
107 | updateButtonText(view);
108 | updateProgress(view);
109 | updateSwitchLoginTypeListener(view);
110 | return view;
111 | }
112 |
113 | @Override
114 | public void onSaveInstanceState(final Bundle outState) {
115 | super.onSaveInstanceState(outState);
116 |
117 | outState.putString(LOGIN_TYPE_KEY, loginType == null ? null : loginType.name());
118 | outState.putInt(PROGRESS_KEY, progress);
119 | outState.putString(PROGRESS_TYPE_KEY, progressType.name());
120 | }
121 |
122 | private void updateButtonText(@Nullable final View view) {
123 | if (view == null) {
124 | return;
125 | }
126 | final TextView switchLoginTypeButton
127 | = (TextView) view.findViewById(R.id.switch_login_type_button);
128 | if (switchLoginTypeButton == null) {
129 | return;
130 | }
131 | if (loginType == null) {
132 | switchLoginTypeButton.setVisibility(View.GONE);
133 | return;
134 | }
135 | switch (loginType) {
136 | case EMAIL:
137 | switchLoginTypeButton.setText(R.string.reverb_switch_login_type_phone);
138 | break;
139 | case PHONE:
140 | switchLoginTypeButton.setText(R.string.reverb_switch_login_type_email);
141 | break;
142 | }
143 | switchLoginTypeButton.setVisibility(View.VISIBLE);
144 | }
145 |
146 | private void updateProgress(@Nullable final View view) {
147 | if (view == null) {
148 | return;
149 | }
150 |
151 | final ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.reverb_progress_bar);
152 | if (progressBar != null) {
153 | progressBar.setProgress(progress);
154 | }
155 | }
156 |
157 | private void updateSwitchLoginTypeListener(@Nullable final View view) {
158 | if (view == null || onSwitchLoginTypeListener == null) {
159 | return;
160 | }
161 | final View switchLoginTypeButton = view.findViewById(R.id.switch_login_type_button);
162 | if (switchLoginTypeButton == null) {
163 | return;
164 | }
165 | switchLoginTypeButton.setOnClickListener(new View.OnClickListener() {
166 | @Override
167 | public void onClick(final View v) {
168 | if (onSwitchLoginTypeListener != null) {
169 | onSwitchLoginTypeListener.onSwitchLoginType();
170 | }
171 | }
172 | });
173 | }
174 | }
175 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 |
24 |
25 |
29 |
30 |
31 |
32 |
46 |
47 |
56 |
57 |
70 |
71 |
80 |
81 |
92 |
93 |
122 |
123 |
127 |
128 |
137 |
138 |
142 |
143 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/java/com/example/accountkitsample/AccountKitSampleAdvancedUIManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsample;
22 |
23 | import android.app.Fragment;
24 | import android.os.Parcel;
25 | import android.support.annotation.Nullable;
26 |
27 | import com.facebook.accountkit.AccountKitError;
28 | import com.facebook.accountkit.ui.BaseUIManager;
29 | import com.facebook.accountkit.ui.ButtonType;
30 | import com.facebook.accountkit.ui.LoginFlowState;
31 | import com.facebook.accountkit.ui.LoginType;
32 | import com.facebook.accountkit.ui.TextPosition;
33 |
34 | public class AccountKitSampleAdvancedUIManager extends BaseUIManager {
35 | private static final int BODY_HEIGHT = 80;
36 | private static final int FOOTER_HEIGHT = 120;
37 | private static final int HEADER_HEIGHT = 80;
38 |
39 | private final ButtonType confirmButton;
40 | private final ButtonType entryButton;
41 | private AccountKitError error;
42 | private LoginType loginType;
43 | private final TextPosition textPosition;
44 |
45 | @Deprecated
46 | public AccountKitSampleAdvancedUIManager(
47 | final ButtonType confirmButton,
48 | final ButtonType entryButton,
49 | final TextPosition textPosition,
50 | final LoginType loginType) {
51 | super(-1);
52 | this.confirmButton = confirmButton;
53 | this.entryButton = entryButton;
54 | this.textPosition = textPosition;
55 | this.loginType = loginType;
56 | }
57 |
58 | private AccountKitSampleAdvancedUIManager(final Parcel source) {
59 | super(source);
60 | this.loginType = LoginType.values()[source.readInt()];
61 | String s = source.readString();
62 | final ButtonType confirmButton = s == null ? null : ButtonType.valueOf(s);
63 | s = source.readString();
64 | final ButtonType entryButton = s == null ? null : ButtonType.valueOf(s);
65 | s = source.readString();
66 | final TextPosition textPosition = s == null ? null : TextPosition.valueOf(s);
67 | this.confirmButton = confirmButton;
68 | this.entryButton = entryButton;
69 | this.textPosition = textPosition;
70 | }
71 |
72 | @Override
73 | @Nullable
74 | public Fragment getBodyFragment(final LoginFlowState state) {
75 | return getPlaceholderFragment(state, BODY_HEIGHT, "Body");
76 | }
77 |
78 | @Override
79 | @Nullable
80 | public ButtonType getButtonType(final LoginFlowState state) {
81 | switch (state) {
82 | case PHONE_NUMBER_INPUT:
83 | case EMAIL_INPUT:
84 | return entryButton;
85 | case CODE_INPUT:
86 | case CONFIRM_ACCOUNT_VERIFIED:
87 | return confirmButton;
88 | default:
89 | return null;
90 | }
91 | }
92 |
93 | @Override
94 | @Nullable
95 | public Fragment getFooterFragment(final LoginFlowState state) {
96 | return getPlaceholderFragment(state, FOOTER_HEIGHT, "Footer");
97 | }
98 |
99 | @Override
100 | @Nullable
101 | public Fragment getHeaderFragment(final LoginFlowState state) {
102 | if (state != LoginFlowState.ERROR) {
103 | return getPlaceholderFragment(state, HEADER_HEIGHT, "Header");
104 | }
105 | final String errorMessage = getErrorMessage();
106 | if (errorMessage == null) {
107 | return PlaceholderFragment.create(HEADER_HEIGHT, R.string.error_message);
108 | } else {
109 | return PlaceholderFragment.create(HEADER_HEIGHT, errorMessage);
110 | }
111 | }
112 |
113 | @Override
114 | @Nullable
115 | public TextPosition getTextPosition(final LoginFlowState state) {
116 | return textPosition;
117 | }
118 |
119 | @Override
120 | public void onError(final AccountKitError error) {
121 | this.error = error;
122 | }
123 |
124 | private String getErrorMessage() {
125 | if (error == null) {
126 | return null;
127 | }
128 |
129 | final String message = error.getUserFacingMessage();
130 | if (message == null) {
131 | return null;
132 | }
133 |
134 | return message;
135 | }
136 |
137 | @Nullable
138 | private PlaceholderFragment getPlaceholderFragment(
139 | final LoginFlowState state,
140 | final int height,
141 | final String suffix) {
142 | final String prefix;
143 | switch (state) {
144 | case PHONE_NUMBER_INPUT:
145 | prefix = "Custom Phone Number ";
146 | break;
147 | case EMAIL_INPUT:
148 | prefix = "Custom Email ";
149 | break;
150 | case ACCOUNT_VERIFIED:
151 | prefix = "Custom Account Verified ";
152 | break;
153 | case CONFIRM_ACCOUNT_VERIFIED:
154 | prefix = "Custom Confirm Account Verified ";
155 | break;
156 | case CONFIRM_INSTANT_VERIFICATION_LOGIN:
157 | prefix = "Custom Confirm Instant Verification Login ";
158 | break;
159 | case EMAIL_VERIFY:
160 | prefix = "Custom Email Verify ";
161 | break;
162 | case SENDING_CODE:
163 | switch (loginType) {
164 | case EMAIL:
165 | prefix = "Custom Sending Email ";
166 | break;
167 | case PHONE:
168 | prefix = "Custom Sending Code ";
169 | break;
170 | default:
171 | return null;
172 | }
173 | break;
174 | case SENT_CODE:
175 | switch (loginType) {
176 | case EMAIL:
177 | prefix = "Custom Sent Email ";
178 | break;
179 | case PHONE:
180 | prefix = "Custom Sent Code ";
181 | break;
182 | default:
183 | return null;
184 | }
185 | break;
186 | case CODE_INPUT:
187 | prefix = "Custom Code Input ";
188 | break;
189 | case VERIFYING_CODE:
190 | prefix = "Custom Verifying ";
191 | break;
192 | case VERIFIED:
193 | prefix = "Custom Verified ";
194 | break;
195 | case RESEND:
196 | prefix = "Custom Resend ";
197 | break;
198 | case ERROR:
199 | prefix = "Custom Error ";
200 | break;
201 | default:
202 | return null;
203 | }
204 | return PlaceholderFragment.create(height, prefix.concat(suffix));
205 | }
206 |
207 | @Override
208 | public void writeToParcel(final Parcel dest, final int flags) {
209 | super.writeToParcel(dest, flags);
210 | dest.writeInt(loginType.ordinal());
211 | dest.writeString(confirmButton != null ? confirmButton.name() : null);
212 | dest.writeString(entryButton != null ? entryButton.name() : null);
213 | dest.writeString(textPosition != null ? textPosition.name() : null);
214 | }
215 |
216 | public static final Creator CREATOR
217 | = new Creator() {
218 | @Override
219 | public AccountKitSampleAdvancedUIManager createFromParcel(final Parcel source) {
220 | return new AccountKitSampleAdvancedUIManager(source);
221 | }
222 |
223 | @Override
224 | public AccountKitSampleAdvancedUIManager[] newArray(final int size) {
225 | return new AccountKitSampleAdvancedUIManager[size];
226 | }
227 | };
228 | }
229 |
--------------------------------------------------------------------------------
/samples/AccountKitSample/src/main/java/com/example/accountkitsample/ReverbUIManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsample;
22 |
23 | import android.app.Activity;
24 | import android.app.Fragment;
25 | import android.content.Context;
26 | import android.content.Intent;
27 | import android.os.Parcel;
28 | import android.support.annotation.Nullable;
29 | import android.support.v4.content.LocalBroadcastManager;
30 |
31 | import com.facebook.accountkit.ui.BaseUIManager;
32 | import com.facebook.accountkit.ui.ButtonType;
33 | import com.facebook.accountkit.ui.LoginFlowState;
34 | import com.facebook.accountkit.ui.LoginType;
35 | import com.facebook.accountkit.ui.TextPosition;
36 |
37 | public class ReverbUIManager extends BaseUIManager {
38 | public static final String LOGIN_TYPE_EXTRA = "loginType";
39 | public static final String SWITCH_LOGIN_TYPE_EVENT = "switch-login-type";
40 |
41 | private final ButtonType confirmButton;
42 | private final ButtonType entryButton;
43 | private final LoginType loginType;
44 | private final TextPosition textPosition;
45 |
46 | public ReverbUIManager(
47 | final ButtonType confirmButton,
48 | final ButtonType entryButton,
49 | final LoginType loginType,
50 | final TextPosition textPosition,
51 | final int themeResourceId) {
52 | super(themeResourceId);
53 | this.confirmButton = confirmButton;
54 | this.entryButton = entryButton;
55 | this.loginType = loginType;
56 | this.textPosition = textPosition;
57 | }
58 |
59 | private ReverbUIManager(final Parcel source) {
60 | super(source);
61 | this.loginType = LoginType.values()[source.readInt()];
62 | String s = source.readString();
63 | final ButtonType confirmButton = s == null ? null : ButtonType.valueOf(s);
64 | s = source.readString();
65 | final ButtonType entryButton = s == null ? null : ButtonType.valueOf(s);
66 | s = source.readString();
67 | final TextPosition textPosition = s == null ? null : TextPosition.valueOf(s);
68 | this.confirmButton = confirmButton;
69 | this.entryButton = entryButton;
70 | this.textPosition = textPosition;
71 | }
72 |
73 | @Override
74 | @Nullable
75 | public Fragment getBodyFragment(final LoginFlowState state) {
76 | int iconResourceId = 0;
77 | int iconTintResourceId = 0;
78 | boolean showProgressSpinner = false;
79 | switch (state) {
80 | case SENDING_CODE:
81 | showProgressSpinner = true;
82 | break;
83 | case SENT_CODE:
84 | switch (loginType) {
85 | case EMAIL:
86 | iconResourceId = R.drawable.reverb_email;
87 | break;
88 | case PHONE:
89 | iconResourceId = R.drawable.reverb_progress_complete;
90 | break;
91 | }
92 | break;
93 | case EMAIL_VERIFY:
94 | iconResourceId = R.drawable.reverb_email_sent;
95 | break;
96 | case VERIFYING_CODE:
97 | case CONFIRM_INSTANT_VERIFICATION_LOGIN:
98 | showProgressSpinner = true;
99 | break;
100 | case VERIFIED:
101 | iconResourceId = R.drawable.reverb_progress_complete;
102 | iconTintResourceId = R.color.reverb_dark;
103 | break;
104 | case ERROR:
105 | iconResourceId = R.drawable.reverb_error;
106 | break;
107 | case PHONE_NUMBER_INPUT:
108 | case EMAIL_INPUT:
109 | case CODE_INPUT:
110 | case CONFIRM_ACCOUNT_VERIFIED:
111 | case RESEND:
112 | case NONE:
113 | default:
114 | return null;
115 | }
116 |
117 | return ReverbBodyFragment.newInstance(
118 | iconResourceId,
119 | iconTintResourceId,
120 | showProgressSpinner);
121 | }
122 |
123 | @Override
124 | @Nullable
125 | public ButtonType getButtonType(final LoginFlowState state) {
126 | switch (state) {
127 | case PHONE_NUMBER_INPUT:
128 | case EMAIL_INPUT:
129 | return entryButton;
130 | case CODE_INPUT:
131 | case CONFIRM_ACCOUNT_VERIFIED:
132 | return confirmButton;
133 | default:
134 | return null;
135 | }
136 | }
137 |
138 | @Override
139 | @Nullable
140 | public Fragment getFooterFragment(final LoginFlowState state) {
141 | final int progress;
142 | switch (state) {
143 | case PHONE_NUMBER_INPUT:
144 | case EMAIL_INPUT:
145 | progress = 1;
146 | break;
147 | case SENDING_CODE:
148 | case SENT_CODE:
149 | progress = 2;
150 | break;
151 | case CODE_INPUT:
152 | case EMAIL_VERIFY:
153 | case CONFIRM_ACCOUNT_VERIFIED:
154 | progress = 3;
155 | break;
156 | case VERIFYING_CODE:
157 | case CONFIRM_INSTANT_VERIFICATION_LOGIN:
158 | progress = 4;
159 | break;
160 | case VERIFIED:
161 | progress = 5;
162 | break;
163 | case RESEND:
164 | case ERROR:
165 | case NONE:
166 | default:
167 | return null;
168 | }
169 | final ReverbFooterFragment fragment = new ReverbFooterFragment();
170 | if (progress == 1) {
171 | fragment.setLoginType(loginType);
172 | fragment.setOnSwitchLoginTypeListener(
173 | new ReverbFooterFragment.OnSwitchLoginTypeListener() {
174 | @Override
175 | public void onSwitchLoginType() {
176 | if (listener == null) {
177 | return;
178 | }
179 |
180 | listener.onCancel();
181 |
182 | final Activity activity = fragment.getActivity();
183 | if (activity == null) {
184 | return;
185 | }
186 | final Context applicationContext = activity.getApplicationContext();
187 | final LoginType newLoginType;
188 | switch (loginType) {
189 | case EMAIL:
190 | newLoginType = LoginType.PHONE;
191 | break;
192 | case PHONE:
193 | newLoginType = LoginType.EMAIL;
194 | break;
195 | default:
196 | return;
197 | }
198 | LocalBroadcastManager
199 | .getInstance(applicationContext)
200 | .sendBroadcast(new Intent(SWITCH_LOGIN_TYPE_EVENT)
201 | .putExtra(LOGIN_TYPE_EXTRA, newLoginType.name()));
202 | }
203 | });
204 | }
205 | if (getThemeId() == R.style.AppLoginTheme_Reverb_A) {
206 | fragment.setProgressType(ReverbFooterFragment.ProgressType.BAR);
207 | } else if (getThemeId() == R.style.AppLoginTheme_Reverb_B
208 | || getThemeId() == R.style.AppLoginTheme_Reverb_C) {
209 | fragment.setProgressType(ReverbFooterFragment.ProgressType.DOTS);
210 | }
211 | fragment.setProgress(progress);
212 | return fragment;
213 | }
214 |
215 | @Override
216 | @Nullable
217 | public Fragment getHeaderFragment(final LoginFlowState state) {
218 | if (state == LoginFlowState.ERROR) {
219 | return null;
220 | } else {
221 | return SpaceFragment.create(
222 | R.styleable.Theme_AccountKitSample_Style_reverb_content_margin_top);
223 | }
224 | }
225 |
226 | @Override
227 | @Nullable
228 | public TextPosition getTextPosition(final LoginFlowState state) {
229 | return textPosition == null ? TextPosition.ABOVE_BODY : textPosition;
230 | }
231 |
232 | @Override
233 | public void writeToParcel(final Parcel dest, final int flags) {
234 | super.writeToParcel(dest, flags);
235 | dest.writeInt(loginType.ordinal());
236 | dest.writeString(confirmButton != null ? confirmButton.name() : null);
237 | dest.writeString(entryButton != null ? entryButton.name() : null);
238 | dest.writeString(textPosition != null ? textPosition.name() : null);
239 | }
240 |
241 | public static final Creator CREATOR
242 | = new Creator() {
243 | @Override
244 | public ReverbUIManager createFromParcel(final Parcel source) {
245 | return new ReverbUIManager(source);
246 | }
247 |
248 | @Override
249 | public ReverbUIManager[] newArray(final int size) {
250 | return new ReverbUIManager[size];
251 | }
252 | };
253 | }
254 |
--------------------------------------------------------------------------------
/samples/AccountKitSimpleSample/src/main/java/com/example/accountkitsimplesample/MainActivity.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | package com.example.accountkitsimplesample;
22 |
23 | import android.Manifest;
24 | import android.annotation.TargetApi;
25 | import android.app.Activity;
26 | import android.app.AlertDialog;
27 | import android.content.DialogInterface;
28 | import android.content.Intent;
29 | import android.content.pm.PackageManager;
30 | import android.os.Build;
31 | import android.os.Bundle;
32 | import android.support.annotation.NonNull;
33 | import android.view.View;
34 | import android.widget.Toast;
35 |
36 | import com.facebook.accountkit.AccessToken;
37 | import com.facebook.accountkit.AccountKit;
38 | import com.facebook.accountkit.AccountKitLoginResult;
39 | import com.facebook.accountkit.ui.AccountKitActivity;
40 | import com.facebook.accountkit.ui.AccountKitConfiguration;
41 | import com.facebook.accountkit.ui.LoginType;
42 | import com.google.android.gms.common.ConnectionResult;
43 | import com.google.android.gms.common.GoogleApiAvailability;
44 |
45 | import java.util.HashMap;
46 | import java.util.Map;
47 |
48 | public class MainActivity extends Activity {
49 | private static final int FRAMEWORK_REQUEST_CODE = 1;
50 |
51 | private int nextPermissionsRequestCode = 4000;
52 | private final Map permissionsListeners = new HashMap<>();
53 |
54 | private interface OnCompleteListener {
55 | void onComplete();
56 | }
57 |
58 | @Override
59 | protected void onCreate(final Bundle savedInstanceState) {
60 | super.onCreate(savedInstanceState);
61 | setContentView(R.layout.activity_main);
62 |
63 | if (AccountKit.getCurrentAccessToken() != null && savedInstanceState == null) {
64 | startActivity(new Intent(this, TokenActivity.class));
65 | }
66 | }
67 |
68 | public void onLoginEmail(final View view) {
69 | onLogin(LoginType.EMAIL);
70 | }
71 |
72 | public void onLoginPhone(final View view) {
73 | onLogin(LoginType.PHONE);
74 | }
75 |
76 | @Override
77 | protected void onActivityResult(
78 | final int requestCode,
79 | final int resultCode,
80 | final Intent data) {
81 | super.onActivityResult(requestCode, resultCode, data);
82 |
83 | if (requestCode != FRAMEWORK_REQUEST_CODE) {
84 | return;
85 | }
86 |
87 | final String toastMessage;
88 | final AccountKitLoginResult loginResult = AccountKit.loginResultWithIntent(data);
89 | if (loginResult == null || loginResult.wasCancelled()) {
90 | toastMessage = "Login Cancelled";
91 | } else if (loginResult.getError() != null) {
92 | toastMessage = loginResult.getError().getErrorType().getMessage();
93 | final Intent intent = new Intent(this, ErrorActivity.class);
94 | intent.putExtra(ErrorActivity.HELLO_TOKEN_ACTIVITY_ERROR_EXTRA, loginResult.getError());
95 |
96 | startActivity(intent);
97 | } else {
98 | final AccessToken accessToken = loginResult.getAccessToken();
99 | final long tokenRefreshIntervalInSeconds =
100 | loginResult.getTokenRefreshIntervalInSeconds();
101 | if (accessToken != null) {
102 | toastMessage = "Success:" + accessToken.getAccountId()
103 | + tokenRefreshIntervalInSeconds;
104 | startActivity(new Intent(this, TokenActivity.class));
105 | } else {
106 | toastMessage = "Unknown response type";
107 | }
108 | }
109 |
110 | Toast.makeText(
111 | this,
112 | toastMessage,
113 | Toast.LENGTH_LONG)
114 | .show();
115 | }
116 |
117 | private void onLogin(final LoginType loginType) {
118 | final Intent intent = new Intent(this, AccountKitActivity.class);
119 | final AccountKitConfiguration.AccountKitConfigurationBuilder configurationBuilder
120 | = new AccountKitConfiguration.AccountKitConfigurationBuilder(
121 | loginType,
122 | AccountKitActivity.ResponseType.TOKEN);
123 | //By default enableInitialSmsButton=true which displays sms as login option alongwith whatsapp
124 | configurationBuilder.setEnableInitialSmsButton(false);
125 | final AccountKitConfiguration configuration = configurationBuilder.build();
126 | intent.putExtra(
127 | AccountKitActivity.ACCOUNT_KIT_ACTIVITY_CONFIGURATION,
128 | configuration);
129 | OnCompleteListener completeListener = new OnCompleteListener() {
130 | @Override
131 | public void onComplete() {
132 | startActivityForResult(intent, FRAMEWORK_REQUEST_CODE);
133 | }
134 | };
135 | switch (loginType) {
136 | case EMAIL:
137 | if (!isGooglePlayServicesAvailable()) {
138 | final OnCompleteListener getAccountsCompleteListener = completeListener;
139 | completeListener = new OnCompleteListener() {
140 | @Override
141 | public void onComplete() {
142 | requestPermissions(
143 | Manifest.permission.GET_ACCOUNTS,
144 | R.string.permissions_get_accounts_title,
145 | R.string.permissions_get_accounts_message,
146 | getAccountsCompleteListener);
147 | }
148 | };
149 | }
150 | break;
151 | case PHONE:
152 | if (configuration.isReadPhoneStateEnabled() && !isGooglePlayServicesAvailable()) {
153 | final OnCompleteListener readPhoneStateCompleteListener = completeListener;
154 | completeListener = new OnCompleteListener() {
155 | @Override
156 | public void onComplete() {
157 | requestPermissions(
158 | Manifest.permission.READ_PHONE_STATE,
159 | R.string.permissions_read_phone_state_title,
160 | R.string.permissions_read_phone_state_message,
161 | readPhoneStateCompleteListener);
162 | }
163 | };
164 | }
165 | break;
166 | }
167 | completeListener.onComplete();
168 | }
169 |
170 | private boolean isGooglePlayServicesAvailable() {
171 | final GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
172 | int googlePlayServicesAvailable = apiAvailability.isGooglePlayServicesAvailable(this);
173 | return googlePlayServicesAvailable == ConnectionResult.SUCCESS;
174 | }
175 |
176 | private boolean canReadSmsWithoutPermission() {
177 | final GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
178 | int googlePlayServicesAvailable = apiAvailability.isGooglePlayServicesAvailable(this);
179 | if (googlePlayServicesAvailable == ConnectionResult.SUCCESS) {
180 | return true;
181 | }
182 | //TODO we should also check for Android O here t18761104
183 |
184 | return false;
185 | }
186 |
187 | private void requestPermissions(
188 | final String permission,
189 | final int rationaleTitleResourceId,
190 | final int rationaleMessageResourceId,
191 | final OnCompleteListener listener) {
192 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
193 | if (listener != null) {
194 | listener.onComplete();
195 | }
196 | return;
197 | }
198 |
199 | checkRequestPermissions(
200 | permission,
201 | rationaleTitleResourceId,
202 | rationaleMessageResourceId,
203 | listener);
204 | }
205 |
206 | @TargetApi(23)
207 | private void checkRequestPermissions(
208 | final String permission,
209 | final int rationaleTitleResourceId,
210 | final int rationaleMessageResourceId,
211 | final OnCompleteListener listener) {
212 | if (checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED) {
213 | if (listener != null) {
214 | listener.onComplete();
215 | }
216 | return;
217 | }
218 |
219 | final int requestCode = nextPermissionsRequestCode++;
220 | permissionsListeners.put(requestCode, listener);
221 |
222 | if (shouldShowRequestPermissionRationale(permission)) {
223 | new AlertDialog.Builder(this)
224 | .setTitle(rationaleTitleResourceId)
225 | .setMessage(rationaleMessageResourceId)
226 | .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
227 | @Override
228 | public void onClick(final DialogInterface dialog, final int which) {
229 | requestPermissions(new String[] { permission }, requestCode);
230 | }
231 | })
232 | .setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
233 | @Override
234 | public void onClick(final DialogInterface dialog, final int which) {
235 | // ignore and clean up the listener
236 | permissionsListeners.remove(requestCode);
237 | }
238 | })
239 | .setIcon(android.R.drawable.ic_dialog_alert)
240 | .show();
241 | } else {
242 | requestPermissions(new String[]{ permission }, requestCode);
243 | }
244 | }
245 |
246 | @TargetApi(23)
247 | @SuppressWarnings("unused")
248 | @Override
249 | public void onRequestPermissionsResult(final int requestCode,
250 | final @NonNull String permissions[],
251 | final @NonNull int[] grantResults) {
252 | final OnCompleteListener permissionsListener = permissionsListeners.remove(requestCode);
253 | if (permissionsListener != null
254 | && grantResults.length > 0
255 | && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
256 | permissionsListener.onComplete();
257 | }
258 | }
259 | }
260 |
--------------------------------------------------------------------------------