|
@ -21,6 +21,7 @@ import retrofit2.Retrofit; |
|
|
import retrofit2.converter.gson.GsonConverterFactory; |
|
|
import retrofit2.converter.gson.GsonConverterFactory; |
|
|
import ru.visionlab.femdemo.CheckInActivity; |
|
|
import ru.visionlab.femdemo.CheckInActivity; |
|
|
import ru.visionlab.femdemo.R; |
|
|
import ru.visionlab.femdemo.R; |
|
|
|
|
|
import ru.visionlab.femdemo.api.CallApiService; |
|
|
import ru.visionlab.femdemo.api.JsonPlaceHolderApi; |
|
|
import ru.visionlab.femdemo.api.JsonPlaceHolderApi; |
|
|
import ru.visionlab.femdemo.login.LoginActivity; |
|
|
import ru.visionlab.femdemo.login.LoginActivity; |
|
|
import ru.visionlab.femdemo.login.LoginActivityNew; |
|
|
import ru.visionlab.femdemo.login.LoginActivityNew; |
|
@ -46,13 +47,9 @@ public class RegisterActivityNew extends AppCompatActivity { |
|
|
edt_comp = findViewById(R.id.edt_comp); |
|
|
edt_comp = findViewById(R.id.edt_comp); |
|
|
edt_emp = findViewById(R.id.edt_emp); |
|
|
edt_emp = findViewById(R.id.edt_emp); |
|
|
edt_otp = findViewById(R.id.edt_otp); |
|
|
edt_otp = findViewById(R.id.edt_otp); |
|
|
|
|
|
createRetrofit(); |
|
|
|
|
|
|
|
|
Retrofit retrofit=new Retrofit.Builder() |
|
|
|
|
|
.baseUrl("https://jsonplaceholder.typicode.com/") |
|
|
|
|
|
.addConverterFactory(GsonConverterFactory.create()) |
|
|
|
|
|
.build(); |
|
|
|
|
|
|
|
|
|
|
|
jsonPlaceHolderApi=retrofit.create(JsonPlaceHolderApi.class); |
|
|
|
|
|
|
|
|
|
|
|
verifynproceed = findViewById(R.id.verifynproceed); |
|
|
verifynproceed = findViewById(R.id.verifynproceed); |
|
|
verifynproceed.setOnClickListener(new View.OnClickListener() { |
|
|
verifynproceed.setOnClickListener(new View.OnClickListener() { |
|
@ -60,8 +57,8 @@ public class RegisterActivityNew extends AppCompatActivity { |
|
|
public void onClick(View view) { |
|
|
public void onClick(View view) { |
|
|
isAllFieldsChecked = CheckAllFields(); |
|
|
isAllFieldsChecked = CheckAllFields(); |
|
|
if(isAllFieldsChecked) { |
|
|
if(isAllFieldsChecked) { |
|
|
Intent intent = new Intent(RegisterActivityNew.this, SavePhotoActivity.class); |
|
|
|
|
|
startActivity(intent); |
|
|
|
|
|
|
|
|
/*Intent intent = new Intent(RegisterActivityNew.this, SavePhotoActivity.class); |
|
|
|
|
|
startActivity(intent);*/ |
|
|
//saveInfo(); |
|
|
//saveInfo(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -76,6 +73,15 @@ public class RegisterActivityNew extends AppCompatActivity { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
public void createRetrofit(){ |
|
|
|
|
|
Retrofit retrofit=new Retrofit.Builder() |
|
|
|
|
|
.baseUrl("https://jsonplaceholder.typicode.com/") |
|
|
|
|
|
.addConverterFactory(GsonConverterFactory.create()) |
|
|
|
|
|
.build(); |
|
|
|
|
|
|
|
|
|
|
|
jsonPlaceHolderApi=retrofit.create(JsonPlaceHolderApi.class); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean CheckAllFields() { |
|
|
private boolean CheckAllFields() { |
|
|
if (edt_comp.length() == 0) { |
|
|
if (edt_comp.length() == 0) { |
|
@ -97,19 +103,21 @@ public class RegisterActivityNew extends AppCompatActivity { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void saveInfo(){ |
|
|
public void saveInfo(){ |
|
|
Map<String,String> fields=new HashMap<>(); |
|
|
|
|
|
|
|
|
/*Map<String,String> fields=new HashMap<>(); |
|
|
fields.put("companyId",edt_comp.getText().toString()); |
|
|
fields.put("companyId",edt_comp.getText().toString()); |
|
|
fields.put("employeeId",edt_emp.getText().toString()); |
|
|
fields.put("employeeId",edt_emp.getText().toString()); |
|
|
fields.put("otp",edt_otp.getText().toString()); |
|
|
|
|
|
|
|
|
fields.put("otp",edt_otp.getText().toString());*/ |
|
|
|
|
|
|
|
|
Call<RegistrationNew> call=jsonPlaceHolderApi.createpost(fields); |
|
|
|
|
|
|
|
|
RegistrationNew registrationNew = new RegistrationNew(edt_comp.getText().toString(),edt_emp.getText().toString(),edt_otp.getText().toString()); |
|
|
|
|
|
CallApiService.getClient().createpost(registrationNew); |
|
|
|
|
|
Call<RegistrationNew> call=jsonPlaceHolderApi.createpost(registrationNew); |
|
|
call.enqueue(new Callback<RegistrationNew>() { |
|
|
call.enqueue(new Callback<RegistrationNew>() { |
|
|
@Override |
|
|
@Override |
|
|
public void onResponse(Call<RegistrationNew> call, Response<RegistrationNew> response) { |
|
|
public void onResponse(Call<RegistrationNew> call, Response<RegistrationNew> response) { |
|
|
if(response.isSuccessful()) |
|
|
if(response.isSuccessful()) |
|
|
{ |
|
|
{ |
|
|
Log.e("code=", String.valueOf(response.code())); |
|
|
Log.e("code=", String.valueOf(response.code())); |
|
|
Toast.makeText(RegisterActivityNew.this, "Info Added succesfully", Toast.LENGTH_SHORT).show(); |
|
|
|
|
|
|
|
|
Toast.makeText(RegisterActivityNew.this, "Info Added successfully", Toast.LENGTH_SHORT).show(); |
|
|
// Intent intent=new Intent(AddBook.this,Home.class); |
|
|
// Intent intent=new Intent(AddBook.this,Home.class); |
|
|
// startActivity(intent); |
|
|
// startActivity(intent); |
|
|
|
|
|
|
|
|