Search in sources :

Example 1 with DepictedItem

use of fr.free.nrw.commons.upload.structure.depictions.DepictedItem in project apps-android-commons by commons-app.

the class BookmarkItemsDao method getAllBookmarksItems.

/**
 * Find all persisted items bookmarks on database
 * @return list of bookmarks
 */
public List<DepictedItem> getAllBookmarksItems() {
    final List<DepictedItem> items = new ArrayList<>();
    final ContentProviderClient db = clientProvider.get();
    try (final Cursor cursor = db.query(BookmarkItemsContentProvider.BASE_URI, Table.ALL_FIELDS, null, new String[] {}, null)) {
        while (cursor != null && cursor.moveToNext()) {
            items.add(fromCursor(cursor));
        }
    } catch (final RemoteException e) {
        throw new RuntimeException(e);
    } finally {
        db.release();
    }
    return items;
}
Also used : ArrayList(java.util.ArrayList) Cursor(android.database.Cursor) RemoteException(android.os.RemoteException) ContentProviderClient(android.content.ContentProviderClient) DepictedItem(fr.free.nrw.commons.upload.structure.depictions.DepictedItem)

Example 2 with DepictedItem

use of fr.free.nrw.commons.upload.structure.depictions.DepictedItem in project apps-android-commons by commons-app.

the class WikidataItemDetailsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_wikidata_item_details);
    ButterKnife.bind(this);
    compositeDisposable = new CompositeDisposable();
    supportFragmentManager = getSupportFragmentManager();
    viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
    viewPager.setAdapter(viewPagerAdapter);
    viewPager.setOffscreenPageLimit(2);
    tabLayout.setupWithViewPager(viewPager);
    final DepictedItem depictedItem = getIntent().getParcelableExtra(WikidataConstants.BOOKMARKS_ITEMS);
    wikidataItem = depictedItem;
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    setTabs();
    setPageTitle();
}
Also used : ViewPagerAdapter(fr.free.nrw.commons.ViewPagerAdapter) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) DepictedItem(fr.free.nrw.commons.upload.structure.depictions.DepictedItem)

Aggregations

DepictedItem (fr.free.nrw.commons.upload.structure.depictions.DepictedItem)2 ContentProviderClient (android.content.ContentProviderClient)1 Cursor (android.database.Cursor)1 RemoteException (android.os.RemoteException)1 ViewPagerAdapter (fr.free.nrw.commons.ViewPagerAdapter)1 CompositeDisposable (io.reactivex.disposables.CompositeDisposable)1 ArrayList (java.util.ArrayList)1