MiniumApps/launcher3/src/main/java/co/siempo/phone/activities/FavoritesSelectionActivity.java
/**
     * bind the list view of flag app and all apps.
     */
bind the list view of flag app and all apps.
bind the list view of flag app and all apps .
private void bindData() {
        try {
            favoriteList = new ArrayList<>();
            unfavoriteList = new ArrayList<>();
            bindingList = new ArrayList<>();
            for (String resolveInfo : installedPackageList) {
                if (resolveInfo != null && !resolveInfo.equalsIgnoreCase(getPackageName())) {
                    boolean isEnable = UIUtils.isAppInstalledAndEnabled(this, resolveInfo);
                    if (isEnable) {
                        String applicationname = CoreApplication.getInstance()
                                .getListApplicationName().get(resolveInfo);
                        if (!TextUtils.isEmpty(applicationname)) {
                            if (adapterList.contains(resolveInfo)) {
                                favoriteList.add(new AppListInfo(resolveInfo, applicationname,
                                        false, false, true));
                            } else {
                                if (null != junkFoodList && !junkFoodList
                                        .contains(resolveInfo)) {
                                    unfavoriteList.add(new AppListInfo(resolveInfo,
                                            applicationname, false, false, false));
                                }
                            }
                        }
                    }
                }
            }
            setToolBarText(favoriteList.size());
            if (favoriteList.size() == 0) {
                favoriteList.add(new AppListInfo("", "", true, true, true));
            } else {
                favoriteList.add(0, new AppListInfo("", "", true, false, true));
            }
            favoriteList = Sorting.sortApplication(favoriteList);
            bindingList.addAll(favoriteList);
            if (unfavoriteList.size() == 0) {
                unfavoriteList.add(new AppListInfo("", "", true, true, false));
            } else {
                unfavoriteList.add(0, new AppListInfo("", "", true, false, false));
            }
            unfavoriteList = Sorting.sortApplication(unfavoriteList);
            bindingList.addAll(unfavoriteList);
            junkfoodFlaggingAdapter = new FavoriteFlaggingAdapter(this, bindingList);
            listAllApps.setAdapter(junkfoodFlaggingAdapter);
            listAllApps.setOnItemClickListener(this);
            junkfoodFlaggingAdapter.getFilter().filter(edtSearch.getText().toString());
            listAllApps.setSelection(firstPosition);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
private void bindData ( ) { try { favoriteList = new ArrayList < > ( ) ; unfavoriteList = new ArrayList < > ( ) ; bindingList = new ArrayList < > ( ) ; for ( String resolveInfo : installedPackageList ) { if ( resolveInfo != null && ! resolveInfo . equalsIgnoreCase ( getPackageName ( ) ) ) { boolean isEnable = UIUtils . isAppInstalledAndEnabled ( this , resolveInfo ) ; if ( isEnable ) { String applicationname = CoreApplication . getInstance ( ) . getListApplicationName ( ) . get ( resolveInfo ) ; if ( ! TextUtils . isEmpty ( applicationname ) ) { if ( adapterList . contains ( resolveInfo ) ) { favoriteList . add ( new AppListInfo ( resolveInfo , applicationname , false , false , true ) ) ; } else { if ( null != junkFoodList && ! junkFoodList . contains ( resolveInfo ) ) { unfavoriteList . add ( new AppListInfo ( resolveInfo , applicationname , false , false , false ) ) ; } } } } } } setToolBarText ( favoriteList . size ( ) ) ; if ( favoriteList . size ( ) == 0 ) { favoriteList . add ( new AppListInfo ( "" , "" , true , true , true ) ) ; } else { favoriteList . add ( 0 , new AppListInfo ( "" , "" , true , false , true ) ) ; } favoriteList = Sorting . sortApplication ( favoriteList ) ; bindingList . addAll ( favoriteList ) ; if ( unfavoriteList . size ( ) == 0 ) { unfavoriteList . add ( new AppListInfo ( "" , "" , true , true , false ) ) ; } else { unfavoriteList . add ( 0 , new AppListInfo ( "" , "" , true , false , false ) ) ; } unfavoriteList = Sorting . sortApplication ( unfavoriteList ) ; bindingList . addAll ( unfavoriteList ) ; junkfoodFlaggingAdapter = new FavoriteFlaggingAdapter ( this , bindingList ) ; listAllApps . setAdapter ( junkfoodFlaggingAdapter ) ; listAllApps . setOnItemClickListener ( this ) ; junkfoodFlaggingAdapter . getFilter ( ) . filter ( edtSearch . getText ( ) . toString ( ) ) ; listAllApps . setSelection ( firstPosition ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } }
bind the list view of flag app and all apps.
bind the list view of flag app and all apps .