mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-25 19:36:50 +01:00
Keep device info on the correct device during reordering
This commit is contained in:
parent
2f217b077f
commit
93dad44750
@ -108,7 +108,7 @@ public class GBDeviceAdapterv2 extends RecyclerView.Adapter<GBDeviceAdapterv2.Vi
|
||||
|
||||
private final Context context;
|
||||
private List<GBDevice> deviceList;
|
||||
private int expandedDevicePosition = RecyclerView.NO_POSITION;
|
||||
private String expandedDeviceAddress = "";
|
||||
private ViewGroup parent;
|
||||
private HashMap<String, long[]> deviceActivityMap = new HashMap();
|
||||
|
||||
@ -385,7 +385,7 @@ public class GBDeviceAdapterv2 extends RecyclerView.Adapter<GBDeviceAdapterv2.Vi
|
||||
justifyListViewHeightBasedOnChildren(holder.deviceInfoList);
|
||||
holder.deviceInfoList.setFocusable(false);
|
||||
|
||||
final boolean detailsShown = position == expandedDevicePosition;
|
||||
final boolean detailsShown = expandedDeviceAddress.equals(device.getAddress());
|
||||
boolean showInfoIcon = device.hasDeviceInfos() && !device.isBusy();
|
||||
holder.deviceInfoView.setVisibility(showInfoIcon ? View.VISIBLE : View.GONE);
|
||||
holder.deviceInfoBox.setActivated(detailsShown);
|
||||
@ -393,7 +393,7 @@ public class GBDeviceAdapterv2 extends RecyclerView.Adapter<GBDeviceAdapterv2.Vi
|
||||
holder.deviceInfoView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
expandedDevicePosition = detailsShown ? -1 : position;
|
||||
expandedDeviceAddress = detailsShown ? "" : device.getAddress();
|
||||
TransitionManager.beginDelayedTransition(parent);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user