Search in sources :

Example 21 with DividerItemDecoration

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;
    }
}
Also used : ActivityCustomDevicesBinding(org.kde.kdeconnect_tp.databinding.ActivityCustomDevicesBinding) FloatingActionButton(com.google.android.material.floatingactionbutton.FloatingActionButton) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) DividerItemDecoration(androidx.recyclerview.widget.DividerItemDecoration)

Example 22 with DividerItemDecoration

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();
}
Also used : DividerItemDecoration(androidx.recyclerview.widget.DividerItemDecoration) Chip(com.google.android.material.chip.Chip) Bundle(android.os.Bundle) ProgressBar(android.widget.ProgressBar) NonNull(androidx.annotation.NonNull) Uri(android.net.Uri) FrameLayout(android.widget.FrameLayout) ImageView(android.widget.ImageView) BookmarkLocationsDao(fr.free.nrw.commons.bookmarks.locations.BookmarkLocationsDao) MapView(com.mapbox.mapboxsdk.maps.MapView) Marker(com.mapbox.mapboxsdk.annotations.Marker) VectorDrawableCompat(androidx.vectordrawable.graphics.drawable.VectorDrawableCompat) OnClick(butterknife.OnClick) CommonsApplication(fr.free.nrw.commons.CommonsApplication) Manifest(android.Manifest) Utils(fr.free.nrw.commons.Utils) Log(android.util.Log) RxSearchView(com.jakewharton.rxbinding3.appcompat.RxSearchView) IntentFilter(android.content.IntentFilter) SearchView(androidx.appcompat.widget.SearchView) LocationServiceManager(fr.free.nrw.commons.location.LocationServiceManager) LayoutUtils(fr.free.nrw.commons.utils.LayoutUtils) Unit(kotlin.Unit) Nullable(androidx.annotation.Nullable) SystemThemeUtils(fr.free.nrw.commons.utils.SystemThemeUtils) UiUtils(fr.free.nrw.commons.utils.UiUtils) LOCATION_SLIGHTLY_CHANGED(fr.free.nrw.commons.location.LocationServiceManager.LocationChangeType.LOCATION_SLIGHTLY_CHANGED) Html(android.text.Html) LOCATION_SIGNIFICANTLY_CHANGED(fr.free.nrw.commons.location.LocationServiceManager.LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) LatLngBounds(com.mapbox.mapboxsdk.geometry.LatLngBounds) CommonsDaggerSupportFragment(fr.free.nrw.commons.di.CommonsDaggerSupportFragment) Place(fr.free.nrw.commons.nearby.Place) ButterKnife(butterknife.ButterKnife) BottomSheetBehavior(com.google.android.material.bottomsheet.BottomSheetBehavior) OnMenuItemClickListener(android.view.MenuItem.OnMenuItemClickListener) ChipGroup(com.google.android.material.chip.ChipGroup) NearbyParentFragmentPresenter(fr.free.nrw.commons.nearby.presenter.NearbyParentFragmentPresenter) Callback(fr.free.nrw.commons.nearby.fragments.AdvanceQueryFragment.Callback) ArrayList(java.util.ArrayList) CameraUpdateFactory(com.mapbox.mapboxsdk.camera.CameraUpdateFactory) RxView(com.jakewharton.rxbinding2.view.RxView) MenuInflater(android.view.MenuInflater) Toast(android.widget.Toast) Menu(android.view.Menu) CameraPosition(com.mapbox.mapboxsdk.camera.CameraPosition) Settings(android.provider.Settings) Observable(io.reactivex.Observable) Named(javax.inject.Named) MapboxMap(com.mapbox.mapboxsdk.maps.MapboxMap) LocationUtils(fr.free.nrw.commons.utils.LocationUtils) ScaleBarOptions(com.mapbox.pluginscalebar.ScaleBarOptions) IOException(java.io.IOException) Gravity(android.view.Gravity) NearbyPlacesInfo(fr.free.nrw.commons.nearby.NearbyController.NearbyPlacesInfo) Configuration(android.content.res.Configuration) NetworkUtils(fr.free.nrw.commons.utils.NetworkUtils) NearbyMarker(fr.free.nrw.commons.nearby.NearbyMarker) LinearLayout(android.widget.LinearLayout) MainActivity(fr.free.nrw.commons.contributions.MainActivity) LengthUtils.formatDistanceBetween(fr.free.nrw.commons.utils.LengthUtils.formatDistanceBetween) UiSettings(com.mapbox.mapboxsdk.maps.UiSettings) PackageManager(android.content.pm.PackageManager) AppCompatImageView(androidx.appcompat.widget.AppCompatImageView) Date(java.util.Date) R(fr.free.nrw.commons.R) LinkMovementMethod(android.text.method.LinkMovementMethod) DrawableRes(androidx.annotation.DrawableRes) AndroidSchedulers(io.reactivex.android.schedulers.AndroidSchedulers) BindView(butterknife.BindView) ScaleBarPlugin(com.mapbox.pluginscalebar.ScaleBarPlugin) MarkerOptions(com.mapbox.mapboxsdk.annotations.MarkerOptions) ActiveFragment(fr.free.nrw.commons.contributions.MainActivity.ActiveFragment) FloatingActionButton(com.google.android.material.floatingactionbutton.FloatingActionButton) View(android.view.View) Button(android.widget.Button) Schedulers(io.reactivex.schedulers.Schedulers) Animation(android.view.animation.Animation) RecyclerView(androidx.recyclerview.widget.RecyclerView) Label(fr.free.nrw.commons.nearby.Label) JsonKvStore(fr.free.nrw.commons.kvstore.JsonKvStore) BroadcastReceiver(android.content.BroadcastReceiver) AppCompatButton(androidx.appcompat.widget.AppCompatButton) ViewGroup(android.view.ViewGroup) CheckBoxTriStates(fr.free.nrw.commons.nearby.CheckBoxTriStates) Timber(timber.log.Timber) CUSTOM_QUERY(fr.free.nrw.commons.location.LocationServiceManager.LocationChangeType.CUSTOM_QUERY) PolygonOptions(com.mapbox.mapboxsdk.annotations.PolygonOptions) FileUtils(fr.free.nrw.commons.upload.FileUtils) List(java.util.List) TextView(android.widget.TextView) NearbyBaseMarker(fr.free.nrw.commons.nearby.NearbyBaseMarker) Style(com.mapbox.mapboxsdk.maps.Style) RelativeLayout(android.widget.RelativeLayout) PermissionUtils(fr.free.nrw.commons.utils.PermissionUtils) NotNull(org.jetbrains.annotations.NotNull) LocationManager(android.location.LocationManager) Snackbar(com.google.android.material.snackbar.Snackbar) NearbyParentFragmentContract(fr.free.nrw.commons.nearby.contract.NearbyParentFragmentContract) AppCompatTextView(androidx.appcompat.widget.AppCompatTextView) DialogUtil(fr.free.nrw.commons.utils.DialogUtil) Context(android.content.Context) IconFactory(com.mapbox.mapboxsdk.annotations.IconFactory) NearbyFilterState(fr.free.nrw.commons.nearby.NearbyFilterState) AlertDialog(androidx.appcompat.app.AlertDialog) WikidataEditListener(fr.free.nrw.commons.wikidata.WikidataEditListener) Intent(android.content.Intent) ExecutorUtils(fr.free.nrw.commons.utils.ExecutorUtils) ViewUtil(fr.free.nrw.commons.utils.ViewUtil) MAP_UPDATED(fr.free.nrw.commons.location.LocationServiceManager.LocationChangeType.MAP_UPDATED) ContributionController(fr.free.nrw.commons.contributions.ContributionController) MenuItem(android.view.MenuItem) AnimationUtils(android.view.animation.AnimationUtils) Inject(javax.inject.Inject) SuppressLint(android.annotation.SuppressLint) LatLng(com.mapbox.mapboxsdk.geometry.LatLng) LoginActivity(fr.free.nrw.commons.auth.LoginActivity) LocationUpdateListener(fr.free.nrw.commons.location.LocationUpdateListener) MotionEvent(android.view.MotionEvent) Icon(com.mapbox.mapboxsdk.annotations.Icon) MarkerPlaceGroup(fr.free.nrw.commons.nearby.MarkerPlaceGroup) Iterator(java.util.Iterator) LayoutInflater(android.view.LayoutInflater) TimeUnit(java.util.concurrent.TimeUnit) Bitmap(android.graphics.Bitmap) NearbyFilterSearchRecyclerViewAdapter(fr.free.nrw.commons.nearby.NearbyFilterSearchRecyclerViewAdapter) NearbyController(fr.free.nrw.commons.nearby.NearbyController) Polygon(com.mapbox.mapboxsdk.annotations.Polygon) NearbyFABUtils(fr.free.nrw.commons.utils.NearbyFABUtils) PLACE_OBJECT(fr.free.nrw.commons.wikidata.WikidataConstants.PLACE_OBJECT) NearbyFilterSearchRecyclerViewAdapter(fr.free.nrw.commons.nearby.NearbyFilterSearchRecyclerViewAdapter) ArrayList(java.util.ArrayList) Label(fr.free.nrw.commons.nearby.Label) DividerItemDecoration(androidx.recyclerview.widget.DividerItemDecoration) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) SuppressLint(android.annotation.SuppressLint)

Example 23 with DividerItemDecoration

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);
}
Also used : DividerItemDecoration(androidx.recyclerview.widget.DividerItemDecoration) Context(android.content.Context) Bundle(android.os.Bundle) ProgressBar(android.widget.ProgressBar) ButterKnife(butterknife.ButterKnife) Uri(android.net.Uri) R(fr.free.nrw.commons.R) Intent(android.content.Intent) Callable(java.util.concurrent.Callable) ViewUtil(fr.free.nrw.commons.utils.ViewUtil) AndroidSchedulers(io.reactivex.android.schedulers.AndroidSchedulers) MenuItem(android.view.MenuItem) BindView(butterknife.BindView) Inject(javax.inject.Inject) SuppressLint(android.annotation.SuppressLint) MenuInflater(android.view.MenuInflater) Toast(android.widget.Toast) Utils(fr.free.nrw.commons.Utils) Menu(android.view.Menu) View(android.view.View) ObservableSource(io.reactivex.ObservableSource) Observable(io.reactivex.Observable) Schedulers(io.reactivex.schedulers.Schedulers) RecyclerView(androidx.recyclerview.widget.RecyclerView) BaseActivity(fr.free.nrw.commons.theme.BaseActivity) Timber(timber.log.Timber) Disposable(io.reactivex.disposables.Disposable) List(java.util.List) Unit(kotlin.Unit) TextView(android.widget.TextView) ConstraintLayout(androidx.constraintlayout.widget.ConstraintLayout) NetworkUtils(fr.free.nrw.commons.utils.NetworkUtils) RelativeLayout(android.widget.RelativeLayout) Toolbar(androidx.appcompat.widget.Toolbar) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) Snackbar(com.google.android.material.snackbar.Snackbar) Collections(java.util.Collections) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) DividerItemDecoration(androidx.recyclerview.widget.DividerItemDecoration)

Example 24 with DividerItemDecoration

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;
}
Also used : BooleanPreferenceData(james.alarmio.data.preference.BooleanPreferenceData) ImageFilePreferenceData(james.alarmio.data.preference.ImageFilePreferenceData) ArrayList(java.util.ArrayList) DividerItemDecoration(androidx.recyclerview.widget.DividerItemDecoration) CustomPreferenceData(james.alarmio.data.preference.CustomPreferenceData) Attribouter(me.jfenn.attribouter.Attribouter) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TimeZonesPreferenceData(james.alarmio.data.preference.TimeZonesPreferenceData) GridLayoutManager(androidx.recyclerview.widget.GridLayoutManager) PreferenceAdapter(james.alarmio.adapters.PreferenceAdapter) TimePreferenceData(james.alarmio.data.preference.TimePreferenceData) RingtonePreferenceData(james.alarmio.data.preference.RingtonePreferenceData) ThemePreferenceData(james.alarmio.data.preference.ThemePreferenceData) Nullable(androidx.annotation.Nullable)

Example 25 with DividerItemDecoration

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);
    }
}
Also used : RecyclerView(androidx.recyclerview.widget.RecyclerView) DividerItemDecoration(androidx.recyclerview.widget.DividerItemDecoration) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Aggregations

DividerItemDecoration (androidx.recyclerview.widget.DividerItemDecoration)26 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)20 RecyclerView (androidx.recyclerview.widget.RecyclerView)15 View (android.view.View)12 TextView (android.widget.TextView)7 Button (android.widget.Button)6 Context (android.content.Context)5 ArrayList (java.util.ArrayList)5 Activity (android.app.Activity)4 Bundle (android.os.Bundle)4 ProgressBar (android.widget.ProgressBar)4 Nullable (androidx.annotation.Nullable)4 List (java.util.List)4 SuppressLint (android.annotation.SuppressLint)3 Log (android.util.Log)3 LayoutInflater (android.view.LayoutInflater)3 MenuItem (android.view.MenuItem)3 ViewGroup (android.view.ViewGroup)3 RelativeLayout (android.widget.RelativeLayout)3 NonNull (androidx.annotation.NonNull)3