public int getNotificationWidth(Context context, int width, int height, int padding) { if (mWidth > 0) { return mWidth; } int w = getDefaultWidth(width, padding); if (OSUtils.getInstance().isEmui()) { // huawei's emui w = getEMUINotificationWidth(context, width, height); } else if (OSUtils.getInstance().isMiui()) { if (Build.VERSION.SDK_INT >= 21) { padding = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10f, context.getResources().getDisplayMetrics())); w = getMIUINotificationWidth(context, width - padding * 2, height); } else { padding = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 25f, context.getResources().getDisplayMetrics())); w = getMIUINotificationWidth(context, width - padding * 2, height); } } mWidth = w; return w; }
public int getNotificationWidth(Context context, int width, int height, int padding) { if (mWidth > 0) { return mWidth; } int w = getDefaultWidth(width, padding); if (OSUtils.getInstance().isEmui()) { // huawei's emui w = getEMUINotificationWidth(context, width, height); } else if (OSUtils.getInstance().isMiui()) { if (Build.VERSION.SDK_INT >= 21) { padding = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10f, context.getResources().getDisplayMetrics())); w = getMIUINotificationWidth(context, width - padding * 2, height); } else { padding = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 25f, context.getResources().getDisplayMetrics())); w = getMIUINotificationWidth(context, width - padding * 2, height); } } mWidth = w; return w; }
public int getNotificationWidth(Context context, int width, int height, int padding) { if (mWidth > 0) { return mWidth; } int w = getDefaultWidth(width, padding); if (OSUtils.getInstance().isEmui()) { // huawei's emui w = getEMUINotificationWidth(context, width, height); } else if (OSUtils.getInstance().isMiui()) { if (Build.VERSION.SDK_INT >= 21) { padding = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10f, context.getResources().getDisplayMetrics())); w = getMIUINotificationWidth(context, width - padding * 2, height); } else { padding = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 25f, context.getResources().getDisplayMetrics())); w = getMIUINotificationWidth(context, width - padding * 2, height); } } mWidth = w; return w; }