Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package id.jababeka.activity;
- import android.Manifest;
- import android.app.ProgressDialog;
- import android.content.BroadcastReceiver;
- import android.content.Context;
- import android.content.Intent;
- import android.content.IntentSender;
- import android.content.pm.PackageInfo;
- import android.content.pm.PackageManager;
- import android.graphics.Color;
- import android.graphics.Paint;
- import android.graphics.Typeface;
- import android.os.AsyncTask;
- import android.os.Build;
- import android.os.Bundle;
- import android.provider.Settings;
- import android.support.v4.app.ActivityCompat;
- import android.support.v7.app.AppCompatActivity;
- import android.telephony.TelephonyManager;
- import android.text.Html;
- import android.text.SpannableString;
- import android.text.TextPaint;
- import android.text.method.LinkMovementMethod;
- import android.text.style.ClickableSpan;
- import android.view.KeyEvent;
- import android.view.View;
- import android.view.inputmethod.EditorInfo;
- import android.widget.Button;
- import android.widget.EditText;
- import android.widget.ImageButton;
- import android.widget.TextView;
- import android.widget.Toast;
- import com.facebook.AccessToken;
- import com.facebook.CallbackManager;
- import com.facebook.FacebookCallback;
- import com.facebook.FacebookException;
- import com.facebook.FacebookSdk;
- import com.facebook.GraphRequest;
- import com.facebook.GraphResponse;
- import com.facebook.appevents.AppEventsLogger;
- import com.facebook.login.LoginManager;
- import com.facebook.login.LoginResult;
- import com.google.android.gms.common.ConnectionResult;
- import com.google.android.gms.common.GooglePlayServicesUtil;
- import com.google.android.gms.common.api.GoogleApiClient;
- import com.google.android.gms.maps.model.LatLng;
- import com.google.android.gms.plus.Plus;
- import com.google.android.gms.plus.model.people.Person;
- import org.json.JSONException;
- import org.json.JSONObject;
- import java.net.SocketTimeoutException;
- import java.util.Arrays;
- import id.jababeka.networks.ApiResponse;
- import id.jababeka.networks.ApiService;
- import id.jababeka.helper.BackEndAPI.RestController;
- import id.jababeka.helper.GPS.CustomGPSFactory;
- import id.jababeka.helper.GPS.GPSTracker;
- import id.jababeka.helper.RetroFailureMessageHandler;
- import id.jababeka.helper.SessionManager;
- import id.jababeka.R;
- import id.jababeka.networks.response.model.LoginRetro;
- import id.jababeka.utilities.AESCrypt;
- import retrofit2.Call;
- import retrofit2.Callback;
- import retrofit2.Response;
- public class LoginActivity extends AppCompatActivity implements View.OnClickListener, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
- // LogCat tag
- private static final String TAG = LoginActivity.class.getSimpleName();
- private Button btnLogin;
- private Button btnLinkToRegister;
- private ImageButton fbLoginButton;
- private EditText inputEmail;
- private EditText inputPassword;
- private TextView lupaPassword;
- private TextView signUptext;
- private ProgressDialog pDialog;
- private SessionManager session;
- private TextView loginTitle;
- private String newPassword;
- CallbackManager callbackManager;
- private GoogleApiClient mGoogleApiClient;
- private static final int RC_GOOGLE_SIGN_IN = 9001;
- private static final int RC_FACEBOOK_SIGN_IN = 64206;
- private static final int RC_TWITTER_SIGN_IN = 140;
- private ImageButton signInButton;
- private boolean isProceedSignOut = true;
- /**
- * A flag indicating that a PendingIntent is in progress and prevents us
- * from starting further intents.
- */
- private boolean mIntentInProgress;
- private boolean mSignInClicked;
- private ConnectionResult mConnectionResult;
- private BroadcastReceiver mRegistrationBroadcastReceiver;
- // tes tes GCM
- // GoogleCloudMessaging gcmObj;
- private final static int PLAY_SERVICES_RESOLUTION_REQUEST = 9000;
- AsyncTask<Void, Void, String> createRegIdTask;
- public static final String REG_ID = "regId";
- public static final String EMAIL_ID = "emailId";
- // public static final String PREF_USER_FIRST_TIME = "user_forst_time";
- // boolean isUserFirsTime;
- String regId = "";
- // tes tes GCM --end
- String fbid = "";
- String fbname = "";
- String fbemail = "";
- String fbgender = "";
- String fbbirthday = "";
- private final int MY_PERMISSIONS_REQUEST_GET_ACCOUNTS = 55;
- private ApiService apiService;
- private GPSTracker gps;
- private String uuid;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- // Add code to print out the key hash
- FacebookSdk.sdkInitialize(getApplicationContext());
- callbackManager = CallbackManager.Factory.create();
- AppEventsLogger.activateApp(this);
- setUpApiService();
- setContentView(R.layout.activity_login);
- // Session manager
- session = new SessionManager(getApplicationContext());
- inputEmail = findViewById(R.id.email);
- inputPassword = findViewById(R.id.password);
- lupaPassword = findViewById(R.id.lupa_password);
- btnLogin = findViewById(R.id.btnLogin);
- btnLinkToRegister = findViewById(R.id.btnLinkToRegisterScreen);
- fbLoginButton = findViewById(R.id.btnfacebook_login);
- loginTitle = findViewById(R.id.login_title);
- signUptext = findViewById(R.id.signup_here_text);
- apiService = RestController.getRetrofit(this).create(ApiService.class);
- //set font
- Typeface quicksandBold = Typeface.createFromAsset(getAssets(), "quicksand_bold.otf");
- Typeface quicksandBook = Typeface.createFromAsset(getAssets(), "quicksand_book.otf");
- Typeface typeFace = Typeface.createFromAsset(getAssets(), "helvetica.otf");
- inputEmail.setTypeface(typeFace, Typeface.ITALIC);
- inputPassword.setTypeface(typeFace, Typeface.ITALIC);
- btnLogin.setTypeface(typeFace);
- // btnLinkToRegister.setTypeface(typeFace);
- loginTitle.setTypeface(quicksandBold);
- lupaPassword.setTypeface(typeFace);
- signUptext.setTypeface(typeFace);
- // set clickable span
- String dontHaveAcc = getString(R.string.text_to_register);
- SpannableString signUpHere = new SpannableString(Html.fromHtml(dontHaveAcc));
- ClickableSpan clickableSpan = new ClickableSpan() {
- @Override
- public void onClick(View widget) {
- Intent i = new Intent(getApplicationContext(), RegisterActivity.class);
- startActivity(i);
- finish();
- }
- @Override
- public void updateDrawState(TextPaint ds) {
- ds.setUnderlineText(false);
- }
- };
- signUpHere.setSpan(clickableSpan, 23, 30, SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
- signUptext.setText(signUpHere);
- signUptext.setMovementMethod(LinkMovementMethod.getInstance());
- signUptext.setHighlightColor(Color.BLACK);
- //set facebook background button
- fbLoginButton.setBackgroundResource(R.drawable.fb_button);
- // Progress dialog
- pDialog = new ProgressDialog(this);
- pDialog.setCancelable(false);
- String dialogMsg = getString(R.string.waiting_response);
- pDialog.setMessage(dialogMsg);
- // if (session.isLoggedIn()) {
- // Intent intent = new Intent(LoginActivity.this, MainTabActivity.class);
- // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
- // startActivity(intent);
- // finish();
- // }
- btnLogin.setOnClickListener(new View.OnClickListener() {
- public void onClick(View view) {
- attemptLogin();
- }
- });
- inputPassword.setOnEditorActionListener(new EditText.OnEditorActionListener() {
- @Override
- public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
- if (actionId == EditorInfo.IME_ACTION_GO) {
- attemptLogin();
- }
- return false;
- }
- });
- lupaPassword.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);
- lupaPassword.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Intent intent = new Intent(getApplicationContext(), ForgotPasswordActivity.class);
- startActivity(intent);
- }
- });
- LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
- @Override
- public void onSuccess(LoginResult loginResult) {
- AccessToken accessToken = loginResult.getAccessToken();
- GraphRequest request = GraphRequest.newMeRequest(loginResult.getAccessToken(),
- new GraphRequest.GraphJSONObjectCallback() {
- @Override
- public void onCompleted(JSONObject object, GraphResponse response) {
- try {
- if (object != null) {
- fbid = object.getString("id");
- fbname = object.getString("first_name");
- fbemail = object.getString("email");
- if (!fbemail.equals("") && !fbname.equals("")) {
- LogInAndRegister(fbemail, fbname);
- } else {
- String toastText = getString(R.string.user_email_not_exist);
- Toast.makeText(getApplication(), toastText, Toast.LENGTH_SHORT).show();
- }
- }
- } catch (JSONException e) {
- }
- }
- });
- Bundle parameters = new Bundle();
- parameters.putString("fields", "id,first_name,email");
- request.setParameters(parameters);
- request.executeAsync();
- }
- @Override
- public void onCancel() {
- System.out.println("cancel");
- }
- @Override
- public void onError(FacebookException error) {
- // Log.d("LoginActivity", String.valueOf(error));
- }
- });
- fbLoginButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- LoginManager.getInstance().logOut();
- LoginManager.getInstance().logInWithReadPermissions(LoginActivity.this, Arrays.asList("email", "public_profile"));
- }
- });
- // fbLoginButton.setReadPermissions(Arrays.asList("public_profile, email, user_birthday"));
- // fbLoginButton.registerCallback(callbackManager, mCallback);
- setUpGoogleSignInComponents();
- // registerGSMService();
- TelephonyManager tManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
- if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
- // TODO: Consider calling
- // ActivityCompat#requestPermissions
- // here to request the missing permissions, and then overriding
- // public void onRequestPermissionsResult(int requestCode, String[] permissions,
- // int[] grantResults)
- // to handle the case where the user grants the permission. See the documentation
- // for ActivityCompat#requestPermissions for more details.
- return;
- }
- uuid = tManager.getDeviceId();
- }
- private void setUpGoogleSignInComponents() {
- // Initializing google plus api client
- mGoogleApiClient = new GoogleApiClient.Builder(this)
- .addConnectionCallbacks(this)
- .addOnConnectionFailedListener(this)
- .addApi(Plus.API)
- .addScope(Plus.SCOPE_PLUS_LOGIN).build();
- signInButton = findViewById(R.id.btngoogle_sign_in);
- signInButton.setOnClickListener(this);
- }
- private void attemptLogin() {
- String email = inputEmail.getText().toString();
- String password = inputPassword.getText().toString();
- if (email.trim().length() > 0 && password.trim().length() > 0) {
- checkLogin(email, password, false);
- } else {
- String toastText = getString(R.string.user_insert_username_pass);
- Toast.makeText(getApplicationContext(),
- toastText, Toast.LENGTH_LONG)
- .show();
- }
- }
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (requestCode == RC_GOOGLE_SIGN_IN) {
- if (resultCode != RESULT_OK) {
- mSignInClicked = false;
- }
- mIntentInProgress = false;
- if (!mGoogleApiClient.isConnecting()) {
- mGoogleApiClient.connect();
- }
- } else if (requestCode == RC_FACEBOOK_SIGN_IN) {
- callbackManager.onActivityResult(requestCode, resultCode, data);
- }
- }
- //
- // Check if Google Playservices is installed in Device or not
- private boolean checkPlayServices() {
- int resultCode = GooglePlayServicesUtil
- .isGooglePlayServicesAvailable(this);
- // When Play services not found in device
- if (resultCode != ConnectionResult.SUCCESS) {
- if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
- // Show Error dialog to install Play services
- GooglePlayServicesUtil.getErrorDialog(resultCode, this,
- PLAY_SERVICES_RESOLUTION_REQUEST).show();
- } else {
- String toastText = getString(R.string.device_not_support_play_services);
- Toast.makeText(
- getApplicationContext(),
- toastText,
- Toast.LENGTH_SHORT).show();
- finish();
- }
- return false;
- }
- return true;
- }
- private void checkLogin(final String email, final String password, final boolean fblogin) {
- showProgressDialog();
- doLogin(email, password);
- }
- private void doLogin(final String email, final String password) {
- if (apiService == null) {
- setUpApiService();
- }
- String androidId = Settings.Secure.getString(getContentResolver(),
- Settings.Secure.ANDROID_ID);
- String app_version = "1";
- String app_origin = getString(R.string.app_name);
- String model_device = Build.MODEL;
- try {
- PackageInfo pInfo = this.getPackageManager().getPackageInfo(getPackageName(), 0);
- app_version = pInfo.versionName;
- } catch (PackageManager.NameNotFoundException e) {
- e.printStackTrace();
- }
- try {
- newPassword = AESCrypt.encrypt(password);
- } catch (Exception e) {
- e.printStackTrace();
- }
- LatLng latLng = CustomGPSFactory.getLatLng(LoginActivity.this,
- LoginActivity.this);
- Call<ApiResponse<LoginRetro>> loginCall = apiService.Login(email, newPassword,
- String.valueOf(latLng.latitude), String.valueOf(latLng.longitude),
- session.getRegId(), app_version, androidId, model_device,app_origin, app_version);
- loginCall.enqueue(new retrofit2.Callback<ApiResponse<LoginRetro>>() {
- @Override
- public void onResponse(Call<ApiResponse<LoginRetro>> call, retrofit2
- .Response<ApiResponse<LoginRetro>> response) {
- ApiResponse<LoginRetro> loginApiResponse = response.body();
- if (loginApiResponse != null) {
- if (loginApiResponse.isCek_status()) {
- LoginRetro loginRetro = loginApiResponse.getData();
- String email = loginRetro.getEmail();
- String token = loginRetro.getToken();
- String foto_user = loginRetro.getFoto();
- Integer is_internal = response.body().getData().getIs_internal();
- // Integer is_internal = 0;
- session.setLogin(email, token, foto_user, is_internal);
- session.setKeyAkses(loginRetro.getAkses());
- // session.setLogin(true);
- checkUser(email,token);
- // Intent intent = new Intent(LoginActivity.this,
- // MainTabActivity.class);
- // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
- // Intent.FLAG_ACTIVITY_CLEAR_TASK);
- // startActivity(intent);
- // finish();
- } else {
- hideProgressDialog();
- if (loginApiResponse.getMessage() != null){
- Toast.makeText(getApplicationContext(), loginApiResponse.getMessage(),
- Toast.LENGTH_LONG).show();
- }
- }
- } else {
- hideProgressDialog();
- Toast.makeText(getApplicationContext(), R.string.HTTP_500,
- Toast.LENGTH_SHORT).show();
- }
- }
- @Override
- public void onFailure(Call<ApiResponse<LoginRetro>> call, Throwable t) {
- hideProgressDialog();
- if (t instanceof SocketTimeoutException){
- Toast.makeText(LoginActivity.this, R.string.server_error,Toast.LENGTH_LONG).show();
- }else {
- String errorCause = t.getMessage();
- RetroFailureMessageHandler.handleMessageError(errorCause,
- LoginActivity.this);
- }
- }
- });
- }
- private void showProgressDialog() {
- if (!pDialog.isShowing())
- pDialog.show();
- }
- private void hideProgressDialog() {
- if (pDialog.isShowing())
- pDialog.dismiss();
- }
- @Override
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.btngoogle_sign_in:
- isProceedSignOut = false;
- signIn();
- break;
- }
- }
- private void signIn() {
- if (mGoogleApiClient != null) {
- if (!mGoogleApiClient.isConnecting()) {
- mSignInClicked = true;
- mIntentInProgress = true;
- try {
- if (mConnectionResult != null) {
- mConnectionResult.startResolutionForResult(this, RC_GOOGLE_SIGN_IN);
- } else {
- mGoogleApiClient.connect();
- }
- } catch (IntentSender.SendIntentException e) {
- e.printStackTrace();
- }
- }
- } else {
- setUpGoogleSignInComponents();
- isProceedSignOut = true;
- }
- }
- private void resolveSignInError() {
- if (mConnectionResult.hasResolution()) {
- try {
- mIntentInProgress = true;
- mConnectionResult.startResolutionForResult(this, RC_GOOGLE_SIGN_IN);
- } catch (IntentSender.SendIntentException e) {
- e.printStackTrace();
- }
- }
- }
- @Override
- public void onRestart() {
- super.onRestart();
- mGoogleApiClient.connect();
- }
- private void signoutGoogle() {
- if (mGoogleApiClient.isConnected()) {
- Plus.AccountApi.clearDefaultAccount(mGoogleApiClient); //Sign Out
- mGoogleApiClient.disconnect();
- mGoogleApiClient.connect();
- }
- }
- @Override
- public void onConnected(Bundle bundle) {
- if (isProceedSignOut) {
- signoutGoogle();
- } else {
- mSignInClicked = false;
- RequestPermissonGetAccounts();
- }
- }
- private void getProfileInformation() {
- try {
- if (Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) != null) {
- Person currentPerson = Plus.PeopleApi
- .getCurrentPerson(mGoogleApiClient);
- String personName = currentPerson.getDisplayName();
- String personPhotoUrl = currentPerson.getImage().getUrl();
- String personGooglePlusProfile = currentPerson.getUrl();
- if (ActivityCompat.checkSelfPermission(this,
- Manifest.permission.GET_ACCOUNTS) != PackageManager.PERMISSION_GRANTED) {
- return;
- }
- final String email = Plus.AccountApi.getAccountName(mGoogleApiClient);
- LogInAndRegister(email, personName);
- } else {
- String toastText = getString(R.string.gplus_not_accessible);
- Toast.makeText(getApplicationContext(),
- toastText, Toast.LENGTH_LONG).show();
- signoutGoogle();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- private void RequestPermissonGetAccounts() {
- ActivityCompat.requestPermissions(this,
- new String[]{Manifest.permission.GET_ACCOUNTS},
- MY_PERMISSIONS_REQUEST_GET_ACCOUNTS);
- }
- public void onRequestPermissionsResult(int requestCode,
- String permissions[], int[] grantResults) {
- switch (requestCode) {
- case MY_PERMISSIONS_REQUEST_GET_ACCOUNTS: {
- if (grantResults.length > 0
- && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
- getProfileInformation();
- } else {
- String toastText = getString(R.string.get_permission_instruction);
- Toast.makeText(getApplicationContext(),toastText,Toast.LENGTH_SHORT).show();
- }
- return;
- }
- }
- }
- @Override
- public void onConnectionSuspended(int i) {
- mGoogleApiClient.connect();
- }
- @Override
- protected void onStart() {
- super.onStart();
- mGoogleApiClient.connect();
- }
- @Override
- protected void onStop() {
- super.onStop();
- if (mGoogleApiClient.isConnected()) {
- mGoogleApiClient.disconnect();
- }
- }
- @Override
- public void onConnectionFailed(ConnectionResult connectionResult) {
- if (!connectionResult.hasResolution()) {
- GooglePlayServicesUtil.getErrorDialog(connectionResult.getErrorCode(), this,
- 0).show();
- return;
- }
- if (!mIntentInProgress) {
- mConnectionResult = connectionResult;
- if (mSignInClicked) {
- resolveSignInError();
- }
- }
- }
- private void setUpApiService(){
- if (apiService == null) {
- apiService = RestController.getRetrofit(this).create(ApiService.class);
- }
- }
- private void LogInAndRegister(final String email, final String name) {
- if (apiService == null) {
- setUpApiService();
- }
- String androidId = Settings.Secure.getString(getContentResolver(),
- Settings.Secure.ANDROID_ID);
- String app_version = "1";
- String app_origin = getString(R.string.app_name);
- String model_device = Build.MODEL;
- try {
- PackageInfo pInfo = this.getPackageManager().getPackageInfo(getPackageName(), 0);
- app_version = pInfo.versionName;
- } catch (PackageManager.NameNotFoundException e) {
- e.printStackTrace();
- }
- LatLng latLng = CustomGPSFactory.getLatLng(LoginActivity.this,
- LoginActivity.this);
- Call<ApiResponse<LoginRetro>> loginAndRegisterCall = apiService.LoginAndRegister(email,
- name, String.valueOf(latLng.latitude), String.valueOf(latLng.longitude),
- session.getRegId(), app_version, androidId, model_device, app_origin, app_version);
- showProgressDialog();
- loginAndRegisterCall.enqueue(new retrofit2.Callback<ApiResponse<LoginRetro>>() {
- @Override
- public void onResponse(Call<ApiResponse<LoginRetro>> call, retrofit2
- .Response<ApiResponse<LoginRetro>> response) {
- ApiResponse<LoginRetro> loginApiResponse = response.body();
- if (loginApiResponse != null) {
- if (loginApiResponse.isCek_status()) {
- LoginRetro loginRetro = loginApiResponse.getData();
- String email = loginRetro.getEmail();
- String token = loginRetro.getToken();
- String foto_user = loginRetro.getFoto();
- Integer is_internal = response.body().getData().getIs_internal();
- // Log.d(email, token);
- session.setLogin(email, token, foto_user, is_internal);
- session.setKeyAkses(loginRetro.getAkses());
- // session.setLogin(true);
- checkUser(email, token);
- // Intent intent = new Intent(LoginActivity.this,
- // MainTabActivity.class);
- // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
- // Intent.FLAG_ACTIVITY_CLEAR_TASK);
- // startActivity(intent);
- // finish();
- } else {
- hideProgressDialog();
- if (loginApiResponse.getMessage() != null){
- Toast.makeText(getApplicationContext(), loginApiResponse.getMessage(),
- Toast.LENGTH_LONG).show();
- }
- }
- } else {
- hideProgressDialog();
- Toast.makeText(getApplicationContext(), R.string.HTTP_500,
- Toast.LENGTH_LONG).show();
- }
- }
- @Override
- public void onFailure(Call<ApiResponse<LoginRetro>> call, Throwable t) {
- hideProgressDialog();
- if (t instanceof SocketTimeoutException){
- Toast.makeText(LoginActivity.this, R.string.server_error,Toast.LENGTH_LONG).show();
- }else {
- String errorCause = t.getLocalizedMessage();
- RetroFailureMessageHandler.handleMessageError(errorCause,
- LoginActivity.this);
- }
- }
- });
- }
- private void checkUser(final String email, final String token){
- if (apiService == null) {
- setUpApiService();
- }
- Call<ApiResponse> dissCallCheckUser = apiService.cekUserOTP(email, token, uuid);
- dissCallCheckUser.enqueue(new Callback<ApiResponse>() {
- @Override
- public void onResponse(Call<ApiResponse> call, Response<ApiResponse> response) {
- ApiResponse apiResponse = response.body();
- hideProgressDialog();
- /*if (apiResponse.isCek_status()){
- Intent intent = new Intent(LoginActivity.this,
- MainTabActivity.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
- Intent.FLAG_ACTIVITY_CLEAR_TASK);
- startActivity(intent);
- session.setLogin(true);
- finish();
- }else {
- Intent intent = new Intent(LoginActivity.this, SendOTPActivity.class);
- startActivity(intent);
- finish();
- if (apiResponse.getMessage() != null){
- Toast.makeText(LoginActivity.this,apiResponse.getMessage(),Toast.LENGTH_LONG).show();
- }
- }*/
- Intent intent = new Intent(LoginActivity.this,
- MainTabActivity.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
- Intent.FLAG_ACTIVITY_CLEAR_TASK);
- startActivity(intent);
- session.setLogin(email, token);
- finish();
- }
- @Override
- public void onFailure(Call<ApiResponse> call, Throwable t) {
- hideProgressDialog();
- String errorCause = t.getLocalizedMessage();
- RetroFailureMessageHandler.handleMessageError(errorCause,
- LoginActivity.this);
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement