use of nodomain.freeyourgadget.gadgetbridge.adapter.GBDeviceAppAdapter in project Gadgetbridge by Freeyourgadget.
the class AbstractAppManagerFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mGBDevice = ((AppManagerActivity) getActivity()).getGBDevice();
mCoordinator = DeviceHelper.getInstance().getCoordinator(mGBDevice);
final FloatingActionButton appListFab = ((FloatingActionButton) getActivity().findViewById(R.id.fab));
final FloatingActionButton appListFabNew = ((FloatingActionButton) getActivity().findViewById(R.id.fab_new));
watchfaceDesignerActivity = mCoordinator.getWatchfaceDesignerActivity();
View rootView = inflater.inflate(R.layout.activity_appmanager, container, false);
RecyclerView appListView = (RecyclerView) (rootView.findViewById(R.id.appListView));
appListView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if (dy > 0) {
appListFab.hide();
appListFabNew.hide();
} else if (dy < 0) {
appListFab.show();
if (watchfaceDesignerActivity != null) {
appListFabNew.show();
}
}
}
});
appListView.setLayoutManager(new LinearLayoutManager(getActivity()));
mGBDeviceAppAdapter = new GBDeviceAppAdapter(appList, R.layout.item_pebble_watchapp, this);
appListView.setAdapter(mGBDeviceAppAdapter);
ItemTouchHelper.Callback appItemTouchHelperCallback = new AppItemTouchHelperCallback(mGBDeviceAppAdapter);
appManagementTouchHelper = new ItemTouchHelper(appItemTouchHelperCallback);
appManagementTouchHelper.attachToRecyclerView(appListView);
if ((watchfaceDesignerActivity != null) && (appListFabNew != null)) {
appListFabNew.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent startIntent = new Intent(getContext(), watchfaceDesignerActivity);
startIntent.putExtra(GBDevice.EXTRA_DEVICE, mGBDevice);
getContext().startActivity(startIntent);
}
});
appListFabNew.show();
}
return rootView;
}
Aggregations