use of androidx.recyclerview.widget.DividerItemDecoration in project kdeconnect-android by KDE.
the class CustomDevicesActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
ThemeUtil.setUserPreferredTheme(this);
super.onCreate(savedInstanceState);
final ActivityCustomDevicesBinding binding = ActivityCustomDevicesBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
recyclerView = binding.recyclerView;
emptyListMessage = binding.emptyListMessage;
final FloatingActionButton fab = binding.floatingActionButton;
setSupportActionBar(binding.toolbarLayout.toolbar);
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
fab.setOnClickListener(v -> showEditTextDialog(""));
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
customDeviceList = getCustomDeviceList(sharedPreferences);
showEmptyListMessageIfRequired();
customDevicesAdapter = new CustomDevicesAdapter(this);
customDevicesAdapter.setCustomDevices(customDeviceList);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false));
recyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
recyclerView.setAdapter(customDevicesAdapter);
addDeviceDialog = (EditTextAlertDialogFragment) getSupportFragmentManager().findFragmentByTag(TAG_ADD_DEVICE_DIALOG);
if (addDeviceDialog != null) {
addDeviceDialog.setCallback(new AddDeviceDialogCallback());
}
TooltipCompat.setTooltipText(fab, getString(R.string.custom_device_fab_hint));
if (savedInstanceState != null) {
editingDeviceAtPosition = savedInstanceState.getInt(KEY_EDITING_DEVICE_AT_POSITION);
} else {
editingDeviceAtPosition = -1;
}
}
use of androidx.recyclerview.widget.DividerItemDecoration in project apps-android-commons by commons-app.
the class NearbyParentFragment method initNearbyFilter.
public void initNearbyFilter() {
nearbyFilterList.setVisibility(View.GONE);
searchView.setOnQueryTextFocusChangeListener((v, hasFocus) -> {
if (hasFocus) {
presenter.searchViewGainedFocus();
nearbyFilterList.setVisibility(View.VISIBLE);
} else {
nearbyFilterList.setVisibility(View.GONE);
}
});
recyclerView.setHasFixedSize(true);
recyclerView.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(linearLayoutManager);
nearbyFilterSearchRecyclerViewAdapter = new NearbyFilterSearchRecyclerViewAdapter(getContext(), new ArrayList<>(Label.valuesAsList()), recyclerView);
nearbyFilterSearchRecyclerViewAdapter.setCallback(new NearbyFilterSearchRecyclerViewAdapter.Callback() {
@Override
public void setCheckboxUnknown() {
presenter.setCheckboxUnknown();
}
@Override
public void filterByMarkerType(final ArrayList<Label> selectedLabels, final int i, final boolean b, final boolean b1) {
presenter.filterByMarkerType(selectedLabels, i, b, b1);
}
@Override
public boolean isDarkTheme() {
return isDarkTheme;
}
});
nearbyFilterList.getLayoutParams().width = (int) LayoutUtils.getScreenWidth(getActivity(), 0.75);
recyclerView.setAdapter(nearbyFilterSearchRecyclerViewAdapter);
LayoutUtils.setLayoutHeightAllignedToWidth(1.25, nearbyFilterList);
compositeDisposable.add(RxSearchView.queryTextChanges(searchView).takeUntil(RxView.detaches(searchView)).debounce(500, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(query -> {
((NearbyFilterSearchRecyclerViewAdapter) recyclerView.getAdapter()).getFilter().filter(query.toString());
}));
initFilterChips();
}
use of androidx.recyclerview.widget.DividerItemDecoration in project apps-android-commons by commons-app.
the class NotificationActivity method initListView.
private void initListView() {
recyclerView.setLayoutManager(new LinearLayoutManager(this));
DividerItemDecoration itemDecor = new DividerItemDecoration(recyclerView.getContext(), DividerItemDecoration.VERTICAL);
recyclerView.addItemDecoration(itemDecor);
if (isRead) {
refresh(true);
} else {
refresh(false);
}
adapter = new NotificatinAdapter(item -> {
Timber.d("Notification clicked %s", item.getLink());
handleUrl(item.getLink());
removeNotification(item);
return Unit.INSTANCE;
});
recyclerView.setAdapter(this.adapter);
}
use of androidx.recyclerview.widget.DividerItemDecoration in project Alarmio by TheAndroidMaster.
the class SettingsFragment method onCreateView.
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_recycler, container, false);
recyclerView = v.findViewById(R.id.recycler);
recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 1));
recyclerView.addItemDecoration(new DividerItemDecoration(recyclerView.getContext(), DividerItemDecoration.VERTICAL));
preferenceAdapter = new PreferenceAdapter(new ArrayList<BasePreferenceData>(Arrays.asList(new ThemePreferenceData(), new ImageFilePreferenceData(PreferenceData.BACKGROUND_IMAGE, R.string.title_background_image), new BooleanPreferenceData(PreferenceData.RINGING_BACKGROUND_IMAGE, R.string.title_ringing_background_image, R.string.desc_ringing_background_image), new TimeZonesPreferenceData(PreferenceData.TIME_ZONE_ENABLED, R.string.title_time_zones), new RingtonePreferenceData(PreferenceData.DEFAULT_ALARM_RINGTONE, R.string.title_default_alarm_ringtone), new RingtonePreferenceData(PreferenceData.DEFAULT_TIMER_RINGTONE, R.string.title_default_timer_ringtone), new BooleanPreferenceData(PreferenceData.SLEEP_REMINDER, R.string.title_sleep_reminder, R.string.desc_sleep_reminder), new TimePreferenceData(PreferenceData.SLEEP_REMINDER_TIME, R.string.title_sleep_reminder_time), new BooleanPreferenceData(PreferenceData.SLOW_WAKE_UP, R.string.title_slow_wake_up, R.string.desc_slow_wake_up), new TimePreferenceData(PreferenceData.SLOW_WAKE_UP_TIME, R.string.title_slow_wake_up_time), new CustomPreferenceData(R.string.title_about) {
@Override
public String getValueName(ViewHolder holder) {
return "";
}
@Override
public void onClick(ViewHolder holder) {
Attribouter attribouter = Attribouter.from(getContext());
int githubAuthKey = getResources().getIdentifier("githubAuthKey", "string", getContext().getPackageName());
if (githubAuthKey != 0)
attribouter = attribouter.withGitHubToken(getString(githubAuthKey));
attribouter.show();
}
})));
recyclerView.setAdapter(preferenceAdapter);
colorPrimarySubscription = Aesthetic.Companion.get().colorPrimary().subscribe(this);
textColorPrimarySubscription = Aesthetic.Companion.get().textColorPrimary().subscribe(this);
return v;
}
use of androidx.recyclerview.widget.DividerItemDecoration in project RespawnIRC-Android by FranckRJ.
the class ManageAccountListActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_manageaccountlist);
initToolbar(R.id.toolbar_manageaccountlist);
adapterForAccountList = new RemovableItemListAdapter(this);
RecyclerView accountListView = findViewById(R.id.account_list_manageaccountlist);
emptyListMessageText = findViewById(R.id.text_emptylist_manageaccountlist);
generateListOfAccounts();
adapterForAccountList.setOnItemRemovedListener(listenerForAccountRemoved);
accountListView.setNestedScrollingEnabled(false);
accountListView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
accountListView.setLayoutManager(new LinearLayoutManager(this));
accountListView.setAdapter(adapterForAccountList);
if (adapterForAccountList.listIsEmpty()) {
emptyListMessageText.setVisibility(View.VISIBLE);
} else {
emptyListMessageText.setVisibility(View.GONE);
}
}
Aggregations