use of com.thecoolguy.rumaan.fileio.adapters.UploadHistoryListAdapter in project file.io-app by rumaan.
the class UploadHistoryActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_upload_history);
ButterKnife.bind(this);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(getString(R.string.upload_history_title));
actionBar.setDisplayHomeAsUpEnabled(true);
}
final UploadHistoryListAdapter uploadHistoryListAdapter = new UploadHistoryListAdapter(this);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
recyclerView.setLayoutManager(linearLayoutManager);
uploadItemViewModel = ViewModelProviders.of(this).get(UploadItemViewModel.class);
uploadItemViewModel.getUploadHistoryList().observe(this, new Observer<List<UploadItem>>() {
@Override
public void onChanged(@Nullable List<UploadItem> uploadItems) {
if ((uploadItems == null) || uploadItems.isEmpty()) {
noUploadsView.setVisibility(View.VISIBLE);
recyclerView.setVisibility(View.INVISIBLE);
} else {
noUploadsView.setVisibility(View.INVISIBLE);
recyclerView.setVisibility(View.VISIBLE);
uploadHistoryListAdapter.setUploadItemList(uploadItems);
recyclerView.addItemDecoration(getSectionCallback(uploadItemViewModel.getUploadHistoryList().getValue()));
}
}
});
recyclerView.setAdapter(uploadHistoryListAdapter);
uploadHistoryListAdapter.setOnUploadItemLongClickListener(this);
LayoutAnimationController layoutAnimationController = AnimationUtils.loadLayoutAnimation(this, R.anim.layout_anim_fall_down);
recyclerView.setLayoutAnimation(layoutAnimationController);
}
Aggregations