org.telegram.messenger.AndroidUtilities Java Examples
The following examples show how to use
org.telegram.messenger.AndroidUtilities.
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: ChatEditActivity.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public void didUploadPhoto(final TLRPC.InputFile file, final TLRPC.PhotoSize bigSize, final TLRPC.PhotoSize smallSize) { AndroidUtilities.runOnUIThread(() -> { if (file != null) { uploadedAvatar = file; if (createAfterUpload) { try { if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); progressDialog = null; } } catch (Exception e) { FileLog.e(e); } donePressed = false; doneButton.performClick(); } showAvatarProgress(false, true); } else { avatar = smallSize.location; avatarBig = bigSize.location; avatarImage.setImage(ImageLocation.getForLocal(avatar), "50_50", avatarDrawable, currentChat); showAvatarProgress(true, false); } }); }
Example #2
Source File: ProgressButton.java From Telegram with GNU General Public License v2.0 | 6 votes |
public ProgressButton(Context context) { super(context); setAllCaps(false); setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setOutlineProvider(null); } ViewHelper.setPadding(this, 8, 0, 8, 0); final int minWidth = AndroidUtilities.dp(60); setMinWidth(minWidth); setMinimumWidth(minWidth); progressRect = new RectF(); progressPaint = new Paint(Paint.ANTI_ALIAS_FLAG); progressPaint.setStrokeCap(Paint.Cap.ROUND); progressPaint.setStyle(Paint.Style.STROKE); progressPaint.setStrokeWidth(AndroidUtilities.dp(2)); }
Example #3
Source File: ContextProgressView.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
public ContextProgressView(Context context, int colorType) { super(context); innerPaint.setStyle(Paint.Style.STROKE); innerPaint.setStrokeWidth(AndroidUtilities.dp(2)); outerPaint.setStyle(Paint.Style.STROKE); outerPaint.setStrokeWidth(AndroidUtilities.dp(2)); outerPaint.setStrokeCap(Paint.Cap.ROUND); if (colorType == 0) { innerKey = Theme.key_contextProgressInner1; outerKey = Theme.key_contextProgressOuter1; } else if (colorType == 1) { innerKey = Theme.key_contextProgressInner2; outerKey = Theme.key_contextProgressOuter2; } else if (colorType == 2) { innerKey = Theme.key_contextProgressInner3; outerKey = Theme.key_contextProgressOuter3; } else if (colorType == 3) { innerKey = Theme.key_contextProgressInner4; outerKey = Theme.key_contextProgressOuter4; } updateColors(); }
Example #4
Source File: ReorderingHintDrawable.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
private void drawStage2(Canvas canvas, float progress) { final Rect bounds = getBounds(); progress = interpolator.getInterpolation(progress); tempRect.left = (int) (AndroidUtilities.dp(2) * scaleX); tempRect.bottom = bounds.bottom - ((int) (AndroidUtilities.dp(6) * scaleY)); tempRect.right = bounds.right - tempRect.left; tempRect.top = tempRect.bottom - ((int) (AndroidUtilities.dp(4) * scaleY)); tempRect.offset(0, AndroidUtilities.dp(AndroidUtilities.lerp(0, -8, progress))); secondaryRectDrawable.setBounds(tempRect); secondaryRectDrawable.draw(canvas); tempRect.left = (int) (AndroidUtilities.dpf2(AndroidUtilities.lerp(1, 2, progress)) * scaleX); tempRect.top = (int) (AndroidUtilities.dpf2(AndroidUtilities.lerp(5, 6, progress)) * scaleY); tempRect.right = bounds.right - tempRect.left; tempRect.bottom = tempRect.top + (int) (AndroidUtilities.dpf2(AndroidUtilities.lerp(6, 4, progress)) * scaleY); tempRect.offset(0, AndroidUtilities.dp(AndroidUtilities.lerp(0, 8, progress))); primaryRectDrawable.setBounds(tempRect); primaryRectDrawable.setAlpha(255); primaryRectDrawable.draw(canvas); }
Example #5
Source File: StickerCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void setSticker(TLRPC.Document document, int side) { if (document != null && document.thumb != null) { imageView.setImage(document.thumb.location, null, "webp", null); } sticker = document; if (side == -1) { setBackgroundResource(R.drawable.stickers_back_left); setPadding(AndroidUtilities.dp(7), 0, 0, 0); } else if (side == 0) { setBackgroundResource(R.drawable.stickers_back_center); setPadding(0, 0, 0, 0); } else if (side == 1) { setBackgroundResource(R.drawable.stickers_back_right); setPadding(0, 0, AndroidUtilities.dp(7), 0); } else if (side == 2) { setBackgroundResource(R.drawable.stickers_back_all); setPadding(AndroidUtilities.dp(3), 0, AndroidUtilities.dp(3), 0); } Drawable background = getBackground(); if (background != null) { background.setAlpha(230); background.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_stickersHintPanel), PorterDuff.Mode.MULTIPLY)); } }
Example #6
Source File: LocationActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
private void openShareLiveLocation() { if (delegate == null || getParentActivity() == null || myLocation == null) { return; } TLRPC.User user = null; if ((int) dialogId > 0) { user = getMessagesController().getUser((int) dialogId); } showDialog(AlertsCreator.createLocationUpdateDialog(getParentActivity(), user, param -> { TLRPC.TL_messageMediaGeoLive location = new TLRPC.TL_messageMediaGeoLive(); location.geo = new TLRPC.TL_geoPoint(); location.geo.lat = AndroidUtilities.fixLocationCoord(myLocation.getLatitude()); location.geo._long = AndroidUtilities.fixLocationCoord(myLocation.getLongitude()); location.period = param; delegate.didSelectLocation(location, locationType, true, 0); finishFragment(); })); }
Example #7
Source File: StickersSearchAdapter.java From Telegram with GNU General Public License v2.0 | 6 votes |
public void search(String text) { if (reqId != 0) { ConnectionsManager.getInstance(currentAccount).cancelRequest(reqId, true); reqId = 0; } if (reqId2 != 0) { ConnectionsManager.getInstance(currentAccount).cancelRequest(reqId2, true); reqId2 = 0; } if (TextUtils.isEmpty(text)) { searchQuery = null; localPacks.clear(); emojiStickers.clear(); serverPacks.clear(); delegate.setAdapterVisible(false); notifyDataSetChanged(); } else { searchQuery = text.toLowerCase(); } AndroidUtilities.cancelRunOnUIThread(searchRunnable); AndroidUtilities.runOnUIThread(searchRunnable, 300); }
Example #8
Source File: StickerMasksAlert.java From Telegram with GNU General Public License v2.0 | 6 votes |
public void search(String text) { if (reqId2 != 0) { ConnectionsManager.getInstance(currentAccount).cancelRequest(reqId2, true); reqId2 = 0; } if (TextUtils.isEmpty(text)) { searchQuery = null; localPacks.clear(); emojiStickers.clear(); if (gridView.getAdapter() != stickersGridAdapter) { gridView.setAdapter(stickersGridAdapter); } notifyDataSetChanged(); } else { searchQuery = text.toLowerCase(); } AndroidUtilities.cancelRunOnUIThread(searchRunnable); AndroidUtilities.runOnUIThread(searchRunnable, 300); }
Example #9
Source File: EmbedBottomSheet.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@JavascriptInterface public void postEvent(final String eventName, final String eventData) { AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { switch (eventName) { case "loaded": progressBar.setVisibility(View.INVISIBLE); progressBarBlackBackground.setVisibility(View.INVISIBLE); pipButton.setEnabled(true); pipButton.setAlpha(1.0f); showOrHideYoutubeLogo(false); break; } } }); }
Example #10
Source File: ShareDialogCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public ShareDialogCell(Context context) { super(context); imageView = new BackupImageView(context); imageView.setRoundRadius(AndroidUtilities.dp(27)); addView(imageView, LayoutHelper.createFrame(54, 54, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 7, 0, 0)); nameTextView = new TextView(context); nameTextView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack)); nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12); nameTextView.setMaxLines(2); nameTextView.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL); nameTextView.setLines(2); nameTextView.setEllipsize(TextUtils.TruncateAt.END); addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 6, 64, 6, 0)); checkBox = new CheckBox(context, R.drawable.round_check2); checkBox.setSize(24); checkBox.setCheckOffset(AndroidUtilities.dp(1)); checkBox.setVisibility(VISIBLE); checkBox.setColor(Theme.getColor(Theme.key_dialogRoundCheckBox), Theme.getColor(Theme.key_dialogRoundCheckBoxCheck)); addView(checkBox, LayoutHelper.createFrame(24, 24, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 17, 39, 0, 0)); }
Example #11
Source File: TextPriceCell.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
public TextPriceCell(Context context) { super(context); setWillNotDraw(false); textView = new TextView(context); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); textView.setLines(1); textView.setMaxLines(1); textView.setSingleLine(true); textView.setEllipsize(TextUtils.TruncateAt.END); textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL); addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 21, 0, 21, 0)); valueTextView = new TextView(context); valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); valueTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); valueTextView.setLines(1); valueTextView.setMaxLines(1); valueTextView.setSingleLine(true); valueTextView.setEllipsize(TextUtils.TruncateAt.END); valueTextView.setGravity((LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL); addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, 21, 0, 21, 0)); }
Example #12
Source File: PhotoAlbumPickerActivity.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
private void fixLayoutInternal() { if (getParentActivity() == null) { return; } WindowManager manager = (WindowManager) ApplicationLoader.applicationContext.getSystemService(Activity.WINDOW_SERVICE); int rotation = manager.getDefaultDisplay().getRotation(); columnsCount = 2; if (!AndroidUtilities.isTablet() && (rotation == Surface.ROTATION_270 || rotation == Surface.ROTATION_90)) { columnsCount = 4; } listAdapter.notifyDataSetChanged(); }
Example #13
Source File: FeaturedSettings.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
private TabSettings() { super(TabSettings.class.getName()); tabsToBottom = getBool(TabsToBottom, false); hideTabs = getBool(HideTabs, false); hideALl = getBool(HideAll, false); hideUsers = getBool(HideUsers, false); hideGroups = getBool(HideGroups, false); hideSuperGroups = getBool(HideSuperGroups, false); hideChannels = getBool(HideChannels, false); hideBots = getBool(HideBots, false); hideFavorites = getBool(HideFavorites, false); hideAdmins = getBool(HideAdmins, true); hideUnreads = getBool(HideUnreads, true); hideTabsCounters = getBool(HideTabsCounters, false); tabsCountersCountNotMuted = getBool(TabsCountersCountNotMuted, true); tabsCountersCountChats = getBool(TabsCountersCountChats, false); limitTabsCounters = getBool(LimitTabsCounters, false); tabsShouldExpand = getBool(TabsShouldExpand, true); chatsTabCounterSize = getInt(ChatsTabCounterSize, AndroidUtilities.isTablet() ? 13 : 11); tabsTextSize = getInt(TabsTextSize, 14); tabsHeight = getInt(TabsHeight, 40); disableTabsScrolling = getBool(DisableTabsScrolling, false); actionBarCastShadows = storage.getBoolean(ActionBarCastShadowsKey, true); currentTab = getInt(CurrentTab, 0); }
Example #14
Source File: ThemeActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override protected void onTransitionAnimationEnd(boolean isOpen, boolean backward) { if (isOpen) { AndroidUtilities.requestAdjustResize(getParentActivity(), classGuid); AndroidUtilities.setAdjustResizeToNothing(getParentActivity(), classGuid); } }
Example #15
Source File: ConnectionsManager.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public static void onLogout(final int currentAccount) { AndroidUtilities.runOnUIThread(() -> { if (UserConfig.getInstance(currentAccount).getClientUserId() != 0) { UserConfig.getInstance(currentAccount).clearConfig(); MessagesController.getInstance(currentAccount).performLogout(0); } }); }
Example #16
Source File: PullForegroundDrawable.java From Telegram with GNU General Public License v2.0 | 5 votes |
public PullForegroundDrawable(String pullText, String releaseText) { tooltipTextPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); tooltipTextPaint.setTextAlign(Paint.Align.CENTER); tooltipTextPaint.setTextSize(AndroidUtilities.dp(16)); final ViewConfiguration vc = ViewConfiguration.get(ApplicationLoader.applicationContext); touchSlop = vc.getScaledTouchSlop(); pullTooltip = pullText; releaseTooltip = releaseText; }
Example #17
Source File: LinearSmoothScrollerCustom.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public int calculateDyToMakeVisible(View view) { final RecyclerView.LayoutManager layoutManager = getLayoutManager(); if (layoutManager == null || !layoutManager.canScrollVertically()) { return 0; } final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) view.getLayoutParams(); int top = layoutManager.getDecoratedTop(view) - params.topMargin; int bottom = layoutManager.getDecoratedBottom(view) + params.bottomMargin; int start = layoutManager.getPaddingTop(); int end = layoutManager.getHeight() - layoutManager.getPaddingBottom(); int boxSize = end - start; int viewSize = bottom - top; if (viewSize > boxSize) { start = 0; } else if (scrollPosition == POSITION_MIDDLE) { start = (boxSize - viewSize) / 2; } else { start = (layoutManager.getPaddingTop() - AndroidUtilities.dp(88)); } end = start + viewSize; final int dtStart = start - top; if (dtStart > 0) { return dtStart; } final int dtEnd = end - bottom; if (dtEnd < 0) { return dtEnd; } return 0; }
Example #18
Source File: EmojiView.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public int getTabForPosition(int position) { if (position == 0) { position = 1; } if (stickersPerRow == 0) { int width = getMeasuredWidth(); if (width == 0) { width = AndroidUtilities.displaySize.x; } stickersPerRow = width / AndroidUtilities.dp(72); } int row = positionToRow.get(position, Integer.MIN_VALUE); if (row == Integer.MIN_VALUE) { return stickerSets.size() - 1 + stickersTabOffset; } Object pack = rowStartPack.get(row); if (pack instanceof String) { if ("recent".equals(pack)) { return recentTabBum; } else { return favTabBum; } } else { TLRPC.TL_messages_stickerSet set = (TLRPC.TL_messages_stickerSet) pack; int idx = stickerSets.indexOf(set); return idx + stickersTabOffset; } }
Example #19
Source File: ActionBarLayout.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void removeFragmentFromStack(BaseFragment fragment) { if (useAlphaAnimations && fragmentsStack.size() == 1 && AndroidUtilities.isTablet()) { closeLastFragment(true); } else { removeFragmentFromStackInternal(fragment); } }
Example #20
Source File: CheckBoxBase.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public void setDrawBackgroundAsArc(int type) { drawBackgroundAsArc = type; if (type == 4 || type == 5) { backgroundPaint.setStrokeWidth(AndroidUtilities.dp(1.9f)); if (type == 5) { checkPaint.setStrokeWidth(AndroidUtilities.dp(1.5f)); } } else if (type == 3) { backgroundPaint.setStrokeWidth(AndroidUtilities.dp(1.2f)); } else if (type != 0) { backgroundPaint.setStrokeWidth(AndroidUtilities.dp(1.5f)); } }
Example #21
Source File: WallpapersListActivity.java From Telegram with GNU General Public License v2.0 | 5 votes |
private void processSearch(String text, boolean now) { if (text != null && selectedColor != null) { text = "#color" + selectedColor + " " + text; } if (searchRunnable != null) { AndroidUtilities.cancelRunOnUIThread(searchRunnable); searchRunnable = null; } if (TextUtils.isEmpty(text)) { searchResult.clear(); searchResultKeys.clear(); bingSearchEndReached = true; lastSearchString = null; if (imageReqId != 0) { ConnectionsManager.getInstance(currentAccount).cancelRequest(imageReqId, true); imageReqId = 0; } searchEmptyView.showTextView(); } else { searchEmptyView.showProgress(); final String textFinal = text; if (now) { doSearch(textFinal); } else { searchRunnable = () -> { doSearch(textFinal); searchRunnable = null; }; AndroidUtilities.runOnUIThread(searchRunnable, 500); } } notifyDataSetChanged(); }
Example #22
Source File: WebPlayerView.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private void updatePlayButton() { controlsView.checkNeedHide(); AndroidUtilities.cancelRunOnUIThread(progressRunnable); if (!videoPlayer.isPlaying()) { if (isCompleted) { playButton.setImageResource(isInline ? R.drawable.ic_againinline : R.drawable.ic_again); } else { playButton.setImageResource(isInline ? R.drawable.ic_playinline : R.drawable.ic_play); } } else { playButton.setImageResource(isInline ? R.drawable.ic_pauseinline : R.drawable.ic_pause); AndroidUtilities.runOnUIThread(progressRunnable, 500); checkAudioFocus(); } }
Example #23
Source File: PhotoPaintView.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void closeTextEnter(boolean apply) { if (!editingText || !(currentEntityView instanceof TextPaintView)) { return; } TextPaintView textPaintView = (TextPaintView) currentEntityView; toolsView.setVisibility(VISIBLE); AndroidUtilities.hideKeyboard(textPaintView.getFocusedView()); textPaintView.getFocusedView().clearFocus(); textPaintView.endEditing(); if (!apply) { textPaintView.setText(initialText); } if (textPaintView.getText().trim().length() == 0) { entitiesView.removeView(textPaintView); selectEntity(null); } else { textPaintView.setPosition(editedTextPosition); textPaintView.setRotation(editedTextRotation); textPaintView.setScale(editedTextScale); editedTextPosition = null; editedTextRotation = 0.0f; editedTextScale = 0.0f; } setTextDimVisibility(false, textPaintView); editingText = false; initialText = null; curtainView.setVisibility(View.GONE); }
Example #24
Source File: EditTextEmoji.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public void setEnabled(boolean enabled) { editText.setEnabled(enabled); emojiButton.setVisibility(enabled ? VISIBLE : GONE); if (enabled) { editText.setPadding(LocaleController.isRTL ? AndroidUtilities.dp(40) : 0, 0, LocaleController.isRTL ? 0 : AndroidUtilities.dp(40), AndroidUtilities.dp(8)); } else { editText.setPadding(0, 0, 0, AndroidUtilities.dp(8)); } }
Example #25
Source File: CropRotationWheel.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public boolean onTouchEvent(MotionEvent ev) { int action = ev.getActionMasked(); float x = ev.getX(); if (action == MotionEvent.ACTION_DOWN) { prevX = x; if (rotationListener != null) rotationListener.onStart(); } else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) { if (rotationListener != null) rotationListener.onEnd(this.rotation); } else if (action == MotionEvent.ACTION_MOVE) { float delta = prevX - x; float newAngle = this.rotation + (float)(delta / AndroidUtilities.density / Math.PI / 1.65f); newAngle = Math.max(-MAX_ANGLE, Math.min(MAX_ANGLE, newAngle)); if (Math.abs(newAngle - this.rotation) > 0.001) { if (Math.abs(newAngle) < 0.05) newAngle = 0; setRotation(newAngle, false); if (rotationListener != null) rotationListener.onChange(this.rotation); prevX = x; } } return true; }
Example #26
Source File: RadialProgress.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public CheckDrawable() { paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(AndroidUtilities.dp(3)); paint.setStrokeCap(Paint.Cap.ROUND); paint.setColor(0xffffffff); }
Example #27
Source File: ActionBarMenu.java From Telegram with GNU General Public License v2.0 | 5 votes |
public ActionBarMenuItem addItem(int id, int icon, CharSequence text, int backgroundColor, Drawable drawable, int width, CharSequence title) { ActionBarMenuItem menuItem = new ActionBarMenuItem(getContext(), this, backgroundColor, isActionMode ? parentActionBar.itemsActionModeColor : parentActionBar.itemsColor, text != null); menuItem.setTag(id); if (text != null) { menuItem.textView.setText(text); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(width != 0 ? width : ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT); layoutParams.leftMargin = layoutParams.rightMargin = AndroidUtilities.dp(14); addView(menuItem, layoutParams); } else { if (drawable != null) { menuItem.iconView.setImageDrawable(drawable); } else if (icon != 0) { menuItem.iconView.setImageResource(icon); } addView(menuItem, new LinearLayout.LayoutParams(width, ViewGroup.LayoutParams.MATCH_PARENT)); } menuItem.setOnClickListener(view -> { ActionBarMenuItem item = (ActionBarMenuItem) view; if (item.hasSubMenu()) { if (parentActionBar.actionBarMenuOnItemClick.canOpenMenu()) { item.toggleSubMenu(); } } else if (item.isSearchField()) { parentActionBar.onSearchFieldVisibilityChanged(item.toggleSearch(true)); } else { onItemClick((Integer) view.getTag()); } }); if (title != null) { menuItem.setContentDescription(title); } return menuItem; }
Example #28
Source File: AudioPlayerCell.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private boolean checkAudioMotionEvent(MotionEvent event) { int x = (int) event.getX(); int y = (int) event.getY(); boolean result = false; int side = AndroidUtilities.dp(36); boolean area = false; if (miniButtonState >= 0) { int offset = AndroidUtilities.dp(27); area = x >= buttonX + offset && x <= buttonX + offset + side && y >= buttonY + offset && y <= buttonY + offset + side; } if (event.getAction() == MotionEvent.ACTION_DOWN) { if (area) { miniButtonPressed = true; invalidate(); result = true; updateRadialProgressBackground(); } } else if (miniButtonPressed) { if (event.getAction() == MotionEvent.ACTION_UP) { miniButtonPressed = false; playSoundEffect(SoundEffectConstants.CLICK); didPressedMiniButton(true); invalidate(); } else if (event.getAction() == MotionEvent.ACTION_CANCEL) { miniButtonPressed = false; invalidate(); } else if (event.getAction() == MotionEvent.ACTION_MOVE) { if (!area) { miniButtonPressed = false; invalidate(); } } updateRadialProgressBackground(); } return result; }
Example #29
Source File: ProxySettingsActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override protected void onTransitionAnimationEnd(boolean isOpen, boolean backward) { if (isOpen && !backward && addingNewProxy) { inputFields[FIELD_IP].requestFocus(); AndroidUtilities.showKeyboard(inputFields[FIELD_IP]); } }
Example #30
Source File: ChatActionCell.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public ChatActionCell(Context context) { super(context); imageReceiver = new ImageReceiver(this); imageReceiver.setRoundRadius(AndroidUtilities.dp(32)); avatarDrawable = new AvatarDrawable(); }