Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19d25df1 authored by Fahim Salam Chowdhury's avatar Fahim Salam Chowdhury 👽
Browse files

Merge branch '167-Toast_message_not_horizontally_centered_issue' into 'master'

167-Toast_message_not_horizontally_centered_issue

See merge request !25
parents 70869200 df99f2d0
Loading
Loading
Loading
Loading
Loading
+5 −4
Original line number Original line Diff line number Diff line
@@ -7236,10 +7236,11 @@ public class Preview implements SurfaceHolder.Callback, TextureView.SurfaceTextu
            final int padding = (int) (14 * scale + 0.5f); // padding for the shaded rectangle; convert dps to pixels
            final int padding = (int) (14 * scale + 0.5f); // padding for the shaded rectangle; convert dps to pixels
            canvas.save();
            canvas.save();
            canvas.rotate(ui_rotation, canvas.getWidth() / 2.0f, canvas.getHeight() / 2.0f);
            canvas.rotate(ui_rotation, canvas.getWidth() / 2.0f, canvas.getHeight() / 2.0f);
            float margin = 32.0f;


            rect.left = canvas.getWidth() / 2.0f - bounds.width() / 2.0f + bounds.left - padding;
            rect.left = canvas.getWidth() / 2.0f - bounds.width() / 2.0f + bounds.left - padding + margin;
            rect.top = canvas.getHeight() / 2.0f + bounds.top - padding + offset_y;
            rect.top = canvas.getHeight() / 2.0f + bounds.top - padding + offset_y;
            rect.right = canvas.getWidth() / 2.0f - bounds.width() / 2.0f + bounds.right + padding;
            rect.right = canvas.getWidth() / 2.0f - bounds.width() / 2.0f + bounds.right + padding + margin;
            rect.bottom = canvas.getHeight() / 2.0f + bounds.bottom + padding + offset_y;
            rect.bottom = canvas.getHeight() / 2.0f + bounds.bottom + padding + offset_y;


            paint.setStyle(Paint.Style.FILL);
            paint.setStyle(Paint.Style.FILL);
@@ -7252,7 +7253,7 @@ public class Preview implements SurfaceHolder.Callback, TextureView.SurfaceTextu
            paint.setColor(Color.WHITE);
            paint.setColor(Color.WHITE);
            int ypos = canvas.getHeight() / 2 + offset_y - ((lines.length - 1) * height) / 2;
            int ypos = canvas.getHeight() / 2 + offset_y - ((lines.length - 1) * height) / 2;
            for (String line : lines) {
            for (String line : lines) {
                canvas.drawText(line, canvas.getWidth() / 2.0f - bounds.width() / 2.0f, ypos, paint);
                canvas.drawText(line, canvas.getWidth() / 2.0f - bounds.width() / 2.0f + margin, ypos, paint);


                if (style_outline) {
                if (style_outline) {
                    // draw outline
                    // draw outline
@@ -7260,7 +7261,7 @@ public class Preview implements SurfaceHolder.Callback, TextureView.SurfaceTextu
                    paint.setColor(Color.BLACK);
                    paint.setColor(Color.BLACK);
                    paint.setStyle(Paint.Style.STROKE);
                    paint.setStyle(Paint.Style.STROKE);
                    paint.setStrokeWidth(1);
                    paint.setStrokeWidth(1);
                    canvas.drawText(line, canvas.getWidth() / 2.0f - bounds.width() / 2.0f, ypos, paint);
                    canvas.drawText(line, canvas.getWidth() / 2.0f - bounds.width() / 2.0f + margin, ypos, paint);
                    paint.setStyle(Paint.Style.FILL);
                    paint.setStyle(Paint.Style.FILL);
                    paint.setColor(current_color);
                    paint.setColor(current_color);
                }
                }