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

Add subscriptions to tags/folders #4634

Merged
merged 26 commits into from
Mar 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2a2c495
Added basic proof of concept for displaying folders
ByteHamster Nov 2, 2020
f978d30
Converted nav list to RecyclerView
ByteHamster Nov 2, 2020
c963547
Fixed checkstyle
ByteHamster Nov 3, 2020
3ed3379
Merge branch 'develop' into folders
ByteHamster Jan 2, 2021
b107e6d
Fixed crash when opening subscriptions screen
ByteHamster Jan 2, 2021
c4db0ff
Added support for folder counter
ByteHamster Jan 2, 2021
0bbeda9
Fixed nav item width
ByteHamster Jan 2, 2021
052884e
Clear glide when loading image manually
ByteHamster Jan 2, 2021
3104232
Calculate layer in makeFlatDrawerData
ByteHamster Jan 2, 2021
1eb47a2
Build tags based on feed properties
ByteHamster Jan 2, 2021
19e427b
Store tags in the database
ByteHamster Jan 2, 2021
f4bbc55
Added basic UI for editing tags
ByteHamster Jan 2, 2021
5a8bfc0
Fix checkstyle
ByteHamster Jan 2, 2021
f76d3ad
Merge branch 'develop' into folders
ByteHamster Mar 5, 2021
27c4364
Fixed long-pressing drawer items
ByteHamster Mar 5, 2021
627bd35
Fixed folder ID generation
ByteHamster Mar 5, 2021
d1d5974
Fix selection highlighting
ByteHamster Mar 5, 2021
4b7cb20
Fixed long-pressing items on subscriptions page
ByteHamster Mar 5, 2021
e86905e
Sort folders to the end
ByteHamster Mar 5, 2021
20f4d97
Store opened folders across app launches
ByteHamster Mar 5, 2021
bbde3ff
Fixed test
ByteHamster Mar 5, 2021
4b7f788
Use dp for padding
ByteHamster Mar 5, 2021
8586c76
Make folders work on subscriptions page
ByteHamster Mar 5, 2021
3f21ef5
Added basic tag editor UI
ByteHamster Mar 5, 2021
3a2a2ab
Test fixes
ByteHamster Mar 5, 2021
d54ce2f
Code cleanup
ByteHamster Mar 5, 2021
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
Prev Previous commit
Next Next commit
Clear glide when loading image manually
  • Loading branch information
ByteHamster committed Jan 2, 2021
commit 052884e0813fbd4580d6139d3034a4fe57e2bce0
33 changes: 24 additions & 9 deletions app/src/main/java/de/danoeh/antennapod/adapter/CoverLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import de.danoeh.antennapod.core.glide.ApGlideSettings;

public class CoverLoader {
private int resource = 0;
private String uri;
private String fallbackUri;
private TextView txtvPlaceholder;
Expand All @@ -37,6 +38,11 @@ public CoverLoader withUri(String uri) {
return this;
}

public CoverLoader withResource(int resource) {
this.resource = resource;
return this;
}

public CoverLoader withFallbackUri(String uri) {
fallbackUri = uri;
return this;
Expand Down Expand Up @@ -66,6 +72,12 @@ public CoverLoader withPlaceholderView(@NonNull TextView placeholderView, boolea
}

public void load() {
if (resource != 0) {
imgvCover.setImageResource(resource);
CoverTarget.setPlaceholderVisibility(txtvPlaceholder, textAndImageCombined);
return;
}

RequestOptions options = new RequestOptions()
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
.fitCenter()
Expand Down Expand Up @@ -106,15 +118,7 @@ public void onLoadFailed(Drawable errorDrawable) {

@Override
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
TextView txtvPlaceholder = placeholder.get();
if (txtvPlaceholder != null) {
if (textAndImageCombined) {
int bgColor = txtvPlaceholder.getContext().getResources().getColor(R.color.feed_text_bg);
txtvPlaceholder.setBackgroundColor(bgColor);
} else {
txtvPlaceholder.setVisibility(View.INVISIBLE);
}
}
setPlaceholderVisibility(placeholder.get(), textAndImageCombined);
ImageView ivCover = cover.get();
ivCover.setImageDrawable(resource);
}
Expand All @@ -124,5 +128,16 @@ protected void onResourceCleared(@Nullable Drawable placeholder) {
ImageView ivCover = cover.get();
ivCover.setImageDrawable(placeholder);
}

static void setPlaceholderVisibility(TextView placeholder, boolean textAndImageCombined) {
if (placeholder != null) {
if (textAndImageCombined) {
int bgColor = placeholder.getContext().getResources().getColor(R.color.feed_text_bg);
placeholder.setBackgroundColor(bgColor);
} else {
placeholder.setVisibility(View.INVISIBLE);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ private void bindFolderView(NavDrawerData.FolderDrawerItem folder, FeedHolder ho
if (folder.isOpen) {
holder.count.setVisibility(View.GONE);
}

Glide.with(context).clear(holder.image);
holder.image.setImageResource(ThemeUtils.getDrawableFromAttr(context, R.attr.ic_folder));
holder.failure.setVisibility(View.GONE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,8 @@ public View getView(int position, View convertView, ViewGroup parent) {
.withCoverView(holder.imageView)
.load();
} else {
String resourceEntryName = mainActivityRef.get().getResources()
.getResourceEntryName(ThemeUtils.getDrawableFromAttr(mainActivityRef.get(), R.attr.ic_folder));
String iconUri = ContentResolver.SCHEME_ANDROID_RESOURCE + "://"
+ mainActivityRef.get().getPackageName() + "/raw/"
+ resourceEntryName;
new CoverLoader(mainActivityRef.get())
.withUri(iconUri)
.withResource(ThemeUtils.getDrawableFromAttr(mainActivityRef.get(), R.attr.ic_folder))
.withPlaceholderView(holder.feedTitle, true)
.withCoverView(holder.imageView)
.load();
Expand Down