Java Code Examples for androidx.recyclerview.widget.DividerItemDecoration#VERTICAL

The following examples show how to use androidx.recyclerview.widget.DividerItemDecoration#VERTICAL . 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: 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 2
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 3
Source File: RecentActivity.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);
    if (!checkPermissions(this, requiredPermissions()))
        return;

    setContentView(R.layout.activity_recent);

    recyclerView = findViewById(R.id.recycler_view);
    final DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(), DividerItemDecoration.VERTICAL);
    dividerItemDecoration.setDrawable(getDrawable(R.drawable.ll_divider));
    recyclerView.addItemDecoration(dividerItemDecoration);
    final CallsRecyclerViewAdapter callsRecyclerViewAdapter = new CallsRecyclerViewAdapter(CallLogsHelper.getAllCalls(getContentResolver()), this);
    CallLogsHelper.markAllAsRead(getContentResolver());
    recyclerView.setAdapter(callsRecyclerViewAdapter);

    setupYoutube(3);
}
 
Example 4
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 5
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 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: 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 8
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 9
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 10
Source File: CoalitionsActivity.java    From intra42 with Apache License 2.0 6 votes vote down vote up
@Override
protected void setViewContent() {
    if (blocs == null) {
        setViewState(StatusCode.EMPTY);
        return;
    }
    List<Coalitions> coalitions = blocs.coalitions;
    Collections.sort(coalitions, (o1, o2) -> {
        if (o1.score == o2.score)
            return 0;
        return o1.score < o2.score ? 1 : -1;
    });

    RecyclerAdapterCoalitionsBlocs adapter = new RecyclerAdapterCoalitionsBlocs(this, coalitions);
    recyclerView.setAdapter(adapter);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setNestedScrollingEnabled(false);
    DividerItemDecoration decoration = new DividerItemDecoration(this, DividerItemDecoration.VERTICAL);
    Drawable decoDrawable = decoration.getDrawable();
    decoDrawable.setAlpha(1);
    decoration.setDrawable(decoDrawable);
    recyclerView.addItemDecoration(decoration);
}
 
Example 11
Source File: BaseContactsActivity.java    From BaldPhone with Apache License 2.0 5 votes vote down vote up
protected void attachXml() {
    baldTitleBar = findViewById(R.id.bald_title_bar);
    et_filter_input = findViewById(R.id.edit_text);
    recyclerView = findViewById(R.id.contacts_recycler_view);
    bt_speak = findViewById(R.id.bt_speak);
    bt_type = findViewById(R.id.bt_type);
    bt_favorite = findViewById(R.id.bt_favorite);
    final DividerItemDecoration dividerItemDecoration =
            new DividerItemDecoration(recyclerView.getContext(), DividerItemDecoration.VERTICAL);
    dividerItemDecoration.setDrawable(getDrawable(R.drawable.ll_divider));
    recyclerView.addItemDecoration(dividerItemDecoration);

}
 
Example 12
Source File: SimpleDividerItemDecoration.java    From AndroidApp with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Default divider will be used
 */
public SimpleDividerItemDecoration(Context context) {
    super(context, DividerItemDecoration.VERTICAL);
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    divider = a.getDrawable(0);
    leftPadding = Math.round(72 * (context.getResources().getDisplayMetrics().xdpi / DisplayMetrics.DENSITY_DEFAULT));
}
 
Example 13
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 14
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 15
Source File: ErrorDialog.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onAttach(@NotNull Context context) {
    super.onAttach(context);
    this.title = context.getString(R.string.error_dialog_title);
    this.shareTitle = context.getString(R.string.share_with);
    this.shareMessageTitle = context.getString(R.string.sync_error_title);
    this.divider = new DividerItemDecoration(context, DividerItemDecoration.VERTICAL);
    this.shareData = new ObservableArrayList<>();
}
 
Example 16
Source File: NotificationsActivity.java    From BaldPhone with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (!notificationListenerGranted(this))
        return;

    setContentView(R.layout.activity_notifications);
    findViewById(R.id.clear_all_notifications).setOnClickListener(v -> {
        if (notificationRecyclerViewAdapter != null)
            notificationRecyclerViewAdapter.clearAll();
        finish();
    });
    recyclerView = findViewById(R.id.recycler_view);
    final DividerItemDecoration dividerItemDecoration =
            new DividerItemDecoration(this, DividerItemDecoration.VERTICAL);
    dividerItemDecoration.setDrawable(getDrawable(R.drawable.ll_divider));
    recyclerView.addItemDecoration(dividerItemDecoration);
    recyclerView.setItemViewCacheSize(10);

    if (!Settings.Secure.getString(this.getContentResolver(), "enabled_notification_listeners")
            .contains(getApplicationContext().getPackageName())) {
        BDB.from(this)
                .setTitle(R.string.enable_notification_access)
                .setSubText(R.string.enable_notification_access_subtext)
                .addFlag(BDialog.FLAG_OK | BDialog.FLAG_CANCEL)
                .setPositiveButtonListener(params -> {
                    getApplicationContext().startActivity(new Intent(
                            "android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"));
                    return true;
                })
                .setNegativeButtonListener(params -> true)
                .show();
    }

}
 
Example 17
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 18
Source File: OdysseyRecyclerFragment.java    From odyssey with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Method to setup the recyclerview with a linear layout manager and a default item decoration.
 * Make sure to call this method after the recyclerview was set.
 */
protected void setLinearLayoutManagerAndDecoration() {
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    final DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL);
    mRecyclerView.addItemDecoration(dividerItemDecoration);
}
 
Example 19
Source File: AppKeysActivity.java    From Android-nRF-Mesh-Library with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_keys);
    mViewModel = new ViewModelProvider(this, mViewModelFactory).get(AppKeysViewModel.class);

    //Bind ui
    ButterKnife.bind(this);

    final Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    //noinspection ConstantConditions
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    final ExtendedFloatingActionButton fab = findViewById(R.id.fab_add);
    final RecyclerView appKeysRecyclerView = findViewById(R.id.recycler_view_keys);
    appKeysRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    final DividerItemDecoration dividerItemDecoration =
            new DividerItemDecoration(appKeysRecyclerView.getContext(), DividerItemDecoration.VERTICAL);
    appKeysRecyclerView.addItemDecoration(dividerItemDecoration);
    appKeysRecyclerView.setItemAnimator(new DefaultItemAnimator());

    final Bundle bundle = getIntent().getExtras();
    if (bundle != null) {
        switch (bundle.getInt(EXTRA_DATA)) {
            case MANAGE_APP_KEY:
                break;
            case ADD_APP_KEY:
                getSupportActionBar().setTitle(R.string.title_select_app_key);
                fab.hide();
                mAdapter = new ManageAppKeyAdapter(this, mViewModel.getNetworkLiveData());
                mAdapter.setOnItemClickListener(this);
                appKeysRecyclerView.setAdapter(mAdapter);
                setUpObserver();
                break;
            case BIND_APP_KEY:
            case PUBLICATION_APP_KEY:
                getSupportActionBar().setTitle(R.string.title_select_app_key);
                fab.hide();
                //Get selected mesh node
                final ProvisionedMeshNode node = mViewModel.getSelectedMeshNode().getValue();
                if (node != null) {
                    final List<NodeKey> applicationKeys = node.getAddedAppKeys();
                    if (!applicationKeys.isEmpty()) {
                        mAdapter = new ManageAppKeyAdapter(mViewModel.getNetworkLiveData().getAppKeys(), applicationKeys);
                        mAdapter.setOnItemClickListener(this);
                        appKeysRecyclerView.setAdapter(mAdapter);
                    } else {
                        final TextView textView = mEmptyView.findViewById(R.id.rationale);
                        textView.setText(R.string.no_added_app_keys_rationale);
                        mEmptyView.setVisibility(View.VISIBLE);
                    }
                }
                break;
        }
    } else {
        getSupportActionBar().setTitle(R.string.title_manage_app_keys);
        final ItemTouchHelper.Callback itemTouchHelperCallback = new RemovableItemTouchHelperCallback(this);
        final ItemTouchHelper itemTouchHelper = new ItemTouchHelper(itemTouchHelperCallback);
        itemTouchHelper.attachToRecyclerView(appKeysRecyclerView);
        mAdapter = new ManageAppKeyAdapter(this, mViewModel.getNetworkLiveData());
        mAdapter.setOnItemClickListener(this);
        appKeysRecyclerView.setAdapter(mAdapter);
        setUpObserver();
    }


    fab.setOnClickListener(v -> {
        final Intent intent = new Intent(this, AddAppKeyActivity.class);
        startActivity(intent);
    });

    appKeysRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(@NonNull final RecyclerView recyclerView, final int dx, final int dy) {
            super.onScrolled(recyclerView, dx, dy);
            final LinearLayoutManager m = (LinearLayoutManager) recyclerView.getLayoutManager();
            if (m != null) {
                if (m.findFirstCompletelyVisibleItemPosition() == 0) {
                    fab.extend();
                } else {
                    fab.shrink();
                }
            }
        }
    });
}
 
Example 20
Source File: RangesActivity.java    From Android-nRF-Mesh-Library with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@SuppressWarnings("ConstantConditions")
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_ranges);
    ButterKnife.bind(this);
    mViewModel = new ViewModelProvider(this, mViewModelFactory).get(RangesViewModel.class);
    mType = getIntent().getExtras().getInt(Utils.RANGE_TYPE);

    //Bind ui
    final Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    final RecyclerView recyclerView = findViewById(R.id.recycler_view);
    final View rangesContainer = findViewById(R.id.info_ranges);
    rangesContainer.findViewById(R.id.container).setVisibility(View.VISIBLE);
    mRangeView = rangesContainer.findViewById(R.id.range);
    final TextView startAddress = rangesContainer.findViewById(R.id.start_address);
    final TextView endAddress = rangesContainer.findViewById(R.id.end_address);
    final ExtendedFloatingActionButton fab_add = findViewById(R.id.fab_add);

    mProvisioner = mViewModel.getSelectedProvisioner().getValue();

    switch (mType) {
        case Utils.GROUP_RANGE:
            startAddress.setText(MeshAddress.formatAddress(MeshAddress.START_GROUP_ADDRESS, true));
            endAddress.setText(MeshAddress.formatAddress(MeshAddress.END_GROUP_ADDRESS, true));
            getSupportActionBar().setTitle(R.string.title_edit_group_ranges);
            mRangeAdapter = new RangeAdapter(this,
                    mProvisioner.getProvisionerUuid(),
                    mProvisioner.getAllocatedGroupRanges(),
                    mViewModel.getNetworkLiveData().getProvisioners());
            break;
        case Utils.SCENE_RANGE:
            startAddress.setText(MeshAddress.formatAddress(0x0000, true));
            endAddress.setText(MeshAddress.formatAddress(0xFFFF, true));
            getSupportActionBar().setTitle(R.string.title_edit_scene_ranges);
            mRangeAdapter = new RangeAdapter(this,
                    mProvisioner.getProvisionerUuid(),
                    mProvisioner.getAllocatedSceneRanges(),
                    mViewModel.getNetworkLiveData().getProvisioners());
            break;
        default:
        case Utils.UNICAST_RANGE:
            startAddress.setText(MeshAddress.formatAddress(MeshAddress.START_UNICAST_ADDRESS, true));
            endAddress.setText(MeshAddress.formatAddress(MeshAddress.END_UNICAST_ADDRESS, true));
            getSupportActionBar().setTitle(R.string.title_edit_unicast_ranges);
            mRangeAdapter = new RangeAdapter(this,
                    mProvisioner.getProvisionerUuid(),
                    mProvisioner.getAllocatedUnicastRanges(),
                    mViewModel.getNetworkLiveData().getProvisioners());
            break;
    }

    mRangeAdapter.setOnItemClickListener(this);

    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    final DividerItemDecoration dividerItemDecoration =
            new DividerItemDecoration(recyclerView.getContext(), DividerItemDecoration.VERTICAL);
    recyclerView.addItemDecoration(dividerItemDecoration);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(mRangeAdapter);
    final ItemTouchHelper.Callback itemTouchHelperCallback = new RemovableItemTouchHelperCallback(this);
    final ItemTouchHelper itemTouchHelper = new ItemTouchHelper(itemTouchHelperCallback);
    itemTouchHelper.attachToRecyclerView(recyclerView);

    fab_add.setOnClickListener(v -> {
        switch (mType) {
            case Utils.GROUP_RANGE:
                final DialogFragmentGroupRange groupRange = DialogFragmentGroupRange.newInstance(null);
                groupRange.show(getSupportFragmentManager(), null);
                break;
            case Utils.SCENE_RANGE:
                final DialogFragmentSceneRange sceneRange = DialogFragmentSceneRange.newInstance(null);
                sceneRange.show(getSupportFragmentManager(), null);
                break;
            default:
            case Utils.UNICAST_RANGE:
                final DialogFragmentUnicastRange unicastRange = DialogFragmentUnicastRange.newInstance(null);
                unicastRange.show(getSupportFragmentManager(), null);
                break;
        }
    });

    mFabResolve.setOnClickListener(v -> resolveRanges());

    updateRanges();
    updateOtherRanges();
    updateEmptyView();
    updateResolveFab();
}