app/src/main/java/com/smedic/tubtub/MainActivity.java
@Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_about) {

            AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create();
            alertDialog.setTitle("Stevan Medic");
            alertDialog.setIcon(R.mipmap.ic_launcher);
            alertDialog.setMessage("TubTub v1.01\n\nvanste25@gmail.com\n\nMarch 2016.\n");
            alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK",
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            dialog.dismiss();
                        }
                    });
            alertDialog.show();

            return true;
        } else if (id == R.id.action_clear_list) {
            YouTubeSqlDb.getInstance().videos(YouTubeSqlDb.VIDEOS_TYPE.RECENTLY_WATCHED).deleteAll();
            recentlyPlayedFragment.clearRecentlyPlayedList();
            return true;
        } else if (id == R.id.action_search) {
            MenuItemCompat.expandActionView(item);
            return true;
        } else if (id == R.id.action_color_picker) {
            /* Show color picker dialog */
            ColorPickerDialogBuilder
                    .with(this)
                    .setTitle("Choose background and text color")
                    .initialColor(initialColor)
                    .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
                    .setPickerCount(2)
                    .initialColors(initialColors)
                    .density(12)
                    .setOnColorSelectedListener(new OnColorSelectedListener() {
                        @Override
                        public void onColorSelected(int selectedColor) {
                        }
                    })
                    .setPositiveButton("ok", new ColorPickerClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int selectedColor, Integer[] allColors) {
                            //changeBackgroundColor(selectedColor);
                            if (allColors != null) {
                                setColors(allColors[0], allColors[1]);
                            }
                        }
                    })
                    .setNegativeButton("cancel", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                        }
                    })
                    .showColorEdit(true)
                    .build()
                    .show();
        }

        return super.onOptionsItemSelected(item);
    }
/**
     * Handles selected item from action bar
     *
     * @param item
     * @return
     */
Handles selected item from action bar
@param item
@return
Handles selected item from action bar @param item @return
@Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        if (id == R.id.action_about) {
            AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create();
            alertDialog.setTitle("Stevan Medic");
            alertDialog.setIcon(R.mipmap.ic_launcher);
            alertDialog.setMessage("TubTub v1.01\n\nvanste25@gmail.com\n\nMarch 2016.\n");
            alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK",
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            dialog.dismiss();
                        }
                    });
            alertDialog.show();
            return true;
        } else if (id == R.id.action_clear_list) {
            YouTubeSqlDb.getInstance().videos(YouTubeSqlDb.VIDEOS_TYPE.RECENTLY_WATCHED).deleteAll();
            recentlyPlayedFragment.clearRecentlyPlayedList();
            return true;
        } else if (id == R.id.action_search) {
            MenuItemCompat.expandActionView(item);
            return true;
        } else if (id == R.id.action_color_picker) {
            /* Show color picker dialog */
            ColorPickerDialogBuilder
                    .with(this)
                    .setTitle("Choose background and text color")
                    .initialColor(initialColor)
                    .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
                    .setPickerCount(2)
                    .initialColors(initialColors)
                    .density(12)
                    .setOnColorSelectedListener(new OnColorSelectedListener() {
                        @Override
                        public void onColorSelected(int selectedColor) {
                        }
                    })
                    .setPositiveButton("ok", new ColorPickerClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int selectedColor, Integer[] allColors) {
                            if (allColors != null) {
                                setColors(allColors[0], allColors[1]);
                            }
                        }
                    })
                    .setNegativeButton("cancel", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                        }
                    })
                    .showColorEdit(true)
                    .build()
                    .show();
        }
        return super.onOptionsItemSelected(item);
    }
@ Override public boolean onOptionsItemSelected ( MenuItem item ) { int id = item . getItemId ( ) ; if ( id == R . id . action_about ) { AlertDialog alertDialog = new AlertDialog . Builder ( MainActivity . this ) . create ( ) ; alertDialog . setTitle ( "Stevan Medic" ) ; alertDialog . setIcon ( R . mipmap . ic_launcher ) ; alertDialog . setMessage ( "TubTub v1.01\n\nvanste25@gmail.com\n\nMarch 2016.\n" ) ; alertDialog . setButton ( AlertDialog . BUTTON_NEUTRAL , "OK" , new DialogInterface . OnClickListener ( ) { public void onClick ( DialogInterface dialog , int which ) { dialog . dismiss ( ) ; } } ) ; alertDialog . show ( ) ; return true ; } else if ( id == R . id . action_clear_list ) { YouTubeSqlDb . getInstance ( ) . videos ( YouTubeSqlDb . VIDEOS_TYPE . RECENTLY_WATCHED ) . deleteAll ( ) ; recentlyPlayedFragment . clearRecentlyPlayedList ( ) ; return true ; } else if ( id == R . id . action_search ) { MenuItemCompat . expandActionView ( item ) ; return true ; } else if ( id == R . id . action_color_picker ) { /* Show color picker dialog */ ColorPickerDialogBuilder . with ( this ) . setTitle ( "Choose background and text color" ) . initialColor ( initialColor ) . wheelType ( ColorPickerView . WHEEL_TYPE . FLOWER ) . setPickerCount ( 2 ) . initialColors ( initialColors ) . density ( 12 ) . setOnColorSelectedListener ( new OnColorSelectedListener ( ) { @ Override public void onColorSelected ( int selectedColor ) { } } ) . setPositiveButton ( "ok" , new ColorPickerClickListener ( ) { @ Override public void onClick ( DialogInterface dialog , int selectedColor , Integer [ ] allColors ) { if ( allColors != null ) { setColors ( allColors [ 0 ] , allColors [ 1 ] ) ; } } } ) . setNegativeButton ( "cancel" , new DialogInterface . OnClickListener ( ) { @ Override public void onClick ( DialogInterface dialog , int which ) { } } ) . showColorEdit ( true ) . build ( ) . show ( ) ; } return super . onOptionsItemSelected ( item ) ; }
Handles selected item from action bar
 @param item
 @return
Handles selected item from action bar @param item @return
// Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. //noinspection SimplifiableIfStatement //changeBackgroundColor(selectedColor);