content: package org.amfoss.templeapp.home;
  
  import android.content.Intent;
  import android.os.Bundle;
  import androidx.annotation.Nullable;
  import androidx.appcompat.app.AppCompatActivity;
  import butterknife.ButterKnife;
  import butterknife.OnClick;
  import com.firebase.ui.auth.AuthUI;
  import com.google.firebase.auth.FirebaseAuth;
  import java.util.Arrays;
  import java.util.List;
  import org.amfoss.templeapp.R;
  import org.amfoss.templeapp.Util.ActivityUtils;
  
  /**
  * @author Chromicle (ajayprabhakar369@gmail.com)
  * @since 17/10/2019
  */
  public class LoginActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_login);
          ButterKnife.bind(this);
  
          isUserSignedIn();
      }
  
      @OnClick(R.id.sign_in_button)
      public void isUserSignedIn() {
          if (FirebaseAuth.getInstance().getCurrentUser() == null) {
              List<AuthUI.IdpConfig> signInIntentBuilders =
                      Arrays.asList(
                              new AuthUI.IdpConfig.EmailBuilder().build(),
                              new AuthUI.IdpConfig.GoogleBuilder().build());
              startActivityForResult(
                      AuthUI.getInstance()
                              .createSignInIntentBuilder()
                              .setAvailableProviders(signInIntentBuilders)
                              .setIsSmartLockEnabled(false)
                              .setLogo(R.mipmap.ic_launcher)
                              .build(),
                      200);
          } else if (FirebaseAuth.getInstance().getCurrentUser().getDisplayName() != null) {
              ActivityUtils.launchActivity(LoginActivity.this, HomeActivity.class, true);
          }
      }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
  
          if (requestCode == 200) {
              if (resultCode == RESULT_OK) {
                  ActivityUtils.launchActivity(LoginActivity.this, HomeActivity.class, true);
              }
          }
      }
  }
  