MiniumApps/launcher3/src/main/java/co/siempo/phone/activities/JunkfoodFlaggingActivity.java
/**
     * Remove the junk apps from Favorite Sorted menu and Favorite list
     */
Remove the junk apps from Favorite Sorted menu and Favorite list
Remove the junk apps from Favorite Sorted menu and Favorite list
private void removeJunkAppsFromFavorites() {
        String jsonListOfSortedFavorites = PrefSiempo.getInstance(JunkfoodFlaggingActivity.this)
                .read(PrefSiempo.FAVORITE_SORTED_MENU, "");
        Set<String> favlist = PrefSiempo.getInstance(this).read(PrefSiempo
                .FAVORITE_APPS, new HashSet<String>());
        Gson gson1 = new Gson();
        List<String> listOfSortFavoritesApps = gson1.fromJson(jsonListOfSortedFavorites, new TypeToken<List<String>>() {
        }.getType());
        for (String junkString : adapterlist) {
            if (favlist != null && favlist.contains(junkString)) {
                for (ListIterator<String> it =
                     listOfSortFavoritesApps.listIterator(); it.hasNext
                        (); ) {
                    String packageName = it.next();
                    if (junkString.equalsIgnoreCase(packageName)) {
                        it.set("");
                    }
                }
            }
        }
        Gson gson2 = new Gson();
        String jsonListOfFavoriteApps = gson2.toJson(listOfSortFavoritesApps);
        PrefSiempo.getInstance(JunkfoodFlaggingActivity.this).write(PrefSiempo
                .FAVORITE_SORTED_MENU, jsonListOfFavoriteApps);
        PrefSiempo.getInstance(JunkfoodFlaggingActivity.this).write(PrefSiempo.FAVORITE_APPS,
                favlist);
    }
private void removeJunkAppsFromFavorites ( ) { String jsonListOfSortedFavorites = PrefSiempo . getInstance ( JunkfoodFlaggingActivity . this ) . read ( PrefSiempo . FAVORITE_SORTED_MENU , "" ) ; Set < String > favlist = PrefSiempo . getInstance ( this ) . read ( PrefSiempo . FAVORITE_APPS , new HashSet < String > ( ) ) ; Gson gson1 = new Gson ( ) ; List < String > listOfSortFavoritesApps = gson1 . fromJson ( jsonListOfSortedFavorites , new TypeToken < List < String > > ( ) { } . getType ( ) ) ; for ( String junkString : adapterlist ) { if ( favlist != null && favlist . contains ( junkString ) ) { for ( ListIterator < String > it = listOfSortFavoritesApps . listIterator ( ) ; it . hasNext ( ) ; ) { String packageName = it . next ( ) ; if ( junkString . equalsIgnoreCase ( packageName ) ) { it . set ( "" ) ; } } } } Gson gson2 = new Gson ( ) ; String jsonListOfFavoriteApps = gson2 . toJson ( listOfSortFavoritesApps ) ; PrefSiempo . getInstance ( JunkfoodFlaggingActivity . this ) . write ( PrefSiempo . FAVORITE_SORTED_MENU , jsonListOfFavoriteApps ) ; PrefSiempo . getInstance ( JunkfoodFlaggingActivity . this ) . write ( PrefSiempo . FAVORITE_APPS , favlist ) ; }
Remove the junk apps from Favorite Sorted menu and Favorite list
Remove the junk apps from Favorite Sorted menu and Favorite list
//convert onNoteListChangedJSON array into a List<Long> //Used List Iterator to set empty // value for package name retaining // the positions of elements