Example usage for android.support.v4.content ContextCompat getDrawable

List of usage examples for android.support.v4.content ContextCompat getDrawable

Introduction

In this page you can find the example usage for android.support.v4.content ContextCompat getDrawable.

Prototype

public static final Drawable getDrawable(Context context, int i) 

Source Link

Usage

From source file:com.grarak.kerneladiutor.fragments.RecyclerViewFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

    if (!hideBanner())
        return;//from ww  w. j a v a 2 s .  com

    if (showViewPager()) {
        menu.add(0, 0, Menu.NONE, R.string.options)
                .setIcon(ContextCompat.getDrawable(getActivity(), R.drawable.ic_launcher_preview))
                .setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }
    if (showTopFab()) {
        menu.add(0, 1, Menu.NONE, R.string.more).setIcon(getTopFabDrawable())
                .setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    } else if (showBottomFab()) {
        menu.add(0, 1, Menu.NONE, R.string.more).setIcon(getBottomFabDrawable())
                .setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }
}

From source file:com.caseystalnaker.android.popinvideodemo.fragments.Camera2VideoFragment.java

private void stopRecordingVideo(final boolean startPreview) {
    mIsRecordingVideo = false;/*from  w  w  w.  jav  a  2  s .c o  m*/
    closeCamera();
    stopCountdownTimer();
    if (null != mContext) {
        //reset button to "record"
        mButtonVideo.setBackgroundDrawable(ContextCompat.getDrawable(mContext, R.drawable.record_btn));

        final Intent videoCompleteIntent = new Intent(Utils.PREVIEW_VIDEO_COMPLETE_INTENT);
        videoCompleteIntent.putExtra(Utils.PREVIEW_VIDEO_PATH_INTENT_KEY, mNextVideoAbsolutePath);
        //broadcast a local intent containing path to newly recorded video
        //This will ultimately launch a new activity to show the preview.
        LocalBroadcastManager.getInstance(mContext).sendBroadcast(videoCompleteIntent);
    }
    if (startPreview)
        openCamera(mTextureView.getWidth(), mTextureView.getHeight());

    //unlock orientation
    getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}

From source file:com.example.angelina.travelapp.map.MapFragment.java

/**
 * If any places are found,//from   ww w . ja va2  s  . c  o m
 * add them to the map as graphics.
 * @param places List of Place items
 */
@Override
public final void showNearbyPlaces(final List<Place> places) {

    // Clear out any existing graphics
    mGraphicOverlay.getGraphics().clear();

    if (!initialLocationLoaded) {
        setNavigationChangeListener();
    }
    initialLocationLoaded = true;
    if (places == null || places.isEmpty()) {
        Toast.makeText(getContext(), getString(R.string.no_places_found), Toast.LENGTH_SHORT).show();
        if (mProgressDialog != null) {
            mProgressDialog.dismiss();
        }
        return;
    }

    // Create a graphic for every place
    for (final Place place : places) {
        final BitmapDrawable pin = (BitmapDrawable) ContextCompat.getDrawable(getActivity(),
                getDrawableForPlace(place));
        addGraphicToMap(pin, place.getLocation());
    }

    // If a centered place name is not null,
    // show detail view
    if (centeredPlaceName != null) {
        for (final Place p : places) {
            if (p.getName().equalsIgnoreCase(centeredPlaceName)) {
                showDetail(p);
                centeredPlaceName = null;
                break;
            }
        }
    }
    if (mProgressDialog != null) {
        mProgressDialog.dismiss();
    }

}

From source file:com.amaze.filemanager.activities.MainActivity.java

public void updateDrawer() {
    ArrayList<Item> list = new ArrayList<>();
    List<String> val = getStorageDirectories();
    ArrayList<String[]> books = new ArrayList<>();
    ArrayList<String[]> Servers = new ArrayList<>();
    ArrayList<String[]> accounts = new ArrayList<>();
    storage_count = 0;//from   w ww .  j  a v a  2 s . c  om
    for (String file : val) {
        File f = new File(file);
        String name;
        Drawable icon1 = ContextCompat.getDrawable(this, R.drawable.ic_sd_storage_white_56dp);
        if ("/storage/emulated/legacy".equals(file) || "/storage/emulated/0".equals(file)) {
            name = getResources().getString(R.string.storage);

        } else if ("/storage/sdcard1".equals(file)) {
            name = getResources().getString(R.string.extstorage);
        } else if ("/".equals(file)) {
            name = getResources().getString(R.string.rootdirectory);
            icon1 = ContextCompat.getDrawable(this, R.drawable.ic_drawer_root_white);
        } else
            name = f.getName();
        if (!f.isDirectory() || f.canExecute()) {
            storage_count++;
            list.add(new EntryItem(name, file, icon1));
        }
    }
    DataUtils.setStorages(val);
    list.add(new SectionItem());
    try {
        for (String[] file : grid.readTableSecondary(DataUtils.SMB))
            Servers.add(file);
        DataUtils.setServers(Servers);
        if (Servers.size() > 0) {
            Collections.sort(Servers, new BookSorter());
            for (String[] file : Servers)
                list.add(new EntryItem(file[0], file[1],
                        ContextCompat.getDrawable(this, R.drawable.ic_settings_remote_white_48dp)));
            list.add(new SectionItem());
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    try {
        for (String[] file : grid.readTableSecondary(DataUtils.DRIVE)) {
            accounts.add(file);
        }
        DataUtils.setAccounts(accounts);
        if (accounts.size() > 0) {
            Collections.sort(accounts, new BookSorter());
            for (String[] file : accounts)
                list.add(new EntryItem(file[0], file[1], ContextCompat.getDrawable(this, R.drawable.drive)));
            list.add(new SectionItem());
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    try {
        for (String[] file : grid.readTableSecondary(DataUtils.BOOKS)) {
            books.add(file);
        }
        DataUtils.setBooks(books);
        if (books.size() > 0) {
            Collections.sort(books, new BookSorter());
            for (String[] file : books)
                list.add(new EntryItem(file[0], file[1],
                        ContextCompat.getDrawable(this, R.drawable.folder_fab)));
            list.add(new SectionItem());
        }
    } catch (Exception e) {

    }
    list.add(new EntryItem(getResources().getString(R.string.quick), "5",
            ContextCompat.getDrawable(this, R.drawable.ic_star_white_18dp)));
    list.add(new EntryItem(getResources().getString(R.string.recent), "6",
            ContextCompat.getDrawable(this, R.drawable.ic_history_white_48dp)));
    list.add(new EntryItem(getResources().getString(R.string.images), "0",
            ContextCompat.getDrawable(this, R.drawable.ic_doc_image)));
    list.add(new EntryItem(getResources().getString(R.string.videos), "1",
            ContextCompat.getDrawable(this, R.drawable.ic_doc_video_am)));
    list.add(new EntryItem(getResources().getString(R.string.audio), "2",
            ContextCompat.getDrawable(this, R.drawable.ic_doc_audio_am)));
    list.add(new EntryItem(getResources().getString(R.string.documents), "3",
            ContextCompat.getDrawable(this, R.drawable.ic_doc_doc_am)));
    list.add(new EntryItem(getResources().getString(R.string.apks), "4",
            ContextCompat.getDrawable(this, R.drawable.ic_doc_apk_grid)));
    DataUtils.setList(list);
    adapter = new DrawerAdapter(this, list, MainActivity.this, Sp);
    mDrawerList.setAdapter(adapter);
}

From source file:com.farmerbb.notepad.fragment.NoteEditFragment.java

public void dispatchKeyShortcutEvent(int keyCode) {
    switch (keyCode) {

    // CTRL+S: Save
    case KeyEvent.KEYCODE_S:
        // Set current note contents to a String
        contents = noteContents.getText().toString();

        // If EditText is empty, show toast informing user to enter some text
        if (contents.equals(""))
            showToast(R.string.empty_note);
        else {//from   ww  w .  ja v  a 2s  .  c  om
            try {
                // Keyboard shortcut just saves the note; no dialog shown
                saveNote();
                isSavedNote = true;

                // Change window title
                String title;
                try {
                    title = listener.loadNoteTitle(filename);
                } catch (IOException e) {
                    title = getResources().getString(R.string.edit_note);
                }

                getActivity().setTitle(title);

                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                    Bitmap bitmap = ((BitmapDrawable) ContextCompat.getDrawable(getActivity(),
                            R.drawable.ic_recents_logo)).getBitmap();

                    ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription(title,
                            bitmap, ContextCompat.getColor(getActivity(), R.color.primary));
                    getActivity().setTaskDescription(taskDescription);
                }
            } catch (IOException e) {
                // Show error message as toast if file fails to save
                showToast(R.string.failed_to_save);
            }
        }
        break;

    // CTRL+D: Delete
    case KeyEvent.KEYCODE_D:
        listener.showDeleteDialog();
        break;

    // CTRL+H: Share
    case KeyEvent.KEYCODE_H:
        // Set current note contents to a String
        contents = noteContents.getText().toString();

        // If EditText is empty, show toast informing user to enter some text
        if (contents.equals(""))
            showToast(R.string.empty_note);
        else {
            // Send a share intent
            Intent shareIntent = new Intent();
            shareIntent.setAction(Intent.ACTION_SEND);
            shareIntent.putExtra(Intent.EXTRA_TEXT, contents);
            shareIntent.setType("text/plain");

            // Verify that the intent will resolve to an activity, and send
            if (shareIntent.resolveActivity(getActivity().getPackageManager()) != null)
                startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.send_to)));
        }
        break;
    }
}

From source file:android.support.design.widget.CollapsingToolbarLayout.java

/**
 * Set the drawable to use for the content scrim from resources.
 *
 * @param resId drawable resource id//  ww  w  .j a  v  a2s  .  c om
 *
 * @attr ref R.styleable#CollapsingToolbarLayout_contentScrim
 * @see #getContentScrim()
 */
public void setContentScrimResource(@DrawableRes int resId) {
    setContentScrim(ContextCompat.getDrawable(getContext(), resId));

}

From source file:com.appeaser.sublimepickerlibrary.recurrencepicker.RecurrenceOptionCreator.java

void initializeLayout() {
    int weekButtonUnselectedTextColor, weekButtonSelectedTextColor, weekButtonSelectedCircleColor;

    final TypedArray a = getContext().obtainStyledAttributes(R.styleable.RecurrenceOptionCreator);
    try {/* w ww .  j  a va 2s  . c  o m*/
        mHeaderBackgroundColor = a.getColor(R.styleable.RecurrenceOptionCreator_spHeaderBackground, 0);

        int endDateFormat = a.getInt(R.styleable.RecurrenceOptionCreator_spEndDateFormat, 1);

        mEndDateFormatter = DateFormat.getDateInstance(
                endDateFormat == 0 ? DateFormat.SHORT : DateFormat.MEDIUM, Locale.getDefault());

        weekButtonUnselectedTextColor = a.getColor(
                R.styleable.RecurrenceOptionCreator_spWeekButtonUnselectedTextColor, SUtils.COLOR_ACCENT);
        weekButtonSelectedTextColor = a.getColor(
                R.styleable.RecurrenceOptionCreator_spWeekButtonSelectedTextColor,
                SUtils.COLOR_TEXT_PRIMARY_INVERSE);
        weekButtonSelectedCircleColor = a.getColor(
                R.styleable.RecurrenceOptionCreator_spWeekButtonSelectedCircleColor, SUtils.COLOR_ACCENT);
    } finally {
        a.recycle();
    }

    mResources = getResources();

    LayoutInflater.from(getContext()).inflate(R.layout.recurrence_picker, this);

    mRecurrencePicker = findViewById(R.id.recurrence_picker);

    mDateOnlyPicker = (RecurrenceEndDatePicker) findViewById(R.id.date_only_picker);
    mDateOnlyPicker.setVisibility(View.GONE);

    // OK/Cancel buttons
    mButtonLayout = (DecisionButtonLayout) findViewById(R.id.roc_decision_button_layout);
    mButtonLayout.applyOptions(mButtonLayoutCallback);

    SUtils.setViewBackground(findViewById(R.id.freqSpinnerHolder), mHeaderBackgroundColor,
            SUtils.CORNER_TOP_LEFT | SUtils.CORNER_TOP_RIGHT);

    /** EFrequency Spinner {Repeat daily, Repeat weekly, Repeat monthly, Repeat yearly} **/

    mFreqSpinner = (Spinner) findViewById(R.id.freqSpinner);
    mFreqSpinner.setOnItemSelectedListener(this);

    ArrayAdapter<CharSequence> freqAdapter = ArrayAdapter.createFromResource(getContext(),
            R.array.recurrence_freq, R.layout.roc_freq_spinner_item);
    freqAdapter.setDropDownViewResource(R.layout.roc_spinner_dropdown_item);
    mFreqSpinner.setAdapter(freqAdapter);

    Drawable freqSpinnerBg = ContextCompat.getDrawable(getContext(), R.drawable.abc_spinner_mtrl_am_alpha);
    PorterDuffColorFilter cfFreqSpinner = new PorterDuffColorFilter(SUtils.COLOR_TEXT_PRIMARY_INVERSE,
            PorterDuff.Mode.SRC_IN);
    if (freqSpinnerBg != null) {
        freqSpinnerBg.setColorFilter(cfFreqSpinner);
        SUtils.setViewBackground(mFreqSpinner, freqSpinnerBg);
    }

    mInterval = (EditText) findViewById(R.id.interval);
    mInterval.addTextChangedListener(new minMaxTextWatcher(1, INTERVAL_DEFAULT, INTERVAL_MAX) {
        @Override
        void onChange(int v) {
            if (mIntervalResId != -1 && mInterval.getText().toString().length() > 0) {
                mModel.interval = v;
                updateIntervalText();
                mInterval.requestLayout();
            }
        }
    });
    mIntervalPreText = (TextView) findViewById(R.id.intervalPreText);
    mIntervalPostText = (TextView) findViewById(R.id.intervalPostText);

    /** End Spinner {Forever, Until a date, For a number of events} **/

    mEndNeverStr = mResources.getString(R.string.recurrence_end_continously);
    mEndDateLabel = mResources.getString(R.string.recurrence_end_date_label);
    mEndCountLabel = mResources.getString(R.string.recurrence_end_count_label);

    mEndSpinnerArray.add(mEndNeverStr);
    mEndSpinnerArray.add(mEndDateLabel);
    mEndSpinnerArray.add(mEndCountLabel);
    mEndSpinner = (Spinner) findViewById(R.id.endSpinner);
    mEndSpinner.setOnItemSelectedListener(this);

    mEndSpinnerAdapter = new EndSpinnerAdapter(getContext(), mEndSpinnerArray, R.layout.roc_end_spinner_item,
            R.id.spinner_item, R.layout.roc_spinner_dropdown_item);
    mEndSpinner.setAdapter(mEndSpinnerAdapter);

    mEndCount = (EditText) findViewById(R.id.endCount);
    mEndCount.addTextChangedListener(new minMaxTextWatcher(1, COUNT_DEFAULT, COUNT_MAX) {
        @Override
        void onChange(int v) {
            if (mModel.endCount != v) {
                mModel.endCount = v;
                updateEndCountText();
                mEndCount.requestLayout();
            }
        }
    });
    mPostEndCount = (TextView) findViewById(R.id.postEndCount);

    mEndDateTextView = (TextView) findViewById(R.id.endDate);
    mEndDateTextView.setOnClickListener(this);

    SUtils.setViewBackground(mEndDateTextView,
            SUtils.createButtonBg(getContext(), SUtils.COLOR_BUTTON_NORMAL, SUtils.COLOR_CONTROL_HIGHLIGHT));

    // set default & checked state colors
    WeekButton.setStateColors(weekButtonUnselectedTextColor, weekButtonSelectedTextColor);

    // AOSP code handled this differently. It has been refactored to
    // let Android decide if we have enough space to show
    // all seven 'WeekButtons' inline. In this case, 'mWeekGroup2'
    // will be null (see @layout-w460dp/week_buttons).
    mWeekGroup = (LinearLayout) findViewById(R.id.weekGroup);
    mWeekGroup2 = (LinearLayout) findViewById(R.id.weekGroup2);

    // Only non-null when available width is < 460dp
    // Used only for positioning 'WeekButtons' in two rows
    // of 4 & 3.
    View eighthWeekDay = findViewById(R.id.week_day_8);
    if (eighthWeekDay != null)
        eighthWeekDay.setVisibility(View.INVISIBLE);

    // In Calendar.java day of week order e.g Sun = 1 ... Sat = 7
    //String[] dayOfWeekString = new DateFormatSymbols().getWeekdays();

    mMonthRepeatByDayOfWeekStrs = new String[7][];
    // from Time.SUNDAY as 0 through Time.SATURDAY as 6
    mMonthRepeatByDayOfWeekStrs[0] = mResources.getStringArray(R.array.repeat_by_nth_sun);
    mMonthRepeatByDayOfWeekStrs[1] = mResources.getStringArray(R.array.repeat_by_nth_mon);
    mMonthRepeatByDayOfWeekStrs[2] = mResources.getStringArray(R.array.repeat_by_nth_tues);
    mMonthRepeatByDayOfWeekStrs[3] = mResources.getStringArray(R.array.repeat_by_nth_wed);
    mMonthRepeatByDayOfWeekStrs[4] = mResources.getStringArray(R.array.repeat_by_nth_thurs);
    mMonthRepeatByDayOfWeekStrs[5] = mResources.getStringArray(R.array.repeat_by_nth_fri);
    mMonthRepeatByDayOfWeekStrs[6] = mResources.getStringArray(R.array.repeat_by_nth_sat);

    // In Time.java day of week order e.g. Sun = 0
    int idx = RecurrenceUtils.getFirstDayOfWeek();

    // In Calendar.java day of week order e.g Sun = 1 ... Sat = 7
    String[] dayOfWeekString = new DateFormatSymbols().getShortWeekdays();

    // CheckableDrawable's width & height
    int expandedWidthHeight = mResources.getDimensionPixelSize(R.dimen.week_button_state_on_circle_size);

    WeekButton[] tempWeekButtons = new WeekButton[7];
    tempWeekButtons[0] = (WeekButton) findViewById(R.id.week_day_1);
    tempWeekButtons[1] = (WeekButton) findViewById(R.id.week_day_2);
    tempWeekButtons[2] = (WeekButton) findViewById(R.id.week_day_3);
    tempWeekButtons[3] = (WeekButton) findViewById(R.id.week_day_4);
    tempWeekButtons[4] = (WeekButton) findViewById(R.id.week_day_5);
    tempWeekButtons[5] = (WeekButton) findViewById(R.id.week_day_6);
    tempWeekButtons[6] = (WeekButton) findViewById(R.id.week_day_7);

    for (int i = 0; i < mWeekByDayButtons.length; i++) {
        mWeekByDayButtons[idx] = tempWeekButtons[i];
        SUtils.setViewBackground(mWeekByDayButtons[idx],
                new CheckableDrawable(weekButtonSelectedCircleColor, false, expandedWidthHeight));
        mWeekByDayButtons[idx].setTextColor(weekButtonUnselectedTextColor);
        mWeekByDayButtons[idx].setTextOff(dayOfWeekString[TIME_DAY_TO_CALENDAR_DAY[idx]]);
        mWeekByDayButtons[idx].setTextOn(dayOfWeekString[TIME_DAY_TO_CALENDAR_DAY[idx]]);
        mWeekByDayButtons[idx].setOnCheckedChangeListener(this);

        if (++idx >= 7) {
            idx = 0;
        }
    }

    mMonthRepeatByRadioGroup = (RadioGroup) findViewById(R.id.monthGroup);
    mMonthRepeatByRadioGroup.setOnCheckedChangeListener(this);
    mRepeatMonthlyByNthDayOfWeek = (RadioButton) findViewById(R.id.repeatMonthlyByNthDayOfTheWeek);
    mRepeatMonthlyByNthDayOfMonth = (RadioButton) findViewById(R.id.repeatMonthlyByNthDayOfMonth);
}

From source file:android.support.v17.leanback.app.BackgroundManager.java

private void lazyInit() {
    if (mLayerDrawable != null) {
        return;//w  w  w  .  ja v a2 s . co  m
    }

    LayerDrawable layerDrawable = (LayerDrawable) ContextCompat.getDrawable(mContext, R.drawable.lb_background)
            .mutate();
    mLayerDrawable = createOptimizedTranslucentLayerDrawable(layerDrawable);
    BackgroundHelper.setBackgroundPreservingAlpha(mBgView, mLayerDrawable);

    mLayerDrawable.clearDrawable(R.id.background_imageout, mContext);
    mLayerDrawable.updateDrawable(R.id.background_theme, getThemeDrawable());

    updateDimWrapper();
}

From source file:com.esri.squadleader.view.SquadLeaderActivity.java

private void instantiateMil2525CController() throws IOException {
    mil2525cController = new AdvancedSymbolController(mapController, getAssets(),
            getString(R.string.sym_dict_dirname),
            ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_spot_report), messageController);
    messageController.addListener(new MessageListener(mil2525cController));
}

From source file:com.filemanager.free.activities.MainActivity.java

public void updateDrawer() {
    ArrayList<Item> list = new ArrayList<>();
    List<String> val = getStorageDirectories();
    ArrayList<String[]> books = new ArrayList<>();
    ArrayList<String[]> Servers = new ArrayList<>();
    ArrayList<String[]> accounts = new ArrayList<>();
    storage_count = 0;/*from   ww w. j a  va 2  s.  co  m*/
    for (String file : val) {
        File f = new File(file);
        String name;
        Drawable icon1 = ContextCompat.getDrawable(this, R.drawable.ic_sd_storage_white_24dp);
        if ("/storage/emulated/legacy".equals(file) || "/storage/emulated/0".equals(file)) {
            name = getResources().getString(R.string.storage);
            icon1 = ContextCompat.getDrawable(this, R.drawable.ic_memory_white_24dp);
        } else if ("/storage/sdcard1".equals(file)) {
            name = getResources().getString(R.string.extstorage);
        } else if ("/".equals(file)) {
            name = getResources().getString(R.string.rootdirectory);
            icon1 = ContextCompat.getDrawable(this, R.drawable.ic_security_white_24dp);
        } else
            name = f.getName();
        if (!f.isDirectory() || f.canExecute()) {
            storage_count++;
            list.add(new EntryItem(name, file, icon1));
        }
    }
    DataUtils.setStorages(val);
    list.add(new SectionItem());
    try {
        for (String[] file : grid.readTableSecondary(DataUtils.SMB))
            Servers.add(file);
        DataUtils.setServers(Servers);
        if (Servers.size() > 0) {
            Collections.sort(Servers, new BookSorter());
            for (String[] file : Servers)
                list.add(new EntryItem(file[0], file[1],
                        ContextCompat.getDrawable(this, R.drawable.ic_settings_remote_white_48dp)));
            list.add(new SectionItem());
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    try {
        for (String[] file : grid.readTableSecondary(DataUtils.DRIVE)) {
            accounts.add(file);
        }
        DataUtils.setAccounts(accounts);
        if (accounts.size() > 0) {
            Collections.sort(accounts, new BookSorter());
            for (String[] file : accounts)
                list.add(new EntryItem(file[0], file[1], ContextCompat.getDrawable(this, R.drawable.drive)));
            list.add(new SectionItem());
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    try {
        for (String[] file : grid.readTableSecondary(DataUtils.BOOKS)) {
            books.add(file);
        }
        DataUtils.setBooks(books);
        if (books.size() > 0) {
            Collections.sort(books, new BookSorter());
            for (String[] file : books)
                list.add(new EntryItem(file[0], file[1],
                        ContextCompat.getDrawable(this, R.drawable.folder_fab)));
            list.add(new SectionItem());
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    list.add(new EntryItem(getResources().getString(R.string.quick), "5",
            ContextCompat.getDrawable(this, R.drawable.ic_star_white_18dp)));
    list.add(new EntryItem(getResources().getString(R.string.recent), "6",
            ContextCompat.getDrawable(this, R.drawable.ic_history_white_48dp)));
    list.add(new EntryItem(getResources().getString(R.string.images), "0",
            ContextCompat.getDrawable(this, R.drawable.ic_doc_image)));
    list.add(new EntryItem(getResources().getString(R.string.videos), "1",
            ContextCompat.getDrawable(this, R.drawable.ic_doc_video_am)));
    list.add(new EntryItem(getResources().getString(R.string.audio), "2",
            ContextCompat.getDrawable(this, R.drawable.ic_doc_audio_am)));
    list.add(new EntryItem(getResources().getString(R.string.documents), "3",
            ContextCompat.getDrawable(this, R.drawable.ic_doc_doc_am)));
    list.add(new EntryItem(getResources().getString(R.string.apks), "4",
            ContextCompat.getDrawable(this, R.drawable.ic_doc_apk_grid)));
    DataUtils.setList(list);
    adapter = new DrawerAdapter(con, list, MainActivity.this, Sp);
    mDrawerList.setAdapter(adapter);
}