Add Report creation, report saving mechanism

master
saad.siddiq 2026-01-30 16:00:46 +05:00
parent 25eaa9d914
commit 5b33c6770b
25 changed files with 1012 additions and 350 deletions

View File

@ -7,11 +7,14 @@ import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import androidx.activity.EdgeToEdge;
@ -23,6 +26,8 @@ import androidx.core.view.WindowCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.core.view.WindowInsetsControllerCompat;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;
import com.utopiaindustries.qc_android.R;
@ -30,15 +35,31 @@ import com.utopiaindustries.qc_android.adapters.PagerAdapter;
import com.google.android.material.tabs.TabLayout;
import com.utopiaindustries.qc_android.adapters.ReportListAdapter;
import com.utopiaindustries.qc_android.db.ReportRepository;
import com.utopiaindustries.qc_android.db.ReportWrapper;
import com.utopiaindustries.qc_android.helper.Helper;
import com.utopiaindustries.qc_android.utils.FileUtils;
import com.utopiaindustries.qc_android.utils.NotificationHelper;
import com.utopiaindustries.qc_android.utils.ProgressDialogFragment;
import com.utopiaindustries.qc_android.utils.ReportSelectListener;
import com.utopiaindustries.qc_android.viewmodels.ServiceViewModel;
public class DashboardActivity extends AppCompatActivity {
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.List;
import java.util.Map;
public class DashboardActivity extends AppCompatActivity implements ReportSelectListener {
Button btnCreateReport, btnFetchProduct, btnLogout, btnAppUpdate, btnReportUpload;
ServiceViewModel serviceViewModel;
RecyclerView reportRecyclerview;
TextView reportTextView;
ReportListAdapter reportListAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -70,7 +91,30 @@ public class DashboardActivity extends AppCompatActivity {
});
btnLogout.setOnClickListener(v -> {});
btnAppUpdate.setOnClickListener(v -> {});
btnReportUpload.setOnClickListener(v -> {});
btnReportUpload.setOnClickListener(v -> {
if (!Helper.isNetworkConnected(this)) {
Toast.makeText(this, "No Internet Connection Available", Toast.LENGTH_LONG).show();
}
else {
pushDataToUind();
}
});
}
private void pushDataToUind() {
ReportRepository repository = new ReportRepository(this);
List<ReportWrapper> reportWrapperList = repository.findAllReports();
if (reportWrapperList.isEmpty()) {
Toast.makeText(this, "No Reports to upload", Toast.LENGTH_SHORT).show();
return;
}
Toast.makeText(this, "Uploading Reports. Please wait", Toast.LENGTH_LONG).show();
//disableButtons();
// Start processing reports one by one
//processReportsSequentially(repository, reportWrapperList, 0, 100);
}
public void initializeLayout() {
@ -79,6 +123,7 @@ public class DashboardActivity extends AppCompatActivity {
btnLogout = findViewById(R.id.btn_logout);
btnAppUpdate = findViewById(R.id.btn_app_update);
btnReportUpload = findViewById(R.id.btn_reports_upload);
reportRecyclerview = findViewById(R.id.report_recyclerview);
serviceViewModel = new ViewModelProvider(this).get(ServiceViewModel.class);
@ -107,7 +152,7 @@ public class DashboardActivity extends AppCompatActivity {
}
});
loadReportList();
}
private void getScreenSize() {
@ -169,4 +214,125 @@ public class DashboardActivity extends AppCompatActivity {
progressDialog.dismiss();
}
}
public void loadReportList() {
ReportRepository repository = new ReportRepository(this);
List<ReportWrapper> reportWrappers = repository.findAllReports();
reportListAdapter = new ReportListAdapter(reportWrappers, this, this);
reportRecyclerview.setLayoutManager(new LinearLayoutManager(this));
reportRecyclerview.setAdapter(reportListAdapter);
}
@Override
public void onItemClicked(ReportWrapper reportWrapper) {
Toast.makeText(this, String.valueOf(reportWrapper.getId()), Toast.LENGTH_SHORT).show();
}
/*private void processReportsSequentially(ReportRepository repository,
List<ReportWrapper> wrappers,
int currentIndex, int notificationId) {
// Check if all reports have been processed
if (currentIndex >= wrappers.size()) {
//enableButtons();
return;
}
ReportWrapper wrapper = wrappers.get(currentIndex);
try {
// Load only one report at a time to save memory
byte[] fileData = FileUtils.readFile(wrapper.getContent());
InspectionReport report = deserializeReport(fileData, wrapper);
final int currentNotificationId = notificationId;
final int nextIndex = currentIndex + 1;
final int nextNotificationId = notificationId + 1;
InspectionReportService service = InspectionReportService.getInstance();
service.saveReport(report, new SubmitReportCallback() {
@Override
public void onSuccess(Map<String, String> responseMap) {
String result = responseMap.get("result");
String reportId = responseMap.get("reportId");
String sku = responseMap.get("Sku");
String generatedAt = responseMap.get("GeneratedAt");
String modelNumber = responseMap.get("modelNumber");
String code = responseMap.get("Code");
report.setPreviousReportId(Long.parseLong(reportId));
report.setGeneratedAt(generatedAt);
report.setCode(code);
// update status
repository.updateSyncStatus(report.getWrapperId());
saveReportToDraft(report, reportId);
NotificationHelper.showNotificationForReportUpload(
HomeActivity.this,
currentNotificationId,
"Upload Success",
"SKU: " + report.getItems().get(0).getSku() + " uploaded successfully.");
// Process next report after a short delay to free memory
new Handler(Looper.getMainLooper()).postDelayed(() -> {
// Force garbage collection before processing next report
System.gc();
processReportsSequentially(repository, wrappers, nextIndex, nextNotificationId);
}, 500); // 500ms delay between reports
}
@Override
public void onFailure(Throwable throwable) {
if (throwable.getMessage() != null && throwable.getMessage().contains("Duplicated")) {
Log.e("Request: ", "Duplicated");
// update status
repository.updateSyncStatus(report.getWrapperId());
// remove file
FileUtils.deleteFile(report.getFilePath());
} else {
NotificationHelper.showNotificationForReportUpload(
HomeActivity.this,
currentNotificationId,
"Upload Failed",
"SKU: " + report.getItems().get(0).getSku() + " failed.\nReason: " + throwable.getMessage());
}
// Continue with next report even if current one fails
new Handler(Looper.getMainLooper()).postDelayed(() -> {
System.gc();
processReportsSequentially(repository, wrappers, nextIndex, nextNotificationId);
}, 500);
}
});
} catch (Exception e) {
e.printStackTrace();
// If there's an error loading the report, skip it and continue with the next one
NotificationHelper.showNotificationForReportUpload(
DashboardActivity.this,
notificationId,
"Upload Failed",
"Reason: " + e.getMessage());
new Handler(Looper.getMainLooper()).postDelayed(() -> {
processReportsSequentially(repository, wrappers, currentIndex + 1, notificationId + 1);
}, 500);
}
}*/
/*private InspectionReport deserializeReport(byte[] data, InspectionReportWrapper wrapper)
throws IOException, ClassNotFoundException {
try (ByteArrayInputStream byteIn = new ByteArrayInputStream(data);
ObjectInputStream in = new ObjectInputStream(byteIn)) {
InspectionReport report = (InspectionReport) in.readObject();
report.setWrapperId(wrapper.getId());
report.setFilePath(wrapper.getContent());
return report;
}
}*/
}

View File

@ -0,0 +1,81 @@
package com.utopiaindustries.qc_android.adapters;
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView;
import com.utopiaindustries.qc_android.R;
import com.utopiaindustries.qc_android.db.ReportWrapper;
import com.utopiaindustries.qc_android.utils.ReportSelectListener;
import com.utopiaindustries.qc_android.utils.SelectListener;
import java.text.ParseException;
import java.util.List;
public class ReportListAdapter extends RecyclerView.Adapter<ReportListAdapter.ViewHolder> {
private List<ReportWrapper> reportList;
private ReportSelectListener listener;
private Context context;
public ReportListAdapter(List<ReportWrapper> reports, ReportSelectListener listener, Context context) {
this.reportList = reports;
this.listener = listener;
this.context = context;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.report_list_item, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, @SuppressLint("RecyclerView") int position) {
try {
holder.bindData(reportList.get(position));
holder.cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onItemClicked(reportList.get(position));
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public int getItemCount() {
return reportList.size();
}
public static class ViewHolder extends RecyclerView.ViewHolder {
private final TextView txtCategory, txtCreatedBy, reportDate;
private final CardView cardView;
public ViewHolder(@NonNull View itemView) {
super(itemView);
txtCategory = itemView.findViewById(R.id.txt_category);
txtCreatedBy = itemView.findViewById(R.id.txt_createdBy);
reportDate = itemView.findViewById(R.id.report_date);
cardView = itemView.findViewById(R.id.main_container);
}
public void bindData(ReportWrapper report) {
reportDate.setText(String.valueOf(report.getId()));
txtCategory.setText("Category");
txtCreatedBy.setText("Created By");
}
}
}

View File

@ -1,8 +1,10 @@
package com.utopiaindustries.qc_android.apiservice;
import com.utopiaindustries.qc_android.models.DataEntryModel;
import com.utopiaindustries.qc_android.models.InspectionCheckPoint;
import java.util.List;
import java.util.Map;
import retrofit2.Call;
import retrofit2.http.Body;
@ -50,4 +52,9 @@ public interface ApiService {
@GET("rest/uic/inspection-report/checkpoints")
Call<List<InspectionCheckPoint>> fetchCheckPoints();
@POST("rest/uic/inspection-report")
Call<Map<String,String>> saveReport(
@Body DataEntryModel inspectionReport
);
}

View File

@ -79,7 +79,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
public static final String REPORT_TABLE_NAME = "report";
public static final String REPORT_COLUMN_ID = "id";
public static final String REPORT_COLUMN_CONTENT = "content";
public static final String REPORT_COLUMN_SYNCED = "synced";
//public static final String REPORT_COLUMN_SYNCED = "synced";
/*
* draft report table
@ -150,9 +150,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
String CREATE_REPORT_TABLE = "CREATE TABLE " + REPORT_TABLE_NAME + " (" +
REPORT_COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
REPORT_COLUMN_CONTENT + " TEXT NOT NULL," +
REPORT_COLUMN_SYNCED + " INTEGER DEFAULT 0 CHECK(synced IN (0, 1))"
+ ")";
REPORT_COLUMN_CONTENT + " TEXT NOT NULL )";
String CREATE_DRAFT_REPORT_TABLE = "CREATE TABLE " + DRAFT_REPORT_TABLE_NAME + " (" +
DRAFT_REPORT_COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
@ -189,7 +187,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
db.execSQL( CREATE_CHECKPOINT_TABLE );
///db.execSQL( CREATE_DEFECT_TABLE );
//db.execSQL( CREATE_UNIT_TABLE );
//db.execSQL( CREATE_REPORT_TABLE );
db.execSQL( CREATE_REPORT_TABLE );
//db.execSQL( CREATE_DRAFT_REPORT_TABLE);
//db.execSQL( CREATE_SKU_CHECKPOINT_TABLE );
//db.execSQL( CREATE_INSPECTION_LABEL_TABLE );
@ -203,7 +201,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
db.execSQL( "DROP TABLE IF EXISTS " + CHECKPOINT_TABLE_NAME );
//db.execSQL( "DROP TABLE IF EXISTS " + DEFECT_TABLE_NAME );
//db.execSQL( "DROP TABLE IF EXISTS " + UNIT_TABLE_NAME );
//db.execSQL( "DROP TABLE IF EXISTS " + REPORT_TABLE_NAME );
db.execSQL( "DROP TABLE IF EXISTS " + REPORT_TABLE_NAME );
// db.execSQL( "DROP TABLE IF EXISTS " + DRAFT_REPORT_TABLE_NAME );
//db.execSQL( "DROP TABLE IF EXISTS " + CHECKPOINT_SKU_TABLE_NAME );
//db.execSQL( "DROP TABLE IF EXISTS " + INSPECTION_LABEL_TABLE_NAME );

View File

@ -0,0 +1,140 @@
package com.utopiaindustries.qc_android.db;
import static com.utopiaindustries.qc_android.db.DatabaseHelper.DRAFT_REPORT_TABLE_NAME;
import static com.utopiaindustries.qc_android.db.DatabaseHelper.REPORT_TABLE_NAME;
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.RejectedExecutionException;
public class ReportRepository {
private final DatabaseHelper dbHelper;
private SQLiteDatabase database;
private final ExecutorService executorService;
private Context cxt;
public ReportRepository(Context context) {
dbHelper = new DatabaseHelper(context);
executorService = Executors.newSingleThreadExecutor();
cxt = context;
}
private void openDatabase() {
try {
if (database == null || !database.isOpen() || !database.isDbLockedByCurrentThread()) {
database = dbHelper.getWritableDatabase();
}
}
catch (Exception e) {
e.printStackTrace();
}
}
public void insert(ReportWrapper wrapper) {
executeSafely(() -> {
openDatabase();
database.beginTransaction();
try {
ContentValues values = new ContentValues();
values.put(DatabaseHelper.REPORT_COLUMN_CONTENT, wrapper.getContent());
database.insertWithOnConflict(REPORT_TABLE_NAME, null, values, SQLiteDatabase.CONFLICT_REPLACE);
database.setTransactionSuccessful();
} catch (Exception e) {
e.printStackTrace();
} finally {
database.endTransaction();
close();
}
});
}
/*
* Close the database when all operations are complete
*/
public void close() {
if (database != null && database.isOpen()) {
database.close();
}
}
/*
* Executes a task safely, ensuring the ExecutorService is still active
*/
private void executeSafely(Runnable task) {
try {
if (!executorService.isShutdown()) {
executorService.submit(task);
} else {
// Handle the situation when the executor is already shut down
System.out.println("Task execution rejected because ExecutorService is shut down");
}
} catch (RejectedExecutionException e) {
e.printStackTrace();
}
}
@SuppressLint("Range")
public List<ReportWrapper> findAllReports() {
List<ReportWrapper> reports = new ArrayList<>();
openDatabase();
try (Cursor cursor = database.query(REPORT_TABLE_NAME,
null,
null,
null,
null,
null,
null)) {
if (cursor != null && cursor.moveToFirst()) {
do {
ReportWrapper wrapper = new ReportWrapper();
wrapper.setId(cursor.getLong(cursor.getColumnIndex(DatabaseHelper.REPORT_COLUMN_ID)));
wrapper.setContent(cursor.getString(cursor.getColumnIndex(DatabaseHelper.REPORT_COLUMN_CONTENT)));
reports.add(wrapper);
} while (cursor.moveToNext());
}
} catch (Exception e) {
e.printStackTrace();
} finally {
close();
}
return reports;
}
/*
* Delete Draft Record from draft table
* */
public void deleteDraftRecordById(Long id) {
executeSafely(() -> {
openDatabase();
database.beginTransaction();
try {
String whereClause = DatabaseHelper.DRAFT_REPORT_COLUMN_ID + " = ?";
String[] whereArgs = {String.valueOf(id)};
database.delete(DRAFT_REPORT_TABLE_NAME, whereClause, whereArgs);
database.setTransactionSuccessful();
} catch (Exception e) {
e.printStackTrace();
} finally {
database.endTransaction();
close();
}
});
}
}

View File

@ -0,0 +1,39 @@
package com.utopiaindustries.qc_android.db;
public class ReportWrapper {
private long id;
private String content;
public ReportWrapper(long id, String content) {
this.id = id;
this.content = content;
}
public ReportWrapper() {
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
@Override
public String toString() {
return "ReportWrapper{" +
"id=" + id +
", content='" + content + '\'' +
'}';
}
}

View File

@ -1,5 +1,6 @@
package com.utopiaindustries.qc_android.fragments;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
@ -15,8 +16,15 @@ import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.utopiaindustries.qc_android.R;
import com.utopiaindustries.qc_android.activities.DashboardActivity;
import com.utopiaindustries.qc_android.db.ReportRepository;
import com.utopiaindustries.qc_android.db.ReportWrapper;
import com.utopiaindustries.qc_android.models.DataEntryModel;
import com.utopiaindustries.qc_android.utils.AppDataManager;
import com.utopiaindustries.qc_android.utils.FileUtils;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
public class FragmentQcTerryThree extends Fragment {
@ -125,15 +133,38 @@ public class FragmentQcTerryThree extends Fragment {
// Show success message
Toast.makeText(getActivity(), "Data submitted successfully!", Toast.LENGTH_SHORT).show();
DataEntryModel dataEntryModel = AppDataManager.getInstance().getCurrentDataEntry();
Log.e("DataEntryModel: " ,""+dataEntryModel);
// Update UI
//btnSubmit.setText("Submitted ✓");
//btnSubmit.setEnabled(false);
//btnSubmit.setBackgroundColor(getResources().getColor(android.R.color.darker_gray));
Log.e("DataEntryModel: ", "" + dataEntryModel);
saveReport(dataEntryModel);
// You would typically:
// 1. Send data to API/backend
// 2. Save to database
// 3. Navigate to success screen
// 3. Navigate to main screen
}
public void saveReport(DataEntryModel dataEntryModel) {
try {
// convert into byte array
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
objectOutputStream.writeObject(dataEntryModel);
objectOutputStream.flush();
byte[] bytes = byteArrayOutputStream.toByteArray();
// write bytes in file
long epochSeconds = System.currentTimeMillis() / 1000;
//String fileName = "Report-" + inspectionReport.getItems().get(0).getSku() + ".bin";
String fileName = "Report-" + epochSeconds + ".bin";
String savedPath = FileUtils.writeFile(requireActivity(), bytes, fileName);
System.out.println(savedPath);
new ReportRepository(getActivity()).insert(
new ReportWrapper(0, savedPath)
);
Intent intent = new Intent(getActivity(), DashboardActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -244,7 +244,6 @@ public class FragmentQcTerryTwo extends Fragment implements CheckPointAdapter.On
result -> {
if (result.getResultCode() == getActivity().RESULT_OK && photoUri != null) {
//imageView.setImageURI(photoUri);
dataEntryModel.setSelectedImageUri(photoUri);
Helper.uriToByteArrayAsync(
getContext(),
@ -273,7 +272,6 @@ public class FragmentQcTerryTwo extends Fragment implements CheckPointAdapter.On
uri -> {
if (uri != null) {
//imageView.setImageURI(uri);
dataEntryModel.setSelectedImageUri(uri);
Helper.uriToByteArrayAsync(
getContext(),

View File

@ -2,10 +2,11 @@ package com.utopiaindustries.qc_android.models;
import android.net.Uri;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class DataEntryModel {
public class DataEntryModel implements Serializable {
private static final long serialVersionUID = 1L;
// Personal Info
@ -21,7 +22,6 @@ public class DataEntryModel {
private String company;
private String position;
private Uri selectedImageUri;
private List<InspectionCheckPoint> checkPointList = new ArrayList<>();
// Constructor
@ -38,7 +38,6 @@ public class DataEntryModel {
this.city = other.city;
this.company = other.company;
this.position = other.position;
this.selectedImageUri = other.selectedImageUri;
this.checkPointList = new ArrayList<>(other.checkPointList);
}
@ -50,14 +49,6 @@ public class DataEntryModel {
this.checkPointList = checkPointList;
}
public Uri getSelectedImageUri() {
return selectedImageUri;
}
public void setSelectedImageUri(Uri selectedImageUri) {
this.selectedImageUri = selectedImageUri;
}
public String getPosition() {
return position;
}
@ -122,7 +113,6 @@ public class DataEntryModel {
city = null;
company = null;
position = null;
selectedImageUri = null;
checkPointList.clear();
}
@ -136,7 +126,6 @@ public class DataEntryModel {
", city='" + city + '\'' +
", company='" + company + '\'' +
", position='" + position + '\'' +
", selectedImageUri=" + selectedImageUri +
", checkPointListSize=" + checkPointList +
'}';
}

View File

@ -5,6 +5,7 @@ import android.content.Context;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@ -16,6 +17,45 @@ import java.io.ObjectOutputStream;
public class FileUtils {
public static String writeFile( Context context ,
byte[] content,
String fileName ){
FileOutputStream fos = null;
try {
// Get the file path in the internal storage
File file = new File( context.getFilesDir(), fileName);
// Open the file output stream
fos = new FileOutputStream(file);
fos.write( content );
fos.flush();
return file.getAbsolutePath();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return "";
}
public static byte[] readFile(String filePath) throws IOException {
File file = new File(filePath);
try (FileInputStream fis = new FileInputStream(file);
ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
byte[] buffer = new byte[8192];
int bytesRead;
while ((bytesRead = fis.read(buffer)) != -1) {
baos.write(buffer, 0, bytesRead);
}
return baos.toByteArray();
}
}
// Save model object as byte array file
public static String saveObjectToFile(Context context, Object model, String fileName) {
File file = new File(context.getFilesDir(), fileName);

View File

@ -0,0 +1,9 @@
package com.utopiaindustries.qc_android.utils;
import com.utopiaindustries.qc_android.db.ReportWrapper;
public interface ReportSelectListener {
void onItemClicked(ReportWrapper reportWrapper);
}

View File

@ -10,6 +10,7 @@ import androidx.lifecycle.ViewModel;
import com.utopiaindustries.qc_android.apiservice.ApiService;
import com.utopiaindustries.qc_android.apiservice.ApiServiceFactory;
import com.utopiaindustries.qc_android.db.CheckpointRepository;
import com.utopiaindustries.qc_android.models.DataEntryModel;
import com.utopiaindustries.qc_android.models.InspectionCheckPoint;
import java.util.List;
@ -229,35 +230,31 @@ public class ServiceViewModel extends ViewModel {
});
}*/
/*public void saveHSEData(HseReportRequest hseRequestModel) {
/*public void saveReport(DataEntryModel hseRequestModel) {
isLoading.setValue(true);
// Execute the task in the background
executorService.execute(() -> {
try {
apiService.saveHseReport(hseRequestModel).enqueue(new Callback<HseSaveResponse>() {
@Override
public void onResponse(Call<HseSaveResponse> call, Response<HseSaveResponse> response) {
isLoading.setValue(false);
if (response.isSuccessful() && response.body() != null) {
userSaveLiveData.setValue(response.body());
} else {
errorLiveData.setValue(response.message());
}
try {
apiService.saveReport(hseRequestModel).enqueue(new Callback<DataEntryModel>() {
@Override
public void onResponse(Call<DataEntryModel> call, Response<DataEntryModel> response) {
isLoading.setValue(false);
if (response.isSuccessful() && response.body() != null) {
userSaveLiveData.setValue(response.body());
} else {
errorLiveData.setValue(response.message());
}
}
@Override
public void onFailure(Call<HseSaveResponse> call, Throwable t) {
isLoading.setValue(false);
errorLiveData.setValue(t.getMessage());
}
});
} catch (Exception e) {
errorLiveData.postValue(e.getMessage());
isLoading.postValue(false);
}
});
@Override
public void onFailure(Call<DataEntryModel> call, Throwable t) {
isLoading.setValue(false);
errorLiveData.setValue(t.getMessage());
}
});
} catch (Exception e) {
errorLiveData.postValue(e.getMessage());
isLoading.postValue(false);
}
}*/
public LiveData<Boolean> getLoginUser() {

View File

@ -0,0 +1,8 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/white" />
<stroke
android:color="@color/theme_color"
android:width="4dp" />
<corners android:radius="12dp" />
</shape>

View File

@ -23,7 +23,7 @@
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Home"
android:text="Dashboard"
android:textColor="@color/white"
android:textSize="@dimen/_12sdp"
app:layout_constraintBottom_toBottomOf="@+id/toolbar"
@ -50,7 +50,28 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolbar">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/report_recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/btn_layout"
android:layout_margin="5dp"/>
<TextView
android:id="@+id/draft_textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:textStyle="bold"
android:textSize="@dimen/_13sdp"
android:visibility="gone"
android:textColor="@color/black"
android:text="No Reports found"
android:layout_centerInParent="true"
android:gravity="center" />
<LinearLayout
android:id="@+id/btn_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"

View File

@ -4,12 +4,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_marginVertical="4dp"
android:clickable="true"
android:elevation="10dp"
android:focusable="true"
android:padding="5dp"
app:cardBackgroundColor="@color/white">
android:background="@drawable/card_background"
android:foreground="?attr/selectableItemBackground"
app:cardCornerRadius="12dp"
app:cardElevation="6dp">
<LinearLayout
android:layout_width="match_parent"
@ -52,8 +50,10 @@
android:id="@+id/check_point_remarks"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:layout_margin="5dp"
android:background="@drawable/et_border"
android:imeOptions="actionDone"
android:hint="Remarks"
android:padding="10dp" />

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:background="@drawable/card_background"
android:foreground="?attr/selectableItemBackground"
app:cardCornerRadius="12dp"
app:cardElevation="6dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="@+id/report_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
android:text="Date"
android:textColor="@color/black"
android:textSize="@dimen/_11sdp" />
<TextView
android:id="@+id/txt_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="01"
android:layout_marginTop="5dp"
android:textColor="@color/black"
android:textSize="@dimen/_10sdp" />
<TextView
android:id="@+id/txt_createdBy"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Remarks"
android:layout_marginTop="5dp"
android:textColor="@color/black"
android:textSize="@dimen/_10sdp" />
</LinearLayout>
</androidx.cardview.widget.CardView>

View File

@ -23,9 +23,9 @@
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Home - Mobile"
android:text="Dashboard"
android:textColor="@color/white"
android:textSize="@dimen/_15sdp"
android:textSize="@dimen/_12sdp"
app:layout_constraintBottom_toBottomOf="@+id/toolbar"
app:layout_constraintEnd_toEndOf="@+id/toolbar"
app:layout_constraintStart_toStartOf="parent"
@ -50,7 +50,100 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolbar">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/report_recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/btn_layout"
android:layout_margin="5dp"/>
<TextView
android:id="@+id/draft_textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:textStyle="bold"
android:textSize="@dimen/_13sdp"
android:visibility="gone"
android:textColor="@color/black"
android:text="No Reports found"
android:layout_centerInParent="true"
android:gravity="center" />
<LinearLayout
android:id="@+id/btn_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/btn_create_report"
android:background="@color/grey_200"
android:orientation="horizontal"
android:weightSum="2"
android:padding="5dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<Button
android:id="@+id/btn_reports_upload"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@drawable/rounded_btn_login"
android:text="Upload Reports"
app:backgroundTint="@color/grey_500" />
<Button
android:id="@+id/btn_app_update"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@drawable/rounded_btn_login"
android:text="App Update"
app:backgroundTint="@color/grey_500" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<Button
android:id="@+id/btn_fetch_product"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@drawable/rounded_btn_login"
android:text="Fetch"
app:backgroundTint="@color/grey_500" />
<Button
android:id="@+id/btn_logout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@drawable/rounded_btn_login"
android:text="Logout"
app:backgroundTint="@color/grey_500" />
</LinearLayout>
</LinearLayout>
<Button
android:id="@+id/btn_create_report"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="5dp"
android:layout_alignParentBottom="true"
android:background="@drawable/rounded_btn_login"
android:text="Create"
app:backgroundTint="@color/blue_600" />
</RelativeLayout>

View File

@ -12,34 +12,36 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="1dp"
android:layout_marginTop="60dp"
android:layout_marginEnd="1dp"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginBottom="20dp"
android:src="@drawable/qc" />
android:src="@drawable/ic_launcher" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginStart="30dp"
android:layout_marginBottom="20dp"
android:padding="5dp"
android:text="Login Now to Continue"
android:textSize="@dimen/_17sdp" />
android:textSize="@dimen/_14sdp" />
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="300dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="50dp"
android:paddingEnd="50dp"
android:layout_gravity="center_horizontal">
<EditText
@ -50,16 +52,19 @@
android:drawableStart="@drawable/ic_email"
android:drawablePadding="5dp"
android:drawableTint="@color/grey_700"
android:padding="10dp"
android:hint="User"
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="300dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
android:layout_marginTop="10dp"
android:paddingStart="50dp"
android:paddingEnd="50dp"
app:passwordToggleEnabled="true">
<EditText
@ -69,22 +74,24 @@
android:background="@null"
android:drawableStart="@drawable/ic_password"
android:drawablePadding="5dp"
android:padding="10dp"
android:drawableTint="@color/grey_700"
android:hint="Password"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/btn_login"
android:layout_width="300dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
android:layout_marginTop="20dp"
android:background="@drawable/rounded_btn_login"
android:padding="10dp"
android:padding="5dp"
android:text="Login"
android:textColor="@color/white"
android:textSize="@dimen/_15sdp" />
android:textSize="@dimen/_10sdp" />
</LinearLayout>
<TextView
@ -95,14 +102,14 @@
android:layout_marginBottom="28dp"
android:textStyle="bold"
android:text="V-1.0"
android:textSize="@dimen/_13sdp"
android:textSize="@dimen/_11sdp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<ImageView
android:id="@+id/img_check_update"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="10dp"
app:layout_constraintEnd_toEndOf="parent"

View File

@ -7,4 +7,12 @@
android:layout_height="match_parent"
tools:context=".activities.QCTerryActivity">
<fragment
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:navGraph="@navigation/nav_graph" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -4,70 +4,58 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_marginVertical="4dp"
android:clickable="true"
android:elevation="10dp"
android:focusable="true"
android:padding="4dp"
app:cardBackgroundColor="@color/white">
android:background="@drawable/card_background"
android:foreground="?attr/selectableItemBackground"
app:cardCornerRadius="12dp"
app:cardElevation="6dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp">
android:orientation="vertical">
<TextView
android:id="@+id/check_point_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:background="@color/grey_200"
android:layout_gravity="center|right"
android:layout_marginBottom="5dp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="horizontal">
<Spinner
android:id="@+id/check_point_spinner"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_weight="4">
</Spinner>
<CheckBox
android:id="@+id/check_point_ok"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_weight="1"
android:text="OK"/>
android:layout_weight="0.5"
android:text="OK" />
<CheckBox
android:id="@+id/check_point_no"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_weight="1"
android:text="NO"/>
android:layout_weight="10.5"
android:text="NO" />
<!-- <ImageButton-->
<!-- android:id="@+id/check_point_delete"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:src="@drawable/ic_delete"-->
<!-- android:background="@null"-->
<!-- android:padding="8dp"/>-->
</LinearLayout>
<LinearLayout
<EditText
android:id="@+id/check_point_remarks"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:orientation="horizontal">
<EditText
android:id="@+id/check_point_remarks"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_weight="4"
android:hint="Remarks"/>
</LinearLayout>
android:singleLine="true"
android:layout_margin="5dp"
android:background="@drawable/et_border"
android:imeOptions="actionDone"
android:hint="Remarks"
android:padding="10dp" />
<LinearLayout
android:layout_width="match_parent"
@ -77,72 +65,37 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/image_recycler_view"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="150dp"
android:layout_margin="10dp"
android:layout_weight="0.8"
android:layout_weight="0.9"
android:orientation="horizontal" />
<!--<ImageView
android:id="@+id/preview_image"
android:layout_width="150dp"
android:layout_height="150dp">
</ImageView>-->
<TextView
android:id="@+id/selected_image"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:text=""
android:textAlignment="center"/>
<ImageButton
android:id="@+id/image_picker"
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@null"
android:padding="8dp"
android:src="@drawable/image_picker" />
android:layout_weight="0.1"
android:orientation="horizontal">
<ImageButton
android:id="@+id/delete_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:padding="8dp"
android:src="@drawable/ic_delete" />
<ImageButton
android:id="@+id/image_picker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:padding="8dp"
android:src="@drawable/image_picker" />
<ImageButton
android:id="@+id/add_defect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:padding="8dp"
android:src="@drawable/ic_add" />
</LinearLayout>
<ImageButton
android:id="@+id/delete_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:padding="8dp"
android:src="@drawable/ic_delete" />
<LinearLayout
android:id="@+id/defect_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:orientation="horizontal">
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/defects_recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<TextView
android:id="@+id/standard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/light_blue_50"
android:padding="16dp"
android:text=""
android:textColor="#000000"
android:textSize="18sp" />
</LinearLayout>
</androidx.cardview.widget.CardView>

View File

@ -27,7 +27,7 @@
android:text="Select Image from"
android:textAllCaps="false"
android:textColor="@color/black"
android:textSize="@dimen/_15sdp"
android:textSize="@dimen/_12sdp"
android:textStyle="normal" />
<View
@ -54,7 +54,7 @@
android:text="Camera"
android:textAllCaps="false"
android:textColor="@color/white"
android:textSize="@dimen/_14sdp"
android:textSize="@dimen/_12sdp"
android:textStyle="normal" />
<TextView
@ -77,7 +77,7 @@
android:textAllCaps="false"
android:background="@drawable/custom_button"
android:textColor="@color/white"
android:textSize="@dimen/_14sdp"
android:textSize="@dimen/_12sdp"
android:textStyle="normal" />
</LinearLayout>

View File

@ -1,109 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:text="Personal Information"
android:textSize="20sp"
android:textStyle="bold" />
<com.google.android.material.textfield.TextInputLayout
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:hint="First Name"
app:errorEnabled="true">
android:background="@color/theme_color"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme">
<EditText
android:id="@+id/edtFirstName"
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName" />
</com.google.android.material.textfield.TextInputLayout>
android:layout_gravity="center"
android:gravity="center"
android:padding="5dp"
android:text="QC - Terry"
android:textColor="@color/white"
android:textSize="@dimen/_11sdp" />
</androidx.appcompat.widget.Toolbar>
<com.google.android.material.textfield.TextInputLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:hint="Last Name"
app:errorEnabled="true">
android:layout_height="match_parent"
android:layout_above="@+id/btnNext"
android:layout_below="@+id/toolbar"
android:layout_margin="5dp"
android:orientation="vertical"
android:padding="10dp">
<EditText
android:id="@+id/edtLastName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:hint="Email"
app:errorEnabled="true">
<EditText
android:id="@+id/edtEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress" />
</com.google.android.material.textfield.TextInputLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerInParent="true"
android:padding="5dp"
android:orientation="vertical"
android:layout_marginBottom="16dp">
android:layout_marginBottom="24dp"
android:text="Personal Information"
android:textSize="20sp"
android:textStyle="bold" />
<Button
android:id="@+id/btnCamera"
android:layout_width="wrap_content"
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:hint="First Name"
app:errorEnabled="true">
<EditText
android:id="@+id/edtFirstName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Camera" />
android:inputType="textPersonName" />
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/btnGallery"
android:layout_width="wrap_content"
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:hint="Last Name"
app:errorEnabled="true">
<EditText
android:id="@+id/edtLastName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Gallery " />
android:inputType="textPersonName" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<ImageView
android:id="@+id/imageView"
android:layout_width="200dp"
android:layout_height="200dp"
android:padding="5dp"
android:layout_alignParentEnd="true"
android:background="#f0f0f0"
android:scaleType="centerCrop"
android:layout_marginBottom="24dp"/>
</RelativeLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:hint="Email"
app:errorEnabled="true">
<EditText
android:id="@+id/edtEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<Button
android:id="@+id/btnNext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Next →" />
android:layout_alignParentBottom="true"
android:background="@drawable/rounded_btn_login"
android:padding="10dp"
android:text="Next →"
android:textSize="@dimen/_11sdp" />
</LinearLayout>
</RelativeLayout>

View File

@ -1,32 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/theme_color"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:padding="5dp"
android:text="QC - Terry"
android:textColor="@color/white"
android:textSize="@dimen/_11sdp" />
</androidx.appcompat.widget.Toolbar>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Employment Information"
android:textSize="20sp"
android:textStyle="bold"
android:layout_marginBottom="24dp"/>
android:layout_below="@+id/toolbar"
android:layout_margin="5dp"
android:orientation="vertical">
<TextView
android:id="@+id/tvSummary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Summary will appear here"
android:textSize="14sp"
android:padding="12dp"
android:layout_marginBottom="24dp"
android:background="#F5F5F5"
android:layout_marginBottom="24dp"/>
android:padding="12dp"
android:text="Summary will appear here"
android:textSize="14sp" />
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
@ -39,7 +52,7 @@
android:id="@+id/edtCompany"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"/>
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
@ -53,29 +66,19 @@
android:id="@+id/edtPosition"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"/>
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:hint="Salary (Optional)">
<EditText
android:id="@+id/edtSalary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal"/>
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/btnSubmit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Submit All Data"
android:layout_marginTop="16dp"
android:backgroundTint="@android:color/holo_green_dark"/>
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/btnSubmit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@drawable/rounded_btn_login"
android:padding="10dp"
android:text="Submit"
android:textSize="@dimen/_11sdp" />
</RelativeLayout>

View File

@ -1,66 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Address Information"
android:textSize="20sp"
android:textStyle="bold"
android:layout_marginBottom="24dp"/>
<com.google.android.material.textfield.TextInputLayout
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:hint="Address"
app:errorEnabled="true">
android:background="@color/theme_color"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme" >
<EditText
android:id="@+id/edtAddress"
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPostalAddress"/>
</com.google.android.material.textfield.TextInputLayout>
android:text="QC - Terry"
android:layout_gravity="center"
android:gravity="center"
android:padding="5dp"
android:textColor="@color/white"
android:textSize="@dimen/_11sdp" />
</androidx.appcompat.widget.Toolbar>
<com.google.android.material.textfield.TextInputLayout
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/check_point_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:hint="City"
app:errorEnabled="true">
<EditText
android:id="@+id/edtCity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPostalAddress"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:hint="Zip Code"
app:errorEnabled="true">
<EditText
android:id="@+id/edtZipCode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"/>
</com.google.android.material.textfield.TextInputLayout>
android:layout_height="match_parent"
android:layout_below="@+id/toolbar"
android:layout_above="@+id/btnNext"
android:layout_margin="5dp"
android:padding="8dp" />
<Button
android:id="@+id/btnNext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Next →"
android:layout_marginTop="16dp"/>
android:layout_marginTop="10dp"
android:layout_alignParentBottom="true"
android:background="@drawable/rounded_btn_login"
android:padding="10dp"
android:textSize="@dimen/_11sdp"
android:text="Next →" />
</LinearLayout>
</RelativeLayout>

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:background="@drawable/card_background"
android:foreground="?attr/selectableItemBackground"
app:cardCornerRadius="12dp"
app:cardElevation="6dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="@+id/report_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="start"
android:text="Date"
android:textColor="@color/black"
android:textSize="16sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/txt_category"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="01"
android:textColor="@color/black"
android:textSize="16sp" />
</LinearLayout>
<TextView
android:id="@+id/txt_createdBy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Remarks"
android:layout_marginTop="5dp"
android:textColor="@color/black"
android:textSize="16sp" />
</LinearLayout>
</androidx.cardview.widget.CardView>