Design modification and retrofit setup
This commit is contained in:
parent
7e7ca3533c
commit
2a202fd18f
@ -24,8 +24,12 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name=".CheckInActivity"
|
||||
android:name=".register.SavePhotoActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".CheckInActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
|
||||
<activity
|
||||
android:name=".register.RegisterActivityNew"
|
||||
android:exported="false" />
|
||||
|
@ -2,13 +2,21 @@ package ru.visionlab.femdemo;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.PopupMenu;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import ru.visionlab.femdemo.login.LoginActivity;
|
||||
@ -19,6 +27,8 @@ public class CheckInActivity extends AppCompatActivity {
|
||||
ImageView logout;
|
||||
ImageView menu;
|
||||
|
||||
AlertDialog dialogBuilder;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -38,7 +48,75 @@ public class CheckInActivity extends AppCompatActivity {
|
||||
menu.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
PopupMenu popupMenu = new PopupMenu(CheckInActivity.this, menu);
|
||||
LayoutInflater inflater = LayoutInflater.from(getApplicationContext());
|
||||
view = inflater.inflate(R.layout.layout, null);
|
||||
|
||||
/*Button btn_confirm = view.findViewById(R.id.btn_confirm);
|
||||
Button btn_cancel = view.findViewById(R.id.btn_cancel);
|
||||
TextView txt_title = view.findViewById(R.id.txt_title);
|
||||
TextView txt_content = view.findViewById(R.id.txt_content);
|
||||
|
||||
btn_cancel.setVisibility(View.GONE);
|
||||
btn_confirm.setText("OK");
|
||||
|
||||
txt_title.setText("WARNING");
|
||||
txt_content.setText("This job is not active. Please synchronize to get the latest data, then contact your coordinator if needed.");*/
|
||||
|
||||
|
||||
final AlertDialog alertDialog = new AlertDialog.Builder(CheckInActivity.this)
|
||||
.setView(view)
|
||||
.create();
|
||||
alertDialog.show();
|
||||
alertDialog.getWindow().setLayout(600,460);
|
||||
alertDialog.getWindow().setGravity(Gravity.TOP|Gravity.LEFT);
|
||||
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
|
||||
|
||||
WindowManager.LayoutParams params = alertDialog.getWindow().getAttributes();
|
||||
alertDialog.setCanceledOnTouchOutside(true);
|
||||
params.horizontalMargin = -100;
|
||||
alertDialog.getWindow().setAttributes(params);
|
||||
|
||||
/*btn_confirm.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
alertDialog.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
btn_cancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
alertDialog.cancel();
|
||||
}
|
||||
});*/
|
||||
}
|
||||
});
|
||||
/*menu.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
// instance of alert dialog to build alert dialog
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(CheckInActivity.this);
|
||||
builder.setIcon(R.drawable.andrew);
|
||||
builder.setTitle("Andrew Bahl");
|
||||
// builder.setMessage("Bottom Alert dialog");
|
||||
|
||||
// set the neutral button to do some actions
|
||||
builder.setNeutralButton("Logout", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Intent intent = new Intent(CheckInActivity.this, LoginActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
// show the alert dialog
|
||||
AlertDialog alertDialog = builder.create();
|
||||
alertDialog.show();
|
||||
alertDialog.getWindow().setLayout(800,400);
|
||||
alertDialog.getWindow().setGravity(Gravity.TOP);
|
||||
*//*PopupMenu popupMenu = new PopupMenu(CheckInActivity.this, menu);
|
||||
popupMenu.getMenuInflater().inflate(R.menu.navigation_menu, popupMenu.getMenu());
|
||||
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
@ -49,8 +127,10 @@ public class CheckInActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
// Showing the popup menu
|
||||
popupMenu.show();
|
||||
popupMenu.show();*//*
|
||||
}
|
||||
});
|
||||
});*/
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package ru.visionlab.femdemo.api;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
import ru.visionlab.femdemo.models.RegistrationNew;
|
||||
|
||||
public interface JsonPlaceHolderApi {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("posts")
|
||||
Call<RegistrationNew> createpost(@FieldMap Map<String,String> fields);
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package ru.visionlab.femdemo.models;
|
||||
|
||||
public class RegistrationNew {
|
||||
|
||||
private String companyId;
|
||||
private String employeeId;
|
||||
private String otp;
|
||||
|
||||
public RegistrationNew(String companyId, String employeeId, String otp) {
|
||||
this.companyId = companyId;
|
||||
this.employeeId = employeeId;
|
||||
this.otp = otp;
|
||||
}
|
||||
|
||||
public String getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(String companyId) {
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
public String getEmployeeId() {
|
||||
return employeeId;
|
||||
}
|
||||
|
||||
public void setEmployeeId(String employeeId) {
|
||||
this.employeeId = employeeId;
|
||||
}
|
||||
|
||||
public String getOtp() {
|
||||
return otp;
|
||||
}
|
||||
|
||||
public void setOtp(String otp) {
|
||||
this.otp = otp;
|
||||
}
|
||||
}
|
@ -4,15 +4,27 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
import ru.visionlab.femdemo.CheckInActivity;
|
||||
import ru.visionlab.femdemo.R;
|
||||
import ru.visionlab.femdemo.api.JsonPlaceHolderApi;
|
||||
import ru.visionlab.femdemo.login.LoginActivity;
|
||||
import ru.visionlab.femdemo.login.LoginActivityNew;
|
||||
import ru.visionlab.femdemo.models.RegistrationNew;
|
||||
|
||||
public class RegisterActivityNew extends AppCompatActivity {
|
||||
|
||||
@ -22,6 +34,8 @@ public class RegisterActivityNew extends AppCompatActivity {
|
||||
|
||||
boolean isAllFieldsChecked = false;
|
||||
|
||||
JsonPlaceHolderApi jsonPlaceHolderApi;
|
||||
|
||||
Button verifynproceed;
|
||||
|
||||
@Override
|
||||
@ -33,14 +47,22 @@ public class RegisterActivityNew extends AppCompatActivity {
|
||||
edt_emp = findViewById(R.id.edt_emp);
|
||||
edt_otp = findViewById(R.id.edt_otp);
|
||||
|
||||
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.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
isAllFieldsChecked = CheckAllFields();
|
||||
if(isAllFieldsChecked) {
|
||||
|
||||
|
||||
Intent intent = new Intent(RegisterActivityNew.this, SavePhotoActivity.class);
|
||||
startActivity(intent);
|
||||
//saveInfo();
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -73,4 +95,41 @@ public class RegisterActivityNew extends AppCompatActivity {
|
||||
// after all validation return true.
|
||||
return true;
|
||||
}
|
||||
|
||||
public void saveInfo(){
|
||||
Map<String,String> fields=new HashMap<>();
|
||||
fields.put("companyId",edt_comp.getText().toString());
|
||||
fields.put("employeeId",edt_emp.getText().toString());
|
||||
fields.put("otp",edt_otp.getText().toString());
|
||||
|
||||
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 succesfully", 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());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package ru.visionlab.femdemo.register;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
|
||||
import ru.visionlab.femdemo.R;
|
||||
|
||||
public class SavePhotoActivity extends AppCompatActivity {
|
||||
|
||||
RoundedImageView photo;
|
||||
|
||||
Bitmap bitmap;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_save_photo);
|
||||
|
||||
/* photo = findViewById(R.id.photo);
|
||||
|
||||
photo.setImageBitmap(bitmap);
|
||||
bitmap = null;*/
|
||||
}
|
||||
}
|
@ -3,8 +3,8 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<solid android:color="#e0e0e0"/>
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="#EBEBEB"/>
|
||||
<corners android:radius="15dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle" >
|
||||
|
||||
<solid
|
||||
android:color="#EBEBEB" >
|
||||
</solid>
|
||||
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="#C4CDE0" >
|
||||
</stroke>
|
||||
|
||||
<padding
|
||||
android:left="5dp"
|
||||
android:top="5dp"
|
||||
android:right="5dp"
|
||||
android:bottom="5dp" >
|
||||
</padding>
|
||||
|
||||
<corners
|
||||
android:radius="11dp" >
|
||||
</corners>
|
||||
|
||||
</shape>
|
@ -97,7 +97,8 @@
|
||||
android:paddingRight="16dp"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:inputType="number"/>
|
||||
android:inputType="numberPassword"
|
||||
android:maxLength="3"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/verifynproceed"
|
||||
|
@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginStart="@dimen/activity_horizontal_margin"
|
||||
android:gravity="center_horizontal"
|
||||
tools:context=".register.SavePhotoActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/reasonTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:drawableTop="@drawable/ic_face_not_found"
|
||||
android:drawablePadding="41dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/error_face_not_found"
|
||||
android:textColor="@color/colorRed"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<!--<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/photo_save_photo_margin_top">
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/photo"
|
||||
android:layout_width="@dimen/rounded_photo_size"
|
||||
android:layout_height="@dimen/rounded_photo_size"
|
||||
android:scaleType="centerCrop"
|
||||
app:riv_border_color="@color/accentColor"
|
||||
app:riv_border_width="7dp"
|
||||
app:riv_mutate_background="true"
|
||||
app:riv_oval="false"/>
|
||||
|
||||
<ProgressBar
|
||||
style="@style/Base.Widget.AppCompat.ProgressBar"
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:indeterminate="true"
|
||||
android:visibility="invisible"/>
|
||||
</RelativeLayout>-->
|
||||
|
||||
<Button
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:id="@+id/retry"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/button_height"
|
||||
android:layout_above="@+id/save"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:text="@string/retry"
|
||||
android:textColor="@color/accentColor"
|
||||
android:textSize="14sp"
|
||||
android:background="@drawable/bg_button_disable"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/save"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/button_height"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginBottom="@dimen/button_margin_bottom"
|
||||
android:background="@color/accentColor"
|
||||
android:text="@string/Ok"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
</RelativeLayout>
|
@ -11,12 +11,12 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:drawablePadding="41dp"
|
||||
android:drawableTop="@drawable/ic_face_not_found"
|
||||
android:drawablePadding="41dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/error_face_not_found"
|
||||
android:textColor="@color/colorRed"
|
||||
android:textSize="15sp"/>
|
||||
android:textSize="15sp" />
|
||||
|
||||
<Button
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
|
@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/shape"
|
||||
android:layout_margin="15dp" >
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rel1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="15dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/menu"
|
||||
android:layout_width="43dp"
|
||||
android:layout_height="43dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/andrew" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Andrew Bahl"
|
||||
android:layout_toRightOf="@id/menu"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#4262D3"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_below="@id/rel1"
|
||||
/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="15dp"
|
||||
android:layout_below="@id/view">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/log"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/back" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Log out"
|
||||
android:layout_toRightOf="@id/log"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="38dp"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
Loading…
x
Reference in New Issue
Block a user