Skip to content

Commit

Permalink
#250 Android 11/12: app crashes when tooltip is activated or back but…
Browse files Browse the repository at this point in the history
…ton is pressed: fixed
  • Loading branch information
mkulesh committed Jan 15, 2022
1 parent 13997c7 commit 34e9553
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,11 @@ else if (attached && !cv.isChecked())
removeCmd.getDevice().add(id);
}
}
if (removeCmd.getDevice().size() > 0)
if (removeCmd.getDevice().size() > 0 && activity.isConnected())
{
activity.getStateManager().sendMessage(removeCmd);
}
if (addCmd.getDevice().size() > 0)
if (addCmd.getDevice().size() > 0 && activity.isConnected())
{
activity.getStateManager().sendMessage(addCmd);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="?attr/colorTooltipBackground" />
<solid android:color="@color/tooltip_background_light" />
<corners android:radius="@dimen/tooltip_corner_radius" />
</shape>
19 changes: 19 additions & 0 deletions app/src/main/res/drawable/toast_frame_light.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Enhanced Controller for Onkyo and Pioneer
~ Copyright (C) 2018-2020. Mikhail Kulesh
~
~ This program 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.
~
~ This program 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 this program.
-->

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/tooltip_background_dark" />
<corners android:radius="@dimen/tooltip_corner_radius" />
</shape>
14 changes: 7 additions & 7 deletions app/src/main/res/layout/widget_toast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:background="@drawable/toast_frame"
android:layout_marginEnd="@dimen/tooltip_margin"
android:layout_marginStart="@dimen/tooltip_margin"
android:paddingStart="16dp"
android:paddingEnd="16dp">
android:background="?attr/toastFrame"
android:layout_marginRight="@dimen/tooltip_margin"
android:layout_marginLeft="@dimen/tooltip_margin"
android:paddingTop="@dimen/tooltip_margin"
android:paddingBottom="@dimen/tooltip_margin"
android:paddingRight="16dp"
android:paddingLeft="16dp">

<TextView
android:id="@+id/toast_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:paddingTop="@dimen/tooltip_margin"
android:paddingBottom="@dimen/tooltip_margin"
android:textAppearance="@style/TextAppearance.AppCompat.Tooltip"
android:textColor="?attr/colorTooltipText"/>
</LinearLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<attr name="themeActivityPopup" format="reference" />
<attr name="colorButtonEnabled" format="color" />
<attr name="colorButtonDisabled" format="color" />
<attr name="colorTooltipBackground" format="color" />
<attr name="toastFrame" format="reference" />
<attr name="colorTooltipText" format="color" />

<declare-styleable name="HorizontalNumberPicker">
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<item name="android:textColorTertiary">@android:color/white</item>
<item name="colorButtonEnabled">?android:attr/textColor</item>
<item name="colorButtonDisabled">?android:attr/textColorSecondary</item>
<item name="colorTooltipBackground">@color/tooltip_background_dark</item>
<item name="toastFrame">@drawable/toast_frame_light</item>
<item name="colorTooltipText">@android:color/white</item>
</style>

Expand All @@ -34,7 +34,7 @@
<item name="android:textColorTertiary">@android:color/white</item>
<item name="colorButtonEnabled">?android:attr/textColor</item>
<item name="colorButtonDisabled">?android:attr/textColorSecondary</item>
<item name="colorTooltipBackground">@color/tooltip_background_light</item>
<item name="toastFrame">@drawable/toast_frame_dark</item>
<item name="colorTooltipText">@android:color/black</item>
</style>

Expand Down

0 comments on commit 34e9553

Please sign in to comment.