update USB-OTG status every time the user switches to Nearby

The USB-OTG device can be plugged and unplugged anytime, so the Nearby view
should be updated each time the user switches to this screen.  Registered
callbacks should handle updating the USB-OTG status while the Nearby view
is active.
This commit is contained in:
Hans-Christoph Steiner 2020-11-11 13:52:22 +01:00
parent bd45f0fdc5
commit 6fd7970ca5

View File

@ -21,14 +21,14 @@
package org.fdroid.fdroid.views.main;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import android.util.SparseIntArray;
import android.view.Menu;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.PopupMenu;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import org.fdroid.fdroid.R;
/**
@ -76,6 +76,8 @@ class MainViewAdapter extends RecyclerView.Adapter<MainViewController> {
long viewType = getItemId(holder.getAdapterPosition());
if (viewType == R.id.updates) {
holder.bindUpdates();
} else if (viewType == R.id.nearby) {
NearbyViewBinder.updateUsbOtg(activity);
}
}