use of com.googletest.firebase.perf.testapp.ListAdapter in project firebase-android-sdk by firebase.
the class NotificationsFragment method onCreateView.
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
notificationsViewModel = new ViewModelProvider(this, new ViewModelProvider.NewInstanceFactory()).get(NotificationsViewModel.class);
View root = inflater.inflate(R.layout.fragment_notifications, container, false);
final TextView textView = root.findViewById(R.id.text_notifications);
notificationsViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
// Gif loading for testing
sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
final ImageView imageView = root.findViewById(R.id.img_notifications);
sharedViewModel.getImageSrc().observe(getViewLifecycleOwner(), new Observer<String>() {
@Override
public void onChanged(String s) {
Glide.with(requireActivity()).load(s).diskCacheStrategy(DiskCacheStrategy.NONE).skipMemoryCache(true).into(imageView);
}
});
// Recycler View setup
RecyclerView numbersList = root.findViewById(R.id.rv_fragment_notifications);
LinearLayoutManager layoutManager = new LinearLayoutManager(requireActivity());
ListAdapter listAdapter = new ListAdapter(NUM_LIST_ITEMS);
numbersList.setLayoutManager(layoutManager);
numbersList.setHasFixedSize(true);
numbersList.setAdapter(listAdapter);
return root;
}
Aggregations