mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-07-07 14:11:36 +02: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));
|
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);
|
appListView.setAdapter(mGBDeviceAppAdapter);
|
||||||
|
|
||||||
ItemTouchHelper.Callback appItemTouchHelperCallback = new AppItemTouchHelperCallback(mGBDeviceAppAdapter);
|
ItemTouchHelper.Callback appItemTouchHelperCallback = new AppItemTouchHelperCallback(mGBDeviceAppAdapter);
|
||||||
|
|
|
@ -27,7 +27,6 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
@ -49,15 +48,17 @@ public class GBDeviceAppAdapter extends RecyclerView.Adapter<GBDeviceAppAdapter.
|
||||||
private final int mLayoutId;
|
private final int mLayoutId;
|
||||||
private final List<GBDeviceApp> appList;
|
private final List<GBDeviceApp> appList;
|
||||||
private final AbstractAppManagerFragment mParentFragment;
|
private final AbstractAppManagerFragment mParentFragment;
|
||||||
|
private final boolean allowReorder;
|
||||||
|
|
||||||
public List<GBDeviceApp> getAppList() {
|
public List<GBDeviceApp> getAppList() {
|
||||||
return appList;
|
return appList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GBDeviceAppAdapter(List<GBDeviceApp> list, int layoutId, AbstractAppManagerFragment parentFragment) {
|
public GBDeviceAppAdapter(List<GBDeviceApp> list, int layoutId, AbstractAppManagerFragment parentFragment, boolean reorder) {
|
||||||
mLayoutId = layoutId;
|
mLayoutId = layoutId;
|
||||||
appList = list;
|
appList = list;
|
||||||
mParentFragment = parentFragment;
|
mParentFragment = parentFragment;
|
||||||
|
allowReorder = reorder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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() {
|
holder.mDragHandle.setOnTouchListener(new View.OnTouchListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user