Cab has a title now
This commit is contained in:
parent
4e3f75d295
commit
e5509fc2ef
2 changed files with 52 additions and 1 deletions
|
|
@ -27,10 +27,15 @@ public abstract class AbsMultiSelectAdapter<VH extends RecyclerView.ViewHolder,
|
||||||
protected void toggleChecked(final int position) {
|
protected void toggleChecked(final int position) {
|
||||||
if (cabHolder != null) {
|
if (cabHolder != null) {
|
||||||
openCabIfNecessary();
|
openCabIfNecessary();
|
||||||
|
|
||||||
I identifier = getIdentifier(position);
|
I identifier = getIdentifier(position);
|
||||||
if (!checked.remove(identifier)) checked.add(identifier);
|
if (!checked.remove(identifier)) checked.add(identifier);
|
||||||
notifyItemChanged(position);
|
notifyItemChanged(position);
|
||||||
if (checked.isEmpty()) cab.finish();
|
|
||||||
|
final int size = checked.size();
|
||||||
|
if (size <= 0) cab.finish();
|
||||||
|
else if (size == 1) cab.setTitle(checked.get(0).toString());
|
||||||
|
else if (size > 1) cab.setTitle(String.valueOf(size));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.kabouzeid.gramophone.model;
|
package com.kabouzeid.gramophone.model;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Karim Abou Zeid (kabouzeid)
|
* @author Karim Abou Zeid (kabouzeid)
|
||||||
*/
|
*/
|
||||||
|
|
@ -30,4 +32,48 @@ public class Album {
|
||||||
songCount = -1;
|
songCount = -1;
|
||||||
year = -1;
|
year = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + id;
|
||||||
|
result = prime * result + (title == null ? 0 : title.hashCode());
|
||||||
|
result = prime * result + (artistName == null ? 0 : artistName.hashCode());
|
||||||
|
result = prime * result + songCount;
|
||||||
|
result = prime * result + year;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final Album other = (Album) obj;
|
||||||
|
if (id != other.id) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!TextUtils.equals(title, other.title)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!TextUtils.equals(artistName, other.artistName)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (songCount != other.songCount) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return year == other.year;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue