MiniumApps/launcher3/src/main/java/co/siempo/phone/activities/FavoritesSelectionActivity.java
/**
     * show pop dialog on List item click for flag/un-flag and application information.
     */
show pop dialog on List item click for flag/un-flag and application information.
show pop dialog on List item click for flag / un - flag and application information .
public void showPopUp(View view, final String packagename, final boolean isFlagApp) {
        if (popup != null) {
            popup.dismiss();
        }
        popup = new PopupMenu(FavoritesSelectionActivity.this, view, Gravity.END);
        popup.getMenuInflater().inflate(R.menu.junkfood_popup, popup.getMenu());
        MenuItem menuItem = popup.getMenu().findItem(R.id.item_Unflag);
        if (isFlagApp) {
            if (favoriteList
                    .size() == 2) {
                menuItem.setVisible(false);
            } else {
                menuItem.setVisible(true);
            }
        } else {
            if (favoriteList != null && (favoriteList.size() < 13)) {
                menuItem.setVisible(true);
            } else {
                menuItem.setVisible(false);
            }
        }
        menuItem.setTitle(isFlagApp ? getString(R.string.favorite_menu_unselect) : getString(R.string.favorite_menu_select));
        popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(MenuItem item) {
                if (item.getItemId() == R.id.item_Unflag) {
                    try {
                        popup.dismiss();
                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                if (adapterList.contains(packagename)) {
                                    adapterList.remove(packagename);
                                    isLoadFirstTime = false;
                                } else {
                                    if (favoriteList != null && favoriteList.size() < 13) {
                                        adapterList.add(packagename);
                                        isLoadFirstTime = false;
                                    }
                                }
                                firstPosition = listAllApps.getFirstVisiblePosition();
                                new FilterApps(true, FavoritesSelectionActivity.this).execute();
                            }
                        });
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                } else if (item.getItemId() == R.id.item_Info) {
                    try {
                        PackageUtil.appSettings(FavoritesSelectionActivity.this, packagename);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                return false;
            }
        });
        popup.show();
        popup.setOnDismissListener(new PopupMenu.OnDismissListener() {
            @Override
            public void onDismiss(PopupMenu menu) {
                popup = null;
            }
        });
    }
public void showPopUp ( View view , final String packagename , final boolean isFlagApp ) { if ( popup != null ) { popup . dismiss ( ) ; } popup = new PopupMenu ( FavoritesSelectionActivity . this , view , Gravity . END ) ; popup . getMenuInflater ( ) . inflate ( R . menu . junkfood_popup , popup . getMenu ( ) ) ; MenuItem menuItem = popup . getMenu ( ) . findItem ( R . id . item_Unflag ) ; if ( isFlagApp ) { if ( favoriteList . size ( ) == 2 ) { menuItem . setVisible ( false ) ; } else { menuItem . setVisible ( true ) ; } } else { if ( favoriteList != null && ( favoriteList . size ( ) < 13 ) ) { menuItem . setVisible ( true ) ; } else { menuItem . setVisible ( false ) ; } } menuItem . setTitle ( isFlagApp ? getString ( R . string . favorite_menu_unselect ) : getString ( R . string . favorite_menu_select ) ) ; popup . setOnMenuItemClickListener ( new PopupMenu . OnMenuItemClickListener ( ) { @ Override public boolean onMenuItemClick ( MenuItem item ) { if ( item . getItemId ( ) == R . id . item_Unflag ) { try { popup . dismiss ( ) ; runOnUiThread ( new Runnable ( ) { @ Override public void run ( ) { if ( adapterList . contains ( packagename ) ) { adapterList . remove ( packagename ) ; isLoadFirstTime = false ; } else { if ( favoriteList != null && favoriteList . size ( ) < 13 ) { adapterList . add ( packagename ) ; isLoadFirstTime = false ; } } firstPosition = listAllApps . getFirstVisiblePosition ( ) ; new FilterApps ( true , FavoritesSelectionActivity . this ) . execute ( ) ; } } ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } else if ( item . getItemId ( ) == R . id . item_Info ) { try { PackageUtil . appSettings ( FavoritesSelectionActivity . this , packagename ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } return false ; } } ) ; popup . show ( ) ; popup . setOnDismissListener ( new PopupMenu . OnDismissListener ( ) { @ Override public void onDismiss ( PopupMenu menu ) { popup = null ; } } ) ; }
show pop dialog on List item click for flag/un-flag and application information.
show pop dialog on List item click for flag / un - flag and application information .
//setToolBarText(favoriteList.size()); // setToolBarText(favoriteList.size());