Extract methods from onViewCreated

This commit is contained in:
Anderson Mesquita 2019-05-19 15:55:52 -04:00
parent 69f116904d
commit a556183d60
1 changed files with 11 additions and 6 deletions

View File

@ -100,24 +100,29 @@ public class CompletedDownloadsFragment extends ListFragment {
@Override
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
// add padding
final ListView lv = getListView();
lv.setClipToPadding(false);
final int vertPadding = getResources().getDimensionPixelSize(R.dimen.list_vertical_padding);
lv.setPadding(0, vertPadding, 0, vertPadding);
addVerticalPadding();
addEmptyView();
viewCreated = true;
if (items != null && getActivity() != null) {
onFragmentLoaded();
}
}
private void addEmptyView() {
EmptyViewHandler emptyView = new EmptyViewHandler(getActivity());
emptyView.setTitle(R.string.no_comp_downloads_head_label);
emptyView.setMessage(R.string.no_comp_downloads_label);
emptyView.attachToListView(getListView());
}
private void addVerticalPadding() {
final ListView lv = getListView();
lv.setClipToPadding(false);
final int vertPadding = getResources().getDimensionPixelSize(R.dimen.list_vertical_padding);
lv.setPadding(0, vertPadding, 0, vertPadding);
}
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);