Skip to content

Commit

Permalink
Maintenance: Remove no-op method (targetSDK 30)
Browse files Browse the repository at this point in the history
https://developer.android.com/reference/android/widget/Toast#setGravity(int,%20int,%20int) : Starting from Android Build.VERSION_CODES#R, for apps targeting API level Build.VERSION_CODES#R or higher, this method is a no-op when called on text toasts. It resulted in an error entry in the logs each time the tool is switched.

- [x] Check that tool change toasts are shown correctly on all supported Android versions
- [x] Include a summary of the changes plus the relevant context
- [x] Choose the proper base branch (*develop*)
- [x] Verify that the changes generate no compiler or linter warnings
- [x] Perform a self-review of the changes
- [x] Verify to commit no other files than the intentionally changed ones
- [x] Stick to the project’s gitflow workflow
- [x] Verify that your changes do not have any conflicts with the base branch
- [x] After the PR, verify that all CI checks have passed
  • Loading branch information
wslany authored and Julian Raphael Jautz committed May 16, 2022
1 parent ce4f5d9 commit 60a0a37
Showing 1 changed file with 0 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import android.graphics.Bitmap
import android.net.Uri
import android.os.Build
import android.provider.OpenableColumns
import android.view.Gravity
import android.widget.Toast
import androidx.appcompat.app.AppCompatDialogFragment
import androidx.core.app.ActivityCompat
Expand Down Expand Up @@ -489,11 +488,9 @@ class MainActivityNavigator(
override fun showToolChangeToast(offset: Int, idRes: Int) {
var offset = offset
val toolNameToast = ToastFactory.makeText(mainActivity, idRes, Toast.LENGTH_SHORT)
val gravity = Gravity.TOP or Gravity.CENTER
if (mainActivity.resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) {
offset = 0
}
toolNameToast.setGravity(gravity, 0, offset)
toolNameToast.show()
}

Expand Down

0 comments on commit 60a0a37

Please sign in to comment.