diff --git a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/api/RegisterApiImplLuna2.java b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/api/RegisterApiImplLuna2.java index 8b82f35..cc2325c 100644 --- a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/api/RegisterApiImplLuna2.java +++ b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/api/RegisterApiImplLuna2.java @@ -152,6 +152,7 @@ public class RegisterApiImplLuna2 implements RegisterApiInterface { Log.e(TAG, "onCreatePersonSuccess ERR_CODE: " + result.error_code + " detaul: " + result.detail); personID = new String(result.person_id); + System.out.println("Person Id "+ personID); File file = new File(context.getCacheDir(), "tmp.jpg"); diff --git a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/models/ResponseError.java b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/models/ResponseError.java new file mode 100644 index 0000000..d3d9f00 --- /dev/null +++ b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/models/ResponseError.java @@ -0,0 +1,17 @@ +package ru.visionlab.femdemo.models; + +public class ResponseError { + String error; + + public ResponseError(String error) { + this.error = error; + } + + public String getError() { + return error; + } + + public void setError(String error) { + this.error = error; + } +} diff --git a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/register/RegisterActivity.java b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/register/RegisterActivity.java index b2837f7..bed84b4 100644 --- a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/register/RegisterActivity.java +++ b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/register/RegisterActivity.java @@ -49,6 +49,7 @@ import ru.visionlab.femdemo.api.VLApi; import ru.visionlab.femdemo.base.PhotoFragment; import ru.visionlab.femdemo.base.ToolbarActivity; import ru.visionlab.femdemo.login.LoginActivity; +import ru.visionlab.femdemo.login.LoginActivityNew; import ru.visionlab.femdemo.settings.VLPreferences; public class RegisterActivity extends ToolbarActivity implements RegisterFragment.Listener, PhotoFragment.Listener, @@ -133,19 +134,19 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen preferenceManager=PreferenceManager.getInstance(this); - photo = (ImageView) findViewById(R.id.photo); + /* photo = (ImageView) findViewById(R.id.photo); photo.setOnClickListener(v -> { // Create the camera_intent ACTION_IMAGE_CAPTURE it will open the camera for capture the image Intent camera_intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); // Start the activity with camera_intent, and request pic id startActivityForResult(camera_intent, pic_id); - }); + });*/ - save = findViewById(R.id.save); - save.setEnabled(true); + /*save = findViewById(R.id.save); + save.setEnabled(true);*/ - System.out.println("in register" + photo.getDrawable()); + //System.out.println("in register" + photo.getDrawable()); // if(photo.getDrawable() == null){ @@ -154,7 +155,7 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen // else if(photo.getDrawable()!=null) // { - save.setOnClickListener(v -> { + /*save.setOnClickListener(v -> { ByteArrayOutputStream baos = new ByteArrayOutputStream(); if(photo2 != null){ save.setClickable(true); @@ -174,16 +175,16 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen System.out.println("imageview photo2 without "+ photo2); } - }); + });*/ // } - retry = findViewById(R.id.retry); + /*retry = findViewById(R.id.retry); retry.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } - }); + });*/ } protected void onActivityResult(int requestCode, int resultCode, Intent data) { @@ -222,7 +223,7 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen fragment.setListener(this); getSupportFragmentManager() .beginTransaction() - .replace(R.id.container, fragment, REGISTER_FRAGMENT) + .replace(R.id.container, fragment, PHOTO_FRAGMENT) .addToBackStack(fragment.toString()) .commit(); } @@ -400,6 +401,7 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen Log.i("ExternalStorage", "-> uri=" + uri); } }); + System.out.println("Inside saving image method"); } @Override @@ -459,7 +461,10 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen private void finishRegistration() { preferences.setUsername(registrationModel.login); + // preferences.setPin(registrationModel.password); + Intent intent = new Intent(RegisterActivity.this, LoginActivityNew.class); + startActivity(intent); finish(); } } diff --git a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/register/RegisterActivityNew.java b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/register/RegisterActivityNew.java index ac352cf..08d6905 100644 --- a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/register/RegisterActivityNew.java +++ b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/register/RegisterActivityNew.java @@ -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 call=jsonPlaceHolderApi.createpost(fields); -// call.enqueue(new Callback() { -// @Override -// public void onResponse(Call call, Response 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 call, Throwable t) { -// Toast.makeText(RegisterActivityNew.this, ""+t.getMessage(), Toast.LENGTH_SHORT).show(); -// Log.e("error=",t.getMessage().toString()); -// } -// }); + call.enqueue(new Callback() { @Override public void onResponse(Call call, Response 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(); + + } } diff --git a/examples/example_bestshot/example/app/src/main/res/layout/activity_register.xml b/examples/example_bestshot/example/app/src/main/res/layout/activity_register.xml index ab9ab7f..6fa85a7 100644 --- a/examples/example_bestshot/example/app/src/main/res/layout/activity_register.xml +++ b/examples/example_bestshot/example/app/src/main/res/layout/activity_register.xml @@ -8,7 +8,8 @@ - + - + android:layout_marginTop="2dp"/>--> @@ -269,7 +270,7 @@ --> - + />--> \ No newline at end of file