MiniumApps/launcher3/src/main/java/co/siempo/phone/activities/JunkfoodFlaggingActivity.java
/**
     * This dialog shows when user comes in this screen and user flag first application
     *
     * @param position
     */
This dialog shows when user comes in this screen and user flag first application
@param position
This dialog shows when user comes in this screen and user flag first application @param position
private void showAlertForFirstTime(final int position, final View itemView) {
        AlertDialog.Builder builder = new AlertDialog.Builder(JunkfoodFlaggingActivity.this);
        builder.setTitle(getString(R.string.are_you_sure));
        builder.setMessage(R.string.msg_flag_first_time);
        builder.setPositiveButton(getString(R.string.yes_unhide), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        isLoadFirstTime = false;
                        if (null != itemView) {
                            showEmptyRowBeforeDelete(itemView);
                        }
                        Handler handler = new Handler();
                        handler.postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                if (adapterlist.contains(bindingList.get(position).packageName)) {
                                    adapterlist.remove(bindingList.get(position).packageName);
                                } else {
                                    adapterlist.add(bindingList.get(position).packageName);
                                }
                                firstPosition = listAllApps.getFirstVisiblePosition();
                                new FilterApps().execute();
                                listAllApps.setEnabled(true);
                                listAllApps.setClickable(true);
                            }
                        }, 200);
                    }
                });
            }
        });
        builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                isLoadFirstTime = false;
                dialog.dismiss();
            }
        });
        AlertDialog dialog = builder.create();
        dialog.show();
        dialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(ContextCompat.getColor(this, R.color.dialog_blue));
        dialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(ContextCompat.getColor(this, R.color.dialog_red));
    }
private void showAlertForFirstTime ( final int position , final View itemView ) { AlertDialog . Builder builder = new AlertDialog . Builder ( JunkfoodFlaggingActivity . this ) ; builder . setTitle ( getString ( R . string . are_you_sure ) ) ; builder . setMessage ( R . string . msg_flag_first_time ) ; builder . setPositiveButton ( getString ( R . string . yes_unhide ) , new DialogInterface . OnClickListener ( ) { @ Override public void onClick ( DialogInterface dialog , int which ) { dialog . dismiss ( ) ; runOnUiThread ( new Runnable ( ) { @ Override public void run ( ) { isLoadFirstTime = false ; if ( null != itemView ) { showEmptyRowBeforeDelete ( itemView ) ; } Handler handler = new Handler ( ) ; handler . postDelayed ( new Runnable ( ) { @ Override public void run ( ) { if ( adapterlist . contains ( bindingList . get ( position ) . packageName ) ) { adapterlist . remove ( bindingList . get ( position ) . packageName ) ; } else { adapterlist . add ( bindingList . get ( position ) . packageName ) ; } firstPosition = listAllApps . getFirstVisiblePosition ( ) ; new FilterApps ( ) . execute ( ) ; listAllApps . setEnabled ( true ) ; listAllApps . setClickable ( true ) ; } } , 200 ) ; } } ) ; } } ) ; builder . setNegativeButton ( getString ( R . string . cancel ) , new DialogInterface . OnClickListener ( ) { @ Override public void onClick ( DialogInterface dialog , int which ) { isLoadFirstTime = false ; dialog . dismiss ( ) ; } } ) ; AlertDialog dialog = builder . create ( ) ; dialog . show ( ) ; dialog . getButton ( AlertDialog . BUTTON_NEGATIVE ) . setTextColor ( ContextCompat . getColor ( this , R . color . dialog_blue ) ) ; dialog . getButton ( AlertDialog . BUTTON_POSITIVE ) . setTextColor ( ContextCompat . getColor ( this , R . color . dialog_red ) ) ; }
This dialog shows when user comes in this screen and user flag first application
 @param position
This dialog shows when user comes in this screen and user flag first application @param position