mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-01 14:32:54 +01:00
App Manager: Hide drag handle if app reorder is not supported
This commit is contained in:
parent
c1339aa5c6
commit
240326c99a
@ -408,7 +408,12 @@ public abstract class AbstractAppManagerFragment extends Fragment {
|
||||
}
|
||||
});
|
||||
appListView.setLayoutManager(new GridAutoFitLayoutManager(getActivity(), 300));
|
||||
mGBDeviceAppAdapter = new GBDeviceAppAdapter(appList, R.layout.item_appmanager_watchapp, this);
|
||||
mGBDeviceAppAdapter = new GBDeviceAppAdapter(
|
||||
appList,
|
||||
R.layout.item_appmanager_watchapp,
|
||||
this,
|
||||
mCoordinator.supportsAppReordering() || isCacheManager()
|
||||
);
|
||||
appListView.setAdapter(mGBDeviceAppAdapter);
|
||||
|
||||
ItemTouchHelper.Callback appItemTouchHelperCallback = new AppItemTouchHelperCallback(mGBDeviceAppAdapter);
|
||||
|
@ -27,7 +27,6 @@ import android.widget.TextView;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
@ -49,15 +48,17 @@ public class GBDeviceAppAdapter extends RecyclerView.Adapter<GBDeviceAppAdapter.
|
||||
private final int mLayoutId;
|
||||
private final List<GBDeviceApp> appList;
|
||||
private final AbstractAppManagerFragment mParentFragment;
|
||||
private final boolean allowReorder;
|
||||
|
||||
public List<GBDeviceApp> getAppList() {
|
||||
return appList;
|
||||
}
|
||||
|
||||
public GBDeviceAppAdapter(List<GBDeviceApp> list, int layoutId, AbstractAppManagerFragment parentFragment) {
|
||||
public GBDeviceAppAdapter(List<GBDeviceApp> list, int layoutId, AbstractAppManagerFragment parentFragment, boolean reorder) {
|
||||
mLayoutId = layoutId;
|
||||
appList = list;
|
||||
mParentFragment = parentFragment;
|
||||
allowReorder = reorder;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -135,6 +136,7 @@ public class GBDeviceAppAdapter extends RecyclerView.Adapter<GBDeviceAppAdapter.
|
||||
}
|
||||
});
|
||||
|
||||
holder.mDragHandle.setVisibility(allowReorder ? View.VISIBLE : View.GONE);
|
||||
holder.mDragHandle.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||
|
Loading…
Reference in New Issue
Block a user