diff --git a/app/src/main/java/eu/faircode/email/ConstraintLayoutEx.java b/app/src/main/java/eu/faircode/email/ConstraintLayoutEx.java new file mode 100644 index 0000000000..523e8db031 --- /dev/null +++ b/app/src/main/java/eu/faircode/email/ConstraintLayoutEx.java @@ -0,0 +1,113 @@ +package eu.faircode.email; + +/* + This file is part of FairEmail. + + FairEmail is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FairEmail is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FairEmail. If not, see . + + Copyright 2018-2022 by Marcel Bokhorst (M66B) +*/ + +import android.content.Context; +import android.util.AttributeSet; +import android.view.MotionEvent; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.constraintlayout.widget.ConstraintLayout; + +public class ConstraintLayoutEx extends ConstraintLayout { + public ConstraintLayoutEx(@NonNull Context context) { + super(context); + } + + public ConstraintLayoutEx(@NonNull Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + } + + public ConstraintLayoutEx(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + public ConstraintLayoutEx(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } + + /* + java.lang.IndexOutOfBoundsException: 2, 0 + at android.text.PackedIntVector.getValue(PackedIntVector.java:75) + at android.text.DynamicLayout.getLineStart(DynamicLayout.java:1028) + at android.text.Layout.getLineEnd(Layout.java:1675) + at android.text.Layout.getOffsetForHorizontal(Layout.java:1544) + at android.text.Layout.getOffsetForHorizontal(Layout.java:1529) + at android.widget.TextView.getOffsetAtCoordinate(TextView.java:12988) + at android.widget.Editor$HandleView.getOffsetAtCoordinate(Editor.java:4875) + at android.widget.Editor$InsertionHandleView.updatePosition(Editor.java:5635) + at android.widget.Editor$HandleView.onTouchEvent(Editor.java:5301) + at android.widget.Editor$InsertionHandleView.onTouchEvent(Editor.java:5464) + at android.view.View.dispatchTouchEvent(View.java:14309) + at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118) + at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) + at android.widget.PopupWindow$PopupDecorView.dispatchTouchEvent(PopupWindow.java:2553) + at android.view.View.dispatchPointerEvent(View.java:14568) + at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6022) + at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5825) + at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5316) + at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5373) + at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5339) + at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5491) + at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5347) + at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5548) + at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5320) + at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5373) + at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5339) + at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5347) + at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5320) + at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:8086) + at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:8037) + at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7998) + at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:8209) + at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:220) + at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method) + at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:200) + at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:8166) + at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:8248) + at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972) + at android.view.Choreographer.doCallbacks(Choreographer.java:796) + at android.view.Choreographer.doFrame(Choreographer.java:724) + at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957) + at android.os.Handler.handleCallback(Handler.java:938) + at android.os.Handler.dispatchMessage(Handler.java:99) + */ + + @Override + public boolean dispatchTouchEvent(MotionEvent ev) { + try { + return super.dispatchTouchEvent(ev); + } catch (Throwable ex) { + Log.w(ex); + return false; + } + } + + @Override + public boolean dispatchGenericMotionEvent(MotionEvent event) { + try { + return super.dispatchGenericMotionEvent(event); + } catch (Throwable ex) { + Log.w(ex); + return false; + } + } +} diff --git a/app/src/main/java/eu/faircode/email/CoordinatorLayoutEx.java b/app/src/main/java/eu/faircode/email/CoordinatorLayoutEx.java new file mode 100644 index 0000000000..e7e85ba8c2 --- /dev/null +++ b/app/src/main/java/eu/faircode/email/CoordinatorLayoutEx.java @@ -0,0 +1,62 @@ +package eu.faircode.email; + +/* + This file is part of FairEmail. + + FairEmail is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FairEmail is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FairEmail. If not, see . + + Copyright 2018-2022 by Marcel Bokhorst (M66B) +*/ + +import android.content.Context; +import android.util.AttributeSet; +import android.view.MotionEvent; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.coordinatorlayout.widget.CoordinatorLayout; + +public class CoordinatorLayoutEx extends CoordinatorLayout { + public CoordinatorLayoutEx(@NonNull Context context) { + super(context); + } + + public CoordinatorLayoutEx(@NonNull Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + } + + public CoordinatorLayoutEx(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + @Override + public boolean dispatchTouchEvent(MotionEvent ev) { + try { + return super.dispatchTouchEvent(ev); + } catch (Throwable ex) { + Log.w(ex); + return false; + } + } + + @Override + public boolean dispatchGenericMotionEvent(MotionEvent event) { + try { + return super.dispatchGenericMotionEvent(event); + } catch (Throwable ex) { + Log.w(ex); + return false; + } + } +} diff --git a/app/src/main/java/eu/faircode/email/DrawerLayoutEx.java b/app/src/main/java/eu/faircode/email/DrawerLayoutEx.java index 18a224e811..4b57e3a473 100644 --- a/app/src/main/java/eu/faircode/email/DrawerLayoutEx.java +++ b/app/src/main/java/eu/faircode/email/DrawerLayoutEx.java @@ -77,6 +77,16 @@ public class DrawerLayoutEx extends DrawerLayout { } } + @Override + public boolean dispatchTouchEvent(MotionEvent ev) { + try { + return super.dispatchTouchEvent(ev); + } catch (Throwable ex) { + Log.w(ex); + return false; + } + } + @Override public boolean dispatchGenericMotionEvent(MotionEvent ev) { if (isLocked()) { @@ -89,7 +99,12 @@ public class DrawerLayoutEx extends DrawerLayout { return content.dispatchGenericMotionEvent(ev); } - return super.dispatchGenericMotionEvent(ev); + try { + return super.dispatchGenericMotionEvent(ev); + } catch (Throwable ex) { + Log.w(ex); + return false; + } } @Override diff --git a/app/src/main/java/eu/faircode/email/FrameLayoutEx.java b/app/src/main/java/eu/faircode/email/FrameLayoutEx.java new file mode 100644 index 0000000000..af716cb364 --- /dev/null +++ b/app/src/main/java/eu/faircode/email/FrameLayoutEx.java @@ -0,0 +1,66 @@ +package eu.faircode.email; + +/* + This file is part of FairEmail. + + FairEmail is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FairEmail is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FairEmail. If not, see . + + Copyright 2018-2022 by Marcel Bokhorst (M66B) +*/ + +import android.content.Context; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.widget.FrameLayout; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +public class FrameLayoutEx extends FrameLayout { + public FrameLayoutEx(@NonNull Context context) { + super(context); + } + + public FrameLayoutEx(@NonNull Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + } + + public FrameLayoutEx(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + public FrameLayoutEx(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } + + @Override + public boolean dispatchTouchEvent(MotionEvent ev) { + try { + return super.dispatchTouchEvent(ev); + } catch (Throwable ex) { + Log.w(ex); + return false; + } + } + + @Override + public boolean dispatchGenericMotionEvent(MotionEvent event) { + try { + return super.dispatchGenericMotionEvent(event); + } catch (Throwable ex) { + Log.w(ex); + return false; + } + } +} diff --git a/app/src/main/res/layout/action_bar.xml b/app/src/main/res/layout/action_bar.xml index 369654dff2..d8508a7daa 100644 --- a/app/src/main/res/layout/action_bar.xml +++ b/app/src/main/res/layout/action_bar.xml @@ -1,5 +1,5 @@ - @@ -27,4 +27,4 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/title" /> - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/action_button_text.xml b/app/src/main/res/layout/action_button_text.xml index d141a00415..e486aa5228 100644 --- a/app/src/main/res/layout/action_button_text.xml +++ b/app/src/main/res/layout/action_button_text.xml @@ -1,5 +1,5 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_amp.xml b/app/src/main/res/layout/activity_amp.xml index 3b587cf336..2a442963fd 100644 --- a/app/src/main/res/layout/activity_amp.xml +++ b/app/src/main/res/layout/activity_amp.xml @@ -1,4 +1,4 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_answer.xml b/app/src/main/res/layout/activity_answer.xml index 6e0a9235d7..fec7190010 100644 --- a/app/src/main/res/layout/activity_answer.xml +++ b/app/src/main/res/layout/activity_answer.xml @@ -1,4 +1,4 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_billing.xml b/app/src/main/res/layout/activity_billing.xml index fa467c73fa..37c9c3f1c6 100644 --- a/app/src/main/res/layout/activity_billing.xml +++ b/app/src/main/res/layout/activity_billing.xml @@ -1,4 +1,4 @@ - - @@ -31,7 +31,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> - - + - + - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_compose.xml b/app/src/main/res/layout/activity_compose.xml index b7baf10132..87993ea757 100644 --- a/app/src/main/res/layout/activity_compose.xml +++ b/app/src/main/res/layout/activity_compose.xml @@ -1,4 +1,4 @@ - - @@ -31,7 +31,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> - - + - + - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_dsn.xml b/app/src/main/res/layout/activity_dsn.xml index aad775f385..316849aa08 100644 --- a/app/src/main/res/layout/activity_dsn.xml +++ b/app/src/main/res/layout/activity_dsn.xml @@ -1,4 +1,4 @@ - - @@ -31,7 +31,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> - - + @@ -59,7 +59,7 @@ android:layout_width="0dp" android:layout_height="0dp" app:constraint_referenced_ids="cardMessage" /> - + - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_eml.xml b/app/src/main/res/layout/activity_eml.xml index 96df99d93c..fa36c16b12 100644 --- a/app/src/main/res/layout/activity_eml.xml +++ b/app/src/main/res/layout/activity_eml.xml @@ -1,4 +1,4 @@ - - @@ -45,7 +45,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvHint"> - - + - - + - - + - + - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_error.xml b/app/src/main/res/layout/activity_error.xml index 6ebfeb9334..6b3a7481e4 100644 --- a/app/src/main/res/layout/activity_error.xml +++ b/app/src/main/res/layout/activity_error.xml @@ -1,4 +1,4 @@ - - @@ -31,7 +31,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> - - + - + - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 715d7834e3..7d39a9115d 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,4 +1,4 @@ - - - - + diff --git a/app/src/main/res/layout/activity_signature.xml b/app/src/main/res/layout/activity_signature.xml index 5f780d7682..1d35730bc8 100644 --- a/app/src/main/res/layout/activity_signature.xml +++ b/app/src/main/res/layout/activity_signature.xml @@ -1,12 +1,12 @@ - - @@ -78,5 +78,5 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:menu="@menu/action_signature" /> - - + + diff --git a/app/src/main/res/layout/activity_unsupported.xml b/app/src/main/res/layout/activity_unsupported.xml index 2f5bdf3972..457e38b9aa 100644 --- a/app/src/main/res/layout/activity_unsupported.xml +++ b/app/src/main/res/layout/activity_unsupported.xml @@ -1,5 +1,5 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_view_landscape_split.xml b/app/src/main/res/layout/activity_view_landscape_split.xml index c4b68fd2ae..b22fbb7dfe 100644 --- a/app/src/main/res/layout/activity_view_landscape_split.xml +++ b/app/src/main/res/layout/activity_view_landscape_split.xml @@ -12,7 +12,7 @@ android:focusableInTouchMode="false" android:orientation="horizontal"> - - - diff --git a/app/src/main/res/layout/activity_view_portrait_split.xml b/app/src/main/res/layout/activity_view_portrait_split.xml index 2c44c0ac00..29847f799d 100644 --- a/app/src/main/res/layout/activity_view_portrait_split.xml +++ b/app/src/main/res/layout/activity_view_portrait_split.xml @@ -12,7 +12,7 @@ android:focusableInTouchMode="false" android:orientation="vertical"> - - - @@ -52,7 +52,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/cbSemiTransparent" /> - - +