Skip to content

Commit

Permalink
fix links with fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
itkach committed Feb 3, 2022
1 parent a2abd60 commit 14536d3
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/itkach/aard2/ArticleCollectionActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,22 @@ public class ArticleCollectionActivity extends FragmentActivity
ArticleCollectionPagerAdapter articleCollectionPagerAdapter;
ViewPager viewPager;


class ToBlobWithFragment implements ToBlob {

private final String fragment;

ToBlobWithFragment(String fragment){
this.fragment = fragment;
}

@Override
public Blob convert(Object item) {
Blob b = (Blob)item;
return new Blob(b.owner, b.id, b.key, this.fragment);
}
}

ToBlob blobToBlob = new ToBlob(){

@Override
Expand Down Expand Up @@ -196,8 +212,9 @@ private ArticleCollectionPagerAdapter createFromUri(Application app, Uri article
Iterator<Slob.Blob> result = app.find(bd.key, bd.slobId);
BlobListAdapter data = new BlobListAdapter(this, 20, 1);
data.setData(result);
boolean hasFragment = !Util.isBlank(bd.fragment);
return new ArticleCollectionPagerAdapter(
app, data, blobToBlob, getSupportFragmentManager());
app, data, hasFragment ? new ToBlobWithFragment(bd.fragment) : blobToBlob, getSupportFragmentManager());
};

private ArticleCollectionPagerAdapter createFromLastResult(Application app) {
Expand Down

0 comments on commit 14536d3

Please sign in to comment.