Java Code Examples for com.mob.tools.utils.R#getScreenSize()
The following examples show how to use
com.mob.tools.utils.R#getScreenSize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PRTHeader.java From Social with Apache License 2.0 | 5 votes |
public PRTHeader(Context context) { super(context); int[] size = R.getScreenSize(context); float screenWidth = size[0] < size[1] ? size[0] : size[1]; float ratio = screenWidth / DESIGN_SCREEN_WIDTH; setOrientation(VERTICAL); LinearLayout llInner = new LinearLayout(context); LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_HORIZONTAL; addView(llInner, lp); ivArrow = new RotateImageView(context); int resId = R.getBitmapRes(context, "ssdk_oks_ptr_ptr"); if (resId > 0) { ivArrow.setImageResource(resId); } int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH); lp = new LayoutParams(avatarWidth, avatarWidth); lp.gravity = Gravity.CENTER_VERTICAL; int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING); lp.topMargin = lp.bottomMargin = avataPadding; llInner.addView(ivArrow, lp); pbRefreshing = new ProgressBar(context); resId = R.getBitmapRes(context, "ssdk_oks_classic_progressbar"); Drawable pbdrawable = context.getResources().getDrawable(resId); pbRefreshing.setIndeterminateDrawable(pbdrawable); llInner.addView(pbRefreshing, lp); pbRefreshing.setVisibility(View.GONE); tvHeader = new TextView(getContext()); tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvHeader.setPadding(avataPadding, 0, avataPadding, 0); tvHeader.setTextColor(0xff09bb07); lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_VERTICAL; llInner.addView(tvHeader, lp); }
Example 2
Source File: PRTHeader.java From Mobike with Apache License 2.0 | 5 votes |
public PRTHeader(Context context) { super(context); int[] size = R.getScreenSize(context); float screenWidth = size[0] < size[1] ? size[0] : size[1]; float ratio = screenWidth / DESIGN_SCREEN_WIDTH; setOrientation(VERTICAL); LinearLayout llInner = new LinearLayout(context); LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_HORIZONTAL; addView(llInner, lp); ivArrow = new RotateImageView(context); int resId = R.getBitmapRes(context, "ssdk_oks_ptr_ptr"); if (resId > 0) { ivArrow.setImageResource(resId); } int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH); lp = new LayoutParams(avatarWidth, avatarWidth); lp.gravity = Gravity.CENTER_VERTICAL; int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING); lp.topMargin = lp.bottomMargin = avataPadding; llInner.addView(ivArrow, lp); pbRefreshing = new ProgressBar(context); resId = R.getBitmapRes(context, "ssdk_oks_classic_progressbar"); Drawable pbdrawable = context.getResources().getDrawable(resId); pbRefreshing.setIndeterminateDrawable(pbdrawable); llInner.addView(pbRefreshing, lp); pbRefreshing.setVisibility(View.GONE); tvHeader = new TextView(getContext()); tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvHeader.setPadding(avataPadding, 0, avataPadding, 0); tvHeader.setTextColor(0xff09bb07); lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_VERTICAL; llInner.addView(tvHeader, lp); }
Example 3
Source File: PRTHeader.java From MyHearts with Apache License 2.0 | 5 votes |
public PRTHeader(Context context) { super(context); int[] size = R.getScreenSize(context); float screenWidth = size[0] < size[1] ? size[0] : size[1]; float ratio = screenWidth / DESIGN_SCREEN_WIDTH; setOrientation(VERTICAL); LinearLayout llInner = new LinearLayout(context); LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_HORIZONTAL; addView(llInner, lp); ivArrow = new RotateImageView(context); int resId = R.getBitmapRes(context, "ssdk_oks_ptr_ptr"); if (resId > 0) { ivArrow.setImageResource(resId); } int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH); lp = new LayoutParams(avatarWidth, avatarWidth); lp.gravity = Gravity.CENTER_VERTICAL; int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING); lp.topMargin = lp.bottomMargin = avataPadding; llInner.addView(ivArrow, lp); pbRefreshing = new ProgressBar(context); resId = R.getBitmapRes(context, "ssdk_oks_classic_progressbar"); Drawable pbdrawable = context.getResources().getDrawable(resId); pbRefreshing.setIndeterminateDrawable(pbdrawable); llInner.addView(pbRefreshing, lp); pbRefreshing.setVisibility(View.GONE); tvHeader = new TextView(getContext()); tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvHeader.setPadding(avataPadding, 0, avataPadding, 0); tvHeader.setTextColor(0xff09bb07); lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_VERTICAL; llInner.addView(tvHeader, lp); }
Example 4
Source File: PRTHeader.java From GithubApp with Apache License 2.0 | 5 votes |
public PRTHeader(Context context) { super(context); int[] size = R.getScreenSize(context); float screenWidth = size[0] < size[1] ? size[0] : size[1]; float ratio = screenWidth / DESIGN_SCREEN_WIDTH; setOrientation(VERTICAL); LinearLayout llInner = new LinearLayout(context); LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_HORIZONTAL; addView(llInner, lp); ivArrow = new RotateImageView(context); int resId = R.getBitmapRes(context, "ssdk_oks_ptr_ptr"); if (resId > 0) { ivArrow.setImageResource(resId); } int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH); lp = new LayoutParams(avatarWidth, avatarWidth); lp.gravity = Gravity.CENTER_VERTICAL; int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING); lp.topMargin = lp.bottomMargin = avataPadding; llInner.addView(ivArrow, lp); pbRefreshing = new ProgressBar(context); resId = R.getBitmapRes(context, "ssdk_oks_classic_progressbar"); Drawable pbdrawable = context.getResources().getDrawable(resId); pbRefreshing.setIndeterminateDrawable(pbdrawable); llInner.addView(pbRefreshing, lp); pbRefreshing.setVisibility(View.GONE); tvHeader = new TextView(getContext()); tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvHeader.setPadding(avataPadding, 0, avataPadding, 0); tvHeader.setTextColor(0xff09bb07); lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_VERTICAL; llInner.addView(tvHeader, lp); }
Example 5
Source File: PRTHeader.java From fingerpoetry-android with Apache License 2.0 | 5 votes |
public PRTHeader(Context context) { super(context); int[] size = R.getScreenSize(context); float screenWidth = size[0] < size[1] ? size[0] : size[1]; float ratio = screenWidth / DESIGN_SCREEN_WIDTH; setOrientation(VERTICAL); LinearLayout llInner = new LinearLayout(context); LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_HORIZONTAL; addView(llInner, lp); ivArrow = new RotateImageView(context); int resId = R.getBitmapRes(context, "ssdk_oks_ptr_ptr"); if (resId > 0) { ivArrow.setImageResource(resId); } int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH); lp = new LayoutParams(avatarWidth, avatarWidth); lp.gravity = Gravity.CENTER_VERTICAL; int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING); lp.topMargin = lp.bottomMargin = avataPadding; llInner.addView(ivArrow, lp); pbRefreshing = new ProgressBar(context); resId = R.getBitmapRes(context, "ssdk_oks_classic_progressbar"); Drawable pbdrawable = context.getResources().getDrawable(resId); pbRefreshing.setIndeterminateDrawable(pbdrawable); llInner.addView(pbRefreshing, lp); pbRefreshing.setVisibility(View.GONE); tvHeader = new TextView(getContext()); tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvHeader.setPadding(avataPadding, 0, avataPadding, 0); tvHeader.setTextColor(0xff09bb07); lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_VERTICAL; llInner.addView(tvHeader, lp); }
Example 6
Source File: PRTHeader.java From HHComicViewer with Apache License 2.0 | 5 votes |
public PRTHeader(Context context) { super(context); int[] size = R.getScreenSize(context); float screenWidth = size[0] < size[1] ? size[0] : size[1]; float ratio = screenWidth / DESIGN_SCREEN_WIDTH; setOrientation(VERTICAL); LinearLayout llInner = new LinearLayout(context); LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_HORIZONTAL; addView(llInner, lp); ivArrow = new RotateImageView(context); int resId = R.getBitmapRes(context, "ssdk_oks_ptr_ptr"); if (resId > 0) { ivArrow.setImageResource(resId); } int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH); lp = new LayoutParams(avatarWidth, avatarWidth); lp.gravity = Gravity.CENTER_VERTICAL; int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING); lp.topMargin = lp.bottomMargin = avataPadding; llInner.addView(ivArrow, lp); pbRefreshing = new ProgressBar(context); resId = R.getBitmapRes(context, "ssdk_oks_classic_progressbar"); Drawable pbdrawable = context.getResources().getDrawable(resId); pbRefreshing.setIndeterminateDrawable(pbdrawable); llInner.addView(pbRefreshing, lp); pbRefreshing.setVisibility(View.GONE); tvHeader = new TextView(getContext()); tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvHeader.setPadding(avataPadding, 0, avataPadding, 0); tvHeader.setTextColor(0xff09bb07); lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_VERTICAL; llInner.addView(tvHeader, lp); }