parent
196aa969d6
commit
a5fe014006
|
@ -4,7 +4,7 @@
|
|||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2024-11-05T12:50:05.084508100Z">
|
||||
<DropdownSelection timestamp="2024-11-06T10:39:51.813244700Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="LocalEmulator" identifier="path=C:\Users\saad.siddiq\.android\avd\Pixel_3_API_35.avd" />
|
||||
|
|
|
@ -38,6 +38,7 @@ dependencies {
|
|||
implementation libs.play.services.maps
|
||||
implementation libs.retrofit
|
||||
implementation libs.converter.gson
|
||||
implementation(libs.preference)
|
||||
testImplementation libs.junit
|
||||
androidTestImplementation libs.ext.junit
|
||||
androidTestImplementation libs.espresso.core
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:icon="@drawable/truck"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:roundIcon="@drawable/truck"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.SelfTruckingApp"
|
||||
android:allowClearUserData="true"
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package com.utopiaindustries.selftrucking.Activities.dashboardScreens;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
@ -12,13 +15,24 @@ import androidx.appcompat.app.AppCompatActivity;
|
|||
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.R;
|
||||
import com.utopiaindustries.selftrucking.models.ContainerWorkflow;
|
||||
import com.utopiaindustries.selftrucking.models.PickResponse;
|
||||
import com.utopiaindustries.selftrucking.models.PickupRequest;
|
||||
import com.utopiaindustries.selftrucking.utils.ProgressDialogFragment;
|
||||
|
||||
public class ContainerDetailActivity extends AppCompatActivity {
|
||||
|
||||
TextView containerDetailId, containerDestination, driverId, driverName;
|
||||
TextView container_no, container_origin, containerDestination, driverId, driverName;
|
||||
Button btnMarkPicked;
|
||||
//FoodDetailObj singleList;
|
||||
ContainerWorkflow containerWorkflow;
|
||||
String truckerId = "";
|
||||
String truckerName = "";
|
||||
HomeViewModel homeViewModel;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -34,21 +48,76 @@ public class ContainerDetailActivity extends AppCompatActivity {
|
|||
initializeLayout();
|
||||
|
||||
btnMarkPicked.setOnClickListener(v -> {
|
||||
PickupRequest request = new PickupRequest(containerWorkflow.getOriginId(),
|
||||
containerWorkflow.getDestinationId(),
|
||||
containerWorkflow.getContainerNo(),
|
||||
50,
|
||||
"USD",
|
||||
Integer.parseInt(truckerId));
|
||||
Log.e("Pick-Request: ", "" + request.toString());
|
||||
homeViewModel.pickTruckLoad(request);
|
||||
Toast.makeText(this, "Container marked as picked", Toast.LENGTH_SHORT).show();
|
||||
|
||||
Intent intent = new Intent(ContainerDetailActivity.this, TrackingActivity.class);
|
||||
//Intent intent = new Intent(ContainerDetailActivity.this, TrackingActivity.class);
|
||||
//intent.putExtra("container_id", container.getContainerId());
|
||||
startActivity(intent);
|
||||
//startActivity(intent);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void initializeLayout() {
|
||||
containerDetailId = findViewById(R.id.container_detail_id);
|
||||
container_no = findViewById(R.id.container_no);
|
||||
container_origin = findViewById(R.id.container_origin);
|
||||
containerDestination = findViewById(R.id.container_destination);
|
||||
driverId = findViewById(R.id.driver_Id);
|
||||
driverName = findViewById(R.id.driver_name);
|
||||
btnMarkPicked = findViewById(R.id.btn_mark_picked);
|
||||
homeViewModel = new ViewModelProvider(this).get(HomeViewModel.class);
|
||||
|
||||
containerWorkflow = (ContainerWorkflow) getIntent().getSerializableExtra("SingleContainerInfo");
|
||||
truckerId = getIntent().getStringExtra("TruckerId");
|
||||
truckerName = getIntent().getStringExtra("TruckerName");
|
||||
|
||||
homeViewModel.getLoadingState().observe(this, isLoading -> {
|
||||
if (isLoading != null && isLoading) {
|
||||
showProgressDialog();
|
||||
} else {
|
||||
dismissProgressDialog();
|
||||
}
|
||||
});
|
||||
|
||||
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();
|
||||
}
|
||||
});
|
||||
|
||||
setContainerDetail(containerWorkflow);
|
||||
|
||||
}
|
||||
|
||||
private void setContainerDetail(ContainerWorkflow containerWorkflow) {
|
||||
|
||||
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));
|
||||
|
||||
}
|
||||
|
||||
public void showProgressDialog() {
|
||||
ProgressDialogFragment progressDialog = new ProgressDialogFragment();
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show(getSupportFragmentManager(), "progressDialog");
|
||||
}
|
||||
|
||||
public void dismissProgressDialog() {
|
||||
ProgressDialogFragment progressDialog = (ProgressDialogFragment) getSupportFragmentManager().findFragmentByTag("progressDialog");
|
||||
if (progressDialog != null) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +1,20 @@
|
|||
package com.utopiaindustries.selftrucking.Activities.dashboardScreens;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
@ -18,11 +28,16 @@ import com.utopiaindustries.selftrucking.Activities.dashboardScreens.apiservice.
|
|||
import com.utopiaindustries.selftrucking.Activities.dashboardScreens.apiservice.ApiServiceFactory;
|
||||
import com.utopiaindustries.selftrucking.Activities.dashboardScreens.apiservice.MotiveApiService;
|
||||
import com.utopiaindustries.selftrucking.Activities.dashboardScreens.interfaces.SelectListener;
|
||||
import com.utopiaindustries.selftrucking.Activities.dashboardScreens.viewModels.HomeViewModel;
|
||||
import com.utopiaindustries.selftrucking.Activities.loginScreens.LoginActivity;
|
||||
import com.utopiaindustries.selftrucking.helper.Helper;
|
||||
import com.utopiaindustries.selftrucking.helper.Preference;
|
||||
import com.utopiaindustries.selftrucking.models.Container;
|
||||
import com.utopiaindustries.selftrucking.R;
|
||||
import com.utopiaindustries.selftrucking.models.ContainerWorkflow;
|
||||
import com.utopiaindustries.selftrucking.models.DriverResponse;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -42,6 +57,8 @@ public class HomeActivity extends AppCompatActivity implements SelectListener {
|
|||
ApiService apiService;
|
||||
MotiveApiService motiveApiService;
|
||||
DriverResponse driverResponse;
|
||||
TextView txtDriverName;
|
||||
ImageView imgLogout;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -64,6 +81,13 @@ public class HomeActivity extends AppCompatActivity implements SelectListener {
|
|||
|
||||
}
|
||||
});*/
|
||||
|
||||
imgLogout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
alertLogOut(HomeActivity.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -73,13 +97,15 @@ public class HomeActivity extends AppCompatActivity implements SelectListener {
|
|||
containerRecyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
apiService = ApiServiceFactory.getApiService();
|
||||
motiveApiService = ApiServiceFactory.getMotiveApiService();
|
||||
txtDriverName = findViewById(R.id.txt_driver_name);
|
||||
imgLogout = findViewById(R.id.img_logout);
|
||||
|
||||
|
||||
driverResponse = (DriverResponse) getIntent().getSerializableExtra("driverResponse");
|
||||
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);
|
||||
|
@ -94,8 +120,11 @@ public class HomeActivity extends AppCompatActivity implements SelectListener {
|
|||
Toast.makeText(this, String.valueOf(container.getContainerNo()), Toast.LENGTH_SHORT).show();
|
||||
|
||||
Intent intent = new Intent(HomeActivity.this, ContainerDetailActivity.class);
|
||||
intent.putExtra("container_id", container.getContainerNo());
|
||||
intent.putExtra("TruckerId", driverResponse.getTruckerId().toString());
|
||||
intent.putExtra("TruckerName", driverResponse.getTruckerName());
|
||||
intent.putExtra("SingleContainerInfo", (Serializable) container);
|
||||
startActivity(intent);
|
||||
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
|
||||
|
||||
|
||||
}
|
||||
|
@ -150,4 +179,51 @@ public class HomeActivity extends AppCompatActivity implements SelectListener {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void alertLogOut(Context con) {
|
||||
ViewGroup viewGroup = findViewById(android.R.id.content);
|
||||
|
||||
TextView dialogOkBtn, dialogCancelBtn;
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(con);
|
||||
View view1 = LayoutInflater.from(con).inflate(R.layout.custom_layout_for_logout, viewGroup, false);
|
||||
builder.setCancelable(false);
|
||||
builder.setView(view1);
|
||||
|
||||
dialogOkBtn = view1.findViewById(R.id.dialogOkBtn);
|
||||
dialogCancelBtn = view1.findViewById(R.id.dialogCancelBtn);
|
||||
|
||||
AlertDialog alertDialog = builder.create();
|
||||
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
|
||||
dialogOkBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
alertDialog.dismiss();
|
||||
//Toast.makeText(con, "Ok", Toast.LENGTH_SHORT).show();
|
||||
|
||||
Preference.setMyBooleanPref(Helper.project_file, "isLoggedIn", getApplicationContext(), false);
|
||||
|
||||
finish();
|
||||
Intent i = new Intent(HomeActivity.this, LoginActivity.class);
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(i);
|
||||
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
dialogCancelBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
alertDialog.dismiss();
|
||||
//Toast.makeText(con, "Cancel", Toast.LENGTH_SHORT).show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
alertDialog.show();
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package com.utopiaindustries.selftrucking.Activities.dashboardScreens;
|
||||
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
public class HomeViewModel extends ViewModel {
|
||||
|
||||
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.utopiaindustries.selftrucking.Activities.dashboardScreens.adapters;
|
||||
|
||||
import android.text.Html;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -35,9 +36,13 @@ public class ContainerAdapter extends RecyclerView.Adapter<ContainerAdapter.Cont
|
|||
@Override
|
||||
public void onBindViewHolder(@NonNull ContainerViewHolder holder, int position) {
|
||||
ContainerWorkflow container = containerList.get(position);
|
||||
holder.containerId.setText(container.getContainerNo());
|
||||
holder.destination.setText(container.getDestination());
|
||||
|
||||
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.itemView.setOnClickListener(v -> listener.onItemClicked(container));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,17 +50,14 @@ public class ContainerAdapter extends RecyclerView.Adapter<ContainerAdapter.Cont
|
|||
return containerList.size();
|
||||
}
|
||||
|
||||
public interface OnContainerClickListener {
|
||||
void onContainerClick(Container container);
|
||||
}
|
||||
|
||||
public static class ContainerViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView containerId, destination;
|
||||
TextView container_no, container_origin, container_destination;
|
||||
|
||||
public ContainerViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
containerId = itemView.findViewById(R.id.container_id);
|
||||
destination = itemView.findViewById(R.id.container_destination);
|
||||
container_no = itemView.findViewById(R.id.container_no);
|
||||
container_origin = itemView.findViewById(R.id.container_origin);
|
||||
container_destination = itemView.findViewById(R.id.container_destination);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,15 @@ package com.utopiaindustries.selftrucking.Activities.dashboardScreens.apiservice
|
|||
|
||||
import com.utopiaindustries.selftrucking.models.Container;
|
||||
import com.utopiaindustries.selftrucking.models.DriverResponse;
|
||||
import com.utopiaindustries.selftrucking.models.PickResponse;
|
||||
import com.utopiaindustries.selftrucking.models.PickupRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Path;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
|
@ -22,14 +26,11 @@ public interface ApiService {
|
|||
@Query("password") String password
|
||||
);
|
||||
|
||||
/*
|
||||
* @POST("rest/authentication/authenticate-user")
|
||||
Call<Boolean> isUserAuthenticated(
|
||||
@Query("username") String username,
|
||||
@Query("password") String password,
|
||||
@Query("roles") String[] roles
|
||||
|
||||
@POST("rest/application/pick-truck-load")
|
||||
Call<PickResponse> pickTruckLoad(
|
||||
@Body PickupRequest request
|
||||
);
|
||||
* */
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
package com.utopiaindustries.selftrucking.Activities.dashboardScreens.viewModels;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import com.utopiaindustries.selftrucking.Activities.dashboardScreens.apiservice.ApiService;
|
||||
import com.utopiaindustries.selftrucking.Activities.dashboardScreens.apiservice.ApiServiceFactory;
|
||||
import com.utopiaindustries.selftrucking.models.DriverResponse;
|
||||
import com.utopiaindustries.selftrucking.models.PickResponse;
|
||||
import com.utopiaindustries.selftrucking.models.PickupRequest;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
public class HomeViewModel extends ViewModel {
|
||||
|
||||
private ApiService apiService;
|
||||
private MutableLiveData<String> errorLiveData;
|
||||
private MutableLiveData<Boolean> isLoading;
|
||||
private MutableLiveData<PickResponse> userLiveData;
|
||||
|
||||
public HomeViewModel() {
|
||||
apiService = ApiServiceFactory.getApiService();
|
||||
errorLiveData = new MutableLiveData<>();
|
||||
isLoading = new MutableLiveData<>();
|
||||
userLiveData = new MutableLiveData<>();
|
||||
}
|
||||
|
||||
public LiveData<PickResponse> getPickLiveData() {
|
||||
return userLiveData;
|
||||
}
|
||||
|
||||
public LiveData<Boolean> getLoadingState() {
|
||||
return isLoading;
|
||||
}
|
||||
|
||||
public void pickTruckLoad(PickupRequest pickupRequest) {
|
||||
|
||||
isLoading.setValue(true);
|
||||
apiService.pickTruckLoad(pickupRequest).enqueue(new Callback<PickResponse>() {
|
||||
@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());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -2,8 +2,6 @@ package com.utopiaindustries.selftrucking.Activities.loginScreens;
|
|||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
@ -16,15 +14,20 @@ import androidx.core.view.WindowInsetsCompat;
|
|||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.utopiaindustries.selftrucking.Activities.dashboardScreens.HomeActivity;
|
||||
import com.utopiaindustries.selftrucking.Activities.dashboardScreens.apiservice.ApiService;
|
||||
import com.utopiaindustries.selftrucking.Activities.dashboardScreens.apiservice.ApiServiceFactory;
|
||||
import com.utopiaindustries.selftrucking.Activities.loginScreens.viewModels.LoginViewModel;
|
||||
import com.utopiaindustries.selftrucking.R;
|
||||
import com.utopiaindustries.selftrucking.helper.Helper;
|
||||
import com.utopiaindustries.selftrucking.helper.Preference;
|
||||
import com.utopiaindustries.selftrucking.utils.ProgressDialogFragment;
|
||||
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
EditText tfEmail, tfPassword;
|
||||
Button btnLogin;
|
||||
LoginViewModel loginViewModel;
|
||||
ApiService apiService;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -45,37 +48,41 @@ public class LoginActivity extends AppCompatActivity {
|
|||
}
|
||||
});
|
||||
|
||||
// Observe the user LiveData for a successful login
|
||||
loginViewModel.getUser().observe(this, user -> {
|
||||
if (user != null) {
|
||||
// Handle successful login (e.g., navigate to another activity)
|
||||
Preference.setMyBooleanPref(Helper.project_file, "isLoggedIn", getApplicationContext(), true);
|
||||
Log.e("User-Details: ",""+user.toString());
|
||||
Toast.makeText(this, "Welcome " + user.getTruckerName(), Toast.LENGTH_SHORT).show();
|
||||
Intent intent = new Intent(this, HomeActivity.class);
|
||||
intent.putExtra("driverResponse", user.toString());
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
// Observe the error LiveData for failed login
|
||||
loginViewModel.getError().observe(this, error -> {
|
||||
if (error != null) {
|
||||
Toast.makeText(this, error, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initializeLayouts() {
|
||||
tfEmail = findViewById(R.id.tf_email);
|
||||
tfPassword = findViewById(R.id.tf_password);
|
||||
btnLogin = findViewById(R.id.btn_login);
|
||||
apiService = ApiServiceFactory.getApiService();
|
||||
|
||||
tfEmail.setText("muhammad.mujtaba");
|
||||
tfPassword.setText("Utopia01");
|
||||
|
||||
loginViewModel = new ViewModelProvider(this).get(LoginViewModel.class);
|
||||
|
||||
loginViewModel.getLoadingState().observe(this, isLoading -> {
|
||||
if (isLoading != null && isLoading) {
|
||||
showProgressDialog();
|
||||
} else {
|
||||
dismissProgressDialog();
|
||||
}
|
||||
});
|
||||
|
||||
loginViewModel.getUserLiveData().observe(this, user -> {
|
||||
if (user != null) {
|
||||
Preference.setMyBooleanPref(Helper.project_file, "isLoggedIn", getApplicationContext(), true);
|
||||
Helper.setPreferenceObject(getApplicationContext(), user, "DriverResponse");
|
||||
|
||||
Toast.makeText(this, "Welcome " + user.getTruckerName(), Toast.LENGTH_SHORT).show();
|
||||
Intent intent = new Intent(this, HomeActivity.class);
|
||||
startActivity(intent);
|
||||
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
|
||||
finish();
|
||||
} else {
|
||||
Toast.makeText(this, "Login Failed", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean isValidate() {
|
||||
|
@ -99,9 +106,21 @@ public class LoginActivity extends AppCompatActivity {
|
|||
|
||||
if (!returnValue) {
|
||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public void showProgressDialog() {
|
||||
ProgressDialogFragment progressDialog = new ProgressDialogFragment();
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show(getSupportFragmentManager(), "progressDialog");
|
||||
}
|
||||
|
||||
public void dismissProgressDialog() {
|
||||
ProgressDialogFragment progressDialog = (ProgressDialogFragment) getSupportFragmentManager().findFragmentByTag("progressDialog");
|
||||
if (progressDialog != null) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +1,8 @@
|
|||
package com.utopiaindustries.selftrucking.Activities.loginScreens;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
|
@ -15,6 +13,8 @@ import androidx.core.view.WindowInsetsCompat;
|
|||
|
||||
import com.utopiaindustries.selftrucking.Activities.dashboardScreens.HomeActivity;
|
||||
import com.utopiaindustries.selftrucking.R;
|
||||
import com.utopiaindustries.selftrucking.helper.Helper;
|
||||
import com.utopiaindustries.selftrucking.helper.Preference;
|
||||
|
||||
public class SplashActivity extends AppCompatActivity {
|
||||
|
||||
|
@ -36,13 +36,10 @@ public class SplashActivity extends AppCompatActivity {
|
|||
setTheme(R.style.Base_Theme_SelfTruckingApp);
|
||||
setContentView(R.layout.activity_splash);
|
||||
|
||||
//hideStatusBar();
|
||||
txtVersion = findViewById(R.id.txt_version);
|
||||
txtVersion.setText(getResources().getString(R.string.app_version));
|
||||
|
||||
//Preference.setMyStringPref(Helper.project_file,"IsRating",this,"False");
|
||||
|
||||
//isLoggedIn = Preference.getMyBooleanPref(Helper.project_file,"isLoggedIn",getApplicationContext());
|
||||
isLoggedIn = Preference.getMyBooleanPref(Helper.project_file, "isLoggedIn", getApplicationContext());
|
||||
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
public void run() {
|
||||
|
@ -52,14 +49,12 @@ public class SplashActivity extends AppCompatActivity {
|
|||
startActivity(myIntent);
|
||||
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
|
||||
finish();
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
Intent myIntent = new Intent(SplashActivity.this, LoginActivity.class);
|
||||
startActivity(myIntent);
|
||||
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
||||
}, TIMER);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
package com.utopiaindustries.selftrucking.Activities.loginScreens;
|
||||
|
||||
import android.text.TextUtils;
|
||||
package com.utopiaindustries.selftrucking.Activities.loginScreens.viewModels;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
@ -8,34 +6,41 @@ import androidx.lifecycle.ViewModel;
|
|||
|
||||
import com.utopiaindustries.selftrucking.Activities.dashboardScreens.apiservice.ApiService;
|
||||
import com.utopiaindustries.selftrucking.Activities.dashboardScreens.apiservice.ApiServiceFactory;
|
||||
import com.utopiaindustries.selftrucking.helper.Helper;
|
||||
import com.utopiaindustries.selftrucking.models.Container;
|
||||
import com.utopiaindustries.selftrucking.models.DriverResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
public class LoginViewModel extends ViewModel {
|
||||
|
||||
private final MutableLiveData<DriverResponse> userLiveData = new MutableLiveData<>();
|
||||
private final MutableLiveData<String> errorLiveData = new MutableLiveData<>();
|
||||
|
||||
// private MutableLiveData<DriverResponse> driverResponse;
|
||||
private MutableLiveData<DriverResponse> userLiveData;
|
||||
private MutableLiveData<String> errorLiveData;
|
||||
private MutableLiveData<Boolean> isLoading;
|
||||
private ApiService apiService;
|
||||
|
||||
public LoginViewModel() {
|
||||
//driverResponse = new MutableLiveData<>();
|
||||
apiService = ApiServiceFactory.getApiService();
|
||||
userLiveData = new MutableLiveData<>();
|
||||
errorLiveData = new MutableLiveData<>();
|
||||
isLoading = new MutableLiveData<>();
|
||||
}
|
||||
|
||||
public LiveData<DriverResponse> getUserLiveData() {
|
||||
return userLiveData;
|
||||
}
|
||||
|
||||
public LiveData<Boolean> getLoadingState() {
|
||||
|
||||
return isLoading;
|
||||
}
|
||||
|
||||
public void authenticateUser(String user, String password) {
|
||||
|
||||
isLoading.setValue(true);
|
||||
apiService.isUserAuthenticated(user, password).enqueue(new Callback<DriverResponse>() {
|
||||
@Override
|
||||
public void onResponse(Call<DriverResponse> call, Response<DriverResponse> response) {
|
||||
isLoading.setValue(false);
|
||||
if (response.isSuccessful()) {
|
||||
userLiveData.setValue(response.body());
|
||||
} else {
|
||||
|
@ -45,6 +50,7 @@ public class LoginViewModel extends ViewModel {
|
|||
|
||||
@Override
|
||||
public void onFailure(Call<DriverResponse> call, Throwable t) {
|
||||
isLoading.setValue(false);
|
||||
errorLiveData.setValue(t.getMessage());
|
||||
}
|
||||
});
|
||||
|
@ -57,12 +63,4 @@ public class LoginViewModel extends ViewModel {
|
|||
public LiveData<String> getError() {
|
||||
return errorLiveData;
|
||||
}
|
||||
|
||||
/*public LiveData<Boolean> getIsValid() {
|
||||
return isValid;
|
||||
}*/
|
||||
|
||||
/*public LiveData<String> getErrorMessage() {
|
||||
return errorMessage;
|
||||
}*/
|
||||
}
|
|
@ -1,7 +1,14 @@
|
|||
package com.utopiaindustries.selftrucking.helper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.utopiaindustries.selftrucking.models.DriverResponse;
|
||||
|
||||
public class Helper {
|
||||
|
||||
public static final String project_file = "Self-Trucking";
|
||||
|
@ -9,4 +16,26 @@ public class Helper {
|
|||
public static boolean isValidEmail(CharSequence target) {
|
||||
return !TextUtils.isEmpty(target) && android.util.Patterns.EMAIL_ADDRESS.matcher(target).matches();
|
||||
}
|
||||
|
||||
static public void setPreferenceObject(Context c, Object modal, String key) {
|
||||
|
||||
SharedPreferences appSharedPrefs = PreferenceManager.getDefaultSharedPreferences(c.getApplicationContext());
|
||||
SharedPreferences.Editor prefsEditor = appSharedPrefs.edit();
|
||||
|
||||
Gson gson = new Gson();
|
||||
String jsonObject = gson.toJson(modal);
|
||||
prefsEditor.putString(key, jsonObject);
|
||||
prefsEditor.commit();
|
||||
|
||||
}
|
||||
|
||||
static public DriverResponse getPreferenceObjectJson(Context c, String key) {
|
||||
|
||||
SharedPreferences appSharedPrefs = PreferenceManager.getDefaultSharedPreferences(c.getApplicationContext());
|
||||
|
||||
String json = appSharedPrefs.getString(key, "");
|
||||
Gson gson = new Gson();
|
||||
DriverResponse selectedUser = gson.fromJson(json, DriverResponse.class);
|
||||
return selectedUser;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,14 +4,22 @@ package com.utopiaindustries.selftrucking.models;
|
|||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class ContainerWorkflow {
|
||||
import java.io.Serializable;
|
||||
|
||||
public class ContainerWorkflow implements Serializable {
|
||||
|
||||
@SerializedName("containerNo")
|
||||
@Expose
|
||||
private String containerNo;
|
||||
@SerializedName("originId")
|
||||
@Expose
|
||||
private Integer originId;
|
||||
@SerializedName("origin")
|
||||
@Expose
|
||||
private String origin;
|
||||
@SerializedName("destinationId")
|
||||
@Expose
|
||||
private Integer destinationId;
|
||||
@SerializedName("destination")
|
||||
@Expose
|
||||
private String destination;
|
||||
|
@ -40,4 +48,19 @@ public class ContainerWorkflow {
|
|||
this.destination = destination;
|
||||
}
|
||||
|
||||
public Integer getOriginId() {
|
||||
return originId;
|
||||
}
|
||||
|
||||
public void setOriginId(Integer originId) {
|
||||
this.originId = originId;
|
||||
}
|
||||
|
||||
public Integer getDestinationId() {
|
||||
return destinationId;
|
||||
}
|
||||
|
||||
public void setDestinationId(Integer destinationId) {
|
||||
this.destinationId = destinationId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,9 @@ import com.google.gson.annotations.Expose;
|
|||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class DriverResponse {
|
||||
|
||||
@SerializedName("truckerId")
|
||||
@Expose
|
||||
private Integer truckerId;
|
||||
@SerializedName("truckerName")
|
||||
@Expose
|
||||
private String truckerName;
|
||||
|
@ -52,4 +54,11 @@ public class DriverResponse {
|
|||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getTruckerId() {
|
||||
return truckerId;
|
||||
}
|
||||
|
||||
public void setTruckerId(Integer truckerId) {
|
||||
this.truckerId = truckerId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package com.utopiaindustries.selftrucking.models;
|
||||
|
||||
public class PickResponse {
|
||||
|
||||
private String message;
|
||||
private boolean status;
|
||||
|
||||
// Getters and setters
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public boolean isStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(boolean status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.utopiaindustries.selftrucking.models;
|
||||
|
||||
public class PickupRequest {
|
||||
|
||||
private int pickupLocation;
|
||||
private int dropoffLocation;
|
||||
private String loadTypeId;
|
||||
private double agreedAmount;
|
||||
private String agreedAmountCurrency;
|
||||
private int assignedToDriver;
|
||||
|
||||
public PickupRequest(int pickupLocation, int dropoffLocation, String loadTypeId,
|
||||
double agreedAmount, String agreedAmountCurrency, int assignedToDriver) {
|
||||
this.pickupLocation = pickupLocation;
|
||||
this.dropoffLocation = dropoffLocation;
|
||||
this.loadTypeId = loadTypeId;
|
||||
this.agreedAmount = agreedAmount;
|
||||
this.agreedAmountCurrency = agreedAmountCurrency;
|
||||
this.assignedToDriver = assignedToDriver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PickupRequest{" +
|
||||
"pickupLocation=" + pickupLocation +
|
||||
", dropoffLocation=" + dropoffLocation +
|
||||
", loadTypeId='" + loadTypeId + '\'' +
|
||||
", agreedAmount=" + agreedAmount +
|
||||
", agreedAmountCurrency='" + agreedAmountCurrency + '\'' +
|
||||
", assignedToDriver=" + assignedToDriver +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.utopiaindustries.selftrucking.utils;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import com.utopiaindustries.selftrucking.R;
|
||||
|
||||
public class ProgressDialogFragment extends DialogFragment {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.dialog_progress, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
if (getDialog() != null && getDialog().getWindow() != null) {
|
||||
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
getDialog().getWindow().setBackgroundDrawableResource(android.R.color.transparent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(@NonNull DialogInterface dialog) {
|
||||
// Prevent the dialog from being canceled when touched outside
|
||||
setCancelable(false);
|
||||
}
|
||||
}
|
|
@ -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="M17,7l-1.41,1.41L18.17,11H8v2h10.17l-2.58,2.58L17,17l5,-5zM4,5h8V3H4c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h8v-2H4V5z"/>
|
||||
|
||||
</vector>
|
|
@ -4,5 +4,5 @@
|
|||
android:shape="rectangle">
|
||||
<solid android:color="@color/grey_50" />
|
||||
<corners android:radius="0dp" />
|
||||
<stroke android:color="@color/black" android:width="0.5dp" />
|
||||
<stroke android:color="@color/black" android:width="0.1dp" />
|
||||
</shape>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/white" />
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="@color/white" />
|
||||
<corners android:radius="10dp" />
|
||||
<padding
|
||||
android:bottom="0dp"
|
||||
android:left="0dp"
|
||||
android:right="0dp"
|
||||
android:top="0dp" />
|
||||
</shape>
|
|
@ -41,20 +41,6 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toolbar2">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/container_detail_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:text="Container ID: 1234" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/container_destination"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:text="Destination: Warehouse" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/driver_Id"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -69,6 +55,29 @@
|
|||
android:padding="5dp"
|
||||
android:text="Driver Name: John Doe" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/container_no"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:text="Container ID: 1234" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/container_origin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:text="Origin: Warehouse" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/container_destination"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:text="Destination: Warehouse" />
|
||||
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_mark_picked"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Home Screen"
|
||||
android:text="Assigned Containers"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/_15sdp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/toolbar"
|
||||
|
@ -31,11 +31,11 @@
|
|||
app:layout_constraintTop_toTopOf="@+id/toolbar" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:id="@+id/txt_driver_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/_16sdp"
|
||||
android:text="Assigned Container"
|
||||
android:textSize="@dimen/_14sdp"
|
||||
android:text="Welcome"
|
||||
android:padding="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -50,7 +50,17 @@
|
|||
android:layout_marginEnd="1dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView2" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/txt_driver_name" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_logout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/toolbar"
|
||||
app:layout_constraintEnd_toEndOf="@+id/toolbar"
|
||||
app:layout_constraintTop_toTopOf="@+id/toolbar"
|
||||
app:srcCompat="@drawable/ic_logout" />
|
||||
|
||||
<!--<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
android:drawableStart="@drawable/ic_email"
|
||||
android:drawablePadding="5dp"
|
||||
android:drawableTint="@color/grey_700"
|
||||
android:hint="Email"
|
||||
android:hint="User"
|
||||
android:inputType="textEmailAddress" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:background="@drawable/rounded_white"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="15dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:text="Are you sure you want to sign out?"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="normal" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginTop="7dp"
|
||||
android:background="@color/grey_400" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="3">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialogCancelBtn"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.495"
|
||||
android:gravity="center"
|
||||
android:paddingTop="15dp"
|
||||
android:paddingBottom="15dp"
|
||||
android:text="No"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/theme_color"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="normal" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.009"
|
||||
android:background="@color/grey_400"
|
||||
android:paddingTop="15dp"
|
||||
android:paddingBottom="15dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialogOkBtn"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.495"
|
||||
android:gravity="center"
|
||||
android:paddingTop="15dp"
|
||||
android:paddingBottom="15dp"
|
||||
android:text="Yes"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/theme_color"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="normal" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,14 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#80000000"> <!-- Semi-transparent dark background -->
|
||||
|
||||
<!-- Blur effect can be enhanced by using drawable with blur effect-->
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:indeterminate="true" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -1,27 +1,39 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.cardview.widget.CardView 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="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="1"
|
||||
android:background="@drawable/rounded_border"
|
||||
android:layout_margin="2dp"
|
||||
android:padding="8dp">
|
||||
android:layout_margin="5dp"
|
||||
app:cardBackgroundColor="@color/grey_50"
|
||||
app:cardPreventCornerOverlap="true"
|
||||
app:cardUseCompatPadding="true">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/container_id"
|
||||
android:layout_width="0dp"
|
||||
android:id="@+id/container_no"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.1"
|
||||
android:padding="5dp"
|
||||
android:text="Container ID" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/container_destination"
|
||||
android:layout_width="0dp"
|
||||
android:id="@+id/container_origin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.9"
|
||||
android:layout_below="@+id/container_no"
|
||||
android:padding="5dp"
|
||||
android:text="Origin" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/container_destination"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/container_origin"
|
||||
android:padding="5dp"
|
||||
android:text="Destination" />
|
||||
</RelativeLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
|
@ -8,6 +8,7 @@ material = "1.12.0"
|
|||
activity = "1.9.2"
|
||||
constraintlayout = "2.1.4"
|
||||
playServicesMaps = "19.0.0"
|
||||
preference = "1.2.1"
|
||||
recyclerview = "1.3.2"
|
||||
retrofit = "2.9.0"
|
||||
|
||||
|
@ -21,6 +22,7 @@ material = { group = "com.google.android.material", name = "material", version.r
|
|||
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
||||
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
|
||||
play-services-maps = { module = "com.google.android.gms:play-services-maps", version.ref = "playServicesMaps" }
|
||||
preference = { module = "androidx.preference:preference", version.ref = "preference" }
|
||||
recyclerview = { group = "androidx.recyclerview", name = "recyclerview", version.ref = "recyclerview" }
|
||||
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
|
||||
|
||||
|
|
Loading…
Reference in New Issue