|
|
@ -11,6 +11,9 @@ import android.widget.EditText; |
|
|
|
import android.widget.ImageButton; |
|
|
|
import android.widget.Toast; |
|
|
|
|
|
|
|
import org.json.JSONException; |
|
|
|
import org.json.JSONObject; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
@ -23,9 +26,11 @@ import ru.visionlab.femdemo.CheckInActivity; |
|
|
|
import ru.visionlab.femdemo.R; |
|
|
|
import ru.visionlab.femdemo.api.CallApiService; |
|
|
|
import ru.visionlab.femdemo.api.JsonPlaceHolderApi; |
|
|
|
import ru.visionlab.femdemo.base.BaseActivity; |
|
|
|
import ru.visionlab.femdemo.login.LoginActivity; |
|
|
|
import ru.visionlab.femdemo.login.LoginActivityNew; |
|
|
|
import ru.visionlab.femdemo.models.RegistrationNew; |
|
|
|
import ru.visionlab.femdemo.models.ResponseError; |
|
|
|
|
|
|
|
public class RegisterActivityNew extends AppCompatActivity { |
|
|
|
|
|
|
@ -57,9 +62,9 @@ public class RegisterActivityNew extends AppCompatActivity { |
|
|
|
public void onClick(View view) { |
|
|
|
isAllFieldsChecked = CheckAllFields(); |
|
|
|
if(isAllFieldsChecked) { |
|
|
|
/*Intent intent = new Intent(RegisterActivityNew.this, SavePhotoActivity.class); |
|
|
|
startActivity(intent);*/ |
|
|
|
saveInfo(); |
|
|
|
Intent intent = new Intent(RegisterActivityNew.this, RegisterActivity.class); |
|
|
|
startActivity(intent); |
|
|
|
//saveInfo(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
@ -75,7 +80,7 @@ public class RegisterActivityNew extends AppCompatActivity { |
|
|
|
} |
|
|
|
public void createRetrofit(){ |
|
|
|
Retrofit retrofit=new Retrofit.Builder() |
|
|
|
.baseUrl("https://jsonplaceholder.typicode.com/") |
|
|
|
.baseUrl("http://huaiglobal.com/api/") |
|
|
|
.addConverterFactory(GsonConverterFactory.create()) |
|
|
|
.build(); |
|
|
|
|
|
|
@ -112,45 +117,24 @@ public class RegisterActivityNew extends AppCompatActivity { |
|
|
|
System.out.println("Value of registrationNew " );*/ |
|
|
|
CallApiService.getClient().createpost(fields); |
|
|
|
Call<RegistrationNew> call=jsonPlaceHolderApi.createpost(fields); |
|
|
|
// call.enqueue(new Callback<RegistrationNew>() { |
|
|
|
// @Override |
|
|
|
// public void onResponse(Call<RegistrationNew> call, Response<RegistrationNew> response) { |
|
|
|
// if(response.isSuccessful()) |
|
|
|
// { |
|
|
|
// Log.e("code=", String.valueOf(response.code())); |
|
|
|
// Toast.makeText(RegisterActivityNew.this, "Info Added successfully", Toast.LENGTH_SHORT).show(); |
|
|
|
//// Intent intent=new Intent(AddBook.this,Home.class); |
|
|
|
//// startActivity(intent); |
|
|
|
// |
|
|
|
// RegistrationNew post=response.body(); |
|
|
|
// String content=""; |
|
|
|
// content +="COMPANYID: "+post.getCompanyId() +"\n"; |
|
|
|
// content +="EMP ID: "+post.getEmployeeId() +"\n"; |
|
|
|
// content +="OTP: "+post.getOtp() +"\n"; |
|
|
|
// |
|
|
|
// // txt_value.append(content); |
|
|
|
// |
|
|
|
// } |
|
|
|
// |
|
|
|
// } |
|
|
|
// |
|
|
|
// @Override |
|
|
|
// public void onFailure(Call<RegistrationNew> call, Throwable t) { |
|
|
|
// Toast.makeText(RegisterActivityNew.this, ""+t.getMessage(), Toast.LENGTH_SHORT).show(); |
|
|
|
// Log.e("error=",t.getMessage().toString()); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
|
|
|
|
call.enqueue(new Callback<RegistrationNew>() { |
|
|
|
@Override |
|
|
|
public void onResponse(Call<RegistrationNew> call, Response<RegistrationNew> response) { |
|
|
|
if(response.isSuccessful()) { |
|
|
|
Log.e("register code=", String.valueOf(response.code())); |
|
|
|
Toast.makeText(RegisterActivityNew.this, "User Added succesfully", Toast.LENGTH_SHORT).show(); |
|
|
|
Intent intent = new Intent(RegisterActivityNew.this, LoginActivityNew.class); |
|
|
|
Intent intent = new Intent(RegisterActivityNew.this, RegisterFragment.class); |
|
|
|
startActivity(intent); |
|
|
|
} |
|
|
|
|
|
|
|
else{ |
|
|
|
Toast.makeText(RegisterActivityNew.this, response.message(), Toast.LENGTH_SHORT).show(); |
|
|
|
Log.e("else part register code=", String.valueOf(response.code())); |
|
|
|
Intent intent = new Intent(RegisterActivityNew.this, RegisterFragment.class); |
|
|
|
startActivity(intent); |
|
|
|
Toast.makeText(RegisterActivityNew.this, "Current user did not login to the application!", Toast.LENGTH_SHORT).show(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|