|
|
|
@ -21,6 +21,7 @@ import androidx.core.content.ContextCompat |
|
|
|
|
import androidx.core.content.FileProvider |
|
|
|
|
import androidx.core.content.edit |
|
|
|
|
import androidx.preference.PreferenceManager |
|
|
|
|
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel |
|
|
|
|
import io.legado.app.R |
|
|
|
|
import io.legado.app.constant.AppConst |
|
|
|
|
import java.io.File |
|
|
|
@ -146,8 +147,12 @@ fun Context.share(text: String, title: String = getString(R.string.share)) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SuppressLint("SetWorldReadable") |
|
|
|
|
fun Context.shareWithQr(text: String, title: String = getString(R.string.share)) { |
|
|
|
|
val bitmap = QRCodeUtils.createQRCode(text) |
|
|
|
|
fun Context.shareWithQr( |
|
|
|
|
text: String, |
|
|
|
|
title: String = getString(R.string.share), |
|
|
|
|
errorCorrectionLevel: ErrorCorrectionLevel = ErrorCorrectionLevel.H |
|
|
|
|
) { |
|
|
|
|
val bitmap = QRCodeUtils.createQRCode(text, errorCorrectionLevel = errorCorrectionLevel) |
|
|
|
|
if (bitmap == null) { |
|
|
|
|
toastOnUi(R.string.text_too_long_qr_error) |
|
|
|
|
} else { |
|
|
|
|