daily pastebin goal
14%
SHARE
TWEET

Untitled

a guest Oct 12th, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.malik.alumnismkn3singaraja;
  2.  
  3. import android.app.Activity;
  4. import android.support.annotation.IntDef;
  5.  
  6. import com.firebase.ui.auth.AuthUI;
  7. import com.google.android.gms.tasks.OnSuccessListener;
  8.  
  9. import java.lang.annotation.Retention;
  10. import java.lang.annotation.RetentionPolicy;
  11. import java.util.Collections;
  12. import java.util.List;
  13.  
  14. public class UserActivity {
  15.     private Activity activity;
  16.     @IntDef({LOGIN_CODE})
  17.     @Retention(RetentionPolicy.SOURCE)
  18.     @interface code{}
  19.     public static final int LOGIN_CODE = 889;
  20.  
  21.     interface OnLogoutSuccessListener{
  22.         void logout();
  23.     }
  24.     private List<AuthUI.IdpConfig> profider;
  25.     public UserActivity(Activity activity1) {
  26.         this.activity = activity1;
  27.        profider = Collections.singletonList(new AuthUI.IdpConfig.PhoneBuilder().build());
  28.  
  29.     }
  30.  
  31.     void setActivitylogin(@code int loginCode){
  32.         activity.startActivityForResult(AuthUI.getInstance().createSignInIntentBuilder().setAvailableProviders(profider).setLogo(R.drawable.smkn3).build(),loginCode);
  33.  
  34.     }
  35.     void setActivityLogout(final OnLogoutSuccessListener listener){
  36.         AuthUI.getInstance().signOut(activity).addOnSuccessListener(new OnSuccessListener<Void>() {
  37.             @Override
  38.             public void onSuccess(Void aVoid) {
  39.                 listener.logout();
  40.             }
  41.         });
  42.     }
  43. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top