use of androidx.recyclerview.widget.DefaultItemAnimator in project PocketMaps by junjunguo.
the class DownloadMapActivity method activateRecyclerView.
/**
* active directions, and directions view
*/
private void activateRecyclerView(List<MyMap> myMaps) {
mapsRV = (RecyclerView) findViewById(R.id.my_maps_download_recycler_view);
DefaultItemAnimator animator = new DefaultItemAnimator();
animator.setAddDuration(600);
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
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
mapsRV.setLayoutManager(layoutManager);
myDownloadAdapter = new MyMapAdapter(myMaps, this, true);
mapsRV.setAdapter(myDownloadAdapter);
}
use of androidx.recyclerview.widget.DefaultItemAnimator in project MaxLock by Maxr1998.
the class LogViewerFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
getActivity().setTitle(getString(R.string.pref_screen_logs));
View rootView = inflater.inflate(R.layout.fragment_logs, container, false);
mLogRecycler = rootView.findViewById(R.id.log_recycler);
mEmptyText = rootView.findViewById(R.id.logs_empty_text);
List<String> text = new ArrayList<>();
try {
BufferedReader br = new BufferedReader(new FileReader(getActivity().getApplicationInfo().dataDir + File.separator + Common.LOG_FILE));
String line;
while ((line = br.readLine()) != null) {
text.add(line);
}
} catch (FileNotFoundException e) {
mLogRecycler.setVisibility(View.GONE);
mEmptyText.setVisibility(View.VISIBLE);
return rootView;
} catch (IOException e) {
e.printStackTrace();
}
mLogRecycler.setLayoutManager(new LinearLayoutManager(getActivity()));
mLogRecycler.setItemAnimator(new DefaultItemAnimator());
LogRecyclerAdapter adapter = new LogRecyclerAdapter(text);
mLogRecycler.setAdapter(adapter);
return rootView;
}
Aggregations