List of usage examples for android.content.res Resources getDimension
public float getDimension(@DimenRes int id) throws NotFoundException
From source file:cn.apputest.ctria.section2.Dialog_DriverLicenseCard.java
public void alert_DriverLicenseCardDialog(Context context, EditText carnum) { // TODO Auto-generated method stub contextAlawys = context;/*from www. j a v a 2 s.com*/ preferencesuser = context.getSharedPreferences(Login.FILE_USER, Context.MODE_PRIVATE); String DBName = preferencesuser.getString(Login.KEY_NAME, "1"); helper = new DBHelper(context, DBName + "_DB"); mgr = new DBManager(helper); final Dialog dialog = new Dialog(context, R.style.add_dialog); View vv = LayoutInflater.from(context) .inflate(R.layout.section2activity_lucha2_alert_driverlicensecard_dialog, null); dialog.setCanceledOnTouchOutside(true); dialog.setContentView(vv); // dialog.getWindow().setLayout(480, 524); // dialog.getWindow().setLayout(720, 1050); Resources r = context.getResources(); int x = (int) r.getDimension(R.dimen.x320); int y = (int) r.getDimension(R.dimen.y350); dialog.getWindow().setLayout(x, y); dialog.getWindow().setGravity(Gravity.BOTTOM); Information = (TextView) vv.findViewById(R.id.DriverLicensecard); Information.setClickable(false); Information.setLongClickable(false); Information.setMovementMethod(ScrollingMovementMethod.getInstance()); getDriverLicense(carnum); ImageButton backButton = (ImageButton) vv.findViewById(R.id.backImageButton); backButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub dialog.dismiss(); } }); dialog.show(); }
From source file:com.z299studio.pb.Snackbar.java
@Override public void onStart() { super.onStart(); if (getDialog() != null) { Window window = getDialog().getWindow(); window.setWindowAnimations(R.style.SnackbarAnimation); Resources res = getResources(); int height = (int) (res.getDimension(R.dimen.snackbar_height_single) + 0.5f); boolean leftAlign = res.getBoolean(R.bool.snackbar_left_align); WindowManager.LayoutParams lp = window.getAttributes(); lp.gravity = Gravity.BOTTOM | Gravity.START; lp.x = 0;//from w ww . j a v a2 s.co m lp.y = 0; lp.height = height; if (!leftAlign) { Point windowSize = new Point(); ((WindowManager) getActivity().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay() .getSize(windowSize); lp.width = windowSize.x; } else { lp.height += (int) (res.getDimension(R.dimen.snackbar_horizontal_margin) + 0.5f); } window.setAttributes(lp); } }
From source file:com.androidmapsextensions.DefaultClusterOptionsProvider.java
private Paint createCircleShadowPaint(Resources resources) { Paint paint = null;/*from w ww .j a v a2s. co m*/ float circleShadowBlurRadius = resources .getDimension(R.dimen.ame_default_cluster_circle_shadow_blur_radius); if (circleShadowBlurRadius > 0.0f) { paint = new Paint(Paint.ANTI_ALIAS_FLAG); float offsetX = resources.getDimension(R.dimen.ame_default_cluster_circle_shadow_offset_x); float offsetY = resources.getDimension(R.dimen.ame_default_cluster_circle_shadow_offset_y); int color = resources.getColor(R.color.ame_default_cluster_circle_shadow_color); paint.setShadowLayer(circleShadowBlurRadius, offsetX, offsetY, color); } return paint; }
From source file:com.androidmapsextensions.DefaultClusterOptionsProvider.java
private Paint createCirclePaint(Resources resources) { Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); blurRadius = resources.getDimension(R.dimen.ame_default_cluster_circle_blur_radius); if (blurRadius > 0.0f) { BlurMaskFilter maskFilter = new BlurMaskFilter(blurRadius, BlurMaskFilter.Blur.SOLID); paint.setMaskFilter(maskFilter); }//from ww w . ja v a 2 s. c o m return paint; }
From source file:com.aretha.slidemenu.SlideMenu.java
/** * Retrieve the height of status bar that defined in system * /*from w w w. jav a 2s. c om*/ * @param context * @return */ public static float getStatusBarHeight(Context context) { Resources resources = context.getResources(); int statusBarIdentifier = resources.getIdentifier("status_bar_height", "dimen", "android"); if (0 != statusBarIdentifier) { return resources.getDimension(statusBarIdentifier); } return 0; }
From source file:com.example.product.GcmIntentService.java
private void sendNotification(Bundle extras) { mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), 0); //largeicon ?? ? Bitmap largeIcon = BitmapFactory.decodeResource(getResources(), R.drawable.mylogo_whitebackground); Resources res = getResources(); int height = (int) res.getDimension(android.R.dimen.notification_large_icon_height); int width = (int) res.getDimension(android.R.dimen.notification_large_icon_width); largeIcon = Bitmap.createScaledBitmap(largeIcon, width, height, false); //? ?? ? /* w ww.j a v a 2 s. c o m*/ NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.mylogo_whitebackground).setLargeIcon(largeIcon) .setTicker(extras.getString("stock_name") + " - " + extras.getString("signal_name")) .setContentTitle(extras.getString("stock_name")) //.setStyle(new NotificationCompat.BigTextStyle() // BigTextStyle? . //.bigText(msg)) //.setWhen() //? ? ?? ?. // ? ? ? ? 5? ?. .setNumber(5).setDefaults(Notification.DEFAULT_VIBRATE).setAutoCancel(true) .setContentText(extras.getString("signal_name")); mBuilder.setContentIntent(contentIntent); mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build()); }
From source file:library.slideMenu.SlideMenu.java
public static float getStatusBarHeight(Context context) { Resources resources = context.getResources(); int statusBarIdentifier = resources.getIdentifier("status_bar_height", "dimen", "android"); if (0 != statusBarIdentifier) { return resources.getDimension(statusBarIdentifier); }/*from w w w. j av a 2 s.co m*/ return 0; }
From source file:com.hrules.darealmvp.sample.presentation.views.fragments.ListFragmentView.java
@SuppressWarnings("deprecation") public void initializeViews(@NonNull View view) { unbinder = ButterKnife.bind(this, view); recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false)); Resources res = getResources(); recyclerView.addItemDecoration(new ColorDividerItemDecoration(res.getColor(android.R.color.darker_gray), res.getDimension(R.dimen.list_divider_size))); }
From source file:com.androidmapsextensions.DefaultClusterOptionsProvider.java
private Paint createTextPaint(Resources resources) { Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setColor(resources.getColor(R.color.ame_default_cluster_text_color)); shadowBlurRadius = resources.getDimension(R.dimen.ame_default_cluster_text_shadow_blur_radius); if (shadowBlurRadius > 0.0f) { shadowOffsetX = resources.getDimension(R.dimen.ame_default_cluster_text_shadow_offset_x); shadowOffsetY = resources.getDimension(R.dimen.ame_default_cluster_text_shadow_offset_y); int shadowColor = resources.getColor(R.color.ame_default_cluster_text_shadow_color); paint.setShadowLayer(shadowBlurRadius, shadowOffsetX, shadowOffsetY, shadowColor); }//from w ww . java 2 s. co m paint.setTextSize(resources.getDimension(R.dimen.ame_default_cluster_text_size)); paint.setTypeface(Typeface.DEFAULT_BOLD); return paint; }
From source file:com.limewoodmedia.nsdroid.fragments.WACouncilFragment.java
private void setUpChartRenderer(XYMultipleSeriesRenderer chartRenderer) { Log.d(TAG, "Set up chart renderer"); Resources r = getResources(); float labelTextSize = r.getDimension(R.dimen.bar_chart_label_size); // For renderer forRenderer = new XYSeriesRenderer(); forRenderer.setColor(r.getColor(R.color.wa_for)); forRenderer.setChartValuesTextSize(labelTextSize); forRenderer.setDisplayChartValues(true); againstRenderer = new XYSeriesRenderer(); againstRenderer.setColor(r.getColor(R.color.wa_against)); againstRenderer.setChartValuesTextSize(labelTextSize); againstRenderer.setDisplayChartValues(true); chartRenderer.setZoomButtonsVisible(false); chartRenderer.setOrientation(XYMultipleSeriesRenderer.Orientation.HORIZONTAL); chartRenderer.setClickEnabled(true); chartRenderer.setInScroll(true);/*from ww w. j a v a2 s . com*/ chartRenderer.setAntialiasing(true); chartRenderer.setShowLegend(false); chartRenderer.setTextTypeface(Typeface.DEFAULT); chartRenderer.setPanEnabled(false); chartRenderer.setShowLabels(false); chartRenderer.setXAxisMin(-0.5); chartRenderer.setXAxisMax(2.5); chartRenderer.setYAxisMin(0); chartRenderer.setXLabels(0); chartRenderer.setYLabels(0); chartRenderer.setBarWidth(r.getDimensionPixelSize(R.dimen.wa_bar_width)); chartRenderer.setGridColor(Color.WHITE); chartRenderer.setMarginsColor(Color.WHITE); chartRenderer.setMargins(new int[] { 0, 0, 0, 0 }); chartRenderer.setBackgroundColor(Color.WHITE); chartRenderer.setApplyBackgroundColor(true); chartRenderer.removeAllRenderers(); chartRenderer.addSeriesRenderer(forRenderer); chartRenderer.addSeriesRenderer(againstRenderer); }