com.raizlabs.android.dbflow.sql.language.Select Java Examples

The following examples show how to use com.raizlabs.android.dbflow.sql.language.Select. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DashboardController.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void sendDashboardElements() throws APIException {
    List<DashboardElement> elements = new Select()
            .from(DashboardElement.class)
            .where(Condition.column(DashboardElement$Table
                    .STATE).isNot(State.SYNCED))
            .orderBy(true, DashboardElement$Table.ID)
            .queryList();

    if (elements == null || elements.isEmpty()) {
        return;
    }

    for (DashboardElement element : elements) {
        switch (element.getState()) {
            case TO_POST: {
                postDashboardElement(element);
                break;
            }
            case TO_DELETE: {
                deleteDashboardElement(element);
                break;
            }
        }
    }
}
 
Example #2
Source File: ImageRepository.java    From MoeGallery with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Observable<List<? extends Image>> loadListFromHistory() {
    return Observable.create(new Observable.OnSubscribe<List<? extends Image>>() {
        @Override
        public void call(Subscriber<? super List<? extends Image>> subscriber) {
            try {
                String providerUri = mSetting.provider().
                        replace(Providers.SCHEME_HTTPS, "").
                        replace(Providers.SCHEME_HTTP, "");

                List<HistoryImage> historyImages = new Select().from(HistoryImage.class).where(
                        Condition.column(HistoryImage$Table.PREVIEWURL)
                                .like("%" + providerUri + "%")).
                        orderBy(false, HistoryImage$Table.LAST).queryList();
                for (Image image : historyImages) {
                    mImageList.add(image);
                }
                subscriber.onNext(mImageList);
                notifyDataSetChanged();
            } catch (Exception e) {
                e.printStackTrace();
                subscriber.onError(e);
            }
        }
    }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
}
 
Example #3
Source File: ContentManagerBase.java    From iview-android-tv with MIT License 6 votes vote down vote up
public List<EpisodeBaseModel> getRecentlyPlayed() {

        FlowCursorList<PlayHistory> cursor = new FlowCursorList<>(false,
                (new Select()).from(PlayHistory.class)
                        .orderBy("CASE WHEN "+PlayHistory$Table.PROGRESS+" >= 75 THEN 1 ELSE 0 END ASC, "+PlayHistory$Table.TIMESTAMP+" DESC")
                        .limit(30));

        List<EpisodeBaseModel> recent = new ArrayList<>();
        for (int i = 0, k = cursor.getCount(); i < k; i++) {
            PlayHistory history = cursor.getItem(i);
            EpisodeBaseModel ep = getEpisode(history.href);
            if (ep != null) {
                if (history.progress < 75) {
                    ep.setResumePosition(history.position);
                }
                ep.setRecent(true);
                recent.add(ep);
            }
        }
        return recent;
    }
 
Example #4
Source File: DashboardItem.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@JsonIgnore
public List<DashboardElement> queryRelatedDashboardElements() {
    if (isEmpty(getType())) {
        return new ArrayList<>();
    }

    List<DashboardElement> elements = new Select().from(DashboardElement.class)
            .where(Condition.column(DashboardElement$Table.DASHBOARDITEM_DASHBOARDITEM).is(getId()))
            .and(Condition.column(DashboardElement$Table.STATE).isNot(State.TO_DELETE.toString()))
            .queryList();

    if (elements == null) {
        elements = new ArrayList<>();
    }

    return elements;
}
 
Example #5
Source File: DashboardManageFragment.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    mDashboard = new Select()
            .from(Dashboard.class)
            .where(Condition.column(Dashboard$Table
                    .ID).is(getArguments().getLong(Dashboard$Table.ID)))
            .querySingle();

    ButterKnife.bind(this, view);

    mDialogLabel.setText(getString(R.string.manage_dashboard));
    mActionName.setText(getString(R.string.edit_name));

    mDashboardName.setText(mDashboard.getDisplayName());
    mDeleteButton.setEnabled(mDashboard.getAccess().isDelete());

    setFragmentBarActionMode(false);
    //// FIXME: 22/03/2018 The api 29 => putDashboard api call override the server dashboard.
    //// But the dashboard app is incomplete.
    //// The dashboard needs all the fields and children fields before put dashboards in api 29 =>
    if(SystemInfo.isLoggedInServerWithLatestApiVersion()){
        mDashboardName.setEnabled(false);
    }
}
 
Example #6
Source File: DashboardController.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void sendDashboardItemChanges() throws APIException {
    List<DashboardItem> dashboardItems = new Select()
            .from(DashboardItem.class)
            .where(Condition.column(DashboardItem$Table
                    .STATE).isNot(State.SYNCED))
            .orderBy(true, DashboardItem$Table.ID)
            .queryList();

    if (dashboardItems == null || dashboardItems.isEmpty()) {
        return;
    }

    for (DashboardItem dashboardItem : dashboardItems) {
        switch (dashboardItem.getState()) {
            case TO_POST: {
                postDashboardItem(dashboardItem);
                break;
            }
            case TO_DELETE: {
                deleteDashboardItem(dashboardItem);
                break;
            }
        }
    }
}
 
Example #7
Source File: DBFlowTester.java    From AndroidDatabaseLibraryComparison with MIT License 6 votes vote down vote up
public static void testAddressItems(Context context) {
    com.raizlabs.android.dbflow.sql.language.Delete.table(SimpleAddressItem.class);
    Collection<SimpleAddressItem> dbFlowModels =
            Generator.getAddresses(SimpleAddressItem.class, MainActivity.LOOP_COUNT);
    long startTime = System.currentTimeMillis();
    final Collection<SimpleAddressItem> finalDbFlowModels = dbFlowModels;
    TransactionManager.transact(DBFlowDatabase.NAME, new Runnable() {
        @Override
        public void run() {
            Saver.saveAll(finalDbFlowModels);
        }
    });
    EventBus.getDefault().post(new LogTestDataEvent(startTime, FRAMEWORK_NAME, MainActivity.SAVE_TIME));

    startTime = System.currentTimeMillis();
    dbFlowModels = new Select().from(SimpleAddressItem.class).queryList();
    EventBus.getDefault().post(new LogTestDataEvent(startTime, FRAMEWORK_NAME, MainActivity.LOAD_TIME));

    com.raizlabs.android.dbflow.sql.language.Delete.table(SimpleAddressItem.class);
}
 
Example #8
Source File: AmiiboDescriptorCache.java    From amiibo with GNU General Public License v2.0 6 votes vote down vote up
@NonNull
@Override
protected AmiiboDescriptor updateInDatabaseInternal(@NonNull AmiiboDescriptor object) {
    AmiiboDescriptor previous = new Select()
            .from(AmiiboDescriptor.class)
            .where(Condition.column(AmiiboDescriptor$Table.AMIIBO_IDENTIFIER)
                    .eq(object.amiibo_identifier.toLowerCase()))
            .querySingle();
    if (previous == null) {
        previous = object;
        object.insert();
    } else {
        previous.amiibo_identifier = object.amiibo_identifier.toLowerCase();
        previous.name = object.name;
        previous.update();
    }
    return previous;
}
 
Example #9
Source File: MainActivity.java    From MoeGallery with GNU General Public License v3.0 6 votes vote down vote up
void switchFavorite() {
    Image image = currentImage;
    List<FavoriteImage> favoriteImages = new Select().from(FavoriteImage.class).where(
            Condition.column(FavoriteImage$Table.PREVIEWURL).eq(image.getPreviewUrl())).
            queryList();

    if (favoriteImages.size() == 1) {
        favoriteImages.get(0).delete();
        menuFavorite.setTitle(R.string.add_favorite);
        floatFavorite.setDrawableIcon(getResources().getDrawable(
                R.drawable.ic_favorite_border_white_48dp));
    } else {
        new FavoriteImage(image).save();
        menuFavorite.setTitle(R.string.remove_favorite);
        floatFavorite.setDrawableIcon(getResources().getDrawable(
                R.drawable.ic_favorite_white_48dp));
    }
}
 
Example #10
Source File: FunDao.java    From coderfun with GNU General Public License v3.0 6 votes vote down vote up
public static List<Results> getFun_Girly() {
    List<Results> results = new ArrayList<>();
    List<GirlyDbBean> girlyDbBeen = new Select().from(GirlyDbBean.class).queryList();
    for (int i = 0; i < girlyDbBeen.size(); i++) {
        Results result = new Results();
        result.setWho(girlyDbBeen.get(i).who);
        result.setPublishedAt(girlyDbBeen.get(i).publishedAt);
        result.setDesc(girlyDbBeen.get(i).desc);
        result.setType(girlyDbBeen.get(i).type);
        result.setUrl(girlyDbBeen.get(i).url);
        result.setUsed(girlyDbBeen.get(i).used);
        result.set_id(girlyDbBeen.get(i).objectId);
        result.setCreatedAt(girlyDbBeen.get(i).createdAt);
        results.add(result);
    }
    return results;
}
 
Example #11
Source File: FunDao.java    From coderfun with GNU General Public License v3.0 6 votes vote down vote up
public static List<List<Results>> getFun_Real() {
    List<RealDbBean> realDbBeen = new Select().from(RealDbBean.class).queryList();
    List<List<Results>> results_list = new ArrayList<>();
    for (int i = 0; i < realDbBeen.size() / 3; i++) {
        List<Results> results = new ArrayList<>();
        for (int j = 0; j < 3; j++) {
            int k= 3*i+j;
            Results result = new Results();
            result.setWho(realDbBeen.get(k).who);
            result.setPublishedAt(realDbBeen.get(k).publishedAt);
            result.setDesc(realDbBeen.get(k).desc);
            result.setType(realDbBeen.get(k).type);
            result.setUrl(realDbBeen.get(k).url);
            result.setUsed(realDbBeen.get(k).used);
            result.set_id(realDbBeen.get(k).objectId);
            result.setCreatedAt(realDbBeen.get(k).createdAt);
            results.add(result);
        }
        results_list.add(results);
    }
    return results_list;
}
 
Example #12
Source File: FunDao.java    From coderfun with GNU General Public License v3.0 6 votes vote down vote up
public static List<Results> getFun_Part() {
    List<Results> results = new ArrayList<>();
    List<PartDbBean> partDbBeen = new Select().from(PartDbBean.class).queryList();
    for (int i = 0; i < partDbBeen.size(); i++) {
        Results result = new Results();
        result.setWho(partDbBeen.get(i).who);
        result.setPublishedAt(partDbBeen.get(i).publishedAt);
        result.setDesc(partDbBeen.get(i).desc);
        result.setType(partDbBeen.get(i).type);
        result.setUrl(partDbBeen.get(i).url);
        result.setUsed(partDbBeen.get(i).used);
        result.set_id(partDbBeen.get(i).objectId);
        result.setCreatedAt(partDbBeen.get(i).createdAt);
        results.add(result);
    }
    return results;
}
 
Example #13
Source File: DashboardController.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void syncDashboardContent() throws APIException {
    DateTime lastUpdated = DateTimeManager.getInstance()
            .getLastUpdated(ResourceType.DASHBOARDS_CONTENT);
    DateTime serverDateTime = mDhisApi
            .getSystemInfo().getServerDate();

    /* first we need to update api resources, dashboards
    and dashboard items */
    List<DashboardItemContent> dashboardItemContent =
            updateApiResources(lastUpdated);
    Queue<DbOperation> operations = new LinkedList<>();
    operations.addAll(DbUtils.createOperations(new Select()
            .from(DashboardItemContent.class).queryList(), dashboardItemContent));
    DbUtils.applyBatch(operations);



    DateTimeManager.getInstance()
            .setLastUpdated(ResourceType.DASHBOARDS_CONTENT, serverDateTime);
}
 
Example #14
Source File: DashboardItemAddFragment.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    long dashboardId = getArguments().getLong(Dashboard$Table.ID);
    mDashboard = new Select()
            .from(Dashboard.class)
            .where(Condition.column(Dashboard$Table
                    .ID).is(dashboardId))
            .querySingle();

    ButterKnife.bind(this, view);

    InputMethodManager imm = (InputMethodManager)
            getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(mFilter.getWindowToken(), 0);

    mAdapter = new DashboardItemSearchDialogAdapter(
            LayoutInflater.from(getActivity()));
    mListView.setAdapter(mAdapter);
    mDialogLabel.setText(getString(R.string.add_dashboard_item));

    mResourcesMenu = new PopupMenu(getActivity(),mFilter, Gravity.END);
    mResourcesMenu.inflate(R.menu.menu_filter_resources);
    mResourcesMenu.setOnMenuItemClickListener(this);
}
 
Example #15
Source File: DBLocalSearchManager.java    From tysq-android with GNU General Public License v3.0 6 votes vote down vote up
public static void addLocalHistory(String label){
    Log.d("DBLocalSearchManager", "执行到这了");
    ModelAdapter<LocalLabel> manager =
            FlowManager.getModelAdapter(LocalLabel.class);

    LocalLabel oldModel = new Select()
            .from(LocalLabel.class)
            .where(LocalLabel_Table.label.eq(label))
            .querySingle();

    if (oldModel != null){
        manager.delete(oldModel);
    }

    LocalLabel model = new LocalLabel();
    model.setLabel(label);
    manager.insert(model);
    judgeHistoryNum();
}
 
Example #16
Source File: DBLocalDataSourceManager.java    From tysq-android with GNU General Public License v3.0 6 votes vote down vote up
public static void addLocalHistory(String url){
    ModelAdapter<LocalHistoryModel> manager =
            FlowManager.getModelAdapter(LocalHistoryModel.class);

    LocalHistoryModel oldModel = new Select()
            .from(LocalHistoryModel.class)
            .where(LocalHistoryModel_Table.url.eq(url))
            .querySingle();

    if (oldModel != null){
        manager.delete(oldModel);
    }

    LocalHistoryModel model = new LocalHistoryModel();
    model.setUrl(url);
    manager.insert(model);
    judgeHistoryNum();
}
 
Example #17
Source File: InterpretationCreateFragment.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    ButterKnife.bind(this, view);

    long dashboardItemId = getArguments().getLong(DashboardItem$Table.ID);
    mDashboardItem = new Select()
            .from(DashboardItem.class)
            .where(Condition.column(DashboardItem$Table
                    .ID).is(dashboardItemId))
            .querySingle();

    List<DashboardElement> elements = new Select()
            .from(DashboardElement.class)
            .where(Condition.column(DashboardElement$Table
                    .DASHBOARDITEM_DASHBOARDITEM).is(dashboardItemId))
            .and(Condition.column(DashboardElement$Table
                    .STATE).isNot(State.TO_DELETE.toString()))
            .queryList();

    mDashboardItem.setDashboardElements(elements);
    mDialogLabel.setText(getString(R.string.create_interpretation));
}
 
Example #18
Source File: AmiiboCache.java    From amiibo with GNU General Public License v2.0 5 votes vote down vote up
@Nullable
@Override
protected Amiibo getFromKeyInternal(@NonNull Long id) {
    return new Select()
            .from(Amiibo.class)
            .where(Condition.column(Amiibo$Table.ID).eq(id))
            .querySingle();
}
 
Example #19
Source File: InterpretationCommentEditFragment.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    ButterKnife.bind(this, view);

    mInterpretationComment = new Select()
            .from(InterpretationComment.class)
            .where(Condition.column(InterpretationComment$Table
                    .ID).is(getArguments().getLong(InterpretationComment$Table.ID)))
            .querySingle();

    mDialogLabel.setText(getString(R.string.edit_comment));
    mCommentEditText.setText(mInterpretationComment.getText());
}
 
Example #20
Source File: AmiiboDescriptorCache.java    From amiibo with GNU General Public License v2.0 5 votes vote down vote up
@Override
@Nullable
protected AmiiboDescriptor getFromKeyInternal(@NonNull String identifier) {
    AmiiboDescriptor descriptor = null;
    identifier = identifier.toLowerCase();
    descriptor = new Select()
            .from(AmiiboDescriptor.class)
            .where(Condition.column(AmiiboDescriptor$Table.AMIIBO_IDENTIFIER).eq(identifier))
            .querySingle();
    return descriptor;
}
 
Example #21
Source File: AmiiboCache.java    From amiibo with GNU General Public License v2.0 5 votes vote down vote up
public List<Amiibo> getAmiibosUnsynced() {
    List<Amiibo> amiibos = new Select()
            .from(Amiibo.class)
            .where(Condition.CombinedCondition
                    .begin(Condition.column(Amiibo$Table.SYNCED).eq(false))
                    .or(Condition.column(Amiibo$Table.SYNCED).isNull()))
            .queryList();

    for (Amiibo amiibo : amiibos) updateCache(amiibo, true);

    return amiibos;
}
 
Example #22
Source File: AmiiboCache.java    From amiibo with GNU General Public License v2.0 5 votes vote down vote up
@NonNull
public List<Amiibo> getAmiibos(String amiibo_identifier) {
    amiibo_identifier = amiibo_identifier.toLowerCase();
    List<Amiibo> amiibos = new Select()
            .from(Amiibo.class)
            .where(Condition.column(Amiibo$Table.AMIIBO_IDENTIFIER).eq(amiibo_identifier))
            .orderBy(false, Amiibo$Table.CREATED_AT)
            .queryList();

    for (Amiibo amiibo : amiibos) updateCache(amiibo, true);

    return amiibos;
}
 
Example #23
Source File: AmiiboCache.java    From amiibo with GNU General Public License v2.0 5 votes vote down vote up
@NonNull
public Amiibo getAmiibo(String amiibo_uuid) {
    amiibo_uuid = amiibo_uuid.toLowerCase();
    Amiibo amiibo = new Select()
            .from(Amiibo.class)
            .where(Condition.column(Amiibo$Table.UUID).eq(amiibo_uuid))
            .querySingle();

    if (amiibo != null)
        updateCache(amiibo, true);

    return amiibo;
}
 
Example #24
Source File: MainActivity.java    From MoeGallery with GNU General Public License v3.0 5 votes vote down vote up
public void setMenu(boolean isMain) {
    menuSearch.setVisible(isMain && !mSetting.floatSearch());
    menuInfo.setVisible(!isMain);
    menuWallpaper.setVisible(!isMain);
    menuShare.setVisible(!isMain);
    menuDownload.setVisible(!isMain && !mSetting.autoDownload());

    menuFavorite.setVisible(!isMain && !mSetting.floatFavorite());

    if (!isMain) {
        List<FavoriteImage> favoriteImages = new Select().from(FavoriteImage.class).where(
                Condition.column(FavoriteImage$Table.PREVIEWURL)
                        .eq(currentImage.getPreviewUrl())).queryList();

        if (favoriteImages.size() == 1) {
            menuFavorite.setTitle(R.string.remove_favorite);
            favoriteImages.get(0).updateLast();
            favoriteImages.get(0).save();
            floatFavorite.setDrawableIcon(getResources().getDrawable(
                    R.drawable.ic_favorite_white_48dp));
        } else {
            menuFavorite.setTitle(R.string.add_favorite);
            floatFavorite.setDrawableIcon(getResources().getDrawable(
                    R.drawable.ic_favorite_border_white_48dp));
        }
    }

}
 
Example #25
Source File: InterpretationContainerFragment.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public Boolean query(Context context) {
    List<Interpretation> interpretations = new Select()
            .from(Interpretation.class)
            .where(Condition.column(Interpretation$Table
                    .STATE).isNot(State.TO_DELETE.toString()))
            .queryList();

    return interpretations != null && interpretations.size() > 0;
}
 
Example #26
Source File: InterpretationTextFragment.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    ButterKnife.bind(this, view);

    mInterpretation = new Select()
            .from(Interpretation.class)
            .where(Condition.column(Interpretation$Table
                    .ID).is(getArguments().getLong(Interpretation$Table.ID)))
            .querySingle();

    mDialogLabel.setText(getString(R.string.interpretation_text));
    mInterpretationText.setText(mInterpretation.getText());
}
 
Example #27
Source File: InterpretationCreateFragment.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@OnClick({R.id.close_dialog_button, R.id.cancel_interpretation_create, R.id.create_interpretation})
@SuppressWarnings("unused")
public void onButtonClicked(View view) {
    if (view.getId() == R.id.create_interpretation) {
        // read user
        UserAccount userAccount = UserAccount
                .getCurrentUserAccountFromDb();
        User user = new Select()
                .from(User.class)
                .where(Condition.column(User$Table
                        .UID).is(userAccount.getUId()))
                .querySingle();

        // create interpretation
        Interpretation interpretation = createInterpretation(mDashboardItem,
                user, mInterpretationText.getText().toString());
        List<InterpretationElement> elements = interpretation
                .getInterpretationElements();

        // save interpretation
        interpretation.save();
        if (elements != null && !elements.isEmpty()) {
            for (InterpretationElement element : elements) {
                // save corresponding interpretation elements
                element.save();
            }
        }

        if (isDhisServiceBound()) {
            getDhisService().syncInterpretations(SyncStrategy.DOWNLOAD_ONLY_NEW);
            EventBusProvider.post(new UiEvent(UiEvent.UiEventType.SYNC_INTERPRETATIONS));
        }

        Toast.makeText(getActivity(),
                getString(R.string.successfully_created_interpretation), Toast.LENGTH_SHORT).show();
    }
    dismiss();
}
 
Example #28
Source File: InterpretationCommentsFragment.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public List<InterpretationComment> query(Context context) {
    List<InterpretationComment> comments = new Select()
            .from(InterpretationComment.class)
            .where(Condition.column(InterpretationComment$Table
                    .INTERPRETATION_INTERPRETATION).is(mInterpretationId))
            .and(Condition.column(InterpretationComment$Table
                    .STATE).isNot(State.TO_DELETE.toString()))
            .queryList();
    Collections.sort(comments, IdentifiableObject.CREATED_COMPARATOR);
    return comments;
}
 
Example #29
Source File: DashboardItemAddFragment.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public List<OptionAdapterValue> query(Context context) {
    if (mTypes.isEmpty()) {
        return new ArrayList<>();
    }

    CombinedCondition generalCondition =
            CombinedCondition.begin(column(DashboardItemContent$Table.TYPE).isNotNull());
    CombinedCondition columnConditions = null;
    for (String type : mTypes) {
        if (columnConditions == null) {
            columnConditions = CombinedCondition
                    .begin(column(DashboardItemContent$Table.TYPE).is(type));
        } else {
            columnConditions = columnConditions
                    .or(column(DashboardItemContent$Table.TYPE).is(type));
        }
    }
    generalCondition.and(columnConditions);

    List<DashboardItemContent> resources = new Select().from(DashboardItemContent.class)
            .where(generalCondition).queryList();
    Collections.sort(resources, DashboardItemContent.DISPLAY_NAME_COMPARATOR);

    List<OptionAdapterValue> adapterValues = new ArrayList<>();
    for (DashboardItemContent dashboardItemContent : resources) {
        adapterValues.add(new OptionAdapterValue(dashboardItemContent.getUId(),
                dashboardItemContent.getDisplayName()));
    }

    return adapterValues;
}
 
Example #30
Source File: DashboardViewPagerFragment.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public List<Dashboard> query(Context context) {
    List<Dashboard> dashboards = new Select()
            .from(Dashboard.class)
            .where(Condition.column(Dashboard$Table
                    .STATE).isNot(State.TO_DELETE.toString()))
            .queryList();
    Collections.sort(dashboards, Dashboard.DISPLAY_NAME_COMPARATOR);
    return dashboards;
}