Skip to content

Commit

Permalink
Set Toast Gravity to CENTER
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonMarquis committed Sep 3, 2019
1 parent e2d400b commit 1b19175
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/fr/smarquis/qrcode/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class MainActivity : AppCompatActivity() {
logger = logcat(),
lensPosition = back(),
cameraConfiguration = CameraConfiguration(frameProcessor = this@MainActivity::processFrame),
cameraErrorCallback = { Toast.makeText(this, it.message, Toast.LENGTH_LONG).show() }
cameraErrorCallback = { Toast.makeText(this, it.message, Toast.LENGTH_LONG).apply { setGravity(Gravity.CENTER, 0, 0) }.show() }
)

render()
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/fr/smarquis/qrcode/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.content.Context
import android.content.Intent
import android.text.SpannableStringBuilder
import android.util.Log
import android.view.Gravity
import android.widget.Toast
import androidx.core.content.getSystemService
import androidx.core.text.bold
Expand Down Expand Up @@ -95,5 +96,5 @@ fun copyToClipboard(context: Context, string: String?) {
append("\n\n")
bold { append(string) }
}
Toast.makeText(context, text, Toast.LENGTH_LONG).show()
Toast.makeText(context, text, Toast.LENGTH_LONG).apply { setGravity(Gravity.CENTER, 0, 0) }.show()
}

0 comments on commit 1b19175

Please sign in to comment.