Skip to content

Commit

Permalink
Implements onRefresh event (openfoodfacts#3513)
Browse files Browse the repository at this point in the history
Co-authored-by: Paulo Coelho <[email protected]>
  • Loading branch information
2 people authored and VaiTon committed Sep 8, 2020
1 parent 98549dd commit 6823445
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
return binding.getRoot();
}

@Override
public void onRefresh() {
refreshView(productState);
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Expand Down Expand Up @@ -233,7 +238,6 @@ public void refreshView(ProductState productState) {
return;
}

super.refreshView(productState);
this.productState = productState;
product = productState.getProduct();
presenter = new SummaryProductPresenter(product, this);
Expand Down Expand Up @@ -423,6 +427,9 @@ public void refreshView(ProductState productState) {
//to be sure that top of the product view is visible at start
binding.textNameProduct.requestFocus();
binding.textNameProduct.clearFocus();

//Set refreshing animation to false after all processing is done
super.refreshView(productState);
}

private void refreshScoresLayout() {
Expand Down

0 comments on commit 6823445

Please sign in to comment.