Example usage for android.content.res Resources getDimensionPixelSize

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

Introduction

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

Prototype

public int getDimensionPixelSize(@DimenRes int id) throws NotFoundException 

Source Link

Document

Retrieve a dimensional for a particular resource ID for use as a size in raw pixels.

Usage

From source file:com.googlecode.eyesfree.widget.RadialMenuView.java

public RadialMenuView(Context context, RadialMenu menu, boolean useNodeProvider) {
    super(context);

    mRootMenu = menu;//  w  w  w.  j  a va  2  s  .  c o m
    mRootMenu.setLayoutListener(mLayoutListener);

    mPaint = new Paint();
    mPaint.setAntiAlias(true);

    mHandler = new LongPressHandler(context);
    mHandler.setListener(mLongPressListener);

    final SurfaceHolder holder = getHolder();
    holder.setFormat(PixelFormat.TRANSLUCENT);
    holder.addCallback(mSurfaceCallback);

    final Resources res = context.getResources();
    final ViewConfiguration config = ViewConfiguration.get(context);

    mSingleTapRadiusSq = config.getScaledTouchSlop();

    // Dimensions.
    mInnerRadius = res.getDimensionPixelSize(R.dimen.inner_radius);
    mOuterRadius = res.getDimensionPixelSize(R.dimen.outer_radius);
    mCornerRadius = res.getDimensionPixelSize(R.dimen.corner_radius);
    mExtremeRadius = res.getDimensionPixelSize(R.dimen.extreme_radius);
    mSpacing = res.getDimensionPixelOffset(R.dimen.spacing);
    mTextSize = res.getDimensionPixelSize(R.dimen.text_size);
    mTextShadowRadius = res.getDimensionPixelSize(R.dimen.text_shadow_radius);
    mShadowRadius = res.getDimensionPixelSize(R.dimen.shadow_radius);

    // Colors.
    mOuterFillColor = res.getColor(R.color.outer_fill);
    mTextFillColor = res.getColor(R.color.text_fill);
    mCornerFillColor = res.getColor(R.color.corner_fill);
    mCornerTextFillColor = res.getColor(R.color.corner_text_fill);
    mDotFillColor = res.getColor(R.color.dot_fill);
    mDotStrokeColor = res.getColor(R.color.dot_stroke);
    mSelectionColor = res.getColor(R.color.selection_fill);
    mSelectionTextFillColor = res.getColor(R.color.selection_text_fill);
    mSelectionShadowColor = res.getColor(R.color.selection_shadow);
    mCenterFillColor = res.getColor(R.color.center_fill);
    mCenterTextFillColor = res.getColor(R.color.center_text_fill);
    mTextShadowColor = res.getColor(R.color.text_shadow);

    // Gradient colors.
    final int gradientInnerColor = res.getColor(R.color.gradient_inner);
    final int gradientOuterColor = res.getColor(R.color.gradient_outer);
    final int[] colors = new int[] { gradientInnerColor, gradientOuterColor };
    mGradientBackground = new GradientDrawable(Orientation.TOP_BOTTOM, colors);
    mGradientBackground.setGradientType(GradientDrawable.RADIAL_GRADIENT);
    mGradientBackground.setGradientRadius(mExtremeRadius * 2.0f);

    final int subMenuOverlayColor = res.getColor(R.color.submenu_overlay);

    // Lighting filters generated from colors.
    mSubMenuFilter = new PorterDuffColorFilter(subMenuOverlayColor, PorterDuff.Mode.SCREEN);

    mInnerRadiusSq = (mInnerRadius * mInnerRadius);
    mExtremeRadiusSq = (mExtremeRadius * mExtremeRadius);

    mUseNodeProvider = useNodeProvider;

    if (mUseNodeProvider) {
        mTouchExplorer = new RadialMenuHelper(this);
        ViewCompat.setAccessibilityDelegate(this, mTouchExplorer);
    }

    // Corner shapes only need to be invalidated and cached once.
    initializeCachedShapes();
}

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

private int getSizeDimension(@Size final int size) {
    final Resources res = getResources();
    switch (size) {
    case SIZE_AUTO:
        // If we're set to auto, grab the size from resources and refresh
        final int width = ConfigurationHelper.getScreenWidthDp(res);
        final int height = ConfigurationHelper.getScreenHeightDp(res);
        return Math.max(width, height) < AUTO_MINI_LARGEST_SCREEN_WIDTH ? getSizeDimension(SIZE_MINI)
                : getSizeDimension(SIZE_NORMAL);
    case SIZE_MINI:
        return res.getDimensionPixelSize(R.dimen.design_fab_size_mini);
    case SIZE_NORMAL:
    default:/*from   ww  w .java  2 s.  c o  m*/
        return res.getDimensionPixelSize(R.dimen.design_fab_size_normal);
    }
}

From source file:com.sonymobile.android.media.testmediaplayer.MainActivity.java

public void init() {
    if (mMediaPlayer == null) {
        mMediaPlayer = new MediaPlayer(getApplicationContext());
        mMediaPlayer.setScreenOnWhilePlaying(true);
    }//from w  ww.  j  a  v a  2 s .  com
    mHandler = new Handler();
    mDecorView = getWindow().getDecorView();
    mSeekbar = (SeekBar) findViewById(R.id.activity_main_seekbar);
    mSeekbar.setMax(1000);
    mPlayPauseButton = (ImageView) findViewById(R.id.activity_main_playpause_button);
    mSeekBarUpdater = new SeekbarUpdater(mSeekbar, mMediaPlayer);
    mTopLayout = (RelativeLayout) findViewById(R.id.activity_main_mainlayout);
    mTrackDialog = new AudioSubtitleTrackDialog(this);
    mAudioPos = mSubPos = 0;
    mTimeView = (TextView) findViewById(R.id.activity_main_time);
    mDurationView = (TextView) findViewById(R.id.activity_main_duration);
    mTimeLayout = (LinearLayout) findViewById(R.id.activity_main_timelayout);
    mTimeTracker = new TimeTracker(mMediaPlayer, mTimeView);
    mSubtitleView = (TextView) findViewById(R.id.activity_main_subtitleView);
    mSubtitleRenderer = new SubtitleRenderer(mSubtitleView, Looper.myLooper(), mMediaPlayer);
    mSubtitleLayoutAboveTimeView = (RelativeLayout.LayoutParams) mSubtitleView.getLayoutParams();
    mSubtitleLayoutBottom = (RelativeLayout.LayoutParams) ((TextView) findViewById(
            R.id.activity_main_subtitleView_params)).getLayoutParams();
    mTimeSeekView = (TextView) findViewById(R.id.activity_main_time_seek);
    mMediaPlayer.setOnInfoListener(this);
    RelativeLayout browsingL = (RelativeLayout) findViewById(R.id.activity_main_browsing_layout);
    ExpandableListView elv = (ExpandableListView) browsingL.findViewById(R.id.file_browsing_exp_list_view);
    ListView lv = (ListView) browsingL.findViewById(R.id.file_browsing_listview);
    RelativeLayout debugLayout = (RelativeLayout) findViewById(R.id.activity_main_debug_view);
    LinearLayout debugLinearLayout = (LinearLayout) debugLayout.findViewById(R.id.activity_main_debug_linear);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerLayout.setScrimColor(Color.TRANSPARENT);
    mDrawerLayout.setDrawerListener(this);
    mFileBrowser = new MediaBrowser(this, elv, lv, mMediaPlayer, (MainActivity) this, mDrawerLayout,
            debugLinearLayout);
    mIsFileBrowsing = false;
    mPreview = (SurfaceView) findViewById(R.id.mSurfaceView);
    mPreview.setOnTouchListener(this);
    mTopLayout.setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
    mPreview.setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
    mSubtitleTracker = new HashMap<Integer, Integer>();
    mAudioTracker = new HashMap<Integer, Integer>();
    findViewById(R.id.activity_main_loading_panel).bringToFront();
    findViewById(R.id.activity_main_browsing_layout).bringToFront();
    mUpperControls = (RelativeLayout) findViewById(R.id.UpperButtonLayout);
    mBottomControls = (RelativeLayout) findViewById(R.id.ButtonLayout);
    mSlideInAnimation = AnimationUtils.loadAnimation(this, R.anim.in_top);
    mSlideInAnimation.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationEnd(Animation animation) {
            mUpperControls.setVisibility(View.VISIBLE);
            Runnable r = new Runnable() {
                @Override
                public void run() {
                    mBottomControls.setVisibility(View.INVISIBLE);
                }
            };
            mHandler.postDelayed(r, 3500);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationStart(Animation animation) {
            mBottomControls.setVisibility(View.INVISIBLE);
        }
    });
    mHolder = mPreview.getHolder();
    mHolder.addCallback(this);
    mFadeOutRunnable = new Runnable() {
        @Override
        public void run() {
            mSeekbar.setEnabled(false);
            Animation fadeoutBottom = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.out_bottom);
            fadeoutBottom.setAnimationListener(new AnimationListener() {

                @Override
                public void onAnimationEnd(Animation animation) {
                    if (mOngoingAnimation) {
                        mOngoingAnimation = false;
                        mBottomControls.setVisibility(View.INVISIBLE);
                        mUpperControls.setVisibility(View.INVISIBLE);
                        mSeekbar.setVisibility(View.GONE);
                        mTimeLayout.setVisibility(View.GONE);
                        mSubtitleView.setLayoutParams(mSubtitleLayoutBottom);
                    }
                }

                @Override
                public void onAnimationRepeat(Animation animation) {
                }

                @Override
                public void onAnimationStart(Animation animation) {
                    mOngoingAnimation = true;
                }
            });
            Animation fadeoutTop = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.out_top);
            mBottomControls.startAnimation(fadeoutBottom);
            mUpperControls.startAnimation(fadeoutTop);
            mSeekbar.startAnimation(fadeoutBottom);
            mTimeLayout.startAnimation(fadeoutBottom);
        }
    };
    mHideNavigationRunnable = new Runnable() {
        @Override
        public void run() {
            mPreview.setSystemUiVisibility(mUiOptions);
        }
    };

    mDecorView.setOnSystemUiVisibilityChangeListener(this);
    mSeekbar.setOnSeekBarChangeListener(new OwnOnSeekBarChangeListener(mMediaPlayer));
    mMediaPlayer.setOnCompletionListener(this);
    mMediaPlayer.setOnPreparedListener(this);
    mMediaPlayer.setOnSeekCompleteListener(this);
    mMediaPlayer.setOnErrorListener(this);
    mMediaPlayer.setOnSubtitleDataListener(this);

    RelativeLayout browsingLayout = (RelativeLayout) findViewById(R.id.activity_main_browsing_layout);
    DrawerLayout.LayoutParams params = (DrawerLayout.LayoutParams) browsingLayout.getLayoutParams();
    Resources resources = getResources();
    int top = 0;
    int bottom = 0;
    RelativeLayout.LayoutParams tempParams;
    int resourceId = resources.getIdentifier("status_bar_height", "dimen", "android");
    if (resourceId > 0) {
        top = resources.getDimensionPixelSize(resourceId);
    }
    resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
    if (resourceId > 0) {
        bottom = resources.getDimensionPixelSize(resourceId);
    }
    if (navigationBarAtBottom()) {
        tempParams = (RelativeLayout.LayoutParams) mBottomControls.getLayoutParams();
        tempParams.bottomMargin += bottom;
        mBottomControls.setLayoutParams(tempParams);
        tempParams = (RelativeLayout.LayoutParams) mSeekbar.getLayoutParams();
        tempParams.bottomMargin += bottom;
        mSeekbar.setLayoutParams(tempParams);
        params.setMargins(0, top, 0, bottom);
    } else {
        tempParams = (RelativeLayout.LayoutParams) mBottomControls.getLayoutParams();
        tempParams.rightMargin += bottom;
        mBottomControls.setLayoutParams(tempParams);
        params.setMargins(0, top, 0, 0);
    }
    browsingLayout.setLayoutParams(params);
    mDrawerLayout.openDrawer(Gravity.START);

    mMediaPlayer.setOnOutputControlListener(this);
}

From source file:com.ramsofttech.adpushlibrary.fragment.GridFragment.java

/**
 * onActivityCreated/*from   w ww.ja v  a  2  s.  c  o  m*/
 * When the activity is created, divide the usable space into columns
 * and put a grid of images in that area.
 */

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    Activity a = getActivity();
    Resources res = a.getResources();

    View rootView = getView();
    GridView gridview = (GridView) rootView.findViewById(R.id.grid);

    DisplayMetrics metrics = new DisplayMetrics();
    a.getWindowManager().getDefaultDisplay().getMetrics(metrics);

    // From the resource files, determine how many rows and columns are to be displayed.
    int numRows = res.getInteger(R.integer.grid_num_rows);
    int numCols = res.getInteger(R.integer.grid_num_cols);
    AppDataHolder dataHolder = ((AppDataHolder) getActivity().getApplicationContext());
    if (dataHolder.getNumCols() != 0)
        numCols = dataHolder.getNumCols();
    if (dataHolder.getNumRows() != 0)
        numRows = dataHolder.getNumRows();
    // Figure out how much space is available for the N rows and M columns to be displayed.
    // We start with the root view for the fragment and adjust for the title, padding, etc.
    int titleHeight = res.getDimensionPixelSize(R.dimen.topic_title_height);
    int titlePadding = res.getDimensionPixelSize(R.dimen.topic_title_padding);
    int buttonAreaHeight = res.getDimensionPixelSize(R.dimen.button_area_height);
    int titleBarHeight = res.getDimensionPixelSize(R.dimen.title_bar_height);
    int gridHspacing = res.getDimensionPixelSize(R.dimen.image_grid_hspacing);
    int gridVSpacing = res.getDimensionPixelSize(R.dimen.image_grid_vspacing);
    int otherGridH = res.getDimensionPixelSize(R.dimen.other_grid_h);
    int otherGridW = res.getDimensionPixelSize(R.dimen.other_grid_w);
    int heightUsed = 2 * titleBarHeight + (numRows + 2) * gridVSpacing + (titleHeight + 2 * titlePadding)
            + otherGridH + buttonAreaHeight;

    int widthUsed = 40; // just a guess for now.
    int availableHeight = metrics.heightPixels - heightUsed;
    int availableWidth = metrics.widthPixels - widthUsed;
    int cellWidth = availableWidth / numCols;
    if (availableWidth > 1000) {
        cellWidth -= 20;
    }

    float cellHeight = numRows * (availableHeight / numRows) / 6;
    if (dataHolder.getCellHeight() != 0) {
        cellHeight = numRows * (availableHeight / numRows) / dataHolder.getCellHeight();
    }

    // Put this back in to check the calculations for cell height and width.
    Log.d("Debug", "--- metrics h: " + metrics.heightPixels + "  w: " + metrics.widthPixels);
    Log.d("Debug", "    available h: " + availableHeight + "  w: " + availableWidth);
    Log.d("Debug", "    already used h: " + heightUsed + "  w: " + widthUsed);
    Log.d("Debug", "    cell h: " + cellHeight + "  w: " + cellWidth);
    Log.d("Debug", "--- num rows: " + numRows + "  cols: " + numCols);
    Log.d("Debug", "--- firstImage: " + mFirstImage + " image count: " + mImageCount);

    if (gridview == null)
        Log.d("DEBUG", "Unable to locate the gridview.");
    else {
        Log.i("Adapter", "--inside call appadapter");
        //  AppDataHolder dataHolder = ((AppDataHolder) getActivity().getApplication());
        gridview.setNumColumns(numCols);
        // Connect the gridview with an adapter that fills up the space.
        //     gridview.setAdapter (new GridImageAdapter (a, mTopicList, mFirstImage, mImageCount, cellWidth, cellHeight));
        gridview.setAdapter(new AppAdapter(a, dataHolder.getApplicationList(), mFirstImage, mImageCount,
                cellWidth, cellHeight));

        // Arrange it so a long click on an item in the grid shows the topic associated with the image.
        gridview.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
                // TODO Auto-generated method stub
                //showTopic(mFirstImage + position);
                Toast.makeText(getActivity(), "" + (mFirstImage + position), Toast.LENGTH_LONG).show();

                clickAsyncTask clickAsynctask = new clickAsyncTask(getActivity());
                clickAsynctask.execute("" + (mFirstImage + position));

                AppDataHolder dataHolder = ((AppDataHolder) getActivity().getApplication());
                List<ApplicationData> applicationList = dataHolder.getApplicationList();
                ApplicationData application = applicationList.get(mFirstImage + position);
                startActivity(new Intent(Intent.ACTION_VIEW,
                        Uri.parse("market://details?id=" + application.getPackageName())));
            }
        });

    }
}

From source file:com.fa.mastodon.activity.ComposeActivity.java

private void addMediaToQueue(QueuedMedia.Type type, Bitmap preview, Uri uri, long mediaSize) {
    final QueuedMedia item = new QueuedMedia(type, uri, new ImageView(this), mediaSize);
    ImageView view = item.preview;
    Resources resources = getResources();
    int side = resources.getDimensionPixelSize(R.dimen.compose_media_preview_side);
    int margin = resources.getDimensionPixelSize(R.dimen.compose_media_preview_margin);
    int marginBottom = resources.getDimensionPixelSize(R.dimen.compose_media_preview_margin_bottom);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(side, side);
    layoutParams.setMargins(margin, 0, margin, marginBottom);
    view.setLayoutParams(layoutParams);/*from   w ww  .ja va2  s . c  o m*/
    view.setScaleType(ImageView.ScaleType.CENTER_CROP);
    view.setImageBitmap(preview);

    view.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            removeMediaFromQueue(item);
        }
    });
    mediaPreviewBar.addView(view);
    mediaQueued.add(item);
    int queuedCount = mediaQueued.size();
    if (queuedCount == 1) {
        /* The media preview bar is actually not inset in the EditText, it just overlays it and
         * is aligned to the bottom. But, so that text doesn't get hidden under it, extra
         * padding is added at the bottom of the EditText. */
        int totalHeight = side + margin + marginBottom;
        textEditor.setPadding(textEditor.getPaddingLeft(), textEditor.getPaddingTop(),
                textEditor.getPaddingRight(), totalHeight);
        // If there's one video in the queue it is full, so disable the button to queue more.
        if (item.type == QueuedMedia.Type.VIDEO) {
            disableMediaButtons();
        }
    } else if (queuedCount >= Status.MAX_MEDIA_ATTACHMENTS) {
        // Limit the total media attachments, also.
        disableMediaButtons();
    }
    if (queuedCount >= 1) {
        showMarkSensitive(true);
    }
    waitForMediaLatch.countUp();
    if (mediaSize > STATUS_MEDIA_SIZE_LIMIT && type == QueuedMedia.Type.IMAGE) {
        downsizeMedia(item);
    } else {
        uploadMedia(item);
    }
}

From source file:app.android.datetimepicker.date.SimpleMonthView.java

public SimpleMonthView(Context context) {
    super(context);

    Resources res = context.getResources();

    mDayLabelCalendar = Calendar.getInstance();
    mCalendar = Calendar.getInstance();

    mDayOfWeekTypeface = res.getString(R.string.day_of_week_label_typeface);
    mMonthTitleTypeface = res.getString(R.string.sans_serif);

    mDayTextColor = res.getColor(R.color.date_picker_text_normal);
    mTodayNumberColor = res.getColor(R.color.blue);
    mMonthTitleColor = res.getColor(R.color.white);
    mMonthTitleBGColor = res.getColor(R.color.circle_background);

    mStringBuilder = new StringBuilder(50);
    mFormatter = new Formatter(mStringBuilder, Locale.getDefault());

    MINI_DAY_NUMBER_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.day_number_size);
    MONTH_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.month_label_size);
    MONTH_DAY_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.month_day_label_text_size);
    MONTH_HEADER_SIZE = res.getDimensionPixelOffset(R.dimen.month_list_item_header_height);
    DAY_SELECTED_CIRCLE_SIZE = res.getDimensionPixelSize(R.dimen.day_number_select_circle_radius);

    mRowHeight = (res.getDimensionPixelOffset(R.dimen.date_picker_view_animator_height) - MONTH_HEADER_SIZE)
            / MAX_NUM_ROWS;/*from   w w  w.j ava 2 s.c  o m*/

    // Set up accessibility components.
    mTouchHelper = new MonthViewTouchHelper(this);
    ViewCompat.setAccessibilityDelegate(this, mTouchHelper);
    ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    mLockAccessibilityDelegate = true;

    // Sets up any standard paints that will be used
    initView();
}

From source file:com.android.tv.guide.ProgramItemView.java

private void initIfNeeded() {
    if (sVisibleThreshold != 0) {
        return;/*from w  w  w. j  a  v  a 2 s. co  m*/
    }
    Resources res = getContext().getResources();

    sVisibleThreshold = res.getDimensionPixelOffset(R.dimen.program_guide_table_item_visible_threshold);

    sItemPadding = res.getDimensionPixelOffset(R.dimen.program_guide_table_item_padding);

    ColorStateList programTitleColor = ColorStateList
            .valueOf(Utils.getColor(res, R.color.program_guide_table_item_program_title_text_color));
    ColorStateList grayedOutProgramTitleColor = Utils.getColorStateList(res,
            R.color.program_guide_table_item_grayed_out_program_text_color);
    ColorStateList episodeTitleColor = ColorStateList
            .valueOf(Utils.getColor(res, R.color.program_guide_table_item_program_episode_title_text_color));
    ColorStateList grayedOutEpisodeTitleColor = ColorStateList.valueOf(
            Utils.getColor(res, R.color.program_guide_table_item_grayed_out_program_episode_title_text_color));
    int programTitleSize = res.getDimensionPixelSize(R.dimen.program_guide_table_item_program_title_font_size);
    int episodeTitleSize = res
            .getDimensionPixelSize(R.dimen.program_guide_table_item_program_episode_title_font_size);

    sProgramTitleStyle = new TextAppearanceSpan(null, 0, programTitleSize, programTitleColor, null);
    sGrayedOutProgramTitleStyle = new TextAppearanceSpan(null, 0, programTitleSize, grayedOutProgramTitleColor,
            null);
    sEpisodeTitleStyle = new TextAppearanceSpan(null, 0, episodeTitleSize, episodeTitleColor, null);
    sGrayedOutEpisodeTitleStyle = new TextAppearanceSpan(null, 0, episodeTitleSize, grayedOutEpisodeTitleColor,
            null);
}

From source file:com.diandi.widget.googledatetimepicker.date.SimpleMonthView.java

public SimpleMonthView(Context context) {
    super(context);

    Resources res = context.getResources();

    mDayLabelCalendar = Calendar.getInstance();
    mCalendar = Calendar.getInstance();

    mDayOfWeekTypeface = res.getString(R.string.day_of_week_label_typeface);
    mMonthTitleTypeface = res.getString(R.string.sans_serif);

    mDayTextColor = res.getColor(R.color.date_picker_text_normal);
    mTodayNumberColor = res.getColor(R.color.blue);
    mMonthTitleColor = res.getColor(R.color.white);
    mMonthTitleBGColor = res.getColor(R.color.circle_background);

    mStringBuilder = new StringBuilder(50);
    mFormatter = new Formatter(mStringBuilder, Locale.getDefault());

    MINI_DAY_NUMBER_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.day_number_size);
    MONTH_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.month_label_size);
    MONTH_DAY_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.month_day_label_text_size);
    MONTH_HEADER_SIZE = res.getDimensionPixelOffset(R.dimen.month_list_item_header_height);
    DAY_SELECTED_CIRCLE_SIZE = res.getDimensionPixelSize(R.dimen.day_number_select_circle_radius);

    mRowHeight = (res.getDimensionPixelOffset(R.dimen.date_picker_view_animator_height) - MONTH_HEADER_SIZE)
            / MAX_NUM_ROWS;//from  w w w .  jav  a2 s  .  com

    // Set up accessibility components.
    mNodeProvider = new MonthViewNodeProvider(context, this);
    ViewCompat.setAccessibilityDelegate(this, mNodeProvider.getAccessibilityDelegate());
    ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    mLockAccessibilityDelegate = true;

    // Sets up any standard paints that will be used
    initView();
}

From source file:com.android.tv.menu.MenuLayoutManager.java

public MenuLayoutManager(Context context, MenuView menuView) {
    mMenuView = menuView;//  w w w .j a  va 2  s.co m
    // Load dimensions
    Resources res = context.getResources();
    mRowAlignFromBottom = res.getDimensionPixelOffset(R.dimen.menu_row_align_from_bottom);
    mRowContentsPaddingTop = res.getDimensionPixelOffset(R.dimen.menu_row_contents_padding_top);
    mRowContentsPaddingBottomMax = res.getDimensionPixelOffset(R.dimen.menu_row_contents_padding_bottom_max);
    mRowTitleTextDescenderHeight = res.getDimensionPixelOffset(R.dimen.menu_row_title_text_descender_height);
    mMenuMarginBottomMin = res.getDimensionPixelOffset(R.dimen.menu_margin_bottom_min);
    mRowTitleHeight = res.getDimensionPixelSize(R.dimen.menu_row_title_height);
    mRowScrollUpAnimationOffset = res.getDimensionPixelOffset(R.dimen.menu_row_scroll_up_anim_offset);
    mRowAnimationDuration = res.getInteger(R.integer.menu_row_selection_anim_duration);
    mOldContentsFadeOutDuration = res.getInteger(R.integer.menu_previous_contents_fade_out_duration);
    mCurrentContentsFadeInDuration = res.getInteger(R.integer.menu_current_contents_fade_in_duration);
}

From source file:com.android.yijiang.kzx.widget.betterpickers.calendardatepicker.SimpleMonthView.java

public SimpleMonthView(Context context) {
    super(context);

    Resources res = context.getResources();

    mDayLabelCalendar = Calendar.getInstance();
    mCalendar = Calendar.getInstance();

    mDayOfWeekTypeface = res.getString(R.string.day_of_week_label_typeface);
    mMonthTitleTypeface = res.getString(R.string.sans_serif);

    mDayTextColor = res.getColor(R.color.date_picker_text_normal);
    mTodayNumberColor = res.getColor(R.color.blue);
    mMonthTitleColor = res.getColor(R.color.white);
    mMonthTitleBGColor = res.getColor(R.color.circle_background);

    mStringBuilder = new StringBuilder(50);
    mFormatter = new Formatter(mStringBuilder, Locale.getDefault());

    sMiniDayNumberTextSize = res.getDimensionPixelSize(R.dimen.day_number_size);
    sMonthLabelTextSize = res.getDimensionPixelSize(R.dimen.month_label_size);
    sMonthDayLabelTextSize = res.getDimensionPixelSize(R.dimen.month_day_label_text_size);
    sMonthHeaderSize = res.getDimensionPixelOffset(R.dimen.month_list_item_header_height);
    sDaySelectedCircleSize = res.getDimensionPixelSize(R.dimen.day_number_select_circle_radius);

    mRowHeight = (res.getDimensionPixelOffset(R.dimen.date_picker_view_animator_height) - sMonthHeaderSize)
            / MAX_NUM_ROWS;/*from   w w w.j  a v a 2s.  c o m*/

    // Set up accessibility components.
    mNodeProvider = new MonthViewNodeProvider(context, this);
    ViewCompat.setAccessibilityDelegate(this, mNodeProvider.getAccessibilityDelegate());
    ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    mLockAccessibilityDelegate = true;

    // Sets up any standard paints that will be used
    initView();
}