Java Code Examples for androidx.recyclerview.widget.DividerItemDecoration#setDrawable()

The following examples show how to use androidx.recyclerview.widget.DividerItemDecoration#setDrawable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EntryListView.java    From Aegis with GNU General Public License v3.0 6 votes vote down vote up
private void updateDividerDecoration() {
    if (_dividerDecoration != null) {
        _recyclerView.removeItemDecoration(_dividerDecoration);
    }

    float height = _viewMode.getDividerHeight();
    if (_showProgress && height == 0) {
        DividerItemDecoration divider = new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL);
        divider.setDrawable(ContextCompat.getDrawable(getContext(), R.drawable.entry_divider));
        _dividerDecoration = divider;
    } else {
        _dividerDecoration = new VerticalSpaceItemDecoration(height);
    }

    _recyclerView.addItemDecoration(_dividerDecoration);
}
 
Example 2
Source File: TableView.java    From TableView with MIT License 6 votes vote down vote up
@NonNull
protected DividerItemDecoration createItemDecoration(int orientation) {
    DividerItemDecoration itemDecoration = new DividerItemDecoration(getContext(), orientation);
    Drawable divider = ContextCompat.getDrawable(getContext(), R.drawable.cell_line_divider);
    if (divider == null) {
        return itemDecoration;
    }

    // That means; There is a custom separator color from user.
    if (mSeparatorColor != -1) {
        // Change its color
        divider.setColorFilter(mSeparatorColor, PorterDuff.Mode.SRC_ATOP);
    }

    itemDecoration.setDrawable(divider);
    return itemDecoration;
}
 
Example 3
Source File: PrinterBluetoothDialog.java    From ProjectX with Apache License 2.0 6 votes vote down vote up
PrinterBluetoothDialog(@NonNull Context context, @NonNull OnDialogListener listener) {
    super(context, AlertDialogUtils.getAlertDialogTheme(context));
    mListener = listener;
    setContentView(R.layout.dlg_printer_bluetooth);
    final RecyclerView bonded = findViewById(R.id.dpb_rv_bonded);
    if (bonded == null)
        return;
    final Drawable divider = ContextCompat.getDrawable(context,
            R.drawable.divider_common);
    if (divider != null) {
        final DividerItemDecoration decoration = new DividerItemDecoration(context,
                DividerItemDecoration.VERTICAL);
        decoration.setDrawable(divider);
        bonded.addItemDecoration(decoration);
    }
    bonded.setLayoutManager(new LinearLayoutManager(context));
    bonded.setAdapter(mAdapter);
}
 
Example 4
Source File: OpenTypeListActivity.java    From ProjectX with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setSupportActionBar(R.id.otl_toolbar);
    final RecyclerView list = findViewById(R.id.otl_content);
    final Drawable divider = ContextCompat.getDrawable(this, R.drawable.divider_common);
    if (divider != null) {
        final DividerItemDecoration decoration = new DividerItemDecoration(list.getContext(),
                DividerItemDecoration.VERTICAL);
        decoration.setDrawable(divider);
        list.addItemDecoration(decoration);
    }

    list.setAdapter(mAdapter);
    mPresenter.loadOpenType();
}
 
Example 5
Source File: Utils.java    From Beedio with GNU General Public License v2.0 6 votes vote down vote up
public static DividerItemDecoration createDivider(final Context context) {
    DividerItemDecoration divider = new DividerItemDecoration(context,
            DividerItemDecoration.VERTICAL) {
        @Override
        public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView
                .State state) {
            int verticalSpacing = (int) Math.ceil(TypedValue.applyDimension(TypedValue
                    .COMPLEX_UNIT_SP, 4, context.getResources()
                    .getDisplayMetrics()));
            outRect.top = verticalSpacing;
            outRect.bottom = verticalSpacing;
        }
    };
    divider.setDrawable(context.getResources().getDrawable(R.drawable.greydivider));
    return divider;
}
 
Example 6
Source File: BaseListFragment.java    From pandora with Apache License 2.0 6 votes vote down vote up
@Override
protected View getLayoutView() {
    adapter = new UniversalAdapter();
    recyclerView = new MenuRecyclerView(getContext());
    recyclerView.setBackgroundColor(ViewKnife.getColor(R.color.pd_main_bg));
    recyclerView.setLayoutManager(onCreateLayoutManager());
    if (needDefaultDivider()) {
        DividerItemDecoration divider = new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL);
        GradientDrawable horizontalDrawable = new GradientDrawable();
        horizontalDrawable.setColor(0xffE5E5E5);
        horizontalDrawable.setSize(0, 1);
        divider.setDrawable(horizontalDrawable);
        recyclerView.addItemDecoration(divider);
    }
    recyclerView.setAdapter(adapter);
    return recyclerView;
}
 
Example 7
Source File: VideoTutorialsActivity.java    From BaldPhone with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_help);
    final RecyclerView recycler_view = findViewById(R.id.recycler_view);
    final DividerItemDecoration dividerItemDecoration =
            new DividerItemDecoration(recycler_view.getContext(), DividerItemDecoration.VERTICAL);
    dividerItemDecoration.setDrawable(getDrawable(R.drawable.ll_divider));
    recycler_view.addItemDecoration(dividerItemDecoration);
    final Resources resources = getResources();
    recycler_view.setAdapter(
            new HelpRecyclerViewAdapter(
                    this,
                    S.typedArrayToResArray(resources, R.array.yt_texts),
                    S.typedArrayToResArray(resources, R.array.yt_logos)));
}
 
Example 8
Source File: DialerActivity.java    From BaldPhone with Apache License 2.0 6 votes vote down vote up
private void attachXml() {
    recyclerView = findViewById(R.id.contacts_recycler_view);
    final DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(), DividerItemDecoration.VERTICAL);
    dividerItemDecoration.setDrawable(getDrawable(R.drawable.ll_divider));
    recyclerView.addItemDecoration(dividerItemDecoration);

    tv_number = findViewById(R.id.tv_number);
    numpad = new View[]{
            findViewById(R.id.b_0),
            findViewById(R.id.b_1),
            findViewById(R.id.b_2),
            findViewById(R.id.b_3),
            findViewById(R.id.b_4),
            findViewById(R.id.b_5),
            findViewById(R.id.b_6),
            findViewById(R.id.b_7),
            findViewById(R.id.b_8),
            findViewById(R.id.b_9)
    };
    empty_view = findViewById(R.id.empty_view);
    b_call = findViewById(R.id.b_call);
    b_clear = findViewById(R.id.b_clear);
    b_backspace = findViewById(R.id.b_backspace);
    b_sulamit = findViewById(R.id.b_sulamit);
    b_hash = findViewById(R.id.b_hash);
}
 
Example 9
Source File: PermissionActivity.java    From BaldPhone with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_permission);
    final Intent callingIntent = getIntent();
    requiredPermissions = callingIntent.getIntExtra(EXTRA_REQUIRED_PERMISSIONS, -1);
    ancestorCallingIntent = callingIntent.getParcelableExtra(EXTRA_INTENT);

    recyclerView = findViewById(R.id.child);
    final DividerItemDecoration dividerItemDecoration =
            new DividerItemDecoration(recyclerView.getContext(), DividerItemDecoration.VERTICAL);
    dividerItemDecoration.setDrawable(Objects.requireNonNull(getDrawable(R.drawable.ll_divider)));
    recyclerView.addItemDecoration(dividerItemDecoration);
    recyclerView.setAdapter(new PermissionRecyclerViewAdapter());
    BaldTitleBar baldTitleBar = findViewById(R.id.bald_title_bar);
    baldTitleBar.getBt_back().setOnClickListener(v -> calmyBDB());

}
 
Example 10
Source File: SingleContactActivity.java    From BaldPhone with Apache License 2.0 6 votes vote down vote up
private void inflateHistory(List<Call> callList) {
    final View view = layoutInflater.inflate(R.layout.contact_history, ll, false);
    final ScrollingHelper scrollingHelper = view.findViewById(R.id.scrolling_helper);
    final RecyclerView recyclerView = scrollingHelper.findViewById(R.id.child);
    final DividerItemDecoration dividerItemDecoration =
            new DividerItemDecoration(recyclerView.getContext(), DividerItemDecoration.VERTICAL);
    dividerItemDecoration.setDrawable(getDrawable(R.drawable.ll_divider));
    recyclerView.addItemDecoration(dividerItemDecoration);
    recyclerView.setAdapter(new CallsRecyclerViewAdapter(callList, this));

    final BaldPictureTextButton show = view.findViewById(R.id.bt_show);
    Toggeler.newSimpleTextImageToggeler(
            show,
            show.getImageView(),
            show.getTextView(),
            R.drawable.drop_down_on_button,
            R.drawable.drop_up_on_button,
            R.string.show,
            R.string.hide,
            v -> scrollingHelper.setVisibility(View.VISIBLE),
            v -> scrollingHelper.setVisibility(View.GONE));
    ll.addView(view);
}
 
Example 11
Source File: CustomRecyclerView.java    From msdkui-android with Apache License 2.0 5 votes vote down vote up
private void init(final Context context) {
    final LinearLayoutManager layoutManager = new LinearLayoutManager(context);
    setLayoutManager(layoutManager);
    setHasFixedSize(true);
    setItemAnimator(new DefaultItemAnimator());
    final DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(context,
            layoutManager.getOrientation());
    dividerItemDecoration.setDrawable(getVerticalDivider(context));
    addItemDecoration(dividerItemDecoration);
    addOnItemTouchListener(mRecyclerItemClickListener);
}
 
Example 12
Source File: WaypointList.java    From msdkui-android with Apache License 2.0 5 votes vote down vote up
private void init(final Context context) {
    final LinearLayoutManager layoutManager = new LinearLayoutManager(context);
    setLayoutManager(layoutManager);
    setHasFixedSize(true);
    setItemAnimator(new DefaultItemAnimator());
    final DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(context,
            layoutManager.getOrientation());
    final Drawable verticalDivider = getVerticalDivider(context);
    dividerItemDecoration.setDrawable(verticalDivider);
    addItemDecoration(dividerItemDecoration);
    setBackgroundColor(ThemeUtil.getColor(getContext(), R.attr.colorBackgroundBrand));
    mAdapter = new WaypointListAdapter(mWaypointEntries);
    setAdapter(mAdapter);
    addMinWaypointsItem();
}
 
Example 13
Source File: TableView.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected DividerItemDecoration createItemDecoration(int orientation) {
    Drawable divider = ContextCompat.getDrawable(getContext(), R.drawable.cell_line_divider);

    // That means; There is a custom separator color from user.
    if (mSeparatorColor != -1) {
        // Change its color
        divider.setColorFilter(mSeparatorColor, PorterDuff.Mode.SRC_ATOP);
    }

    DividerItemDecoration itemDecoration = new DividerItemDecoration(getContext(), orientation);
    itemDecoration.setDrawable(divider);
    return itemDecoration;
}
 
Example 14
Source File: ChatsScreen.java    From adamant-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);

    layoutManager = new LinearLayoutManager(this.getContext());
    chatList.setLayoutManager(layoutManager);
    chatList.setAdapter(adapter);

    Drawable divider = ContextCompat.getDrawable(chatList.getContext(), R.drawable.line_divider);
    int avatarWidth = getResources().getDimensionPixelSize(R.dimen.list_item_avatar_size);
    int itemPadding = getResources().getDimensionPixelSize(R.dimen.list_item_chat_padding);
    InsetDrawable insetDivider = new InsetDrawable(divider, avatarWidth + (itemPadding * 2), 0, 0, 0);

    DividerItemDecoration itemDecoration = new DividerItemDecoration(chatList.getContext(), layoutManager.getOrientation());
    itemDecoration.setDrawable(insetDivider);
    chatList.addItemDecoration(itemDecoration);

    adapter.setListener(this);

    chatList.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            if (dy > 0 && addChatFab.getVisibility() == View.VISIBLE) {
                addChatFab.hide();
            } else if (dy < 0 && addChatFab.getVisibility() != View.VISIBLE) {
                addChatFab.show();
            }
        }
    });

    addChatFab.setOnClickListener(v -> presenter.onClickCreateNewChatButton(buildRevealSettings()));

    return view;
}
 
Example 15
Source File: CreditsActivity.java    From BaldPhone with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_credits);
    RecyclerView recyclerView = findViewById(R.id.recycler_view);
    names = getResources().getStringArray(R.array.names);
    tasks = getResources().getStringArray(R.array.tasks);

    recyclerView.setAdapter(new CreditsAdapter());
    final DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(), DividerItemDecoration.VERTICAL);
    dividerItemDecoration.setDrawable(Objects.requireNonNull(getDrawable(R.drawable.ll_divider)));
    recyclerView.addItemDecoration(dividerItemDecoration);

}
 
Example 16
Source File: MainActivity.java    From AppsMonitor with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // https://guides.codepath.com/android/Shared-Element-Activity-Transition
    getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
    getWindow().setExitTransition(new Fade(Fade.OUT));
    setContentView(R.layout.activity_main);
    mPackageManager = getPackageManager();

    mSort = findViewById(R.id.sort_group);
    mSortName = findViewById(R.id.sort_name);
    mSwitch = findViewById(R.id.enable_switch);
    mSwitchText = findViewById(R.id.enable_text);
    mAdapter = new MyAdapter();

    mList = findViewById(R.id.list);
    mList.setLayoutManager(new LinearLayoutManager(this));
    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mList.getContext(), DividerItemDecoration.VERTICAL);
    dividerItemDecoration.setDrawable(getResources().getDrawable(R.drawable.divider, getTheme()));
    mList.addItemDecoration(dividerItemDecoration);
    mList.setAdapter(mAdapter);

    initLayout();
    initEvents();
    initSpinner();
    initSort();

    if (DataManager.getInstance().hasPermission(getApplicationContext())) {
        process();
        startService(new Intent(this, AlarmService.class));
    }
}
 
Example 17
Source File: TransactionHistoryFragment.java    From lbry-android with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_transaction_history, container, false);

    loading = root.findViewById(R.id.transaction_history_loading);
    transactionList = root.findViewById(R.id.transaction_history_list);
    noTransactionsView = root.findViewById(R.id.transaction_history_no_transactions);

    Context context = getContext();
    LinearLayoutManager llm = new LinearLayoutManager(context);
    transactionList.setLayoutManager(llm);
    DividerItemDecoration itemDecoration = new DividerItemDecoration(context, DividerItemDecoration.VERTICAL);
    itemDecoration.setDrawable(ContextCompat.getDrawable(context, R.drawable.thin_divider));
    transactionList.addItemDecoration(itemDecoration);

    transactionList.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
            if (transactionsLoading) {
                return;
            }
            LinearLayoutManager lm = (LinearLayoutManager) recyclerView.getLayoutManager();
            if (lm != null) {
                int visibleItemCount = lm.getChildCount();
                int totalItemCount = lm.getItemCount();
                int pastVisibleItems = lm.findFirstVisibleItemPosition();
                if (pastVisibleItems + visibleItemCount >= totalItemCount) {
                    if (!transactionsHaveReachedEnd) {
                        // load more
                        currentTransactionPage++;
                        loadTransactions();
                    }
                }
            }
        }
    });

    return root;
}
 
Example 18
Source File: FragmentCertificates.java    From FairEmail with GNU General Public License v3.0 4 votes vote down vote up
@Override
@Nullable
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    setSubtitle(R.string.title_advanced_manage_certificates);
    setHasOptionsMenu(true);

    View view = inflater.inflate(R.layout.fragment_certificates, container, false);

    // Get controls
    rvCertificate = view.findViewById(R.id.rvCertificate);
    pbWait = view.findViewById(R.id.pbWait);
    grpReady = view.findViewById(R.id.grpReady);
    fab = view.findViewById(R.id.fab);

    // Wire controls

    rvCertificate.setHasFixedSize(false);
    LinearLayoutManager llm = new LinearLayoutManager(getContext());
    rvCertificate.setLayoutManager(llm);

    DividerItemDecoration itemDecorator = new DividerItemDecoration(getContext(), llm.getOrientation());
    itemDecorator.setDrawable(getContext().getDrawable(R.drawable.divider));
    rvCertificate.addItemDecoration(itemDecorator);

    adapter = new AdapterCertificate(this);
    rvCertificate.setAdapter(adapter);

    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
            lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_IMPORT_CERTIFICATE));
        }
    });

    // Initialize
    grpReady.setVisibility(View.GONE);
    pbWait.setVisibility(View.VISIBLE);

    return view;
}
 
Example 19
Source File: NovelReviewReplyListActivity.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_novel_review_reply_list);

        // fetch values
        rid = getIntent().getIntExtra("rid", 1);
        reviewTitle = getIntent().getStringExtra("title");

        // set indicator enable
        Toolbar mToolbar = findViewById(R.id.toolbar_actionbar);
        setSupportActionBar(mToolbar);
        final Drawable upArrow = getResources().getDrawable(R.drawable.ic_svg_back);
        if(getSupportActionBar() != null && upArrow != null) {
            getSupportActionBar().setHomeButtonEnabled(true);
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
            upArrow.setColorFilter(getResources().getColor(R.color.default_white), PorterDuff.Mode.SRC_ATOP);
            getSupportActionBar().setHomeAsUpIndicator(upArrow);
        }

        // change status bar color tint, and this require SDK16
        if (Build.VERSION.SDK_INT >= 16 ) {
            // create our manager instance after the content view is set
            SystemBarTintManager tintManager = new SystemBarTintManager(this);
            // enable all tint
            tintManager.setStatusBarTintEnabled(true);
            tintManager.setNavigationBarTintEnabled(true);
            tintManager.setTintAlpha(0.15f);
            tintManager.setNavigationBarAlpha(0.0f);
            // set all color
            tintManager.setTintColor(getResources().getColor(android.R.color.black));
            // set Navigation bar color
            if(Build.VERSION.SDK_INT >= 21)
                getWindow().setNavigationBarColor(getResources().getColor(R.color.myNavigationColor));
        }

        // get views and set title
        // get views
        mLoadingLayout = findViewById(R.id.list_loading);
        mSwipeRefreshLayout = findViewById(R.id.swipe_refresh_layout);
        mRecyclerView = findViewById(R.id.review_item_list);
        mLoadingStatusTextView = findViewById(R.id.list_loading_status);
        mLoadingButton = findViewById(R.id.btn_loading);
        etReplyText = findViewById(R.id.review_reply_edit_text);
        LinearLayout llReplyButton = findViewById(R.id.review_reply_send);

        mRecyclerView.setHasFixedSize(false);
        DividerItemDecoration horizontalDecoration = new DividerItemDecoration(mRecyclerView.getContext(), DividerItemDecoration.VERTICAL);
        Drawable horizontalDivider = ContextCompat.getDrawable(getApplication(), R.drawable.divider_horizontal);
        if (horizontalDivider != null) {
            horizontalDecoration.setDrawable(horizontalDivider);
            mRecyclerView.addItemDecoration(horizontalDecoration);
        }
        // use a linear layout manager
        mLayoutManager = new LinearLayoutManager(this);
        mRecyclerView.setLayoutManager(mLayoutManager);

        // Listener
        mRecyclerView.addOnScrollListener(new MyOnScrollListener());

        // set click event for retry and cancel loading
        mLoadingButton.setOnClickListener(v -> new AsyncReviewReplyListLoader(this, mSwipeRefreshLayout, rid, reviewReplyList).execute()); // retry loading

        mSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.myAccentColor));
        mSwipeRefreshLayout.setOnRefreshListener(this::refreshReviewReplyList);

        llReplyButton.setOnClickListener(ignored -> {
            // FIXME: enable these
            Toast.makeText(getApplication(), getResources().getString(R.string.system_api_error), Toast.LENGTH_SHORT).show();

//            String temp = etReplyText.getText().toString();
//            String badWord = Wenku8API.searchBadWords(temp);
//            if (badWord != null) {
//                Toast.makeText(getApplication(), String.format(getResources().getString(R.string.system_containing_bad_word), badWord), Toast.LENGTH_SHORT).show();
//            } else if (temp.length() < Wenku8API.MIN_REPLY_TEXT) {
//                Toast.makeText(getApplication(), getResources().getString(R.string.system_review_too_short), Toast.LENGTH_SHORT).show();
//            } else {
//                // hide ime
//                InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
//                View view = getCurrentFocus();
//                if (view == null) view = new View(this);
//                if (imm != null) imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
//
//                // submit
//                new AsyncPublishReply(etReplyText, this, rid, temp).execute();
//            }
        });

        // load initial content
        new AsyncReviewReplyListLoader(this, mSwipeRefreshLayout, rid, reviewReplyList).execute();
    }
 
Example 20
Source File: HistoryFragment.java    From linphone-android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public View onCreateView(
        LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.history, container, false);
    mSelectionHelper = new SelectableHelper(view, this);

    mNoCallHistory = view.findViewById(R.id.no_call_history);
    mNoMissedCallHistory = view.findViewById(R.id.no_missed_call_history);

    mHistoryList = view.findViewById(R.id.history_list);

    LinearLayoutManager layoutManager = new LinphoneLinearLayoutManager(getActivity());
    mHistoryList.setLayoutManager(layoutManager);
    // Divider between items
    DividerItemDecoration dividerItemDecoration =
            new DividerItemDecoration(
                    mHistoryList.getContext(), layoutManager.getOrientation());
    dividerItemDecoration.setDrawable(getResources().getDrawable(R.drawable.divider));
    mHistoryList.addItemDecoration(dividerItemDecoration);

    mAllCalls = view.findViewById(R.id.all_calls);
    mAllCalls.setOnClickListener(this);

    mAllCallsSelected = view.findViewById(R.id.all_calls_select);

    mMissedCalls = view.findViewById(R.id.missed_calls);
    mMissedCalls.setOnClickListener(this);

    mMissedCallsSelected = view.findViewById(R.id.missed_calls_select);

    mAllCalls.setEnabled(false);
    mOnlyDisplayMissedCalls = false;

    mListener =
            new CoreListenerStub() {
                @Override
                public void onCallStateChanged(
                        Core core, Call call, Call.State state, String message) {
                    if (state == Call.State.End || state == Call.State.Error) {
                        reloadData();
                    }
                }
            };

    return view;
}