use of androidx.recyclerview.widget.DefaultItemAnimator in project UltimateRecyclerView by cymcsg.
the class GridLayoutRVTest method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(getMainLayout());
mToolbar = (Toolbar) findViewById(R.id.tool_bar);
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayShowTitleEnabled(true);
listuv = (UltimateRecyclerView) findViewById(R.id.ultimate_recycler_view);
mGridAdapter = new GridJRAdapter(getJRList());
mGridAdapter.setSpanColumns(columns);
mGridLayoutManager = new BasicGridLayoutManager(this, columns, mGridAdapter);
listuv.setLayoutManager(mGridLayoutManager);
listuv.setHasFixedSize(true);
listuv.setSaveEnabled(true);
listuv.setClipToPadding(false);
// mGridAdapter.setCustomLoadMoreView(LayoutInflater.from(this).inflate(R.layout.custom_bottom_progressbar, null));
listuv.setNormalHeader(setupHeaderView());
final Handler f = new Handler();
listuv.setOnLoadMoreListener(new UltimateRecyclerView.OnLoadMoreListener() {
@Override
public void loadMore(int itemsCount, int maxLastVisiblePosition) {
// Log.d(TAG, itemsCount + " :: " + itemsCount);
f.postDelayed(new Runnable() {
@Override
public void run() {
mGridAdapter.insert(SampleDataboxset.genJRList(5));
afterAdd();
}
}, 2000);
}
});
// listuv.enableLoadmore();
// listuv.disableLoadmore();
listuv.setLoadMoreView(R.layout.custom_bottom_progressbar);
listuv.setAdapter(mGridAdapter);
listuv.setItemAnimator(new DefaultItemAnimator());
harness_control();
}
use of androidx.recyclerview.widget.DefaultItemAnimator in project PocketMaps by junjunguo.
the class GeocodeActivity method showAddresses.
private RecyclerView showAddresses(final List<Address> list, final boolean viewOnly) {
setContentView(R.layout.activity_addresses);
OnClickAddressListener l = new OnClickAddressListener() {
@Override
public void onClick(Address addr) {
log("Address selected: " + addr);
if (viewOnly) {
GeocodeActivity.backToListViewOnly = true;
GeocodeActivity.backToListData = list;
}
GeocodeActivity.this.finish();
if (callbackListener != null) {
callbackListener.onClick(addr);
}
}
};
OnClickAddressListener detL = new OnClickAddressListener() {
@Override
public void onClick(Address addr) {
log("Address details selected: " + addr);
backToListData = list;
backToListViewOnly = viewOnly;
if (viewOnly) {
GeocodeActivity.this.showAddressDetails(EditType.ViewOnly, addr);
} else {
GeocodeActivity.this.showAddressDetails(EditType.ViewEdit, addr);
}
}
};
MyAddressAdapter adapter = new MyAddressAdapter(list, l, detL);
RecyclerView listView = (RecyclerView) findViewById(R.id.my_addr_recycler_view);
listView.setHasFixedSize(true);
// use a linear layout manager
LinearLayoutManager layoutManager = new LinearLayoutManager(this.getApplicationContext());
layoutManager.setOrientation(RecyclerView.VERTICAL);
listView.setLayoutManager(layoutManager);
listView.setItemAnimator(new DefaultItemAnimator());
listView.setAdapter(adapter);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.my_addr_add_fab);
if (!isFavouritesView()) {
fab.setVisibility(View.INVISIBLE);
} else {
fab.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
log("Plus selected!");
showAddressDetails(EditType.EditOnly, null);
}
});
}
if (!viewOnly) {
addDeleteItemHandler(listView);
}
;
return listView;
}
use of androidx.recyclerview.widget.DefaultItemAnimator in project PocketMaps by junjunguo.
the class MainActivity method activateRecyclerView.
/**
* active directions, and directions view
*/
private void activateRecyclerView(List<MyMap> myMaps) {
RecyclerView.LayoutManager layoutManager;
mapsRV = (RecyclerView) findViewById(R.id.my_maps_recycler_view);
DefaultItemAnimator animator = new DefaultItemAnimator();
animator.setAddDuration(2000);
animator.setRemoveDuration(600);
mapsRV.setItemAnimator(animator);
// use this setting to improve performance if you know that changes
// in content do not change the layout size of the RecyclerView
mapsRV.setHasFixedSize(true);
// use a linear layout manager
layoutManager = new LinearLayoutManager(this);
mapsRV.setLayoutManager(layoutManager);
// specify an adapter (see also next example)
if (mapAdapter == null) {
mapAdapter = new MyMapAdapter(myMaps, this, false);
} else {
mapAdapter.clearList();
mapAdapter.addAll(myMaps);
}
mapsRV.setAdapter(mapAdapter);
deleteItemHandler();
}
use of androidx.recyclerview.widget.DefaultItemAnimator in project MaxLock by Maxr1998.
the class AppListFragment method onCreateView.
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
getActivity().setTitle(getString(R.string.pref_screen_apps));
// noinspection ConstantConditions
((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
rootView = (ViewGroup) inflater.inflate(R.layout.fragment_appslist, container, false);
// Setup layout
RecyclerView recyclerView = rootView.findViewById(R.id.app_list);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(appListModel.getAdapter());
return rootView;
}
use of androidx.recyclerview.widget.DefaultItemAnimator in project MVPArms by JessYanCoding.
the class ArmsUtils method configRecyclerView.
/**
* 配置 RecyclerView
*
* @param recyclerView
* @param layoutManager
*/
public static void configRecyclerView(final RecyclerView recyclerView, RecyclerView.LayoutManager layoutManager) {
recyclerView.setLayoutManager(layoutManager);
// 如果可以确定每个item的高度是固定的,设置这个选项可以提高性能
recyclerView.setHasFixedSize(true);
recyclerView.setItemAnimator(new DefaultItemAnimator());
}
Aggregations