Java Code Examples for org.telegram.messenger.AndroidUtilities#makeAccessibilityAnnouncement()

The following examples show how to use org.telegram.messenger.AndroidUtilities#makeAccessibilityAnnouncement() . 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: ChatAttachAlert.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onOpenAnimationEnd() {
    MediaController.AlbumEntry albumEntry;
    if (baseFragment instanceof ChatActivity) {
        albumEntry = MediaController.allMediaAlbumEntry;
    } else {
        albumEntry = MediaController.allPhotosAlbumEntry;
    }
    if (Build.VERSION.SDK_INT <= 19 && albumEntry == null) {
        MediaController.loadGalleryPhotosAlbums(0);
    }
    currentAttachLayout.onOpenAnimationEnd();
    AndroidUtilities.makeAccessibilityAnnouncement(LocaleController.getString("AccDescrAttachButton", R.string.AccDescrAttachButton));
}
 
Example 2
Source File: CropRotationWheel.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@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);
        AndroidUtilities.makeAccessibilityAnnouncement(String.format("%.1f°", 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 3
Source File: ChatAttachAlert.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onOpenAnimationEnd() {
    MediaController.AlbumEntry albumEntry;
    if (baseFragment instanceof ChatActivity) {
        albumEntry = MediaController.allMediaAlbumEntry;
    } else {
        albumEntry = MediaController.allPhotosAlbumEntry;
    }
    if (Build.VERSION.SDK_INT <= 19 && albumEntry == null) {
        MediaController.loadGalleryPhotosAlbums(0);
    }
    currentAttachLayout.onOpenAnimationEnd();
    AndroidUtilities.makeAccessibilityAnnouncement(LocaleController.getString("AccDescrAttachButton", R.string.AccDescrAttachButton));
}
 
Example 4
Source File: CropRotationWheel.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@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);
        AndroidUtilities.makeAccessibilityAnnouncement(String.format("%.1f°", 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;
}