Skip to content

Commit

Permalink
Rename more object to item for Kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
StanKocken committed Jan 20, 2018
1 parent dd320f2 commit 61af850
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.skocken.efficientadapter.lib.viewholder.EfficientViewHolder;

import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.ViewGroup;

Expand Down Expand Up @@ -55,11 +57,11 @@ public interface EfficientAdapter<T> extends AdapterUpdater.Updater<T> {
* Searches this {@code Adapter} for the specified object and returns the index of the
* first occurrence.
*
* @param object the object to search for.
* @param item the object to search for.
* @return the index of the first occurrence of the object or -1 if the
* object was not found.
*/
int indexOf(T object);
int indexOf(T item);

/**
* Adds the objects in the specified collection to the end of this {@code Adapter}. The
Expand Down Expand Up @@ -94,10 +96,10 @@ public interface EfficientAdapter<T> extends AdapterUpdater.Updater<T> {
* {@code Adapter}, the object is added at the end.
*
* @param index the index at which to insert the object.
* @param object the object to add.
* @param item the object to add.
* @throws IndexOutOfBoundsException when {@code location < 0 || location > size()}
*/
void add(int index, T object);
void add(int index, T item);

/**
* Removes the object at the specified location from this {@code Adapter}.
Expand Down Expand Up @@ -283,10 +285,10 @@ interface OnItemClickListener<T> {
* @param adapter The EfficientAdapter where the click happened.
* @param view The view within the EfficientAdapter that was clicked (this
* will be a view provided by the adapter)
* @param object The object associate with this {@link EfficientViewHolder}
* @param item The object associate with this {@link EfficientViewHolder}
* @param position The position of the view in the adapter.
*/
void onItemClick(EfficientAdapter<T> adapter, View view, T object, int position);
void onItemClick(@NonNull EfficientAdapter<T> adapter, @NonNull View view, @Nullable T item, int position);
}

/**
Expand All @@ -302,9 +304,9 @@ interface OnItemLongClickListener<T> {
* @param adapter The EfficientAdapter where the click happened.
* @param view The view within the EfficientAdapter that was clicked (this
* will be a view provided by the adapter)
* @param object The object associate with this {@link EfficientViewHolder}
* @param item The object associate with this {@link EfficientViewHolder}
* @param position The position of the view in the adapter.
*/
void onLongItemClick(EfficientAdapter<T> adapter, View view, T object, int position);
void onLongItemClick(@NonNull EfficientAdapter<T> adapter, @NonNull View view, @Nullable T item, int position);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ public boolean hasItem(T object) {
}

@Override
public int indexOf(T object) {
return mBaseAdapter.indexOf(object);
public int indexOf(T item) {
return mBaseAdapter.indexOf(item);
}

@Override
Expand All @@ -108,8 +108,8 @@ public void add(T object) {
}

@Override
public void add(int position, T object) {
mBaseAdapter.add(position, object);
public void add(int position, T item) {
mBaseAdapter.add(position, item);
notifyDataSetChanged();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ public OnItemLongClickListener<T> getOnItemLongClickListener() {
}

@Override
public boolean hasItem(T object) {
return mBaseAdapter.hasItem(object);
public boolean hasItem(T item) {
return mBaseAdapter.hasItem(item);
}

@Override
public int indexOf(T object) {
return mBaseAdapter.indexOf(object);
public int indexOf(T item) {
return mBaseAdapter.indexOf(item);
}

@Override
Expand Down Expand Up @@ -119,8 +119,8 @@ public void add(T object) {
}

@Override
public void add(int position, T object) {
mBaseAdapter.add(position, object);
public void add(int position, T item) {
mBaseAdapter.add(position, item);
if (mNotifyOnChange) {
notifyItemInserted(position);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ public interface Updater<T> {

void removeAt(int i);

int indexOf(T object);
int indexOf(T item);

void add(int i, T object);
void add(int i, T item);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ public void removeAt(int i) {
}

@Override
public int indexOf(String object) {
return mObjects.indexOf(object);
public int indexOf(String item) {
return mObjects.indexOf(item);
}

@Override
public void add(int i, String object) {
mObjects.add(i, object);
public void add(int i, String item) {
mObjects.add(i, item);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ protected void onCreate(Bundle savedInstanceState) {

adapter.setOnItemClickListener(new EfficientAdapter.OnItemClickListener<Item>() {
@Override
public void onItemClick(EfficientAdapter<Item> parent, View view, Item object,
public void onItemClick(EfficientAdapter<Item> parent, View view, Item item,
int position) {
Toast.makeText(view.getContext(),
"Click on: " + object.toString(),
"Click on: " + item.toString(),
Toast.LENGTH_SHORT).show();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ protected void onCreate(Bundle savedInstanceState) {
adapter.setOnItemClickListener(
new EfficientAdapter.OnItemClickListener<Plane>() {
@Override
public void onItemClick(EfficientAdapter<Plane> parent, View view, Plane object,
public void onItemClick(EfficientAdapter<Plane> parent, View view, Plane item,
int position) {
Toast.makeText(view.getContext(),
"Click on: " + object.toString(),
"Click on: " + item.toString(),
Toast.LENGTH_SHORT).show();
}
});
Expand All @@ -51,9 +51,9 @@ public void onItemClick(EfficientAdapter<Plane> parent, View view, Plane object,
new EfficientAdapter.OnItemLongClickListener<Plane>() {
@Override
public void onLongItemClick(EfficientAdapter<Plane> adapter, View view,
Plane object, int position) {
Plane item, int position) {
Toast.makeText(view.getContext(),
"Longclick on: " + object.toString(),
"Longclick on: " + item.toString(),
Toast.LENGTH_SHORT).show();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ protected void onCreate(Bundle savedInstanceState) {
new EfficientAdapter.OnItemLongClickListener<Book>() {
@Override
public void onLongItemClick(EfficientAdapter<Book> adapter, View view,
Book object, int position) {
Book item, int position) {
Toast.makeText(view.getContext(),
"Longclick on: " + object.toString(),
"Longclick on: " + item.toString(),
Toast.LENGTH_SHORT).show();
}
});
Expand Down

0 comments on commit 61af850

Please sign in to comment.