Implement basic workflow
Add functionality for picked, dropped, completed container workflowmaster
parent
a5fe014006
commit
99b3ea742b
|
@ -7,32 +7,46 @@ import android.text.Html;
|
|||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.utopiaindustries.selftrucking.Activities.dashboardScreens.viewModels.HomeViewModel;
|
||||
import com.utopiaindustries.selftrucking.Activities.loginScreens.SplashActivity;
|
||||
import com.utopiaindustries.selftrucking.R;
|
||||
import com.utopiaindustries.selftrucking.helper.Helper;
|
||||
import com.utopiaindustries.selftrucking.models.ContainerWorkflow;
|
||||
import com.utopiaindustries.selftrucking.models.DriverResponse;
|
||||
import com.utopiaindustries.selftrucking.models.PickResponse;
|
||||
import com.utopiaindustries.selftrucking.models.PickupRequest;
|
||||
import com.utopiaindustries.selftrucking.models.PickupRequestForComplete;
|
||||
import com.utopiaindustries.selftrucking.utils.ProgressDialogFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ContainerDetailActivity extends AppCompatActivity {
|
||||
|
||||
TextView container_no, container_origin, containerDestination, driverId, driverName;
|
||||
TextView container_no, container_origin, containerDestination, driverId, driverName, container_status;
|
||||
Button btnMarkPicked;
|
||||
//FoodDetailObj singleList;
|
||||
ContainerWorkflow containerWorkflow;
|
||||
String truckerId = "";
|
||||
String truckerName = "";
|
||||
HomeViewModel homeViewModel;
|
||||
String currentStatus = "PICKED";
|
||||
int currentPosition = 0;
|
||||
DriverResponse driverResponse;
|
||||
List<ContainerWorkflow> containerList = new ArrayList<>();
|
||||
ImageView img_back;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -45,18 +59,59 @@ public class ContainerDetailActivity extends AppCompatActivity {
|
|||
return insets;
|
||||
});
|
||||
|
||||
if( !Helper.isNetworkConnected(this) ){
|
||||
Toast.makeText( this, "No Internet Connection", Toast.LENGTH_LONG ).show();
|
||||
}
|
||||
|
||||
initializeLayout();
|
||||
|
||||
img_back.setOnClickListener(v -> finish());
|
||||
|
||||
btnMarkPicked.setOnClickListener(v -> {
|
||||
|
||||
/*if (currentStatus.equalsIgnoreCase("DROPPED")) {
|
||||
PickupRequestForComplete request = new PickupRequestForComplete(containerWorkflow.getOriginId(),
|
||||
containerWorkflow.getDestinationId(),
|
||||
containerWorkflow.getContainerNo(),
|
||||
currentStatus,
|
||||
50,
|
||||
"USD",
|
||||
Integer.parseInt(truckerId),
|
||||
containerWorkflow.getTruckLoadId() != null ? containerWorkflow.getTruckLoadId() : 0);
|
||||
|
||||
Log.e("Pick-Request: ", ""+ request.toString());
|
||||
homeViewModel.pickTruckLoad(request);
|
||||
}
|
||||
else {
|
||||
PickupRequest request = new PickupRequest(containerWorkflow.getOriginId(),
|
||||
containerWorkflow.getDestinationId(),
|
||||
containerWorkflow.getContainerNo(),
|
||||
currentStatus,
|
||||
50,
|
||||
"USD",
|
||||
Integer.parseInt(truckerId));
|
||||
Log.e("Pick-Request: ", "" + request.toString());
|
||||
}*/
|
||||
|
||||
/*if (currentStatus.equalsIgnoreCase("DROPPED")) {
|
||||
Log.e("Pick-Request: ", "DROPPED "+currentStatus);
|
||||
}
|
||||
else {
|
||||
Log.e("Pick-Request: ", "ELSE "+currentStatus);
|
||||
}*/
|
||||
|
||||
PickupRequest request = new PickupRequest(containerWorkflow.getOriginId(),
|
||||
containerWorkflow.getDestinationId(),
|
||||
containerWorkflow.getContainerNo(),
|
||||
currentStatus,
|
||||
50,
|
||||
"USD",
|
||||
Integer.parseInt(truckerId),
|
||||
containerWorkflow.getTruckLoadId() != null ? containerWorkflow.getTruckLoadId() : 0);
|
||||
|
||||
// Log.e("Pick-Request: ", ""+ request.toString());
|
||||
homeViewModel.pickTruckLoad(request);
|
||||
Toast.makeText(this, "Container marked as picked", Toast.LENGTH_SHORT).show();
|
||||
|
||||
//Toast.makeText(this, "Container marked as picked", Toast.LENGTH_SHORT).show();
|
||||
|
||||
//Intent intent = new Intent(ContainerDetailActivity.this, TrackingActivity.class);
|
||||
//intent.putExtra("container_id", container.getContainerId());
|
||||
|
@ -69,14 +124,23 @@ public class ContainerDetailActivity extends AppCompatActivity {
|
|||
container_no = findViewById(R.id.container_no);
|
||||
container_origin = findViewById(R.id.container_origin);
|
||||
containerDestination = findViewById(R.id.container_destination);
|
||||
container_status = findViewById(R.id.container_status);
|
||||
driverId = findViewById(R.id.driver_Id);
|
||||
driverName = findViewById(R.id.driver_name);
|
||||
btnMarkPicked = findViewById(R.id.btn_mark_picked);
|
||||
img_back = findViewById(R.id.img_back);
|
||||
homeViewModel = new ViewModelProvider(this).get(HomeViewModel.class);
|
||||
|
||||
containerWorkflow = (ContainerWorkflow) getIntent().getSerializableExtra("SingleContainerInfo");
|
||||
|
||||
truckerId = getIntent().getStringExtra("TruckerId");
|
||||
truckerName = getIntent().getStringExtra("TruckerName");
|
||||
currentPosition = getIntent().getIntExtra("position",0);
|
||||
// Log.e("currentPosition: ",""+currentPosition);
|
||||
|
||||
driverResponse = Helper.getPreferenceObjectJson(this, "DriverResponse");
|
||||
//assert driverResponse != null;
|
||||
//containerList.addAll(driverResponse.getContainerWorkflowData());
|
||||
|
||||
homeViewModel.getLoadingState().observe(this, isLoading -> {
|
||||
if (isLoading != null && isLoading) {
|
||||
|
@ -86,11 +150,69 @@ public class ContainerDetailActivity extends AppCompatActivity {
|
|||
}
|
||||
});
|
||||
|
||||
homeViewModel.getErrorMessage().observe(this, errorResponse -> {
|
||||
Toast.makeText(this, errorResponse, Toast.LENGTH_SHORT).show();
|
||||
});
|
||||
|
||||
homeViewModel.getPickLiveData().observe(this, pickResponse -> {
|
||||
if (pickResponse != null) {
|
||||
Log.d("API", "Message: " + pickResponse.getMessage());
|
||||
Log.d("API", "Status: " + pickResponse.isStatus());
|
||||
Toast.makeText(ContainerDetailActivity.this,pickResponse.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
//Log.d("API", "Message: " + pickResponse.getMessage());
|
||||
//Log.d("API", "Status: " + pickResponse.getStatus());
|
||||
|
||||
Toast.makeText(this, pickResponse.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
ContainerWorkflow containerToUpdate = driverResponse.getContainerWorkflowData().get(currentPosition);
|
||||
|
||||
// Modify the values
|
||||
|
||||
containerToUpdate.setCurrentStatus(pickResponse.getTruckLoad().getStatus());
|
||||
containerToUpdate.setTruckLoadId(pickResponse.getTruckLoad().getTruckLoadId());
|
||||
|
||||
Helper.setPreferenceObject(getApplicationContext(), driverResponse, "DriverResponse");
|
||||
|
||||
DriverResponse driverResponse1 = Helper.getPreferenceObjectJson(getApplicationContext(), "DriverResponse");
|
||||
ContainerWorkflow containerToUpdate1 = driverResponse1.getContainerWorkflowData().get(currentPosition);
|
||||
containerWorkflow = driverResponse1.getContainerWorkflowData().get(currentPosition);
|
||||
//Log.e("driverResponse1: ",""+driverResponse1.getContainerWorkflowData());
|
||||
|
||||
/*Log.e("After Update: ","****************************************");
|
||||
Log.e("containerToUpdate1-ContainerNo: ",""+containerWorkflow.getContainerNo());
|
||||
Log.e("containerToUpdate1-OriginId: ",""+containerWorkflow.getOriginId());
|
||||
Log.e("containerToUpdate1-origin: ",""+containerWorkflow.getOrigin());
|
||||
Log.e("containerToUpdate1-destination: ",""+containerWorkflow.getDestination());
|
||||
Log.e("containerToUpdate1-destinationId: ",""+containerWorkflow.getDestinationId());
|
||||
Log.e("containerToUpdate1-Status: ",""+containerWorkflow.getCurrentStatus());
|
||||
Log.e("containerToUpdate1-truckLoadId: ",""+containerWorkflow.getTruckLoadId());*/
|
||||
|
||||
setContainerDetail(containerWorkflow);
|
||||
|
||||
//Toast.makeText(ContainerDetailActivity.this,pickResponse.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
|
||||
/*if (driverResponse != null && driverResponse.getContainerWorkflowData() != null
|
||||
&& currentPosition < driverResponse.getContainerWorkflowData().size()) {
|
||||
ContainerWorkflow containerToUpdate = driverResponse.getContainerWorkflowData().get(currentPosition);
|
||||
|
||||
// Modify the values
|
||||
|
||||
containerToUpdate.setCurrentStatus(pickResponse.getTruckLoad().getStatus());
|
||||
containerToUpdate.setTruckLoadId(pickResponse.getTruckLoad().getTruckLoadId());
|
||||
|
||||
Helper.setPreferenceObject(getApplicationContext(), driverResponse, "DriverResponse");
|
||||
|
||||
DriverResponse driverResponse1 = Helper.getPreferenceObjectJson(getApplicationContext(), "DriverResponse");
|
||||
ContainerWorkflow containerToUpdate1 = driverResponse1.getContainerWorkflowData().get(currentPosition);
|
||||
containerWorkflow = driverResponse1.getContainerWorkflowData().get(currentPosition);
|
||||
|
||||
Log.e("After Update: ","****************************************");
|
||||
Log.e("containerToUpdate1-ContainerNo: ",""+containerWorkflow.getContainerNo());
|
||||
Log.e("containerToUpdate1-OriginId: ",""+containerWorkflow.getOriginId());
|
||||
Log.e("containerToUpdate1-origin: ",""+containerWorkflow.getOrigin());
|
||||
Log.e("containerToUpdate1-destination: ",""+containerWorkflow.getDestination());
|
||||
Log.e("containerToUpdate1-destinationId: ",""+containerWorkflow.getDestinationId());
|
||||
Log.e("containerToUpdate1-Status: ",""+containerWorkflow.getCurrentStatus());
|
||||
Log.e("containerToUpdate1-truckLoadId: ",""+containerWorkflow.getTruckLoadId());
|
||||
|
||||
setContainerDetail(containerWorkflow);
|
||||
}*/
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -100,11 +222,68 @@ public class ContainerDetailActivity extends AppCompatActivity {
|
|||
|
||||
private void setContainerDetail(ContainerWorkflow containerWorkflow) {
|
||||
|
||||
/* Log.e("Before Update: ","****************************************");
|
||||
Log.e("containerToUpdate1-ContainerNo: ",""+containerWorkflow.getContainerNo());
|
||||
Log.e("containerToUpdate1-OriginId: ",""+containerWorkflow.getOriginId());
|
||||
Log.e("containerToUpdate1-origin: ",""+containerWorkflow.getOrigin());
|
||||
Log.e("containerToUpdate1-destination: ",""+containerWorkflow.getDestination());
|
||||
Log.e("containerToUpdate1-destinationId: ",""+containerWorkflow.getDestinationId());
|
||||
Log.e("containerToUpdate1-Status: ",""+containerWorkflow.getCurrentStatus());
|
||||
Log.e("containerToUpdate1-truckLoadId: ",""+containerWorkflow.getTruckLoadId());*/
|
||||
|
||||
container_no.setText(Html.fromHtml("<b>Container No:</b> " + containerWorkflow.getContainerNo(), Html.FROM_HTML_MODE_LEGACY));
|
||||
container_origin.setText(Html.fromHtml("<b>Container Origin:</b> " + containerWorkflow.getOrigin(), Html.FROM_HTML_MODE_LEGACY));
|
||||
containerDestination.setText(Html.fromHtml("<b>Container Destination:</b> " + containerWorkflow.getDestination(), Html.FROM_HTML_MODE_LEGACY));
|
||||
driverId.setText(Html.fromHtml("<b>Driver Id:</b> " + truckerId, Html.FROM_HTML_MODE_LEGACY));
|
||||
driverName.setText(Html.fromHtml("<b>Driver Name:</b> " + truckerName, Html.FROM_HTML_MODE_LEGACY));
|
||||
currentStatus = containerWorkflow.getCurrentStatus();
|
||||
|
||||
if (containerWorkflow.getCurrentStatus() != null && !containerWorkflow.getCurrentStatus().equalsIgnoreCase("")) {
|
||||
container_status.setText(Html.fromHtml("<b>Container Status:</b> " + containerWorkflow.getCurrentStatus(), Html.FROM_HTML_MODE_LEGACY));
|
||||
}
|
||||
else {
|
||||
container_status.setText(Html.fromHtml("<b>Container Status:</b> " + "Assigned", Html.FROM_HTML_MODE_LEGACY));
|
||||
}
|
||||
|
||||
if (containerWorkflow.getCurrentStatus() != null) {
|
||||
// Log.e("Status: ",""+(containerWorkflow.getCurrentStatus().toLowerCase()));
|
||||
switch (containerWorkflow.getCurrentStatus()) {
|
||||
|
||||
|
||||
case "PICKED":
|
||||
btnMarkPicked.setBackgroundColor(ContextCompat.getColor(this, R.color.picked_color));
|
||||
btnMarkPicked.setText("Mark it Dropped");
|
||||
currentStatus = "DROPPED";
|
||||
break;
|
||||
|
||||
case "DROPPED":
|
||||
btnMarkPicked.setBackgroundColor(ContextCompat.getColor(this, R.color.dropped_color));
|
||||
btnMarkPicked.setText("Mark it Completed");
|
||||
currentStatus = "COMPLETED";
|
||||
break;
|
||||
|
||||
case "COMPLETED":
|
||||
//btnMarkPicked.setBackgroundColor(ContextCompat.getColor(this, R.color.completed_color));
|
||||
btnMarkPicked.setText("Mark it Picked");
|
||||
currentStatus = "PICKED";
|
||||
|
||||
Intent myIntent = new Intent(ContainerDetailActivity.this, HomeActivity.class);
|
||||
myIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(myIntent);
|
||||
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
|
||||
finish();
|
||||
break;
|
||||
|
||||
default:
|
||||
btnMarkPicked.setBackgroundColor(ContextCompat.getColor(this, R.color.theme_color));
|
||||
btnMarkPicked.setText("Mark it Picked");
|
||||
currentStatus = "PICKED";
|
||||
}
|
||||
}
|
||||
else {
|
||||
btnMarkPicked.setBackgroundColor(ContextCompat.getColor(this, R.color.theme_color));
|
||||
currentStatus = "PICKED";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -6,9 +6,13 @@ import android.graphics.Color;
|
|||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
@ -47,17 +51,18 @@ import retrofit2.Response;
|
|||
|
||||
public class HomeActivity extends AppCompatActivity implements SelectListener {
|
||||
|
||||
//String[] item = {"Material", "Design", "Components", "Android", "5.0 Lollipop"};
|
||||
//AutoCompleteTextView autoCompleteTextView;
|
||||
//ArrayAdapter<String> adapterItems;
|
||||
String[] item = {"All", "Assigned", "Picked", "Dropped", "Completed"};
|
||||
AutoCompleteTextView autoCompleteTextView;
|
||||
ArrayAdapter<String> adapterItems;
|
||||
HomeViewModel homeViewModel;
|
||||
RecyclerView containerRecyclerView;
|
||||
ContainerAdapter adapter;
|
||||
List<ContainerWorkflow> containerList = new ArrayList<>();
|
||||
List<ContainerWorkflow> tempList = new ArrayList<>();
|
||||
ApiService apiService;
|
||||
MotiveApiService motiveApiService;
|
||||
DriverResponse driverResponse;
|
||||
TextView txtDriverName;
|
||||
TextView txtDriverName, txtNoData;
|
||||
ImageView imgLogout;
|
||||
|
||||
@Override
|
||||
|
@ -71,16 +76,21 @@ public class HomeActivity extends AppCompatActivity implements SelectListener {
|
|||
return insets;
|
||||
});
|
||||
|
||||
if (!Helper.isNetworkConnected(this)) {
|
||||
Toast.makeText(this, "No Internet Connection", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
initializeLayout();
|
||||
|
||||
/*autoCompleteTextView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
autoCompleteTextView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
|
||||
String item = adapterView.getItemAtPosition(position).toString();
|
||||
Log.e("Item: ", ""+ item);
|
||||
Log.e("Item-----------: ", "" + item);
|
||||
filterList(item);
|
||||
|
||||
}
|
||||
});*/
|
||||
});
|
||||
|
||||
imgLogout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -90,7 +100,6 @@ public class HomeActivity extends AppCompatActivity implements SelectListener {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
public void initializeLayout() {
|
||||
homeViewModel = new ViewModelProvider(this).get(HomeViewModel.class);
|
||||
containerRecyclerView = findViewById(R.id.container_list);
|
||||
|
@ -98,54 +107,69 @@ public class HomeActivity extends AppCompatActivity implements SelectListener {
|
|||
apiService = ApiServiceFactory.getApiService();
|
||||
motiveApiService = ApiServiceFactory.getMotiveApiService();
|
||||
txtDriverName = findViewById(R.id.txt_driver_name);
|
||||
txtNoData = findViewById(R.id.txt_no_data);
|
||||
imgLogout = findViewById(R.id.img_logout);
|
||||
|
||||
driverResponse = Helper.getPreferenceObjectJson(this, "DriverResponse");
|
||||
assert driverResponse != null;
|
||||
containerList.addAll(driverResponse.getContainerWorkflowData());
|
||||
|
||||
//dummyData();
|
||||
txtDriverName.setText(Html.fromHtml("Welcome: " + driverResponse.getTruckerName(), Html.FROM_HTML_MODE_LEGACY));
|
||||
|
||||
adapter = new ContainerAdapter(containerList, this);
|
||||
containerRecyclerView.setAdapter(adapter);
|
||||
|
||||
/*autoCompleteTextView = findViewById(R.id.auto_complete_textview);
|
||||
autoCompleteTextView = findViewById(R.id.auto_complete_textview);
|
||||
adapterItems = new ArrayAdapter<String>(this, R.layout.list_items, item);
|
||||
autoCompleteTextView.setAdapter(adapterItems);*/
|
||||
autoCompleteTextView.setAdapter(adapterItems);
|
||||
if (item.length > 0) {
|
||||
autoCompleteTextView.setText(item[0], false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void filterList(String status) {
|
||||
containerList.clear();
|
||||
for (ContainerWorkflow cx : tempList) {
|
||||
Log.e("tempList-status: ", "" + cx.getCurrentStatus());
|
||||
}
|
||||
|
||||
|
||||
if (status.equals("All")) {
|
||||
containerList.addAll(tempList);
|
||||
} /*else if (status.equalsIgnoreCase("Assigned")) {
|
||||
for (ContainerWorkflow item : tempList) {
|
||||
if (item.getCurrentStatus() != null
|
||||
&& !item.getCurrentStatus().equalsIgnoreCase("Picked")
|
||||
&& !item.getCurrentStatus().equalsIgnoreCase("Dropped")
|
||||
&& !item.getCurrentStatus().equalsIgnoreCase("Completed")) {
|
||||
containerList.add(item);
|
||||
}
|
||||
}
|
||||
}*/ else {
|
||||
for (ContainerWorkflow item : tempList) {
|
||||
if (item.getCurrentStatus() != null && item.getCurrentStatus().equalsIgnoreCase(status)) {
|
||||
containerList.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!containerList.isEmpty()) {
|
||||
txtNoData.setVisibility(View.GONE);
|
||||
} else {
|
||||
txtNoData.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClicked(ContainerWorkflow container) {
|
||||
Toast.makeText(this, String.valueOf(container.getContainerNo()), Toast.LENGTH_SHORT).show();
|
||||
public void onItemClicked(ContainerWorkflow container, int pos) {
|
||||
if (container.getCurrentStatus() != null && container.getCurrentStatus().equalsIgnoreCase("COMPLETED")) {
|
||||
Toast.makeText(this, "Already Completed", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
//Toast.makeText(this, String.valueOf(container.getContainerNo()), Toast.LENGTH_SHORT).show();
|
||||
|
||||
Intent intent = new Intent(HomeActivity.this, ContainerDetailActivity.class);
|
||||
intent.putExtra("TruckerId", driverResponse.getTruckerId().toString());
|
||||
intent.putExtra("TruckerName", driverResponse.getTruckerName());
|
||||
intent.putExtra("position", pos);
|
||||
intent.putExtra("SingleContainerInfo", (Serializable) container);
|
||||
startActivity(intent);
|
||||
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*public void dummyData() {
|
||||
Container container1 = new Container("1","Karachi To Lahore","Assigned","11","abc");
|
||||
Container container2 = new Container("2","Lahore To Lahore","Assigned","11","abc");
|
||||
Container container3 = new Container("3","Islamabad To Lahore","Assigned","11","abc");
|
||||
Container container4 = new Container("4","Peshawar To Lahore","Assigned","11","abc");
|
||||
Container container5 = new Container("5","Multan To Lahore","Assigned","11","abc");
|
||||
Container container6 = new Container("6","Faisalabad To Lahore","Assigned","11","abc");
|
||||
Container container7 = new Container("7","Quetta To Lahore","Assigned","11","abc");
|
||||
|
||||
containerList.add(container1);
|
||||
containerList.add(container2);
|
||||
containerList.add(container3);
|
||||
containerList.add(container4);
|
||||
containerList.add(container5);
|
||||
containerList.add(container6);
|
||||
containerList.add(container7);
|
||||
}*/
|
||||
}
|
||||
|
||||
private void fetchAssignedContainers() {
|
||||
apiService.fetchAllReports("").enqueue(new Callback<List<Container>>() {
|
||||
|
@ -153,8 +177,7 @@ public class HomeActivity extends AppCompatActivity implements SelectListener {
|
|||
public void onResponse(Call<List<Container>> call, Response<List<Container>> response) {
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -226,4 +249,28 @@ public class HomeActivity extends AppCompatActivity implements SelectListener {
|
|||
|
||||
alertDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
containerList.clear();
|
||||
tempList.clear();
|
||||
driverResponse = Helper.getPreferenceObjectJson(this, "DriverResponse");
|
||||
assert driverResponse != null;
|
||||
containerList.addAll(driverResponse.getContainerWorkflowData());
|
||||
tempList.addAll(driverResponse.getContainerWorkflowData());
|
||||
|
||||
//dummyData();
|
||||
txtDriverName.setText(Html.fromHtml("Welcome: " + "<b>" + driverResponse.getTruckerName() + "</b>", Html.FROM_HTML_MODE_LEGACY));
|
||||
|
||||
adapter = new ContainerAdapter(containerList, this, HomeActivity.this);
|
||||
containerRecyclerView.setAdapter(adapter);
|
||||
|
||||
if (!containerList.isEmpty()) {
|
||||
txtNoData.setVisibility(View.GONE);
|
||||
} else {
|
||||
txtNoData.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package com.utopiaindustries.selftrucking.Activities.dashboardScreens.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.Html;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -7,8 +9,11 @@ import android.view.ViewGroup;
|
|||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.utopiaindustries.selftrucking.Activities.dashboardScreens.ContainerDetailActivity;
|
||||
import com.utopiaindustries.selftrucking.Activities.dashboardScreens.HomeActivity;
|
||||
import com.utopiaindustries.selftrucking.Activities.dashboardScreens.interfaces.SelectListener;
|
||||
import com.utopiaindustries.selftrucking.models.Container;
|
||||
import com.utopiaindustries.selftrucking.R;
|
||||
|
@ -20,10 +25,12 @@ public class ContainerAdapter extends RecyclerView.Adapter<ContainerAdapter.Cont
|
|||
|
||||
private List<ContainerWorkflow> containerList;
|
||||
private SelectListener listener;
|
||||
private Context context;
|
||||
|
||||
public ContainerAdapter(List<ContainerWorkflow> containerList, SelectListener listener) {
|
||||
public ContainerAdapter(List<ContainerWorkflow> containerList, SelectListener listener, Context context) {
|
||||
this.containerList = containerList;
|
||||
this.listener = listener;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
@ -37,12 +44,40 @@ public class ContainerAdapter extends RecyclerView.Adapter<ContainerAdapter.Cont
|
|||
public void onBindViewHolder(@NonNull ContainerViewHolder holder, int position) {
|
||||
ContainerWorkflow container = containerList.get(position);
|
||||
|
||||
holder.container_no.setText(Html.fromHtml("<b>Container No:</b> " + container.getContainerNo(), Html.FROM_HTML_MODE_LEGACY));
|
||||
holder.container_origin.setText(Html.fromHtml("<b>Container Origin:</b> " + container.getOrigin(), Html.FROM_HTML_MODE_LEGACY));
|
||||
holder.container_destination.setText(Html.fromHtml("<b>Container Destination:</b> " + container.getDestination(), Html.FROM_HTML_MODE_LEGACY));
|
||||
//holder.container_no.setText(Html.fromHtml("<b>Container No:</b> " + container.getContainerNo(), Html.FROM_HTML_MODE_LEGACY));
|
||||
holder.container_no.setText(container.getContainerNo());
|
||||
holder.container_origin.setText(container.getOrigin());
|
||||
holder.container_destination.setText(container.getDestination());
|
||||
if (container.getCurrentStatus() != null && !container.getCurrentStatus().equalsIgnoreCase("")) {
|
||||
holder.container_status.setText(container.getCurrentStatus());
|
||||
} else {
|
||||
holder.container_status.setText("Assigned");
|
||||
}
|
||||
|
||||
holder.itemView.setOnClickListener(v -> listener.onItemClicked(container));
|
||||
if (container.getCurrentStatus() != null && !container.getCurrentStatus().equalsIgnoreCase("")) {
|
||||
switch (container.getCurrentStatus()) {
|
||||
|
||||
case "PICKED":
|
||||
holder.container_status.setBackgroundColor(ContextCompat.getColor(context, R.color.picked_color));
|
||||
break;
|
||||
|
||||
case "DROPPED":
|
||||
holder.container_status.setBackgroundColor(ContextCompat.getColor(context, R.color.dropped_color));
|
||||
break;
|
||||
|
||||
case "COMPLETED":
|
||||
holder.container_status.setBackgroundColor(ContextCompat.getColor(context, R.color.completed_color));
|
||||
break;
|
||||
|
||||
default:
|
||||
holder.container_status.setBackgroundColor(ContextCompat.getColor(context, R.color.theme_color));
|
||||
|
||||
}
|
||||
} else {
|
||||
holder.container_status.setBackgroundColor(ContextCompat.getColor(context, R.color.theme_color));
|
||||
}
|
||||
|
||||
holder.itemView.setOnClickListener(v -> listener.onItemClicked(container, position));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -51,13 +86,14 @@ public class ContainerAdapter extends RecyclerView.Adapter<ContainerAdapter.Cont
|
|||
}
|
||||
|
||||
public static class ContainerViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView container_no, container_origin, container_destination;
|
||||
TextView container_no, container_origin, container_destination, container_status;
|
||||
|
||||
public ContainerViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
container_no = itemView.findViewById(R.id.container_no);
|
||||
container_origin = itemView.findViewById(R.id.container_origin);
|
||||
container_destination = itemView.findViewById(R.id.container_destination);
|
||||
container_status = itemView.findViewById(R.id.container_status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public interface ApiService {
|
|||
);
|
||||
|
||||
|
||||
@POST("rest/application/pick-truck-load")
|
||||
@POST("rest/application/save-truck-load")
|
||||
Call<PickResponse> pickTruckLoad(
|
||||
@Body PickupRequest request
|
||||
);
|
||||
|
|
|
@ -3,12 +3,15 @@ package com.utopiaindustries.selftrucking.Activities.dashboardScreens.apiservice
|
|||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
public class RetrofitClient {
|
||||
|
||||
private final static String BASE_URL = "http://192.168.90.228:8080/cosmos/";//"http://192.168.90.27:8080/uind/";
|
||||
private final static String BASE_URL = "http://192.168.90.228:8081/cosmos/";//"http://192.168.90.27:8080/uind/";
|
||||
|
||||
private static Retrofit retrofit;
|
||||
|
||||
|
@ -18,11 +21,19 @@ public class RetrofitClient {
|
|||
//.registerTypeAdapter(Boolean.class, new BooleanTypeAdapter())
|
||||
.create();
|
||||
|
||||
|
||||
if (retrofit == null) {
|
||||
try {
|
||||
|
||||
OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
||||
.connectTimeout(30, TimeUnit.SECONDS)
|
||||
.readTimeout(30, TimeUnit.SECONDS)
|
||||
.writeTimeout(30, TimeUnit.SECONDS)
|
||||
.build();
|
||||
|
||||
retrofit = new Retrofit.Builder()
|
||||
.baseUrl(BASE_URL)
|
||||
//.client( SSLCheckHttpClient.getOkHttpClient() )
|
||||
.client(okHttpClient)
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build();
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -5,5 +5,5 @@ import com.utopiaindustries.selftrucking.models.ContainerWorkflow;
|
|||
|
||||
public interface SelectListener {
|
||||
|
||||
void onItemClicked(ContainerWorkflow container);
|
||||
void onItemClicked(ContainerWorkflow container, int position);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,10 @@ public class HomeViewModel extends ViewModel {
|
|||
return isLoading;
|
||||
}
|
||||
|
||||
public LiveData<String> getErrorMessage() {
|
||||
return errorLiveData;
|
||||
}
|
||||
|
||||
public void pickTruckLoad(PickupRequest pickupRequest) {
|
||||
|
||||
isLoading.setValue(true);
|
||||
|
@ -45,25 +49,16 @@ public class HomeViewModel extends ViewModel {
|
|||
@Override
|
||||
public void onResponse(Call<PickResponse> call, Response<PickResponse> response) {
|
||||
isLoading.setValue(false);
|
||||
if (response.isSuccessful()) {
|
||||
Log.e("API_CALL", "Successfull.");
|
||||
if (response.isSuccessful()) {
|
||||
userLiveData.setValue(response.body());
|
||||
|
||||
} else {
|
||||
errorLiveData.setValue(response.message());
|
||||
}
|
||||
} else {
|
||||
// Handle the case where the server responds with an error
|
||||
Log.e("API_CALL", "Error: " + response.code());
|
||||
errorLiveData.setValue(response.message());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<PickResponse> call, Throwable t) {
|
||||
// Handle the failure
|
||||
Log.e("API_CALL", "Failed", t);
|
||||
isLoading.setValue(false);
|
||||
errorLiveData.setValue(t.getMessage());
|
||||
}
|
||||
|
|
|
@ -40,6 +40,10 @@ public class LoginActivity extends AppCompatActivity {
|
|||
return insets;
|
||||
});
|
||||
|
||||
if( !Helper.isNetworkConnected(this) ){
|
||||
Toast.makeText( this, "No Internet Connection", Toast.LENGTH_LONG ).show();
|
||||
}
|
||||
|
||||
initializeLayouts();
|
||||
|
||||
btnLogin.setOnClickListener(v -> {
|
||||
|
@ -69,6 +73,10 @@ public class LoginActivity extends AppCompatActivity {
|
|||
}
|
||||
});
|
||||
|
||||
loginViewModel.getErrorMessage().observe(this, errorResponse -> {
|
||||
Toast.makeText(this, errorResponse, Toast.LENGTH_SHORT).show();
|
||||
});
|
||||
|
||||
loginViewModel.getUserLiveData().observe(this, user -> {
|
||||
if (user != null) {
|
||||
Preference.setMyBooleanPref(Helper.project_file, "isLoggedIn", getApplicationContext(), true);
|
||||
|
|
|
@ -35,6 +35,10 @@ public class LoginViewModel extends ViewModel {
|
|||
return isLoading;
|
||||
}
|
||||
|
||||
public LiveData<String> getErrorMessage() {
|
||||
return errorLiveData;
|
||||
}
|
||||
|
||||
public void authenticateUser(String user, String password) {
|
||||
isLoading.setValue(true);
|
||||
apiService.isUserAuthenticated(user, password).enqueue(new Callback<DriverResponse>() {
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.utopiaindustries.selftrucking.helper;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
@ -38,4 +40,10 @@ public class Helper {
|
|||
DriverResponse selectedUser = gson.fromJson(json, DriverResponse.class);
|
||||
return selectedUser;
|
||||
}
|
||||
|
||||
public static boolean isNetworkConnected(Context context) {
|
||||
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo activeNetwork = connectivityManager.getActiveNetworkInfo();
|
||||
return activeNetwork != null && activeNetwork.isConnectedOrConnecting();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,13 @@ public class ContainerWorkflow implements Serializable {
|
|||
@SerializedName("destination")
|
||||
@Expose
|
||||
private String destination;
|
||||
@SerializedName("currentStatus")
|
||||
@Expose
|
||||
private String currentStatus = "Assigned";
|
||||
@SerializedName("truckLoadId")
|
||||
@Expose
|
||||
private Integer truckLoadId;
|
||||
|
||||
|
||||
public String getContainerNo() {
|
||||
return containerNo;
|
||||
|
@ -63,4 +70,20 @@ public class ContainerWorkflow implements Serializable {
|
|||
public void setDestinationId(Integer destinationId) {
|
||||
this.destinationId = destinationId;
|
||||
}
|
||||
|
||||
public String getCurrentStatus() {
|
||||
return currentStatus;
|
||||
}
|
||||
|
||||
public void setCurrentStatus(String currentStatus) {
|
||||
this.currentStatus = currentStatus;
|
||||
}
|
||||
|
||||
public Integer getTruckLoadId() {
|
||||
return truckLoadId;
|
||||
}
|
||||
|
||||
public void setTruckLoadId(Integer truckLoadId) {
|
||||
this.truckLoadId = truckLoadId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,28 @@
|
|||
package com.utopiaindustries.selftrucking.models;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class PickResponse {
|
||||
|
||||
@SerializedName("truck_load")
|
||||
@Expose
|
||||
private TruckLoad truckLoad;
|
||||
@SerializedName("message")
|
||||
@Expose
|
||||
private String message;
|
||||
private boolean status;
|
||||
@SerializedName("status")
|
||||
@Expose
|
||||
private Boolean status;
|
||||
|
||||
public TruckLoad getTruckLoad() {
|
||||
return truckLoad;
|
||||
}
|
||||
|
||||
public void setTruckLoad(TruckLoad truckLoad) {
|
||||
this.truckLoad = truckLoad;
|
||||
}
|
||||
|
||||
// Getters and setters
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
@ -14,11 +31,12 @@ public class PickResponse {
|
|||
this.message = message;
|
||||
}
|
||||
|
||||
public boolean isStatus() {
|
||||
public Boolean getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(boolean status) {
|
||||
public void setStatus(Boolean status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,17 +6,21 @@ public class PickupRequest {
|
|||
private int dropoffLocation;
|
||||
private String loadTypeId;
|
||||
private double agreedAmount;
|
||||
private String status;
|
||||
private String agreedAmountCurrency;
|
||||
private int assignedToDriver;
|
||||
private int truckLoadId;
|
||||
|
||||
public PickupRequest(int pickupLocation, int dropoffLocation, String loadTypeId,
|
||||
double agreedAmount, String agreedAmountCurrency, int assignedToDriver) {
|
||||
public PickupRequest(int pickupLocation, int dropoffLocation, String loadTypeId, String status,
|
||||
double agreedAmount, String agreedAmountCurrency, int assignedToDriver, int truckLoadId) {
|
||||
this.pickupLocation = pickupLocation;
|
||||
this.dropoffLocation = dropoffLocation;
|
||||
this.loadTypeId = loadTypeId;
|
||||
this.status = status;
|
||||
this.agreedAmount = agreedAmount;
|
||||
this.agreedAmountCurrency = agreedAmountCurrency;
|
||||
this.assignedToDriver = assignedToDriver;
|
||||
this.truckLoadId = truckLoadId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,8 +30,10 @@ public class PickupRequest {
|
|||
", dropoffLocation=" + dropoffLocation +
|
||||
", loadTypeId='" + loadTypeId + '\'' +
|
||||
", agreedAmount=" + agreedAmount +
|
||||
", status='" + status + '\'' +
|
||||
", agreedAmountCurrency='" + agreedAmountCurrency + '\'' +
|
||||
", assignedToDriver=" + assignedToDriver +
|
||||
", truckLoadId=" + truckLoadId +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package com.utopiaindustries.selftrucking.models;
|
||||
|
||||
public class PickupRequestForComplete {
|
||||
|
||||
private int pickupLocation;
|
||||
private int dropoffLocation;
|
||||
private String loadTypeId;
|
||||
private double agreedAmount;
|
||||
private String status;
|
||||
private String agreedAmountCurrency;
|
||||
private int assignedToDriver;
|
||||
private int truckLoadId;
|
||||
|
||||
public PickupRequestForComplete(int pickupLocation, int dropoffLocation, String loadTypeId, String status,
|
||||
double agreedAmount, String agreedAmountCurrency, int assignedToDriver, int truckLoadId) {
|
||||
this.pickupLocation = pickupLocation;
|
||||
this.dropoffLocation = dropoffLocation;
|
||||
this.loadTypeId = loadTypeId;
|
||||
this.status = status;
|
||||
this.agreedAmount = agreedAmount;
|
||||
this.agreedAmountCurrency = agreedAmountCurrency;
|
||||
this.assignedToDriver = assignedToDriver;
|
||||
this.truckLoadId = truckLoadId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PickupRequest{" +
|
||||
"pickupLocation=" + pickupLocation +
|
||||
", dropoffLocation=" + dropoffLocation +
|
||||
", loadTypeId='" + loadTypeId + '\'' +
|
||||
", agreedAmount=" + agreedAmount +
|
||||
", status='" + status + '\'' +
|
||||
", agreedAmountCurrency='" + agreedAmountCurrency + '\'' +
|
||||
", assignedToDriver=" + assignedToDriver +
|
||||
", truckLoadId=" + truckLoadId +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,164 @@
|
|||
|
||||
package com.utopiaindustries.selftrucking.models;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class TruckLoad {
|
||||
|
||||
@SerializedName("truckLoadId")
|
||||
@Expose
|
||||
private Integer truckLoadId;
|
||||
@SerializedName("dateCreated")
|
||||
@Expose
|
||||
private String dateCreated;
|
||||
@SerializedName("createdBy")
|
||||
@Expose
|
||||
private String createdBy;
|
||||
@SerializedName("pickupLocation")
|
||||
@Expose
|
||||
private Integer pickupLocation;
|
||||
@SerializedName("dropoffLocation")
|
||||
@Expose
|
||||
private Integer dropoffLocation;
|
||||
@SerializedName("status")
|
||||
@Expose
|
||||
private String status;
|
||||
@SerializedName("loadType")
|
||||
@Expose
|
||||
private String loadType;
|
||||
@SerializedName("loadTypeId")
|
||||
@Expose
|
||||
private String loadTypeId;
|
||||
@SerializedName("agreedAmount")
|
||||
@Expose
|
||||
private Double agreedAmount;
|
||||
@SerializedName("agreedAmountCurrency")
|
||||
@Expose
|
||||
private String agreedAmountCurrency;
|
||||
@SerializedName("assignedToDriver")
|
||||
@Expose
|
||||
private Integer assignedToDriver;
|
||||
@SerializedName("assignedBy")
|
||||
@Expose
|
||||
private String assignedBy;
|
||||
@SerializedName("dateAssigned")
|
||||
@Expose
|
||||
private String dateAssigned;
|
||||
@SerializedName("marketplace")
|
||||
@Expose
|
||||
private String marketplace;
|
||||
|
||||
public Integer getTruckLoadId() {
|
||||
return truckLoadId;
|
||||
}
|
||||
|
||||
public void setTruckLoadId(Integer truckLoadId) {
|
||||
this.truckLoadId = truckLoadId;
|
||||
}
|
||||
|
||||
public String getDateCreated() {
|
||||
return dateCreated;
|
||||
}
|
||||
|
||||
public void setDateCreated(String dateCreated) {
|
||||
this.dateCreated = dateCreated;
|
||||
}
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public Integer getPickupLocation() {
|
||||
return pickupLocation;
|
||||
}
|
||||
|
||||
public void setPickupLocation(Integer pickupLocation) {
|
||||
this.pickupLocation = pickupLocation;
|
||||
}
|
||||
|
||||
public Integer getDropoffLocation() {
|
||||
return dropoffLocation;
|
||||
}
|
||||
|
||||
public void setDropoffLocation(Integer dropoffLocation) {
|
||||
this.dropoffLocation = dropoffLocation;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getLoadType() {
|
||||
return loadType;
|
||||
}
|
||||
|
||||
public void setLoadType(String loadType) {
|
||||
this.loadType = loadType;
|
||||
}
|
||||
|
||||
public String getLoadTypeId() {
|
||||
return loadTypeId;
|
||||
}
|
||||
|
||||
public void setLoadTypeId(String loadTypeId) {
|
||||
this.loadTypeId = loadTypeId;
|
||||
}
|
||||
|
||||
public Double getAgreedAmount() {
|
||||
return agreedAmount;
|
||||
}
|
||||
|
||||
public void setAgreedAmount(Double agreedAmount) {
|
||||
this.agreedAmount = agreedAmount;
|
||||
}
|
||||
|
||||
public String getAgreedAmountCurrency() {
|
||||
return agreedAmountCurrency;
|
||||
}
|
||||
|
||||
public void setAgreedAmountCurrency(String agreedAmountCurrency) {
|
||||
this.agreedAmountCurrency = agreedAmountCurrency;
|
||||
}
|
||||
|
||||
public Integer getAssignedToDriver() {
|
||||
return assignedToDriver;
|
||||
}
|
||||
|
||||
public void setAssignedToDriver(Integer assignedToDriver) {
|
||||
this.assignedToDriver = assignedToDriver;
|
||||
}
|
||||
|
||||
public String getAssignedBy() {
|
||||
return assignedBy;
|
||||
}
|
||||
|
||||
public void setAssignedBy(String assignedBy) {
|
||||
this.assignedBy = assignedBy;
|
||||
}
|
||||
|
||||
public String getDateAssigned() {
|
||||
return dateAssigned;
|
||||
}
|
||||
|
||||
public void setDateAssigned(String dateAssigned) {
|
||||
this.dateAssigned = dateAssigned;
|
||||
}
|
||||
|
||||
public String getMarketplace() {
|
||||
return marketplace;
|
||||
}
|
||||
|
||||
public void setMarketplace(String marketplace) {
|
||||
this.marketplace = marketplace;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:autoMirrored="true" android:height="24dp" android:tint="#FFFFFF" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
|
||||
|
||||
<path android:fillColor="@android:color/white" android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
|
||||
|
||||
</vector>
|
|
@ -5,6 +5,7 @@
|
|||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
tools:context=".Activities.dashboardScreens.ContainerDetailActivity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
|
@ -24,6 +25,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="Container Detail"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/_15sdp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/toolbar2"
|
||||
app:layout_constraintEnd_toEndOf="@+id/toolbar2"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
@ -46,6 +48,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:textSize="@dimen/_13sdp"
|
||||
android:text="Driver ID: 1234" />
|
||||
|
||||
<TextView
|
||||
|
@ -53,6 +56,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:textSize="@dimen/_13sdp"
|
||||
android:text="Driver Name: John Doe" />
|
||||
|
||||
<TextView
|
||||
|
@ -60,6 +64,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:textSize="@dimen/_13sdp"
|
||||
android:text="Container ID: 1234" />
|
||||
|
||||
<TextView
|
||||
|
@ -67,6 +72,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:textSize="@dimen/_13sdp"
|
||||
android:text="Origin: Warehouse" />
|
||||
|
||||
<TextView
|
||||
|
@ -74,16 +80,35 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:textSize="@dimen/_13sdp"
|
||||
android:text="Destination: Warehouse" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/container_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:textSize="@dimen/_13sdp"
|
||||
android:text="Container Status: Status" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_mark_picked"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="@dimen/_13sdp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="Mark as Picked" />
|
||||
android:text="Mark it Picked" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/toolbar2"
|
||||
app:layout_constraintStart_toStartOf="@+id/toolbar2"
|
||||
app:layout_constraintTop_toTopOf="@+id/toolbar2"
|
||||
app:srcCompat="@drawable/arrow_back" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -5,6 +5,7 @@
|
|||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
tools:context=".Activities.dashboardScreens.HomeActivity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
|
@ -34,23 +35,29 @@
|
|||
android:id="@+id/txt_driver_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/_14sdp"
|
||||
android:text="Welcome"
|
||||
android:padding="5dp"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:padding="5dp"
|
||||
android:text="Welcome"
|
||||
android:textSize="@dimen/_13sdp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toolbar" />
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/container_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="1dp"
|
||||
android:layout_marginEnd="1dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txt_driver_name" />
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="5dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textInputLayout" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_logout"
|
||||
|
@ -62,13 +69,16 @@
|
|||
app:layout_constraintTop_toTopOf="@+id/toolbar"
|
||||
app:srcCompat="@drawable/ic_logout" />
|
||||
|
||||
<!--<com.google.android.material.textfield.TextInputLayout
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textInputLayout"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView2"
|
||||
android:hint="@string/select">
|
||||
android:layout_margin="5dp"
|
||||
android:hint="@string/select"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txt_driver_name">
|
||||
|
||||
<AutoCompleteTextView
|
||||
android:id="@+id/auto_complete_textview"
|
||||
|
@ -76,8 +86,19 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:inputType="none"
|
||||
android:textSize="16sp" />
|
||||
</com.google.android.material.textfield.TextInputLayout>-->
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_no_data"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="List is empty"
|
||||
android:textSize="@dimen/_14sdp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -5,6 +5,7 @@
|
|||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
tools:context=".Activities.loginScreens.LoginActivity">
|
||||
|
||||
<LinearLayout
|
||||
|
@ -32,7 +33,7 @@
|
|||
android:layout_marginBottom="20dp"
|
||||
android:padding="5dp"
|
||||
android:text="Login Now to Continue"
|
||||
android:textSize="18sp" />
|
||||
android:textSize="@dimen/_17sdp" />
|
||||
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
|
@ -81,6 +82,7 @@
|
|||
android:background="@drawable/rounded_btn_login"
|
||||
android:padding="10dp"
|
||||
android:text="Login"
|
||||
android:textSize="@dimen/_15sdp"
|
||||
android:textColor="@color/white"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:indeterminateTint="@color/black"
|
||||
android:indeterminate="true" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -4,36 +4,131 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
app:cardBackgroundColor="@color/grey_50"
|
||||
android:elevation="10dp"
|
||||
app:cardBackgroundColor="@color/grey_100"
|
||||
app:cardPreventCornerOverlap="true"
|
||||
app:cardUseCompatPadding="true">
|
||||
|
||||
<RelativeLayout
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/container_no_heading"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.3"
|
||||
android:padding="5dp"
|
||||
android:text="Container ID:"
|
||||
android:textSize="@dimen/_13sdp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/container_no"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_weight="0.7"
|
||||
android:padding="5dp"
|
||||
android:text="Container ID"
|
||||
android:textSize="@dimen/_13sdp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/container_origin_heading"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/container_no"
|
||||
android:layout_weight="0.3"
|
||||
android:padding="5dp"
|
||||
android:text="Container ID" />
|
||||
android:text="Origin: "
|
||||
android:textSize="@dimen/_13sdp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/container_origin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/container_no"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_weight="0.7"
|
||||
android:padding="5dp"
|
||||
android:text="Origin" />
|
||||
android:text="Origin"
|
||||
android:textSize="@dimen/_13sdp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/container_destination_heading"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/container_origin"
|
||||
android:layout_weight="0.3"
|
||||
android:padding="5dp"
|
||||
android:text="Destination: "
|
||||
android:textSize="@dimen/_13sdp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/container_destination"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/container_origin"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_weight="0.7"
|
||||
android:padding="5dp"
|
||||
android:text="Destination" />
|
||||
android:text="Destination"
|
||||
android:textSize="@dimen/_13sdp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/container_status_heading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:text="Status: "
|
||||
android:textSize="@dimen/_13sdp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/container_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="50dp"
|
||||
android:layout_toRightOf="@+id/container_status_heading"
|
||||
android:padding="5dp"
|
||||
android:text="Status"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/_13sdp" />
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:padding="16dp"
|
||||
android:padding="5dp"
|
||||
android:textAppearance="?attr/textAppearanceSubtitle1">
|
||||
|
||||
</TextView>
|
|
@ -5,6 +5,10 @@
|
|||
|
||||
<color name="theme_color">#64B5F6</color>
|
||||
|
||||
<color name="picked_color">#FFC107</color>
|
||||
<color name="dropped_color">#FF5722</color>
|
||||
<color name="completed_color">#4CAF50</color>
|
||||
|
||||
<color name="blue01">#0099CC</color>
|
||||
<color name="blue02">#079DD0</color>
|
||||
<color name="blue03">#0FA1D3</color>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<resources>
|
||||
<string name="app_name">SelfTrucking-App</string>
|
||||
|
||||
<string name="select">Select Item</string>
|
||||
<string name="select">Select Type</string>
|
||||
|
||||
<string name="map_key">AIzaSyCFRiiIaGtNnpr2OZNfOF95mHVnTSm3Csw</string>
|
||||
|
||||
|
|
Loading…
Reference in New Issue