mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-19 09:25:34 +00:00
[fenix] Added Vibration Effect On Scanning QR Code (https://github.com/mozilla-mobile/fenix/pull/6129)
* Added Vibration Effect On Scanning QR Code Added Vibration Feature for the new feature Request Vibrate phone upon successful pairing https://github.com/mozilla-mobile/fenix/issues/2928 * Added Vibration Effect On Scanning QR Code Added Vibration Feature for the new feature Request Vibrate phone upon successful pairing https://github.com/mozilla-mobile/fenix/issues/2928 * Update PairFragment.kt Removed unwanted blank lines * Update PairFragment.kt Removed the Casting with !!
This commit is contained in:
parent
afa25a6978
commit
7a847cdf41
@ -12,6 +12,7 @@
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.USE_BIOMETRIC" android:requiredFeature="false"/>
|
||||
|
||||
<!-- Needed to prompt the user to give permission to install a downloaded apk -->
|
||||
|
@ -4,9 +4,13 @@
|
||||
|
||||
package org.mozilla.fenix.settings
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.VibrationEffect
|
||||
import android.os.Vibrator
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.getSystemService
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.navigation.fragment.NavHostFragment.findNavController
|
||||
@ -25,8 +29,10 @@ class PairFragment : Fragment(R.layout.fragment_pair), BackHandler {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
pairInstructions.text = HtmlCompat.fromHtml(getString(R.string.pair_instructions),
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY)
|
||||
pairInstructions.text = HtmlCompat.fromHtml(
|
||||
getString(R.string.pair_instructions),
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY
|
||||
)
|
||||
|
||||
qrFeature.set(
|
||||
QrFeature(
|
||||
@ -40,8 +46,22 @@ class PairFragment : Fragment(R.layout.fragment_pair), BackHandler {
|
||||
requireContext(),
|
||||
pairingUrl
|
||||
)
|
||||
findNavController(this@PairFragment)
|
||||
.popBackStack(R.id.turnOnSyncFragment, false)
|
||||
val vibrator = requireContext().getSystemService<Vibrator>()!!
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
vibrator.vibrate(
|
||||
VibrationEffect.createOneShot(
|
||||
VIBRATE_LENGTH,
|
||||
VibrationEffect.DEFAULT_AMPLITUDE
|
||||
)
|
||||
)
|
||||
} else {
|
||||
@Suppress("Deprecation")
|
||||
vibrator.vibrate(VIBRATE_LENGTH)
|
||||
}
|
||||
findNavController(this@PairFragment).popBackStack(
|
||||
R.id.turnOnSyncFragment,
|
||||
false
|
||||
)
|
||||
}),
|
||||
owner = this,
|
||||
view = view
|
||||
@ -66,6 +86,7 @@ class PairFragment : Fragment(R.layout.fragment_pair), BackHandler {
|
||||
|
||||
companion object {
|
||||
private const val REQUEST_CODE_CAMERA_PERMISSIONS = 1
|
||||
private const val VIBRATE_LENGTH = 200L
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(
|
||||
|
Loading…
Reference in New Issue
Block a user