Implement feedbacks
parent
bed085ee56
commit
6a3940677d
|
@ -161,7 +161,7 @@ public class ContainerDetailActivity extends AppCompatActivity {
|
|||
//Log.d("API", "Status: " + pickResponse.getStatus());
|
||||
|
||||
Toast.makeText(this, pickResponse.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
ContainerWorkflow containerToUpdate = driverResponse.getContainerWorkflowData().get(currentPosition);
|
||||
ContainerWorkflow containerToUpdate = getContainerByNo(driverResponse.getContainerWorkflowData(), containerWorkflow.getContainerNo());
|
||||
|
||||
// Modify the values
|
||||
|
||||
|
@ -172,7 +172,7 @@ public class ContainerDetailActivity extends AppCompatActivity {
|
|||
|
||||
DriverResponse driverResponse1 = Helper.getPreferenceObjectJson(getApplicationContext(), "DriverResponse");
|
||||
ContainerWorkflow containerToUpdate1 = driverResponse1.getContainerWorkflowData().get(currentPosition);
|
||||
containerWorkflow = driverResponse1.getContainerWorkflowData().get(currentPosition);
|
||||
containerWorkflow = getContainerByNo(driverResponse1.getContainerWorkflowData(), containerWorkflow.getContainerNo());//driverResponse1.getContainerWorkflowData().get(currentPosition);
|
||||
//Log.e("driverResponse1: ",""+driverResponse1.getContainerWorkflowData());
|
||||
|
||||
/*Log.e("After Update: ","****************************************");
|
||||
|
@ -218,20 +218,19 @@ public class ContainerDetailActivity extends AppCompatActivity {
|
|||
});
|
||||
|
||||
setContainerDetail(containerWorkflow);
|
||||
}
|
||||
|
||||
public ContainerWorkflow getContainerByNo(List<ContainerWorkflow> containerList, String containerNo) {
|
||||
for (ContainerWorkflow container : containerList) {
|
||||
if (container.getContainerNo().equals(containerNo)) {
|
||||
return container;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
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>Terminal Info:</b> " + containerWorkflow.getOrigin(), Html.FROM_HTML_MODE_LEGACY));
|
||||
containerDestination.setText(Html.fromHtml("<b>Destination:</b> " + containerWorkflow.getDestination(), Html.FROM_HTML_MODE_LEGACY));
|
||||
|
@ -252,14 +251,14 @@ public class ContainerDetailActivity extends AppCompatActivity {
|
|||
|
||||
|
||||
case "PICKED":
|
||||
Preference.setMyIntPref(Helper.project_file, "CurrentPosition",this,3);
|
||||
Preference.setMyIntPref(Helper.project_file, "CurrentPosition",this,2);
|
||||
btnMarkPicked.setBackgroundColor(ContextCompat.getColor(this, R.color.picked_color));
|
||||
btnMarkPicked.setText("Mark it Dropped");
|
||||
currentStatus = "DROPPED";
|
||||
break;
|
||||
|
||||
case "DROPPED":
|
||||
Preference.setMyIntPref(Helper.project_file, "CurrentPosition",this,4);
|
||||
Preference.setMyIntPref(Helper.project_file, "CurrentPosition",this,3);
|
||||
btnMarkPicked.setBackgroundColor(ContextCompat.getColor(this, R.color.dropped_color));
|
||||
btnMarkPicked.setText("Mark it Completed");
|
||||
currentStatus = "COMPLETED";
|
||||
|
|
|
@ -235,6 +235,7 @@ public class HomeActivity extends AppCompatActivity implements SelectListener {
|
|||
//Toast.makeText(con, "Ok", Toast.LENGTH_SHORT).show();
|
||||
|
||||
Preference.setMyBooleanPref(Helper.project_file, "isLoggedIn", getApplicationContext(), false);
|
||||
Preference.setMyIntPref(Helper.project_file, "CurrentPosition",getApplicationContext(),0);
|
||||
|
||||
finish();
|
||||
Intent i = new Intent(HomeActivity.this, LoginActivity.class);
|
||||
|
@ -280,5 +281,19 @@ public class HomeActivity extends AppCompatActivity implements SelectListener {
|
|||
} else {
|
||||
txtNoData.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (item.length > 0) {
|
||||
boolean keyExists = Preference.containsKey(Helper.project_file, "CurrentPosition", this);
|
||||
if (keyExists) {
|
||||
Log.e("Key-Exist: ", "True");
|
||||
currentPositionStatus = Preference.getMyIntPref(Helper.project_file, "CurrentPosition", this);
|
||||
autoCompleteTextView.setText(item[currentPositionStatus], false);
|
||||
filterList(item[currentPositionStatus]);
|
||||
} else {
|
||||
Log.e("Key-Exist: ", "False");
|
||||
autoCompleteTextView.setText(item[0], false);
|
||||
filterList(item[currentPositionStatus]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@ import retrofit2.converter.gson.GsonConverterFactory;
|
|||
|
||||
public class RetrofitClient {
|
||||
|
||||
private final static String BASE_URL = "http://192.168.90.228:8081/cosmos/";//"http://192.168.90.27:8080/uind/";
|
||||
private final static String BASE_URL = "http://192.168.90.228:8080/cosmos/";//"http://192.168.90.27:8080/uind/";
|
||||
|
||||
private static Retrofit retrofit;
|
||||
|
||||
|
@ -26,9 +26,9 @@ public class RetrofitClient {
|
|||
try {
|
||||
|
||||
OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
||||
.connectTimeout(30, TimeUnit.SECONDS)
|
||||
.readTimeout(30, TimeUnit.SECONDS)
|
||||
.writeTimeout(30, TimeUnit.SECONDS)
|
||||
.connectTimeout(40, TimeUnit.SECONDS)
|
||||
.readTimeout(40, TimeUnit.SECONDS)
|
||||
.writeTimeout(40, TimeUnit.SECONDS)
|
||||
.build();
|
||||
|
||||
retrofit = new Retrofit.Builder()
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.utopiaindustries.selftrucking.Activities.dashboardScreens.viewModels
|
|||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
@ -47,9 +48,9 @@ public class HomeViewModel extends ViewModel {
|
|||
isLoading.setValue(true);
|
||||
apiService.pickTruckLoad(pickupRequest).enqueue(new Callback<PickResponse>() {
|
||||
@Override
|
||||
public void onResponse(Call<PickResponse> call, Response<PickResponse> response) {
|
||||
public void onResponse(@NonNull Call<PickResponse> call, @NonNull Response<PickResponse> response) {
|
||||
isLoading.setValue(false);
|
||||
if (response.isSuccessful()) {
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
userLiveData.setValue(response.body());
|
||||
|
||||
} else {
|
||||
|
@ -58,7 +59,7 @@ public class HomeViewModel extends ViewModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<PickResponse> call, Throwable t) {
|
||||
public void onFailure(@NonNull Call<PickResponse> call, @NonNull Throwable t) {
|
||||
isLoading.setValue(false);
|
||||
errorLiveData.setValue(t.getMessage());
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ public class LoginActivity extends AppCompatActivity {
|
|||
}*/
|
||||
|
||||
if (tfEmail.getText().toString().isEmpty()) {
|
||||
message = "Please enter email.";
|
||||
message = "Please enter user name.";
|
||||
returnValue = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public class LoginViewModel extends ViewModel {
|
|||
@Override
|
||||
public void onResponse(Call<DriverResponse> call, Response<DriverResponse> response) {
|
||||
isLoading.setValue(false);
|
||||
if (response.isSuccessful()) {
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
userLiveData.setValue(response.body());
|
||||
} else {
|
||||
errorLiveData.setValue(response.message());
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
android:background="@color/grey_100"
|
||||
tools:context=".Activities.loginScreens.LoginActivity">
|
||||
|
||||
<LinearLayout
|
||||
|
|
Loading…
Reference in New Issue