Face recognition after registration
This commit is contained in:
parent
97e70cceff
commit
383e448898
@ -152,6 +152,7 @@ public class RegisterApiImplLuna2 implements RegisterApiInterface {
|
|||||||
Log.e(TAG, "onCreatePersonSuccess ERR_CODE: " + result.error_code + " detaul: " + result.detail);
|
Log.e(TAG, "onCreatePersonSuccess ERR_CODE: " + result.error_code + " detaul: " + result.detail);
|
||||||
|
|
||||||
personID = new String(result.person_id);
|
personID = new String(result.person_id);
|
||||||
|
System.out.println("Person Id "+ personID);
|
||||||
|
|
||||||
File file = new File(context.getCacheDir(), "tmp.jpg");
|
File file = new File(context.getCacheDir(), "tmp.jpg");
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -49,6 +49,7 @@ import ru.visionlab.femdemo.api.VLApi;
|
|||||||
import ru.visionlab.femdemo.base.PhotoFragment;
|
import ru.visionlab.femdemo.base.PhotoFragment;
|
||||||
import ru.visionlab.femdemo.base.ToolbarActivity;
|
import ru.visionlab.femdemo.base.ToolbarActivity;
|
||||||
import ru.visionlab.femdemo.login.LoginActivity;
|
import ru.visionlab.femdemo.login.LoginActivity;
|
||||||
|
import ru.visionlab.femdemo.login.LoginActivityNew;
|
||||||
import ru.visionlab.femdemo.settings.VLPreferences;
|
import ru.visionlab.femdemo.settings.VLPreferences;
|
||||||
|
|
||||||
public class RegisterActivity extends ToolbarActivity implements RegisterFragment.Listener, PhotoFragment.Listener,
|
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);
|
preferenceManager=PreferenceManager.getInstance(this);
|
||||||
|
|
||||||
photo = (ImageView) findViewById(R.id.photo);
|
/* photo = (ImageView) findViewById(R.id.photo);
|
||||||
photo.setOnClickListener(v -> {
|
photo.setOnClickListener(v -> {
|
||||||
// Create the camera_intent ACTION_IMAGE_CAPTURE it will open the camera for capture the image
|
// 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);
|
Intent camera_intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||||
// Start the activity with camera_intent, and request pic id
|
// Start the activity with camera_intent, and request pic id
|
||||||
startActivityForResult(camera_intent, pic_id);
|
startActivityForResult(camera_intent, pic_id);
|
||||||
});
|
});*/
|
||||||
|
|
||||||
|
|
||||||
save = findViewById(R.id.save);
|
/*save = findViewById(R.id.save);
|
||||||
save.setEnabled(true);
|
save.setEnabled(true);*/
|
||||||
|
|
||||||
System.out.println("in register" + photo.getDrawable());
|
//System.out.println("in register" + photo.getDrawable());
|
||||||
|
|
||||||
|
|
||||||
// if(photo.getDrawable() == null){
|
// if(photo.getDrawable() == null){
|
||||||
@ -154,7 +155,7 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen
|
|||||||
// else if(photo.getDrawable()!=null)
|
// else if(photo.getDrawable()!=null)
|
||||||
// {
|
// {
|
||||||
|
|
||||||
save.setOnClickListener(v -> {
|
/*save.setOnClickListener(v -> {
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
if(photo2 != null){
|
if(photo2 != null){
|
||||||
save.setClickable(true);
|
save.setClickable(true);
|
||||||
@ -174,16 +175,16 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen
|
|||||||
System.out.println("imageview photo2 without "+ photo2);
|
System.out.println("imageview photo2 without "+ photo2);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});*/
|
||||||
// }
|
// }
|
||||||
|
|
||||||
retry = findViewById(R.id.retry);
|
/*retry = findViewById(R.id.retry);
|
||||||
retry.setOnClickListener(new View.OnClickListener() {
|
retry.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
@ -222,7 +223,7 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen
|
|||||||
fragment.setListener(this);
|
fragment.setListener(this);
|
||||||
getSupportFragmentManager()
|
getSupportFragmentManager()
|
||||||
.beginTransaction()
|
.beginTransaction()
|
||||||
.replace(R.id.container, fragment, REGISTER_FRAGMENT)
|
.replace(R.id.container, fragment, PHOTO_FRAGMENT)
|
||||||
.addToBackStack(fragment.toString())
|
.addToBackStack(fragment.toString())
|
||||||
.commit();
|
.commit();
|
||||||
}
|
}
|
||||||
@ -400,6 +401,7 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen
|
|||||||
Log.i("ExternalStorage", "-> uri=" + uri);
|
Log.i("ExternalStorage", "-> uri=" + uri);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
System.out.println("Inside saving image method");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -459,7 +461,10 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen
|
|||||||
private void finishRegistration()
|
private void finishRegistration()
|
||||||
{
|
{
|
||||||
preferences.setUsername(registrationModel.login);
|
preferences.setUsername(registrationModel.login);
|
||||||
|
|
||||||
// preferences.setPin(registrationModel.password);
|
// preferences.setPin(registrationModel.password);
|
||||||
|
Intent intent = new Intent(RegisterActivity.this, LoginActivityNew.class);
|
||||||
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,9 @@ import android.widget.EditText;
|
|||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -23,9 +26,11 @@ 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.CallApiService;
|
||||||
import ru.visionlab.femdemo.api.JsonPlaceHolderApi;
|
import ru.visionlab.femdemo.api.JsonPlaceHolderApi;
|
||||||
|
import ru.visionlab.femdemo.base.BaseActivity;
|
||||||
import ru.visionlab.femdemo.login.LoginActivity;
|
import ru.visionlab.femdemo.login.LoginActivity;
|
||||||
import ru.visionlab.femdemo.login.LoginActivityNew;
|
import ru.visionlab.femdemo.login.LoginActivityNew;
|
||||||
import ru.visionlab.femdemo.models.RegistrationNew;
|
import ru.visionlab.femdemo.models.RegistrationNew;
|
||||||
|
import ru.visionlab.femdemo.models.ResponseError;
|
||||||
|
|
||||||
public class RegisterActivityNew extends AppCompatActivity {
|
public class RegisterActivityNew extends AppCompatActivity {
|
||||||
|
|
||||||
@ -57,9 +62,9 @@ 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);
|
Intent intent = new Intent(RegisterActivityNew.this, RegisterActivity.class);
|
||||||
startActivity(intent);*/
|
startActivity(intent);
|
||||||
saveInfo();
|
//saveInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -75,7 +80,7 @@ public class RegisterActivityNew extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
public void createRetrofit(){
|
public void createRetrofit(){
|
||||||
Retrofit retrofit=new Retrofit.Builder()
|
Retrofit retrofit=new Retrofit.Builder()
|
||||||
.baseUrl("https://jsonplaceholder.typicode.com/")
|
.baseUrl("http://huaiglobal.com/api/")
|
||||||
.addConverterFactory(GsonConverterFactory.create())
|
.addConverterFactory(GsonConverterFactory.create())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@ -112,45 +117,24 @@ public class RegisterActivityNew extends AppCompatActivity {
|
|||||||
System.out.println("Value of registrationNew " );*/
|
System.out.println("Value of registrationNew " );*/
|
||||||
CallApiService.getClient().createpost(fields);
|
CallApiService.getClient().createpost(fields);
|
||||||
Call<RegistrationNew> call=jsonPlaceHolderApi.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>() {
|
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("register code=", String.valueOf(response.code()));
|
Log.e("register code=", String.valueOf(response.code()));
|
||||||
Toast.makeText(RegisterActivityNew.this, "User Added succesfully", Toast.LENGTH_SHORT).show();
|
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);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
else{
|
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();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
|
|
||||||
<!-- <include layout="@layout/include_toolbar"/>-->
|
<!-- <include layout="@layout/include_toolbar"/>-->
|
||||||
|
|
||||||
<!--<FrameLayout
|
|
||||||
|
<FrameLayout
|
||||||
android:id="@+id/container"
|
android:id="@+id/container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"/>
|
android:layout_height="match_parent"/>
|
||||||
@ -40,7 +41,7 @@
|
|||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
android:indeterminate="true"
|
android:indeterminate="true"
|
||||||
android:visibility="invisible"/>
|
android:visibility="invisible"/>
|
||||||
</RelativeLayout>-->
|
</RelativeLayout>
|
||||||
|
|
||||||
<!--<RelativeLayout
|
<!--<RelativeLayout
|
||||||
android:layout_width="@dimen/rounded_photo_size"
|
android:layout_width="@dimen/rounded_photo_size"
|
||||||
@ -120,7 +121,7 @@
|
|||||||
|
|
||||||
</RelativeLayout>-->
|
</RelativeLayout>-->
|
||||||
|
|
||||||
<RelativeLayout
|
<!--<RelativeLayout
|
||||||
android:layout_width="350px"
|
android:layout_width="350px"
|
||||||
android:layout_height="350px"
|
android:layout_height="350px"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
@ -155,7 +156,7 @@
|
|||||||
android:textStyle="normal"
|
android:textStyle="normal"
|
||||||
android:textColor="#576277"
|
android:textColor="#576277"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_marginTop="2dp"/>
|
android:layout_marginTop="2dp"/>-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -269,7 +270,7 @@
|
|||||||
|
|
||||||
</com.google.android.material.textfield.TextInputEditText>-->
|
</com.google.android.material.textfield.TextInputEditText>-->
|
||||||
|
|
||||||
<EditText
|
<!-- <EditText
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="54dp"
|
android:layout_height="54dp"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
@ -316,5 +317,5 @@
|
|||||||
android:text="Verify and Proceed"
|
android:text="Verify and Proceed"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
/>
|
/>-->
|
||||||
</LinearLayout>
|
</LinearLayout>
|
Loading…
x
Reference in New Issue
Block a user