Commit 902f6eba authored by wanglei's avatar wanglei

...

parent db6cf620
...@@ -13,6 +13,7 @@ import com.base.scanqr.ui.widget.InputNameDialog.showInputNameDialog ...@@ -13,6 +13,7 @@ import com.base.scanqr.ui.widget.InputNameDialog.showInputNameDialog
import com.base.scanqr.utils.BarUtils import com.base.scanqr.utils.BarUtils
import com.base.scanqr.utils.BitmapUtils.saveBitmapToFile import com.base.scanqr.utils.BitmapUtils.saveBitmapToFile
import com.base.scanqr.utils.ClipboardUtils.copyText 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.IntentUtils.intentShareImage
import com.base.scanqr.utils.LogEx import com.base.scanqr.utils.LogEx
import com.base.scanqr.utils.QRCodeUtils.generateQRCode import com.base.scanqr.utils.QRCodeUtils.generateQRCode
...@@ -110,7 +111,12 @@ class EmailCodeActivity : BaseActivity<ActivityEmailCodeBinding>(ActivityEmailCo ...@@ -110,7 +111,12 @@ class EmailCodeActivity : BaseActivity<ActivityEmailCodeBinding>(ActivityEmailCo
toast("Copied to clipboard", true) toast("Copied to clipboard", true)
} }
binding.flSearch.setOnClickListener { 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 ...@@ -117,16 +117,15 @@ class HistoryFragment : BaseFragment<FragmentHistoryBinding>(FragmentHistoryBind
requireContext().showSortByDialog { requireContext().showSortByDialog {
LogEx.logDebug(TAG, "sortType=$sortType aesOrDes=$aesOrDes") LogEx.logDebug(TAG, "sortType=$sortType aesOrDes=$aesOrDes")
if (tab == 0) { if (tab == 0) {
scanUI()
} else {
createUI() createUI()
} else {
scanUI()
} }
} }
} }
} }
private fun scanUI() { private fun scanUI() {
tab = 1 tab = 1
binding.tvScan.background = ContextCompat.getDrawable(requireContext(), R.drawable.bg_6473f8_10) binding.tvScan.background = ContextCompat.getDrawable(requireContext(), R.drawable.bg_6473f8_10)
...@@ -192,6 +191,7 @@ class HistoryFragment : BaseFragment<FragmentHistoryBinding>(FragmentHistoryBind ...@@ -192,6 +191,7 @@ class HistoryFragment : BaseFragment<FragmentHistoryBinding>(FragmentHistoryBind
} }
return createList return createList
} }
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
immersionBar { immersionBar {
......
...@@ -7,12 +7,14 @@ import com.base.scanqr.bean.FunctionUIBean ...@@ -7,12 +7,14 @@ import com.base.scanqr.bean.FunctionUIBean
import com.base.scanqr.bean.ScanBean import com.base.scanqr.bean.ScanBean
import com.base.scanqr.bean.TextUIBean import com.base.scanqr.bean.TextUIBean
import com.base.scanqr.bean.WifiUIBean import com.base.scanqr.bean.WifiUIBean
import com.base.scanqr.utils.LogEx
import com.base.scanqr.utils.SpJsonUtils import com.base.scanqr.utils.SpJsonUtils
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicBoolean
class HistoryViewModel() : ViewModel() { class HistoryViewModel() : ViewModel() {
private val TAG = "HistoryViewModel"
var historyList = arrayListOf<ScanBean>() var historyList = arrayListOf<ScanBean>()
...@@ -32,6 +34,9 @@ class HistoryViewModel() : ViewModel() { ...@@ -32,6 +34,9 @@ class HistoryViewModel() : ViewModel() {
historyList.addAll(wifiList) historyList.addAll(wifiList)
historyList.addAll(textList) historyList.addAll(textList)
historyList.addAll(emailList) historyList.addAll(emailList)
historyList.forEach {
LogEx.logDebug(TAG, "${it.scanType} ${it.createTime} ${it.createType} ${it.listContent}")
}
dataRefreshBack?.invoke() dataRefreshBack?.invoke()
dataRefreshFinish.set(true) dataRefreshFinish.set(true)
} }
......
...@@ -90,6 +90,7 @@ class WifiActivity : BaseActivity<ActivityWifiBinding>(ActivityWifiBinding::infl ...@@ -90,6 +90,7 @@ class WifiActivity : BaseActivity<ActivityWifiBinding>(ActivityWifiBinding::infl
} }
} }
} }
binding.rg.check(R.id.radioButton1)
binding.editSSID.addTextChangedListener(object : TextWatcher { binding.editSSID.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
......
...@@ -6,6 +6,7 @@ import android.net.Uri ...@@ -6,6 +6,7 @@ import android.net.Uri
import android.os.Build import android.os.Build
import android.provider.Settings import android.provider.Settings
import androidx.core.content.FileProvider import androidx.core.content.FileProvider
import com.base.scanqr.bean.EmailUIBean
import java.io.File import java.io.File
object IntentUtils { object IntentUtils {
...@@ -67,4 +68,13 @@ object IntentUtils { ...@@ -67,4 +68,13 @@ object IntentUtils {
intent.setAction(Settings.ACTION_WIFI_SETTINGS) intent.setAction(Settings.ACTION_WIFI_SETTINGS)
return intent 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 @@ ...@@ -5,6 +5,7 @@
android:id="@+id/main" android:id="@+id/main"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white"
tools:context=".ui.wifi.WifiActivity"> tools:context=".ui.wifi.WifiActivity">
...@@ -183,10 +184,10 @@ ...@@ -183,10 +184,10 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end" android:layout_gravity="center_vertical|end"
android:layout_marginEnd="26dp" android:layout_marginEnd="26dp"
android:checked="false"
android:textColor="#646469" android:textColor="#646469"
android:textSize="15sp" android:textSize="15sp"
android:thumb="@drawable/bg_switch_thumb_ffffff" android:thumb="@drawable/bg_switch_thumb_ffffff"
android:checked="false"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="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