Fix layout favorite food

This commit is contained in:
Nezumi
2023-03-16 20:47:53 +07:00
parent ebd313e32c
commit 14ec27ce28
4 changed files with 10 additions and 26 deletions
@@ -50,7 +50,7 @@ public class FavoriteFoodActivity extends AppCompatActivity implements ItemTouch
private FoodFavoriteAdapter adapter;
private final List<Food> listFavoriteFood = new ArrayList<>();
private ImageView back_image;
private ConstraintLayout listFavoriteFoodView, progressLayout;
private ConstraintLayout listFavoriteFoodView;
private NestedScrollView nestedScrollView;
private ProgressBar progressBar;
private TextView endOfListText;
@@ -61,7 +61,6 @@ public class FavoriteFoodActivity extends AppCompatActivity implements ItemTouch
//Init component
back_image = findViewById(R.id.back_image);
progressLayout = findViewById(R.id.progress_layout);
nestedScrollView = findViewById(R.id.nestedScrollView);
progressBar = findViewById(R.id.progress_bar);
endOfListText = findViewById(R.id.end_of_list_text);
@@ -124,8 +123,6 @@ public class FavoriteFoodActivity extends AppCompatActivity implements ItemTouch
FoodApiToken.apiService.getListFavoriteFood(Common.CURRENT_USER.getId(), page, PAGE_SIZE, SORT_BY, SORT_DIR).enqueue(new Callback<Foods>() {
@Override
public void onResponse(Call<Foods> call, Response<Foods> response) {
//Dismiss progress
progressLayout.setVisibility(View.GONE);
Foods foodData = response.body();
@@ -8,6 +8,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.Fragment;
@@ -31,19 +32,26 @@ import io.paperdb.Paper;
public class ProfileFragment extends Fragment {
LinearLayout account_and_profile, manage_address, favorite_food, order_history, log_out;
PopupDialog popupDialog;
TextView user_name;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View rootView = inflater.inflate(R.layout.fragment_profile, container, false);
//Init component
account_and_profile = rootView.findViewById(R.id.account_and_profile);
manage_address = rootView.findViewById(R.id.manage_address);
favorite_food = rootView.findViewById(R.id.favorite_food);
order_history = rootView.findViewById(R.id.order_history);
log_out = rootView.findViewById(R.id.log_out);
user_name = rootView.findViewById(R.id.user_name);
popupDialog = PopupDialog.getInstance(getContext());
//Set user name on textview
user_name.setText(Common.CURRENT_USER.getFullName());
account_and_profile.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@@ -44,7 +44,7 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_favorite_food"
tools:listitem="@layout/item_food_search_and_favorite"
tools:listitem="@layout/item_food_favorite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
@@ -79,24 +79,4 @@
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#80000000"
android:id="@+id/progress_layout"
>
<ProgressBar
android:id="@+id/progressBarLoadData"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminateTint="@color/primaryColor"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>