BaseAuth


Source link: https://github.com/KingsMentor/BaseAuth

BaseAuth

Easily set up phone authentication leveraging on different auth platforms (like firebase, sinch and many more to be added) of your choice. With a simple User Interface that can be styled to blend with the theme of your app, you can focus more on other functional requirement of the app other than the authentication process

Current Support

compile 'xyz.belvi.auth:baseauth-firebase:1.0.5' compile 'xyz.belvi.auth:baseauth-sinch:1.0.5' compile 'xyz.belvi.auth:baseauth-nexmo:1.0.5'

Sample

Adding as a dependency

add jcenter({ url "http://dl.bintray.com/kingsmentor/maven" } ) to your project / root build.gradle like so:

... allprojects {

  repositories {

jcenter({
url "http://dl.bintray.com/kingsmentor/maven"
}
)
  
}
 
}
 ...

Core

Not Available in 1.0.5

core provides access to other underlying auth platform. Only use core if you intend to perform phone number authetication using multiple auth providers.

dependencies {

  compile 'xyz.belvi.auth:baseauth-core:1.0.3' 
}

Firebase

This module handles phone number authentication using firebase.

dependencies {

  compile 'xyz.belvi.auth:baseauth-firebase:1.0.5' 
}

Sinch

This module handles phone number authentication using sinch.

dependencies {

  compile 'xyz.belvi.auth:baseauth-sinch:1.0.5' 
}

Using the Library:

As Firebase :


  FireAuthActivity.startFirebasePhoneAuth(this, new FirebaseAuthListener() {

 @Override

 public void authIgnored() {

  // user existed without autheticating

 
}

  @Override

 public void helpClicked(Context context) {

  // Help icon is cliced. You might want to do something here.

  
}

  @Override

 public void onAuthCompleted(PhoneAuthCredential credential, String phoneNumber) {

  // do something with Firebase PhoneAuthCredential and the autheticated phone number

 
}

}
, R.style.BaseAuthStyle);

As Sinch :

SinchAuthActivity.startSinchAuth(this, new SinchAuthListener() {

 public void onAuthCompleted(String phoneNumber) {

  
}

  public void authIgnored() {

  
}

  public void helpClicked(Context activity) {

  
}

}
, "API_KEY", R.style.BaseAuthStyle);

As Nemo :


  NexmoAuthActivity.startNexmoAuth(this, new NexmoAuthListener() {

public void onAuthCompleted(String phoneNumber) {

 Toast.makeText(MainActivity.this, phoneNumber, Toast.LENGTH_LONG).show();

}

 public void authIgnored() {

 
}

 public void helpClicked(Context activity) {

 
}

  
}
, new NexmoAuth("YOUR_API_ID", "YOUR_SHARED_SECRET", PIN_LENGTH), R.style.BaseAuthStyle);

Styling and Theming

define style in styles.xml

 <style name="BaseAuthStyle">

<item name="ba_show_help">true</item>
  </style>

ba_show_help determines if the help icon will be shown or not.

layout resources are referenced in corresponding resource xml files.
you can override any of the resource to suit your need.

color.xml
<resources>
  <color name="ba_colorPrimary">#42a5f5</color>
  <color name="ba_colorPrimaryDark">#253493</color>
  <color name="ba_colorAccent">#FF4081</color>
  <color name="ba_txt_error">#FF4081</color>
  <color name="ba_blue">#42a5f5</color>
  <color name="ba_background">#fcfcfc</color>
  <color name="ba_btn_disabled">#dfdfdf</color>
  <color name="ba_btn_enabled">#ffffff</color>
  <color name="ba_txt_grey">#696969</color>
  <color name="ba_auth_code">#42a5f5</color>
  <color name="ba_white">#FFFFFF</color>
  <color name="ba_country_selector_code_color">#787878</color>
  <color name="ba_country_selector_bg_color">#FFFFFF</color>
  <color name="ba_country_selector_name_color">#000000</color> </resources> 
strings.xml
<resources>
  <string name="app_name">BaseAuth</string>
  <string name="help">Help</string>
  <string name="select_country">Select your country</string>
  <string name="type_in">Please type in the verification code sent to %s</string>
  <string name="verify_number">Verify your number</string>
  <string name="phone_hint">Your phone number</string>
  <string name="cc_hint">Your country code</string>
  <string name="btn_next_title">Next</string>
  <string name="verification_code">Verification Code</string>
  <string name="received_question">Didn\'t receive  code ?</string>
  <string name="wait_field">Please wait</string>
  <string name="help_link">http://www.example.com</string>
  <string name="charges_desc">We will send you a one-off SMS message. Carrier charges may apply.</string>
  <string name="details_desc">Enter your country code and phone number for verification</string> </resources> 
dimens.xml
<resources>
  <dimen name="ba_layout_padding">32dp</dimen>
  <dimen name="verification_code_text_size">24sp</dimen>
  <dimen name="vc_txt_size">18sp</dimen>
  <dimen name="type_in_desc_txt_size">16sp</dimen>
  <dimen name="type_in_desc_margin_top">32dp</dimen>
  <dimen name="type_in_desc_margin_bottom">16dp</dimen>
  <dimen name="verification_layout_padding">32dp</dimen>
  <dimen name="verification_code_width">42dp</dimen>
  <dimen name="details_desc">16sp</dimen>
  <dimen name="details_margin_top">16dp</dimen>
  <dimen name="phone_field_text_size">18sp</dimen>
  <dimen name="next_btn_txt_size">14sp</dimen>
  <dimen name="next_btn_padding">16dp</dimen>
  <dimen name="wait_field_txt_size">16sp</dimen>
  <dimen name="wait_field_top_margin">8dp</dimen>
  <dimen name="receive_code_confirmation">14sp</dimen>
  <dimen name="receive_code_confirmation_top_margin">16dp</dimen>
  <dimen name="verification_status_text_size">12sp</dimen>
  <dimen name="verification_status_top_margin">16dp</dimen> </resources>

Resources

Custom ProgressView to show battery progress.

A library for speedy implementation menu or some actions with BottomSheet.

Piri is a lightweight annotation processing library that generates static factory methods which creates new intents for activities in Android.

It is a debug library to easily measure communication traffic of network of Activity.

A simple customizable Music Indicator Animation library. You can animate bars when the audio is played.

Features

  • Animate Indicator Bars
  • Set duration
  • Set color

This is a Customer support chat library built using Smack API that you can add to your Android applications.

Once I was in search of a customer support chat library that I could embed in my Android app easily without writing much code and without taking much time. I couldn't find any. So later I made this library to accomplish that task. Try using it. Try experimenting with it.

How it works?
You need to enter your XMPP server details, details of your user's XMPP account and XMPP id of the customer support executive sitting somewhere else on an XMPP client. The library opens a chat window for your app user and the customer support executive to chat.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes