Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct typos in comments and create a dictionary #982

Merged
merged 1 commit into from
Mar 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ proguard/

#IntelliJ files
*.iml
.idea/
.idea/*
!.idea/dictionaries
Comment on lines -31 to +32
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change to .idea/* is required to allow negating the rule for sub-directories.


*.DS_STORE
*.DS_STORE
57 changes: 57 additions & 0 deletions .idea/dictionaries/benji.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FastAdapter contributors (sorted alphabeticaly)
FastAdapter contributors (sorted alphabetically)
============================================

* **[Fabian Terhorst](https://github.com/FabianTerhorst)**
Expand Down
12 changes: 6 additions & 6 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int, pa

#### v4.x.y

v4 is a huge release changing most of the codebase to Kotlin. This comes with many refactors, and as a result of that with many breaking API changes.
We put a lot of focus on type safety with this release, as such this release is a lot more strict and tries to prevent as many potential bad type mixups as possible.
v4 is a huge release changing most of the codebase to Kotlin. This comes with many refactorings, and as a result of that with many breaking API changes.
We put a lot of focus on type safety with this release, as such this release is a lot more strict and tries to prevent as many potential bad type mix-ups as possible.

* For compatibility, most existing static fields and functions remain static in Java. For newer functions, accessing from Java may require using the `Companion` class. For instance, `FastAdapter.example()` becomes `FastAdapter.Companion.example()`
* The `IItem` interface now requires a type specification. E.g. `IItem<RecyclerView.ViewHolder>`
Expand Down Expand Up @@ -57,7 +57,7 @@ If you have any issues during the migration, or any questions come up please ope
* Further details about migrating to androidX and a overview can be found on the official docs. https://developer.android.com/topic/libraries/support-library/refactor

#### v3.2.4
* Adjusted the `set(int position, Item item, int preItemCount)` to include the `preItemCount` to corretly notify the adapter about the changed element.
* Adjusted the `set(int position, Item item, int preItemCount)` to include the `preItemCount` to correctly notify the adapter about the changed element.

#### v3.2.3
* The `ActionModeHelper` requires a `FastAdapter` with the `SelectExtension` applied. This is done in current versions via `withSelectable(true)`. Make sure this is called before creating the `ActionModeHelper`.
Expand Down Expand Up @@ -156,17 +156,17 @@ public ViewHolder getViewHolder(View v) {

**SHORT OVERVIEW**
* If you have items implemented by using the interface you have to implement the new methods (**unbindView**)
* If you have expandable items make sure to adjust the Model type definitions as metioned below. Check out the `AbstractExpandableItem` to simplify this for you
* If you have expandable items make sure to adjust the Model type definitions as mentioned below. Check out the `AbstractExpandableItem` to simplify this for you
* If you use the `MaterialDrawer`, the `AboutLibraries` in your project, please make sure to update them so the changed interfaces do not cause conflicts

**DETAILED**
* New `unbindView` method was added to the `IItem` --> This method is called when the current item is no longer set and before the `ViewHolder` is used for the next item
* You should move your view resetting logic here, or for example glide image loading canceling
* `IExpandable` Model types changes
* it is now required to define the type which will be used for the subItems. This can be an implementation or `ISubItem`. We now require this, as we will keep the references between childs, and parents.
* it is now required to define the type which will be used for the subItems. This can be an implementation or `ISubItem`. We now require this, as we will keep the references between children, and parents.
* this allows more optimizations, and many additional usecases
* New `ISubItem` interface added
* items serving as subitems, have to implement this.
* items serving as subItems, have to implement this.
* New `AbstractExpandableItem` added, which combines `IExpandable` and `ISubItem` with an `AbstractItem` to simplify your life
* A new `SubItemUtil` was introduced which simplifies some use cases when working with expandable / collapsing lists

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# FastAdapter

The FastAdapter is here to simplify creating adapters for RecyclerViews. Don't worry about the adapter anymore. Just write the logic for how your view/item should look like, and you are done.
It's blazingly fast, minimizing the code you need to write, and is easy to extend.
It's blazing fast, minimizing the code you need to write, and is easy to extend.

-------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import java.util.*
import java.util.concurrent.atomic.AtomicLong

/**
* This sample showcases compatibility the awesome Sticky-Headers library by timehop
* This sample showcases compatibility with the awesome Sticky-Headers library by timehop
* https://github.com/timehop/sticky-headers-recyclerview
*/
class AdvancedSampleActivity : AppCompatActivity() {
Expand Down Expand Up @@ -82,7 +82,7 @@ class AdvancedSampleActivity : AppCompatActivity() {
if (item is IExpandable<*> && item.subItems.isNotEmpty()) {
true
} else {
//handle the longclick actions
//handle the long click actions
val actionMode = mActionModeHelper?.onLongClick(this@AdvancedSampleActivity, position)
if (actionMode != null) {
//we want color our CAB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class DiffUtilActivity : AppCompatActivity() {

override fun onSaveInstanceState(_outState: Bundle) {
var outState = _outState
//add the values which need to be saved from the adapter to the bundel
//add the values which need to be saved from the adapter to the bundle
outState = fastItemAdapter.saveInstanceState(outState)
super.onSaveInstanceState(outState)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class ExpandableMultiselectDeleteSampleActivity : AppCompatActivity() {
.identifier = (i + 1).toLong()
//.withIsExpanded(true) don't use this in such a setup, use adapter.expand() to expand all items instead

//add subitems so we can showcase the collapsible functionality
//add subItems so we can showcase the collapsible functionality
val subItems = LinkedList<ISubItem<*>>()
for (ii in 1..5) {
val sampleItem = SimpleSubItem()
Expand Down Expand Up @@ -159,7 +159,7 @@ class ExpandableMultiselectDeleteSampleActivity : AppCompatActivity() {
val headerItem = item.parent
if (headerItem != null) {
val pos = fastItemAdapter.getAdapterPosition(headerItem)
// Important: notify the header directly, not via the notifyadapterItemChanged!
// Important: notify the header directly, not via the notifyAdapterItemChanged!
// we just want to update the view and we are sure, nothing else has to be done
fastItemAdapter.notifyItemChanged(pos)
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@
<string name="sample_diff_util">Diff Util Sample</string>
<string name="sample_diff_util_descr">Diff Util, refresh list using DiffUtil</string>
<string name="open_source">Open Source</string>
<string name="search_title">Suche</string>
<string name="search_title">Search</string>
<string name="action_undo">UNDO</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ object AdapterUtil {
* Gets all items (including sub items) from the FastAdapter
*
* @param fastAdapter the FastAdapter
* @return a list of all items including the whole subItem hirachy
* @return a list of all items including the whole subItem hierarchy
*/
@JvmStatic fun <Item> getAllItems(fastAdapter: FastAdapter<Item>): List<Item> where Item : GenericItem, Item : IExpandable<*> {
val size = fastAdapter.itemCount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ object SubItemUtil {
}

/**
* Select or unselect all sub itmes underneath an expandable item
* Select or unselect all sub items underneath an expandable item
*
* @param adapter the adapter instance
* @param header the header who's children should be selected or deselected
Expand All @@ -176,7 +176,7 @@ object SubItemUtil {
}

/**
* Select or unselect all sub itmes underneath an expandable item
* Select or unselect all sub items underneath an expandable item
*
* @param adapter the adapter instance
* @param header the header who's children should be selected or deselected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ open class PagedItemListImpl<Model, Item : GenericItem>(
/**
* Returns the default placeholder interceptor
*
* Note if your PagedItemList should contain placeholder, you have to provide a logic what the adapter should show while in placeholding state
* Note if your PagedItemList should contain placeholder, you have to provide a logic what the adapter should show while in placeholder state
*/
internal fun <Item : GenericItem> getDefaultPlaceholderInterceptor(): (Int) -> Item {
return { throw RuntimeException("No item found at position") }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ abstract class EndlessRecyclerOnTopScrollListener : RecyclerView.OnScrollListene
super.onScrolled(recyclerView, dx, dy)
if (!::_layoutManager.isInitialized) {
this._layoutManager = recyclerView.layoutManager as LinearLayoutManager?
?: throw RuntimeException("A layoutmanager is required")
?: throw RuntimeException("A LayoutManager is required")
}

if (visibleThreshold == RecyclerView.NO_POSITION) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class ActionModeHelper<Item : GenericItem> {

/**
* Implements the basic behavior of a CAB and multi select behavior,
* including logics if the clicked item is collapsible
* including logic if the clicked item is collapsible
*
* @param item the current item
* @return null if nothing was done, or a boolean to inform if the event was consumed
Expand All @@ -99,7 +99,7 @@ class ActionModeHelper<Item : GenericItem> {

/**
* Implements the basic behavior of a CAB and multi select behavior,
* including logics if the clicked item is collapsible
* including logic if the clicked item is collapsible
*
* @param act the current Activity
* @param item the current item
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ class HeaderHelper<Item, HeaderItem : Item> {
}

/**
* Call this when your list order has changed or was updated, and you have to readd the headres
* Call this when your list order has changed or was updated, and you have to read the headers
*
* @param items the list which will get the headers added inbetween
* @param items the list which will get the headers added in-between
*/
fun apply(items: MutableList<Item>) {
//If the list is empty avoid sorting and adding headers.
Expand Down Expand Up @@ -69,7 +69,7 @@ class HeaderHelper<Item, HeaderItem : Item> {
interface GroupingFunction<Item, HeaderItem> {
/**
* @param currentItem the current item we check
* @param nextItem the item comming after the current item
* @param nextItem the item coming after the current item
* @param currentPosition the current position of the currentItem
* @return the HeaderItem we want to add after the currentItem
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ open class RangeSelectorHelper<Item : GenericItem>(private val fastAdapter: Fast
}

/**
* Enable this, if you want the range selector to correclty handle sub items as well
* Enable this, if you want the range selector to correctly handle sub items as well
*
* @param supportSubItems true, if sub items are supported, false otherwise
* @return this, for supporting function call chaining
Expand All @@ -44,7 +44,7 @@ open class RangeSelectorHelper<Item : GenericItem>(private val fastAdapter: Fast
/**
* The provided payload will be passed to the adapters notify function, if one is provided
*
* @param payload the paylaod that should be passed to the adapter on selection state change
* @param payload the payload that should be passed to the adapter on selection state change
* @return this, for supporting function call chaining
*/
fun withPayload(payload: Any): RangeSelectorHelper<*> {
Expand Down Expand Up @@ -100,10 +100,10 @@ open class RangeSelectorHelper<Item : GenericItem>(private val fastAdapter: Fast
}

/**
* Selects all items in a range, from and to indizes are inclusive
* Selects all items in a range, from and to indices are inclusive
*
* @param from the from index
* @param to the to index
* @param _from the from index
* @param _to the to index
* @param select true, if the provided range should be selected, false otherwise
* @param skipHeaders true, if you do not want to process headers, false otherwise
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ open class FastAdapter<Item : GenericItem> : RecyclerView.Adapter<RecyclerView.V

/**
* Helper method to get the position from a holder
* overwrite this if you have an adapter adding additional items inbetwean
* overwrite this if you have an adapter adding additional items in-between
*
* @param holder the viewHolder of the item
* @return the position of the holder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ open class ItemFilter<Model, Item : GenericItem>(private val itemAdapter: ModelA
itemAdapter.setInternal(results.values as List<Item>, false, null)
}

//only fire when we are filtered, not in onreset
//only fire when we are filtered, not in onReset
if (originalItems != null) {
itemFilterListener?.itemsFiltered(constraint, results.values as List<Item>)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ open class ModelAdapter<Model, Item : GenericItem>(
}

/**
* defines if this adapter is currently activly shown in the list
* defines if this adapter is currently actively shown in the list
*/
var active: Boolean = true
set(value) {
Expand Down Expand Up @@ -413,7 +413,7 @@ open class ModelAdapter<Model, Item : GenericItem>(
position: Int
): Boolean {
if (identifier == item.identifier) {
//if it's a subitem remove it from the parent
//if it's a subItem remove it from the parent
(item as? IExpandable<*>?)?.let { expandable ->
//a sub item which is not in the list can be instantly deleted
expandable.parent?.subItems?.remove(item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ abstract class AbstractItem<VH : RecyclerView.ViewHolder> : BaseItem<VH>(), IIte

/**
* This method is called by generateView(Context ctx), generateView(Context ctx, ViewGroup parent) and getViewHolder(ViewGroup parent)
* it will generate the View from the layout, overwrite this if you want to implement your view creation programatically
* it will generate the View from the layout, overwrite this if you want to implement your view creation programmatically
*/
open fun createView(ctx: Context, parent: ViewGroup?): View {
return LayoutInflater.from(ctx).inflate(layoutRes, parent, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ abstract class BaseItemFactory<VH : RecyclerView.ViewHolder> : IItemVHFactory<VH

/**
* This method is called by generateView(Context ctx), generateView(Context ctx, ViewGroup parent) and getViewHolder(ViewGroup parent)
* it will generate the View from the layout, overwrite this if you want to implement your view creation programatically
* it will generate the View from the layout, overwrite this if you want to implement your view creation programmatically
*/
open fun createView(ctx: Context, parent: ViewGroup?): View {
return LayoutInflater.from(ctx).inflate(layoutRes, parent, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class SelectExtension<Item : GenericItem>(private val fastAdapter: FastAdapter<I
/**
* Select between the different selection behaviors.
* there are now 2 different variants of selection. you can toggle this via `withSelectWithItemUpdate(boolean)` (where false == default - variant 1)
* 1.) direct selection via the view "selected" state, we also make sure we do not animate here so no notifyItemChanged is called if we repeatly press the same item
* 2.) we select the items via a notifyItemChanged. this will allow custom selected logics within your views (isSelected() - do something...) and it will also animate the change via the provided itemAnimator. because of the animation of the itemAnimator the selection will have a small delay (time of animating)
* 1.) direct selection via the view "selected" state, we also make sure we do not animate here so no notifyItemChanged is called if we repeatedly press the same item
* 2.) we select the items via a notifyItemChanged. this will allow custom selected logic within your views (isSelected() - do something...) and it will also animate the change via the provided itemAnimator. because of the animation of the itemAnimator the selection will have a small delay (time of animating)
*/
var selectWithItemUpdate = false
// if we want multiSelect enabled
Expand Down Expand Up @@ -258,7 +258,7 @@ class SelectExtension<Item : GenericItem>(private val fastAdapter: FastAdapter<I
}

/**
* Selects all items at the positions in the iteratable
* Selects all items at the positions in the iterable
*
* @param positions the global positions to select
*/
Expand Down Expand Up @@ -357,7 +357,7 @@ class SelectExtension<Item : GenericItem>(private val fastAdapter: FastAdapter<I
}

/**
* Deselects all items at the positions in the iteratable
* Deselects all items at the positions in the iterable
*
* @param positions the global positions to deselect
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ class ComparableItemListImpl<Item : GenericItem> @JvmOverloads constructor(
items: MutableList<Item> = ArrayList()
) : DefaultItemListImpl<Item>(items) {

/** @return the defined Comparator used for this ItemAdaper */
/** @return the defined Comparator used for this ItemAdapter */
var comparator: Comparator<Item>? = comparator
private set

/**
* Define a comparator which will be used to sort the list "everytime" it is altered
* Define a comparator which will be used to sort the list "every time" it is altered
* NOTE this will only sort if you "set" a new list or "add" new items (not if you provide a position for the add function)
*
* @param comparator used to sort the list
Expand Down