Java Code Examples for android.widget.FrameLayout#setWillNotDraw()
The following examples show how to use
android.widget.FrameLayout#setWillNotDraw() .
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: CompassRenderer.java From PTVGlass with MIT License | 6 votes |
/** * Creates a new instance of the {@code CompassRenderer} with the specified context, * orientation manager, and landmark collection. */ public CompassRenderer(Context context, OrientationManager orientationManager, Landmarks landmarks) { LayoutInflater inflater = LayoutInflater.from(context); mLayout = (FrameLayout) inflater.inflate(R.layout.compass, null); mLayout.setWillNotDraw(false); mCompassView = (CompassView) mLayout.findViewById(R.id.compass); mTipsContainer = (RelativeLayout) mLayout.findViewById(R.id.tips_container); mTipsView = (TextView) mLayout.findViewById(R.id.tips_view); mOrientationManager = orientationManager; mLandmarks = landmarks; mCompassView.setOrientationManager(mOrientationManager); }
Example 2
Source File: CompassRenderer.java From PTVGlass with MIT License | 6 votes |
/** * Creates a new instance of the {@code CompassRenderer} with the specified context, * orientation manager, and landmark collection. */ public CompassRenderer(Context context, OrientationManager orientationManager, Landmarks landmarks) { LayoutInflater inflater = LayoutInflater.from(context); mLayout = (FrameLayout) inflater.inflate(R.layout.compass, null); mLayout.setWillNotDraw(false); mCompassView = (CompassView) mLayout.findViewById(R.id.compass); mTipsContainer = (RelativeLayout) mLayout.findViewById(R.id.tips_container); mTipsView = (TextView) mLayout.findViewById(R.id.tips_view); mOrientationManager = orientationManager; mLandmarks = landmarks; mCompassView.setOrientationManager(mOrientationManager); }
Example 3
Source File: SpeedHudRenderer.java From SpeedHud with Apache License 2.0 | 5 votes |
/** * Creates a new instance of the {@code SpeedHudRenderer} with the specified context * and orientation manager. */ public SpeedHudRenderer(Context context, OrientationManager orientationManager) { LayoutInflater inflater = LayoutInflater.from(context); mLayout = (FrameLayout) inflater.inflate(R.layout.speed_hud, null); mLayout.setWillNotDraw(false); mSpeedHudView = (SpeedHudView) mLayout.findViewById(R.id.speed_hud); mTipsContainer = (RelativeLayout) mLayout.findViewById(R.id.tips_container); mTipsView = (TextView) mLayout.findViewById(R.id.tips_view); mOrientationManager = orientationManager; mSpeedHudView.setOrientationManager(mOrientationManager); }
Example 4
Source File: HudRenderer.java From Voidstar-AutoHud with Apache License 2.0 | 5 votes |
/** * Creates a new instance of the {@code CompassRenderer} with the specified context, * orientation manager, and landmark collection. */ public HudRenderer(Context context, ObdManager obd) { LayoutInflater inflater = LayoutInflater.from(context); mLayout = (FrameLayout) inflater.inflate(R.layout.autohud, null); mLayout.setWillNotDraw(false); mHudView = (HudView) mLayout.findViewById(R.id.compass); //mTipsContainer = (RelativeLayout) mLayout.findViewById(R.id.tips_container); //mTipsView = (TextView) mLayout.findViewById(R.id.tips_view); mObdManager = obd; }
Example 5
Source File: UpdateAppAlertDialog.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
public UpdateAppAlertDialog(final Activity activity, TLRPC.TL_help_appUpdate update, int account) { super(activity, 0); appUpdate = update; accountNum = account; if (update.document instanceof TLRPC.TL_document) { fileName = FileLoader.getAttachFileName(update.document); } parentActivity = activity; setTopImage(R.drawable.update, Theme.getColor(Theme.key_dialogTopBackground)); setTopHeight(175); setMessage(appUpdate.text); if (appUpdate.document instanceof TLRPC.TL_document) { setSecondTitle(AndroidUtilities.formatFileSize(appUpdate.document.size)); } setDismissDialogByButtons(false); setTitle(LocaleController.getString("UpdateTelegram", R.string.UpdateTelegram)); setPositiveButton(LocaleController.getString("UpdateNow", R.string.UpdateNow), (dialog, which) -> { if (!BlockingUpdateView.checkApkInstallPermissions(getContext())) { return; } if (appUpdate.document instanceof TLRPC.TL_document) { if (!BlockingUpdateView.openApkInstall(parentActivity, appUpdate.document)) { FileLoader.getInstance(accountNum).loadFile(appUpdate.document, true, 1); showProgress(true); } } else if (appUpdate.url != null) { Browser.openUrl(getContext(), appUpdate.url); dialog.dismiss(); } }); setNeutralButton(LocaleController.getString("Later", R.string.Later), (dialog, which) -> { if (appUpdate.document instanceof TLRPC.TL_document) { FileLoader.getInstance(accountNum).cancelLoadFile(appUpdate.document); } dialog.dismiss(); }); radialProgressView = new FrameLayout(parentActivity) { @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); int width = right - left; int height = bottom - top; int w = AndroidUtilities.dp(24); int l = (width - w) / 2; int t = (height - w) / 2 + AndroidUtilities.dp(2); radialProgress.setProgressRect(l, t, l + w, t + w); } @Override protected void onDraw(Canvas canvas) { radialProgress.draw(canvas); } }; radialProgressView.setWillNotDraw(false); radialProgressView.setAlpha(0.0f); radialProgressView.setScaleX(0.1f); radialProgressView.setScaleY(0.1f); radialProgressView.setVisibility(View.INVISIBLE); radialProgress = new RadialProgress(radialProgressView); radialProgress.setStrokeWidth(AndroidUtilities.dp(2)); radialProgress.setBackground(null, true, false); radialProgress.setProgressColor(Theme.getColor(Theme.key_dialogButton)); }
Example 6
Source File: UpdateAppAlertDialog.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
public UpdateAppAlertDialog(final Activity activity, TLRPC.TL_help_appUpdate update, int account) { super(activity, 0); appUpdate = update; accountNum = account; if (update.document instanceof TLRPC.TL_document) { fileName = FileLoader.getAttachFileName(update.document); } parentActivity = activity; setTopImage(R.drawable.update, Theme.getColor(Theme.key_dialogTopBackground)); setTopHeight(175); setMessage(appUpdate.text); if (appUpdate.document instanceof TLRPC.TL_document) { setSecondTitle(AndroidUtilities.formatFileSize(appUpdate.document.size)); } setDismissDialogByButtons(false); setTitle(LocaleController.getString("UpdateTelegram", R.string.UpdateTelegram)); setPositiveButton(LocaleController.getString("UpdateNow", R.string.UpdateNow), (dialog, which) -> { if (!BlockingUpdateView.checkApkInstallPermissions(getContext())) { return; } if (appUpdate.document instanceof TLRPC.TL_document) { if (!BlockingUpdateView.openApkInstall(parentActivity, appUpdate.document)) { FileLoader.getInstance(accountNum).loadFile(appUpdate.document, true, 1); showProgress(true); } } else if (appUpdate.url != null) { Browser.openUrl(getContext(), appUpdate.url); dialog.dismiss(); } }); setNeutralButton(LocaleController.getString("Later", R.string.Later), (dialog, which) -> { if (appUpdate.document instanceof TLRPC.TL_document) { FileLoader.getInstance(accountNum).cancelLoadFile(appUpdate.document); } dialog.dismiss(); }); radialProgressView = new FrameLayout(parentActivity) { @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); int width = right - left; int height = bottom - top; int w = AndroidUtilities.dp(24); int l = (width - w) / 2; int t = (height - w) / 2 + AndroidUtilities.dp(2); radialProgress.setProgressRect(l, t, l + w, t + w); } @Override protected void onDraw(Canvas canvas) { radialProgress.draw(canvas); } }; radialProgressView.setWillNotDraw(false); radialProgressView.setAlpha(0.0f); radialProgressView.setScaleX(0.1f); radialProgressView.setScaleY(0.1f); radialProgressView.setVisibility(View.INVISIBLE); radialProgress = new RadialProgress(radialProgressView); radialProgress.setStrokeWidth(AndroidUtilities.dp(2)); radialProgress.setBackground(null, true, false); radialProgress.setProgressColor(Theme.getColor(Theme.key_dialogButton)); }
Example 7
Source File: PhotoPickerPhotoCell.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public PhotoPickerPhotoCell(Context context) { super(context); setWillNotDraw(false); imageView = new BackupImageView(context); imageView.setRoundRadius(AndroidUtilities.dp(4)); addView(imageView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); checkFrame = new FrameLayout(context); addView(checkFrame, LayoutHelper.createFrame(42, 42, Gravity.RIGHT | Gravity.TOP)); videoInfoContainer = new FrameLayout(context) { private Path path = new Path(); float[] radii = new float[8]; private RectF rect = new RectF(); private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); @Override protected void onDraw(Canvas canvas) { rect.set(0, 0, getMeasuredWidth(), getMeasuredHeight()); radii[0] = radii[1] = radii[2] = radii[3] = 0; radii[4] = radii[5] = radii[6] = radii[7] = AndroidUtilities.dp(4); path.reset(); path.addRoundRect(rect, radii, Path.Direction.CW); path.close(); paint.setColor(0x7f000000); canvas.drawPath(path, paint); } }; videoInfoContainer.setWillNotDraw(false); videoInfoContainer.setPadding(AndroidUtilities.dp(3), 0, AndroidUtilities.dp(3), 0); addView(videoInfoContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 16, Gravity.BOTTOM | Gravity.LEFT)); ImageView imageView1 = new ImageView(context); imageView1.setImageResource(R.drawable.ic_video); videoInfoContainer.addView(imageView1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL)); videoTextView = new TextView(context); videoTextView.setTextColor(0xffffffff); videoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12); videoTextView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); videoInfoContainer.addView(videoTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 18, -0.7f, 0, 0)); checkBox = new CheckBox2(context, 24); checkBox.setDrawBackgroundAsArc(11); checkBox.setColor(Theme.key_chat_attachCheckBoxBackground, Theme.key_chat_attachPhotoBackground, Theme.key_chat_attachCheckBoxCheck); addView(checkBox, LayoutHelper.createFrame(26, 26, Gravity.LEFT | Gravity.TOP, 55, 4, 0, 0)); checkBox.setVisibility(VISIBLE); setFocusable(true); }
Example 8
Source File: TooManyCommunitiesHintCell.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public TooManyCommunitiesHintCell(Context context) { super(context); imageView = new ImageView(context); imageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_nameMessage_threeLines), PorterDuff.Mode.MULTIPLY)); headerTextView = new TextView(context); headerTextView.setTextColor(Theme.getColor(Theme.key_chats_nameMessage_threeLines)); headerTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); headerTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); headerTextView.setGravity(Gravity.CENTER); addView(headerTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 52, 75, 52, 0)); messageTextView = new TextView(context); messageTextView.setTextColor(Theme.getColor(Theme.key_chats_message)); messageTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); messageTextView.setGravity(Gravity.CENTER); addView(messageTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 36, 110, 36, 0)); TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); textPaint.setColor(Color.WHITE); textPaint.setTextSize(AndroidUtilities.dp(12)); textPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); String s = "500"; imageLayout = new FrameLayout(context) { RectF rect = new RectF(); @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); paint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText)); canvas.save(); canvas.translate(getMeasuredWidth() - textPaint.measureText(s) - AndroidUtilities.dp(8), AndroidUtilities.dpf2(7f)); rect.set(0, 0, textPaint.measureText(s), textPaint.getTextSize()); rect.inset(-AndroidUtilities.dp(6), -AndroidUtilities.dp(3)); float r = (textPaint.getTextSize()) / 2f + AndroidUtilities.dp(3); canvas.drawRoundRect(rect, r, r, paint); canvas.drawText(s, 0, textPaint.getTextSize() - AndroidUtilities.dpf2(2f), textPaint); canvas.restore(); } }; imageLayout.setWillNotDraw(false); imageLayout.addView(imageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL)); addView(imageLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 12, 0, 6)); headerTextView.setText(LocaleController.getString("TooManyCommunities", R.string.TooManyCommunities)); imageView.setImageResource(R.drawable.groups_limit1); }
Example 9
Source File: SharedPhotoVideoCell.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public PhotoVideoView(Context context) { super(context); setWillNotDraw(false); container = new FrameLayout(context); addView(container, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); imageView = new BackupImageView(context); imageView.getImageReceiver().setNeedsQualityThumb(true); imageView.getImageReceiver().setShouldGenerateQualityThumb(true); container.addView(imageView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); videoInfoContainer = new FrameLayout(context) { private RectF rect = new RectF(); @Override protected void onDraw(Canvas canvas) { rect.set(0, 0, getMeasuredWidth(), getMeasuredHeight()); canvas.drawRoundRect(rect, AndroidUtilities.dp(4), AndroidUtilities.dp(4), Theme.chat_timeBackgroundPaint); } }; videoInfoContainer.setWillNotDraw(false); videoInfoContainer.setPadding(AndroidUtilities.dp(5), 0, AndroidUtilities.dp(5), 0); container.addView(videoInfoContainer, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 17, Gravity.BOTTOM | Gravity.LEFT, 4, 0, 0, 4)); ImageView imageView1 = new ImageView(context); imageView1.setImageResource(R.drawable.play_mini_video); videoInfoContainer.addView(imageView1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL)); videoTextView = new TextView(context); videoTextView.setTextColor(0xffffffff); videoTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); videoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12); videoTextView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); videoInfoContainer.addView(videoTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 13, -0.7f, 0, 0)); selector = new View(context); selector.setBackgroundDrawable(Theme.getSelectorDrawable(false)); addView(selector, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); checkBox = new CheckBox2(context, 21); checkBox.setVisibility(INVISIBLE); checkBox.setColor(null, Theme.key_sharedMedia_photoPlaceholder, Theme.key_checkboxCheck); checkBox.setDrawUnchecked(false); checkBox.setDrawBackgroundAsArc(1); addView(checkBox, LayoutHelper.createFrame(24, 24, Gravity.RIGHT | Gravity.TOP, 0, 1, 1, 0)); }
Example 10
Source File: PhotoAttachPhotoCell.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public PhotoAttachPhotoCell(Context context) { super(context); setWillNotDraw(false); container = new FrameLayout(context); addView(container, LayoutHelper.createFrame(80, 80)); imageView = new BackupImageView(context); container.addView(imageView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); videoInfoContainer = new FrameLayout(context) { private RectF rect = new RectF(); @Override protected void onDraw(Canvas canvas) { rect.set(0, 0, getMeasuredWidth(), getMeasuredHeight()); canvas.drawRoundRect(rect, AndroidUtilities.dp(4), AndroidUtilities.dp(4), Theme.chat_timeBackgroundPaint); } }; videoInfoContainer.setWillNotDraw(false); videoInfoContainer.setPadding(AndroidUtilities.dp(5), 0, AndroidUtilities.dp(5), 0); container.addView(videoInfoContainer, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 17, Gravity.BOTTOM | Gravity.LEFT, 4, 0, 0, 4)); ImageView imageView1 = new ImageView(context); imageView1.setImageResource(R.drawable.play_mini_video); videoInfoContainer.addView(imageView1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL)); videoTextView = new TextView(context); videoTextView.setTextColor(0xffffffff); videoTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); videoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12); videoTextView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); videoInfoContainer.addView(videoTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 13, -0.7f, 0, 0)); checkBox = new CheckBox2(context, 24); checkBox.setDrawBackgroundAsArc(7); checkBox.setColor(Theme.key_chat_attachCheckBoxBackground, Theme.key_chat_attachPhotoBackground, Theme.key_chat_attachCheckBoxCheck); addView(checkBox, LayoutHelper.createFrame(26, 26, Gravity.LEFT | Gravity.TOP, 52, 4, 0, 0)); checkBox.setVisibility(VISIBLE); setFocusable(true); checkFrame = new FrameLayout(context); addView(checkFrame, LayoutHelper.createFrame(42, 42, Gravity.LEFT | Gravity.TOP, 38, 0, 0, 0)); itemSize = AndroidUtilities.dp(80); }
Example 11
Source File: UpdateAppAlertDialog.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public UpdateAppAlertDialog(final Activity activity, TLRPC.TL_help_appUpdate update, int account) { super(activity, 0); appUpdate = update; accountNum = account; if (update.document instanceof TLRPC.TL_document) { fileName = FileLoader.getAttachFileName(update.document); } parentActivity = activity; setTopImage(R.drawable.update, Theme.getColor(Theme.key_dialogTopBackground)); setTopHeight(175); setMessage(appUpdate.text); if (appUpdate.document instanceof TLRPC.TL_document) { setSecondTitle(AndroidUtilities.formatFileSize(appUpdate.document.size)); } setDismissDialogByButtons(false); setTitle(LocaleController.getString("UpdateTelegram", R.string.UpdateTelegram)); setPositiveButton(LocaleController.getString("UpdateNow", R.string.UpdateNow), (dialog, which) -> { if (!BlockingUpdateView.checkApkInstallPermissions(getContext())) { return; } if (appUpdate.document instanceof TLRPC.TL_document) { if (!BlockingUpdateView.openApkInstall(parentActivity, appUpdate.document)) { FileLoader.getInstance(accountNum).loadFile(appUpdate.document, "update", 1, 1); showProgress(true); } } else if (appUpdate.url != null) { Browser.openUrl(getContext(), appUpdate.url); dialog.dismiss(); } }); setNeutralButton(LocaleController.getString("Later", R.string.Later), (dialog, which) -> { if (appUpdate.document instanceof TLRPC.TL_document) { FileLoader.getInstance(accountNum).cancelLoadFile(appUpdate.document); } dialog.dismiss(); }); radialProgressView = new FrameLayout(parentActivity) { @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); int width = right - left; int height = bottom - top; int w = AndroidUtilities.dp(24); int l = (width - w) / 2; int t = (height - w) / 2 + AndroidUtilities.dp(2); radialProgress.setProgressRect(l, t, l + w, t + w); } @Override protected void onDraw(Canvas canvas) { radialProgress.draw(canvas); } }; radialProgressView.setWillNotDraw(false); radialProgressView.setAlpha(0.0f); radialProgressView.setScaleX(0.1f); radialProgressView.setScaleY(0.1f); radialProgressView.setVisibility(View.INVISIBLE); radialProgress = new RadialProgress(radialProgressView); radialProgress.setStrokeWidth(AndroidUtilities.dp(2)); radialProgress.setBackground(null, true, false); radialProgress.setProgressColor(Theme.getColor(Theme.key_dialogButton)); }
Example 12
Source File: PhotoPickerPhotoCell.java From Telegram with GNU General Public License v2.0 | 4 votes |
public PhotoPickerPhotoCell(Context context) { super(context); setWillNotDraw(false); imageView = new BackupImageView(context); imageView.setRoundRadius(AndroidUtilities.dp(4)); addView(imageView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); checkFrame = new FrameLayout(context); addView(checkFrame, LayoutHelper.createFrame(42, 42, Gravity.RIGHT | Gravity.TOP)); videoInfoContainer = new FrameLayout(context) { private Path path = new Path(); float[] radii = new float[8]; private RectF rect = new RectF(); private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); @Override protected void onDraw(Canvas canvas) { rect.set(0, 0, getMeasuredWidth(), getMeasuredHeight()); radii[0] = radii[1] = radii[2] = radii[3] = 0; radii[4] = radii[5] = radii[6] = radii[7] = AndroidUtilities.dp(4); path.reset(); path.addRoundRect(rect, radii, Path.Direction.CW); path.close(); paint.setColor(0x7f000000); canvas.drawPath(path, paint); } }; videoInfoContainer.setWillNotDraw(false); videoInfoContainer.setPadding(AndroidUtilities.dp(3), 0, AndroidUtilities.dp(3), 0); addView(videoInfoContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 16, Gravity.BOTTOM | Gravity.LEFT)); ImageView imageView1 = new ImageView(context); imageView1.setImageResource(R.drawable.ic_video); videoInfoContainer.addView(imageView1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL)); videoTextView = new TextView(context); videoTextView.setTextColor(0xffffffff); videoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12); videoTextView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); videoInfoContainer.addView(videoTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 18, -0.7f, 0, 0)); checkBox = new CheckBox2(context, 24); checkBox.setDrawBackgroundAsArc(11); checkBox.setColor(Theme.key_chat_attachCheckBoxBackground, Theme.key_chat_attachPhotoBackground, Theme.key_chat_attachCheckBoxCheck); addView(checkBox, LayoutHelper.createFrame(26, 26, Gravity.LEFT | Gravity.TOP, 55, 4, 0, 0)); checkBox.setVisibility(VISIBLE); setFocusable(true); }
Example 13
Source File: TooManyCommunitiesHintCell.java From Telegram with GNU General Public License v2.0 | 4 votes |
public TooManyCommunitiesHintCell(Context context) { super(context); imageView = new ImageView(context); imageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_nameMessage_threeLines), PorterDuff.Mode.MULTIPLY)); headerTextView = new TextView(context); headerTextView.setTextColor(Theme.getColor(Theme.key_chats_nameMessage_threeLines)); headerTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); headerTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); headerTextView.setGravity(Gravity.CENTER); addView(headerTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 52, 75, 52, 0)); messageTextView = new TextView(context); messageTextView.setTextColor(Theme.getColor(Theme.key_chats_message)); messageTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); messageTextView.setGravity(Gravity.CENTER); addView(messageTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 36, 110, 36, 0)); TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); textPaint.setColor(Color.WHITE); textPaint.setTextSize(AndroidUtilities.dp(12)); textPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); String s = "500"; imageLayout = new FrameLayout(context) { RectF rect = new RectF(); @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); paint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText)); canvas.save(); canvas.translate(getMeasuredWidth() - textPaint.measureText(s) - AndroidUtilities.dp(8), AndroidUtilities.dpf2(7f)); rect.set(0, 0, textPaint.measureText(s), textPaint.getTextSize()); rect.inset(-AndroidUtilities.dp(6), -AndroidUtilities.dp(3)); float r = (textPaint.getTextSize()) / 2f + AndroidUtilities.dp(3); canvas.drawRoundRect(rect, r, r, paint); canvas.drawText(s, 0, textPaint.getTextSize() - AndroidUtilities.dpf2(2f), textPaint); canvas.restore(); } }; imageLayout.setWillNotDraw(false); imageLayout.addView(imageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL)); addView(imageLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 12, 0, 6)); headerTextView.setText(LocaleController.getString("TooManyCommunities", R.string.TooManyCommunities)); imageView.setImageResource(R.drawable.groups_limit1); }
Example 14
Source File: SharedPhotoVideoCell.java From Telegram with GNU General Public License v2.0 | 4 votes |
public PhotoVideoView(Context context) { super(context); setWillNotDraw(false); container = new FrameLayout(context); addView(container, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); imageView = new BackupImageView(context); imageView.getImageReceiver().setNeedsQualityThumb(true); imageView.getImageReceiver().setShouldGenerateQualityThumb(true); container.addView(imageView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); videoInfoContainer = new FrameLayout(context) { private RectF rect = new RectF(); @Override protected void onDraw(Canvas canvas) { rect.set(0, 0, getMeasuredWidth(), getMeasuredHeight()); canvas.drawRoundRect(rect, AndroidUtilities.dp(4), AndroidUtilities.dp(4), Theme.chat_timeBackgroundPaint); } }; videoInfoContainer.setWillNotDraw(false); videoInfoContainer.setPadding(AndroidUtilities.dp(5), 0, AndroidUtilities.dp(5), 0); container.addView(videoInfoContainer, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 17, Gravity.BOTTOM | Gravity.LEFT, 4, 0, 0, 4)); ImageView imageView1 = new ImageView(context); imageView1.setImageResource(R.drawable.play_mini_video); videoInfoContainer.addView(imageView1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL)); videoTextView = new TextView(context); videoTextView.setTextColor(0xffffffff); videoTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); videoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12); videoTextView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); videoInfoContainer.addView(videoTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 13, -0.7f, 0, 0)); selector = new View(context); selector.setBackgroundDrawable(Theme.getSelectorDrawable(false)); addView(selector, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); checkBox = new CheckBox2(context, 21); checkBox.setVisibility(INVISIBLE); checkBox.setColor(null, Theme.key_sharedMedia_photoPlaceholder, Theme.key_checkboxCheck); checkBox.setDrawUnchecked(false); checkBox.setDrawBackgroundAsArc(1); addView(checkBox, LayoutHelper.createFrame(24, 24, Gravity.RIGHT | Gravity.TOP, 0, 1, 1, 0)); }
Example 15
Source File: PhotoAttachPhotoCell.java From Telegram with GNU General Public License v2.0 | 4 votes |
public PhotoAttachPhotoCell(Context context) { super(context); setWillNotDraw(false); container = new FrameLayout(context); addView(container, LayoutHelper.createFrame(80, 80)); imageView = new BackupImageView(context); container.addView(imageView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); videoInfoContainer = new FrameLayout(context) { private RectF rect = new RectF(); @Override protected void onDraw(Canvas canvas) { rect.set(0, 0, getMeasuredWidth(), getMeasuredHeight()); canvas.drawRoundRect(rect, AndroidUtilities.dp(4), AndroidUtilities.dp(4), Theme.chat_timeBackgroundPaint); } }; videoInfoContainer.setWillNotDraw(false); videoInfoContainer.setPadding(AndroidUtilities.dp(5), 0, AndroidUtilities.dp(5), 0); container.addView(videoInfoContainer, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 17, Gravity.BOTTOM | Gravity.LEFT, 4, 0, 0, 4)); ImageView imageView1 = new ImageView(context); imageView1.setImageResource(R.drawable.play_mini_video); videoInfoContainer.addView(imageView1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL)); videoTextView = new TextView(context); videoTextView.setTextColor(0xffffffff); videoTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); videoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12); videoTextView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); videoInfoContainer.addView(videoTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 13, -0.7f, 0, 0)); checkBox = new CheckBox2(context, 24); checkBox.setDrawBackgroundAsArc(7); checkBox.setColor(Theme.key_chat_attachCheckBoxBackground, Theme.key_chat_attachPhotoBackground, Theme.key_chat_attachCheckBoxCheck); addView(checkBox, LayoutHelper.createFrame(26, 26, Gravity.LEFT | Gravity.TOP, 52, 4, 0, 0)); checkBox.setVisibility(VISIBLE); setFocusable(true); checkFrame = new FrameLayout(context); addView(checkFrame, LayoutHelper.createFrame(42, 42, Gravity.LEFT | Gravity.TOP, 38, 0, 0, 0)); itemSize = AndroidUtilities.dp(80); }
Example 16
Source File: UpdateAppAlertDialog.java From Telegram with GNU General Public License v2.0 | 4 votes |
public UpdateAppAlertDialog(final Activity activity, TLRPC.TL_help_appUpdate update, int account) { super(activity, 0); appUpdate = update; accountNum = account; if (update.document instanceof TLRPC.TL_document) { fileName = FileLoader.getAttachFileName(update.document); } parentActivity = activity; setTopImage(R.drawable.update, Theme.getColor(Theme.key_dialogTopBackground)); setTopHeight(175); setMessage(appUpdate.text); if (appUpdate.document instanceof TLRPC.TL_document) { setSecondTitle(AndroidUtilities.formatFileSize(appUpdate.document.size)); } setDismissDialogByButtons(false); setTitle(LocaleController.getString("UpdateTelegram", R.string.UpdateTelegram)); setPositiveButton(LocaleController.getString("UpdateNow", R.string.UpdateNow), (dialog, which) -> { if (!BlockingUpdateView.checkApkInstallPermissions(getContext())) { return; } if (appUpdate.document instanceof TLRPC.TL_document) { if (!BlockingUpdateView.openApkInstall(parentActivity, appUpdate.document)) { FileLoader.getInstance(accountNum).loadFile(appUpdate.document, "update", 1, 1); showProgress(true); } } else if (appUpdate.url != null) { Browser.openUrl(getContext(), appUpdate.url); dialog.dismiss(); } }); setNeutralButton(LocaleController.getString("Later", R.string.Later), (dialog, which) -> { if (appUpdate.document instanceof TLRPC.TL_document) { FileLoader.getInstance(accountNum).cancelLoadFile(appUpdate.document); } dialog.dismiss(); }); radialProgressView = new FrameLayout(parentActivity) { @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); int width = right - left; int height = bottom - top; int w = AndroidUtilities.dp(24); int l = (width - w) / 2; int t = (height - w) / 2 + AndroidUtilities.dp(2); radialProgress.setProgressRect(l, t, l + w, t + w); } @Override protected void onDraw(Canvas canvas) { radialProgress.draw(canvas); } }; radialProgressView.setWillNotDraw(false); radialProgressView.setAlpha(0.0f); radialProgressView.setScaleX(0.1f); radialProgressView.setScaleY(0.1f); radialProgressView.setVisibility(View.INVISIBLE); radialProgress = new RadialProgress(radialProgressView); radialProgress.setStrokeWidth(AndroidUtilities.dp(2)); radialProgress.setBackground(null, true, false); radialProgress.setProgressColor(Theme.getColor(Theme.key_dialogButton)); }