Example usage for android.content.res Resources getBoolean

List of usage examples for android.content.res Resources getBoolean

Introduction

In this page you can find the example usage for android.content.res Resources getBoolean.

Prototype

public boolean getBoolean(@BoolRes int id) throws NotFoundException 

Source Link

Document

Return a boolean associated with a particular resource ID.

Usage

From source file:cyl.cframe.library.widgets.viewpagerindicator.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;/*  ww  w . j a v  a  2  s  .  com*/

    //Load defaults from resources
    final Resources res = getResources();
    final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color);
    final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color);
    final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
    final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);
    final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius);
    final float defaultCirclesPadding = res.getDimension(R.dimen.default_circle_indicator_circles_padding);
    final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
    final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0);

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mCirclesPadding = a.getDimension(R.styleable.CirclePageIndicator_circlesPadding, defaultCirclesPadding);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);

    Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:net.fastvan.indicator.CirclePageIndicator.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;/* w  w w.j a  v  a2  s.  co m*/

    //        public static final int getColor(Context context, int id) {
    //            final int version = Build.VERSION.SDK_INT;
    //            if (version >= 23) {
    //                return ContextCompat.getColor(context, id);
    //            } else {
    //                return context.getResources().getColor(id);
    //            }
    //        }
    //Load defaults from resources
    final Resources res = context.getResources();

    final int defaultPageColor = ContextCompat.getColor(context, R.color.default_circle_indicator_page_color);

    final int defaultFillColor = ContextCompat.getColor(context, R.color.default_circle_indicator_fill_color);
    final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
    final int defaultStrokeColor = ContextCompat.getColor(context,
            R.color.default_circle_indicator_stroke_color);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);
    final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius);
    final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
    final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0);

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);

    Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
    if (background != null) {

        int sdk = android.os.Build.VERSION.SDK_INT;
        if (sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) {
            setBackgroundDrawable(background);
        } else {
            setBackground(background);
        }
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.futureinst.viewpagerindicator.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;//from  w  w w  . j  a  v  a  2 s .  c o  m

    //Load defaults from resources
    final Resources res = getResources();
    final int defaultPageColor = res.getColor(com.futureinst.R.color.default_circle_indicator_page_color);
    final int defaultFillColor = res.getColor(com.futureinst.R.color.default_circle_indicator_fill_color);
    final int defaultOrientation = res
            .getInteger(com.futureinst.R.integer.default_circle_indicator_orientation);
    final int defaultStrokeColor = res.getColor(com.futureinst.R.color.default_circle_indicator_stroke_color);
    final float defaultStrokeWidth = res
            .getDimension(com.futureinst.R.dimen.default_circle_indicator_stroke_width);
    final float defaultRadius = res.getDimension(com.futureinst.R.dimen.default_circle_indicator_radius);
    final boolean defaultCentered = res.getBoolean(com.futureinst.R.bool.default_circle_indicator_centered);
    final boolean defaultSnap = res.getBoolean(com.futureinst.R.bool.default_circle_indicator_snap);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, com.futureinst.R.styleable.CirclePageIndicator,
            defStyle, 0);

    mCentered = a.getBoolean(com.futureinst.R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(com.futureinst.R.styleable.CirclePageIndicator_android_orientation,
            defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill
            .setColor(a.getColor(com.futureinst.R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(
            a.getColor(com.futureinst.R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke.setStrokeWidth(
            a.getDimension(com.futureinst.R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(com.futureinst.R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(com.futureinst.R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(com.futureinst.R.styleable.CirclePageIndicator_snap, defaultSnap);

    Drawable background = a.getDrawable(com.futureinst.R.styleable.CirclePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.icloud.listenbook.base.view.viewpagerindicator.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;/*from w w  w  .j  a v a 2  s  .  co  m*/

    // ?
    final Resources res = getResources();
    final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color);
    final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color);
    final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
    final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);
    final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius);
    final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
    final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);

    // ?
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0);

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);

    Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:cn.edu.wyu.documentviewer.DocumentsActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    mRoots = DocumentsApplication.getRootsCache(this);

    virtualIntent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
    virtualIntent.addCategory(Intent.CATEGORY_OPENABLE);
    virtualIntent.setType("*/*");
    virtualIntent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);

    setResult(Activity.RESULT_CANCELED);
    setContentView(R.layout.activity);//  ww w. ja v a 2s. co  m

    final Resources res = getResources();
    mShowAsDialog = res.getBoolean(R.bool.show_as_dialog);

    if (mShowAsDialog) {
        // backgroundDimAmount from theme isn't applied; do it manually
        final WindowManager.LayoutParams a = getWindow().getAttributes();
        a.dimAmount = 0.6f;
        getWindow().setAttributes(a);

        getWindow().setFlags(0, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
        getWindow().setFlags(~0, WindowManager.LayoutParams.FLAG_DIM_BEHIND);

        // Inset ourselves to look like a dialog
        final Point size = new Point();
        getWindowManager().getDefaultDisplay().getSize(size);

        final int width = (int) res.getFraction(R.dimen.dialog_width, size.x, size.x);
        final int height = (int) res.getFraction(R.dimen.dialog_height, size.y, size.y);
        final int insetX = (size.x - width) / 2;
        final int insetY = (size.y - height) / 2;

        final Drawable before = getWindow().getDecorView().getBackground();
        final Drawable after = new InsetDrawable(before, insetX, insetY, insetX, insetY);
        getWindow().getDecorView().setBackground(after);

        // Dismiss when touch down in the dimmed inset area
        getWindow().getDecorView().setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    final float x = event.getX();
                    final float y = event.getY();
                    if (x < insetX || x > v.getWidth() - insetX || y < insetY || y > v.getHeight() - insetY) {
                        finish();
                        return true;
                    }
                }
                return false;
            }
        });

    } else {
        // Non-dialog means we have a drawer
        mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);

        mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer_glyph,
                R.string.drawer_open, R.string.drawer_close);

        mDrawerLayout.setDrawerListener(mDrawerListener);
        mDrawerLayout.setDrawerShadow(R.drawable.ic_drawer_shadow, GravityCompat.START);

        mRootsContainer = findViewById(R.id.container_roots);
    }

    mDirectoryContainer = (DirectoryContainerView) findViewById(R.id.container_directory);

    if (icicle != null) {
        mState = icicle.getParcelable(EXTRA_STATE);
    } else {
        if (DEBUG) {
            Log.i(TAG, "mState");
        }
        buildDefaultState();
    }

    // Hide roots when we're managing a specific root
    if (mState.action == ACTION_MANAGE) {
        if (mShowAsDialog) {
            findViewById(R.id.dialog_roots).setVisibility(View.GONE);
        } else {
            mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
        }
    }

    if (mState.action == ACTION_CREATE) {
        final String mimeType = virtualIntent.getType();
        final String title = virtualIntent.getStringExtra(Intent.EXTRA_TITLE);
        SaveFragment.show(getFragmentManager(), mimeType, title);
    }

    if (mState.action == ACTION_GET_CONTENT) {
        final Intent moreApps = new Intent(virtualIntent);
        moreApps.setComponent(null);
        moreApps.setPackage(null);
        RootsFragment.show(getFragmentManager(), moreApps);
    } else if (mState.action == ACTION_OPEN || mState.action == ACTION_CREATE) {
        RootsFragment.show(getFragmentManager(), null);
    }

    if (!mState.restored) {
        if (mState.action == ACTION_MANAGE) {
            final Uri rootUri = virtualIntent.getData();
            new RestoreRootTask(rootUri).executeOnExecutor(getCurrentExecutor());
        } else {
            new RestoreStackTask().execute();
        }
    } else {
        onCurrentDirectoryChanged(ANIM_NONE);
    }
}

From source file:org.hala.utilities.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;/* w ww.ja  v  a2  s  .c om*/

    //Load defaults from resources
    final Resources res = getResources();
    final int defaultPageColor = ContextCompat.getColor(getContext(),
            R.color.default_circle_indicator_page_color);
    final int defaultFillColor = ContextCompat.getColor(getContext(),
            R.color.default_circle_indicator_fill_color);
    final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
    final int defaultStrokeColor = ContextCompat.getColor(getContext(),
            R.color.default_circle_indicator_stroke_color);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);
    final float defaultRadius = res.getDimension(R.dimen.viewpager_circleindicator_radius);
    final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
    final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0);

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);

    Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
    if (background != null) {
        setBackground(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.silentcircle.contacts.interactions.ImportExportDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Wrap our context to inflate list items using the correct theme
    final Resources res = getActivity().getResources();
    final LayoutInflater dialogInflater = (LayoutInflater) getActivity()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final boolean contactsAreAvailable = getArguments().getBoolean(ARG_CONTACTS_ARE_AVAILABLE);

    // Adapter that shows a list of string resources
    final ArrayAdapter<Integer> adapter = new ArrayAdapter<Integer>(getActivity(),
            R.layout.select_dialog_item) {
        @Override//ww w .  j av  a 2  s  .  c o  m
        public View getView(int position, View convertView, ViewGroup parent) {
            final TextView result = (TextView) (convertView != null ? convertView
                    : dialogInflater.inflate(R.layout.select_dialog_item, parent, false));

            final int resId = getItem(position);
            result.setText(resId);
            return result;
        }
    };

    //        if (TelephonyManager.getDefault().hasIccCard()
    //                && res.getBoolean(R.bool.config_allow_sim_import)) {
    //            adapter.add(R.string.import_from_sim);
    //        }
    if (res.getBoolean(R.bool.config_allow_import_from_sdcard)) {
        adapter.add(R.string.import_from_sdcard);
    }
    if (res.getBoolean(R.bool.config_allow_export_to_sdcard)) {
        if (contactsAreAvailable) {
            adapter.add(R.string.export_to_sdcard);
        }
    }
    if (res.getBoolean(R.bool.config_allow_share_visible_contacts)) {
        if (contactsAreAvailable) {
            adapter.add(R.string.share_visible_contacts);
        }
    }

    final DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            boolean dismissDialog;
            final int resId = adapter.getItem(which);
            switch (resId) {
            //                    case R.string.import_from_sim:
            case R.string.import_from_sdcard: {
                dismissDialog = handleImportRequest(resId);
                break;
            }
            case R.string.export_to_sdcard: {
                dismissDialog = true;
                Intent exportIntent = new Intent(getActivity(), ExportVCardActivity.class);
                getActivity().startActivity(exportIntent);
                break;
            }
            //                    case R.string.share_visible_contacts: {
            //                        dismissDialog = true;
            //                        Log.e(TAG, "Share contects not yet available");
            //                        doShareVisibleContacts();
            //                        break;
            //                    }
            default: {
                dismissDialog = true;
                Log.e(TAG, "Unexpected resource: " + getActivity().getResources().getResourceEntryName(resId));
            }
            }
            if (dismissDialog) {
                dialog.dismiss();
            }
        }
    };
    return new AlertDialog.Builder(getActivity())
            .setTitle(contactsAreAvailable ? R.string.dialog_import_export : R.string.dialog_import)
            .setSingleChoiceItems(adapter, -1, clickListener).create();
}

From source file:com.example.anumbrella.viewpager.LinePagerIndicator.java

public LinePagerIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    ///* w  w w.ja v a 2s.co  m*/
    if (isInEditMode()) {
        return;
    }

    //??
    final Resources res = getResources();

    //
    //?
    final int defaultSelectedColor = res.getColor(R.color.default_line_indicator_selected_color);
    //
    final int defaultUnselectedColor = res.getColor(R.color.default_line_indicator_unselected_color);
    //
    final float defalutLineWidth = res.getDimension(R.dimen.default_line_indicator_line_width);
    //?
    final float defalutGapWidth = res.getDimension(R.dimen.default_line_indicator_gap_width);
    //
    final float defalutStrokeWidth = res.getDimension(R.dimen.default_line_indicator_stroke_width);
    //??
    final boolean defaultCentered = res.getBoolean(R.bool.default_line_indicator_centered);
    //xml
    TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.LinePagerIndicator, defStyle, 0);

    mCentered = array.getBoolean(R.styleable.LinePagerIndicator_centered, defaultCentered);
    mLineWidth = array.getDimension(R.styleable.LinePagerIndicator_lineWidth, defalutLineWidth);
    mGapWidth = array.getDimension(R.styleable.LinePagerIndicator_gapWidth, defalutGapWidth);
    //?
    setStrokeWidth(array.getDimension(R.styleable.LinePagerIndicator_strokeWidth, defalutStrokeWidth));
    mPaintUnselected
            .setColor(array.getColor(R.styleable.LinePagerIndicator_unselectedColor, defaultUnselectedColor));
    mPaintSelected.setColor(array.getColor(R.styleable.LinePagerIndicator_selectedColor, defaultSelectedColor));

    Drawable background = array.getDrawable(R.styleable.LinePagerIndicator_android_background);

    //
    if (background != null) {
        setBackgroundDrawable(background);
    }
    array.recycle();
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    //????(?????)
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);

}

From source file:com.kncwallet.wallet.ui.WalletActivity.java

@Override
public boolean onPrepareOptionsMenu(final Menu menu) {
    super.onPrepareOptionsMenu(menu);

    final Resources res = getResources();
    final String externalStorageState = Environment.getExternalStorageState();

    menu.findItem(R.id.wallet_options_exchange_rates)
            .setVisible(res.getBoolean(R.bool.show_exchange_rates_option));
    menu.findItem(R.id.wallet_options_import_keys)
            .setEnabled(Environment.MEDIA_MOUNTED.equals(externalStorageState)
                    || Environment.MEDIA_MOUNTED_READ_ONLY.equals(externalStorageState));
    menu.findItem(R.id.wallet_options_export_keys)
            .setEnabled(Environment.MEDIA_MOUNTED.equals(externalStorageState));

    return true;//from  ww  w  . j  a va2 s .c  o m
}

From source file:cn.lanqiushe.view.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;//from   w  ww.java  2  s  .c o  m

    // Load defaults from resources
    final Resources res = getResources();
    // 
    final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color);
    // 
    final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color);
    // 
    final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
    // 
    final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color);
    // 
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);
    // 
    final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius);
    //
    final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
    //
    final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);

    // Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0);

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);

    Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}