feat: Add favorite gallery name to scene
This commit is contained in:
1 parent
3360035402
commit
73b702aa56
8 files changed
+18
No files matched your search
@@ -40,6 +40,7 @@ public class GalleryDetail extends GalleryInfo {
|
||||
public GalleryComment[] comments;
|
||||
public int previewPages;
|
||||
public PreviewSet previewSet;
|
||||
public String favoriteName;
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
@@ -64,6 +65,7 @@ public class GalleryDetail extends GalleryInfo {
|
||||
dest.writeParcelableArray(this.comments, 0);
|
||||
dest.writeInt(this.previewPages);
|
||||
dest.writeParcelable(previewSet, flags);
|
||||
dest.writeString(this.favoriteName);
|
||||
}
|
||||
|
||||
public GalleryDetail() {
|
||||
@@ -96,6 +98,7 @@ public class GalleryDetail extends GalleryInfo {
|
||||
}
|
||||
this.previewPages = in.readInt();
|
||||
this.previewSet = in.readParcelable(PreviewSet.class.getClassLoader());
|
||||
this.favoriteName = in.readString();
|
||||
}
|
||||
|
||||
public static final Creator<GalleryDetail> CREATOR = new Creator<GalleryDetail>() {
|
||||
|
||||
@@ -227,6 +227,14 @@ public class GalleryDetailParser {
|
||||
// isFavorited
|
||||
Element gdf = gm.getElementById("gdf");
|
||||
gd.isFavorited = null != gdf && !StringUtils.trim(gdf.text()).equals("Add to Favorites");
|
||||
if (gdf != null) {
|
||||
final String favoriteName = StringUtils.trim(gdf.text());
|
||||
if (favoriteName.equals("Add to Favorites")) {
|
||||
gd.favoriteName = "";
|
||||
} else {
|
||||
gd.favoriteName = StringUtils.trim(gdf.text());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ParseException("Can't parse gallery detail", body);
|
||||
}
|
||||
|
||||
@@ -766,6 +766,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
|
||||
if (gd.isFavorited || EhDB.containLocalFavorites(gd.gid)) {
|
||||
mHeart.setVisibility(View.VISIBLE);
|
||||
mHeart.setText(gd.favoriteName);
|
||||
mHeartOutline.setVisibility(View.GONE);
|
||||
} else {
|
||||
mHeart.setVisibility(View.GONE);
|
||||
|
||||
@@ -128,6 +128,8 @@ public final class GalleryInfoScene extends ToolbarScene implements EasyRecycler
|
||||
mValues.add(Integer.toString(gd.torrentCount));
|
||||
mKeys.add(resources.getString(R.string.key_torrent_url));
|
||||
mValues.add(gd.torrentUrl);
|
||||
mKeys.add(resources.getString(R.string.favorite_name));
|
||||
mValues.add(gd.favoriteName);
|
||||
}
|
||||
|
||||
protected void onInit() {
|
||||
|
||||
Reference in new issue
Block a user