Long click favourite to select slot
This commit is contained in:
2 files changed
+26
-1
No files matched your search
@@ -62,12 +62,17 @@ public final class CommonOperations {
|
||||
|
||||
public static void addToFavorites(final Activity activity, final GalleryInfo galleryInfo,
|
||||
final EhClient.Callback<Void> listener) {
|
||||
addToFavorites(activity, galleryInfo, listener, false);
|
||||
}
|
||||
|
||||
public static void addToFavorites(final Activity activity, final GalleryInfo galleryInfo,
|
||||
final EhClient.Callback<Void> listener, boolean select) {
|
||||
int slot = Settings.getDefaultFavSlot();
|
||||
String[] items = new String[11];
|
||||
items[0] = activity.getString(R.string.local_favorites);
|
||||
String[] favCat = Settings.getFavCat();
|
||||
System.arraycopy(favCat, 0, items, 1, 10);
|
||||
if (slot >= -1 && slot <= 9) {
|
||||
if (!select && slot >= -1 && slot <= 9) {
|
||||
String newFavoriteName = slot >= 0 ? items[slot + 1] : null;
|
||||
doAddToFavorites(activity, galleryInfo, slot, new DelegateFavoriteCallback(listener, galleryInfo, newFavoriteName, slot));
|
||||
} else {
|
||||
|
||||
@@ -559,6 +559,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
mSearchCover = (TextView) ViewUtils.$$(mActions, R.id.search_cover);
|
||||
mNewerVersion.setOnClickListener(this);
|
||||
mHeartGroup.setOnClickListener(this);
|
||||
mHeartGroup.setOnLongClickListener(this);
|
||||
mTorrent.setOnClickListener(this);
|
||||
mArchive.setOnClickListener(this);
|
||||
mShare.setOnClickListener(this);
|
||||
@@ -1443,6 +1444,25 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
CommonOperations.startDownload(activity, galleryInfo, true);
|
||||
}
|
||||
return true;
|
||||
} else if (mHeartGroup == v) {
|
||||
if (mGalleryDetail != null && !mModifingFavorites) {
|
||||
boolean remove = false;
|
||||
if (EhDB.containLocalFavorites(mGalleryDetail.gid) || mGalleryDetail.isFavorited) {
|
||||
mModifingFavorites = true;
|
||||
CommonOperations.removeFromFavorites(activity, mGalleryDetail,
|
||||
new ModifyFavoritesListener(activity,
|
||||
activity.getStageId(), getTag(), true));
|
||||
remove = true;
|
||||
}
|
||||
if (!remove) {
|
||||
mModifingFavorites = true;
|
||||
CommonOperations.addToFavorites(activity, mGalleryDetail,
|
||||
new ModifyFavoritesListener(activity,
|
||||
activity.getStageId(), getTag(), false), true);
|
||||
}
|
||||
// Update UI
|
||||
updateFavoriteDrawable();
|
||||
}
|
||||
} else {
|
||||
String tag = (String) v.getTag(R.id.tag);
|
||||
if (null != tag) {
|
||||
|
||||
Reference in new issue
Block a user