Commit 902f6eba authored by wanglei's avatar wanglei

...

parent db6cf620
......@@ -13,6 +13,7 @@ import com.base.scanqr.ui.widget.InputNameDialog.showInputNameDialog
import com.base.scanqr.utils.BarUtils
import com.base.scanqr.utils.BitmapUtils.saveBitmapToFile
import com.base.scanqr.utils.ClipboardUtils.copyText
import com.base.scanqr.utils.IntentUtils.intentSendEmail
import com.base.scanqr.utils.IntentUtils.intentShareImage
import com.base.scanqr.utils.LogEx
import com.base.scanqr.utils.QRCodeUtils.generateQRCode
......@@ -110,7 +111,12 @@ class EmailCodeActivity : BaseActivity<ActivityEmailCodeBinding>(ActivityEmailCo
toast("Copied to clipboard", true)
}
binding.flSearch.setOnClickListener {
toast("没有做")
val intent = intentSendEmail(email)
try {
startActivity(intent)
} catch (e: Exception) {
toast("No application was found to handle the email request", true)
}
}
}
......
......@@ -117,16 +117,15 @@ class HistoryFragment : BaseFragment<FragmentHistoryBinding>(FragmentHistoryBind
requireContext().showSortByDialog {
LogEx.logDebug(TAG, "sortType=$sortType aesOrDes=$aesOrDes")
if (tab == 0) {
scanUI()
} else {
createUI()
} else {
scanUI()
}
}
}
}
private fun scanUI() {
tab = 1
binding.tvScan.background = ContextCompat.getDrawable(requireContext(), R.drawable.bg_6473f8_10)
......@@ -192,6 +191,7 @@ class HistoryFragment : BaseFragment<FragmentHistoryBinding>(FragmentHistoryBind
}
return createList
}
override fun onResume() {
super.onResume()
immersionBar {
......
......@@ -7,12 +7,14 @@ import com.base.scanqr.bean.FunctionUIBean
import com.base.scanqr.bean.ScanBean
import com.base.scanqr.bean.TextUIBean
import com.base.scanqr.bean.WifiUIBean
import com.base.scanqr.utils.LogEx
import com.base.scanqr.utils.SpJsonUtils
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import java.util.concurrent.atomic.AtomicBoolean
class HistoryViewModel() : ViewModel() {
private val TAG = "HistoryViewModel"
var historyList = arrayListOf<ScanBean>()
......@@ -32,6 +34,9 @@ class HistoryViewModel() : ViewModel() {
historyList.addAll(wifiList)
historyList.addAll(textList)
historyList.addAll(emailList)
historyList.forEach {
LogEx.logDebug(TAG, "${it.scanType} ${it.createTime} ${it.createType} ${it.listContent}")
}
dataRefreshBack?.invoke()
dataRefreshFinish.set(true)
}
......
......@@ -90,6 +90,7 @@ class WifiActivity : BaseActivity<ActivityWifiBinding>(ActivityWifiBinding::infl
}
}
}
binding.rg.check(R.id.radioButton1)
binding.editSSID.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
......
......@@ -6,6 +6,7 @@ import android.net.Uri
import android.os.Build
import android.provider.Settings
import androidx.core.content.FileProvider
import com.base.scanqr.bean.EmailUIBean
import java.io.File
object IntentUtils {
......@@ -67,4 +68,13 @@ object IntentUtils {
intent.setAction(Settings.ACTION_WIFI_SETTINGS)
return intent
}
fun intentSendEmail(emailUIBean: EmailUIBean): Intent {
val emailIntent = Intent(Intent.ACTION_SEND)
emailIntent.setType("text/plain")
emailIntent.putExtra(Intent.EXTRA_EMAIL, arrayOf(emailUIBean.address)) // 替换为收件人邮箱
emailIntent.putExtra(Intent.EXTRA_SUBJECT, emailUIBean.subject) // 替换为邮件主题
emailIntent.putExtra(Intent.EXTRA_TEXT, emailUIBean.message) // 替换为邮件内容
return Intent.createChooser(emailIntent, "Select your mail client")
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".ui.wifi.WifiActivity">
......@@ -183,10 +184,10 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="26dp"
android:checked="false"
android:textColor="#646469"
android:textSize="15sp"
android:thumb="@drawable/bg_switch_thumb_ffffff"
android:checked="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment