Commit 18e3155e authored by wanglei's avatar wanglei

...

parent 89f6300b
...@@ -40,6 +40,9 @@ ...@@ -40,6 +40,9 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.ScanQR" android:theme="@style/Theme.ScanQR"
tools:targetApi="31"> tools:targetApi="31">
<activity
android:name=".ui.whatsappqr.AreaCodeActivity"
android:exported="false" />
<activity <activity
android:name=".qr.QrStyleResultActivity" android:name=".qr.QrStyleResultActivity"
android:exported="false" /> android:exported="false" />
......
package com.base.scanqrclear.bean
data class AreaCodeBean(
val code: Int,
val area: String
)
\ No newline at end of file
...@@ -22,5 +22,12 @@ class FunctionUIBean( ...@@ -22,5 +22,12 @@ class FunctionUIBean(
const val KEY_TELEPHONE = "key_telephone" const val KEY_TELEPHONE = "key_telephone"
const val KEY_MESSAGE = "key_message" const val KEY_MESSAGE = "key_message"
const val KEY_PRODUCT = "key_product" const val KEY_PRODUCT = "key_product"
const val KEY_WHATSAPP = "key_whatsapp"
const val KEY_FACEBOOK = "key_facebook"
const val KEY_INSTAGRAM = "key_instagram"
const val KEY_X = "key_x"
const val KEY_SPOTIFY = "key_spotify"
const val KEY_PAYPAL = "key_paypal"
} }
} }
\ No newline at end of file
package com.base.scanqrclear.bean
data class WhatsappUIBean(val phone: String) : ScanBean(FunctionUIBean.KEY_WHATSAPP) {
companion object {
// whatsapp://send?phone=+861768923756
fun WhatsappUIBean.createWhatsappQrString(): String {
val qrContent = StringBuilder()
qrContent.append("whatsapp://send?")
.append("phone=").append(this.phone)
return qrContent.toString()
}
}
}
\ No newline at end of file
package com.base.scanqrclear.qr package com.base.scanqrclear.qr
import android.content.Intent import android.content.Intent
import androidx.activity.addCallback
import androidx.core.view.updatePadding import androidx.core.view.updatePadding
import com.base.scanqrclear.base.BaseActivity import com.base.scanqrclear.base.BaseActivity
import com.base.scanqrclear.databinding.ActivityQrStyleBinding import com.base.scanqrclear.databinding.ActivityQrStyleBinding
...@@ -11,10 +12,12 @@ import com.gyf.immersionbar.ktx.immersionBar ...@@ -11,10 +12,12 @@ import com.gyf.immersionbar.ktx.immersionBar
class QrStyleActivity : BaseActivity<ActivityQrStyleBinding>(ActivityQrStyleBinding::inflate) { class QrStyleActivity : BaseActivity<ActivityQrStyleBinding>(ActivityQrStyleBinding::inflate) {
private var qrString = ""
private val adapter = QrStyleAdapter() private val adapter = QrStyleAdapter()
override fun initView() { override fun initView() {
super.initView() super.initView()
binding.clTop.updatePadding(top = BarUtils.getStatusBarHeight()) binding.clTop.updatePadding(top = BarUtils.getStatusBarHeight())
qrString = intent.extras?.getString("qrString", "") ?: ""
initAdapter() initAdapter()
} }
...@@ -31,10 +34,18 @@ class QrStyleActivity : BaseActivity<ActivityQrStyleBinding>(ActivityQrStyleBind ...@@ -31,10 +34,18 @@ class QrStyleActivity : BaseActivity<ActivityQrStyleBinding>(ActivityQrStyleBind
override fun initListener() { override fun initListener() {
super.initListener() super.initListener()
onBackPressedDispatcher.addCallback {
finishToMainTop()
}
binding.flBack.setOnClickListener {
onBackPressedDispatcher.onBackPressed()
}
binding.tvConfirm.setOnClickListener { binding.tvConfirm.setOnClickListener {
startActivity(Intent(this, QrStyleResultActivity::class.java).apply { startActivity(Intent(this, QrStyleResultActivity::class.java).apply {
val data = adapter.items.find { it.isSelect } val data = adapter.items.find { it.isSelect }
putExtra("data", Gson().toJson(data)) putExtra("data", Gson().toJson(data))
putExtra("qrString", qrString)
}) })
} }
......
...@@ -21,11 +21,14 @@ import com.gyf.immersionbar.ktx.immersionBar ...@@ -21,11 +21,14 @@ import com.gyf.immersionbar.ktx.immersionBar
class QrStyleResultActivity : BaseActivity<ActivityQrStyleResultBinding>(ActivityQrStyleResultBinding::inflate) { class QrStyleResultActivity : BaseActivity<ActivityQrStyleResultBinding>(ActivityQrStyleResultBinding::inflate) {
private var qrStyleBean: QrStyleBean? = null private var qrStyleBean: QrStyleBean? = null
private var qrString: String = ""
override fun initView() { override fun initView() {
super.initView() super.initView()
binding.clTop.updatePadding(top = BarUtils.getStatusBarHeight()) binding.clTop.updatePadding(top = BarUtils.getStatusBarHeight())
qrString = intent.extras?.getString("qrString", "") ?: ""
LogEx.logDebug(TAG, "qrString=$qrString")
val data = intent.extras?.getString("data", "") val data = intent.extras?.getString("data", "")
data?.let { data?.let {
qrStyleBean = Gson().fromJson(it, QrStyleBean::class.java) qrStyleBean = Gson().fromJson(it, QrStyleBean::class.java)
...@@ -91,7 +94,7 @@ class QrStyleResultActivity : BaseActivity<ActivityQrStyleResultBinding>(Activit ...@@ -91,7 +94,7 @@ class QrStyleResultActivity : BaseActivity<ActivityQrStyleResultBinding>(Activit
if (bean.id == 24) { if (bean.id == 24) {
scale = 0.7f scale = 0.7f
} }
if (bean.id==28){ if (bean.id == 28) {
qrBgColor = Color.TRANSPARENT qrBgColor = Color.TRANSPARENT
} }
if (bean.id == 38) { if (bean.id == 38) {
...@@ -135,7 +138,7 @@ class QrStyleResultActivity : BaseActivity<ActivityQrStyleResultBinding>(Activit ...@@ -135,7 +138,7 @@ class QrStyleResultActivity : BaseActivity<ActivityQrStyleResultBinding>(Activit
LogEx.logDebug(TAG, "id=${bean.id} scale=$scale ${bean.color} ${bean.img_url}") LogEx.logDebug(TAG, "id=${bean.id} scale=$scale ${bean.color} ${bean.img_url}")
val qrBitmap = generateQRCodeWithBackground( val qrBitmap = generateQRCodeWithBackground(
"aaaaaa", resource, qrString, resource,
listOf(points1, points2, points3, points4), scale, qrColor, qrBgColor listOf(points1, points2, points3, points4), scale, qrColor, qrBgColor
) )
......
package com.base.scanqrclear.ui.concatadapt
import android.content.Context
import android.view.ViewGroup
import com.base.scanqrclear.R
import com.base.scanqrclear.ads.AdsMgr
import com.base.scanqrclear.databinding.ItemAdBinding
import com.base.scanqrclear.ui.adapter.CommonViewHolder
import com.base.scanqrclear.utils.XmlEx.inflate
import com.chad.library.adapter4.BaseQuickAdapter
class AdAdapter : BaseQuickAdapter<Any, CommonViewHolder>() {
override fun onBindViewHolder(holder: CommonViewHolder, position: Int, item: Any?) {
item ?: return
val binding = ItemAdBinding.bind(holder.itemView)
AdsMgr.showNative(binding.flAd,R.layout.layout_admob_item)
}
override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): CommonViewHolder {
return CommonViewHolder(R.layout.item_ad.inflate(parent))
}
}
\ No newline at end of file
...@@ -4,7 +4,7 @@ import android.annotation.SuppressLint ...@@ -4,7 +4,7 @@ import android.annotation.SuppressLint
import android.content.Intent import android.content.Intent
import android.view.View import android.view.View
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.ConcatAdapter
import com.base.scanqrclear.R import com.base.scanqrclear.R
import com.base.scanqrclear.ads.AdsMgr import com.base.scanqrclear.ads.AdsMgr
import com.base.scanqrclear.ads.AdsShowCallBack import com.base.scanqrclear.ads.AdsShowCallBack
...@@ -14,17 +14,24 @@ import com.base.scanqrclear.bean.FunctionUIBean ...@@ -14,17 +14,24 @@ import com.base.scanqrclear.bean.FunctionUIBean
import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_CONTACT import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_CONTACT
import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_EMAIL import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_EMAIL
import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_EVENT import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_EVENT
import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_FACEBOOK
import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_INSTAGRAM
import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_MESSAGE import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_MESSAGE
import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_PAYPAL
import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_SCAN import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_SCAN
import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_SPOTIFY
import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_TELEPHONE import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_TELEPHONE
import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_TEXT import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_TEXT
import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_WEBSITE import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_WEBSITE
import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_WHATSAPP
import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_WIFI import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_WIFI
import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_X
import com.base.scanqrclear.bean.config.AdConfigBean.Companion.adsConfigBean import com.base.scanqrclear.bean.config.AdConfigBean.Companion.adsConfigBean
import com.base.scanqrclear.databinding.FragmentCreateBinding import com.base.scanqrclear.databinding.FragmentCreateBinding
import com.base.scanqrclear.luma.WeatherInterface import com.base.scanqrclear.luma.WeatherInterface
import com.base.scanqrclear.luma.WeatherUtils import com.base.scanqrclear.luma.WeatherUtils
import com.base.scanqrclear.qr.QrStyleActivity import com.base.scanqrclear.qr.QrStyleActivity
import com.base.scanqrclear.ui.concatadapt.AdAdapter
import com.base.scanqrclear.ui.contact.ContractActivity import com.base.scanqrclear.ui.contact.ContractActivity
import com.base.scanqrclear.ui.email.EmailActivity import com.base.scanqrclear.ui.email.EmailActivity
import com.base.scanqrclear.ui.event.EventActivity import com.base.scanqrclear.ui.event.EventActivity
...@@ -32,7 +39,7 @@ import com.base.scanqrclear.ui.message.MessageActivity ...@@ -32,7 +39,7 @@ import com.base.scanqrclear.ui.message.MessageActivity
import com.base.scanqrclear.ui.telephone.TelephoneActivity import com.base.scanqrclear.ui.telephone.TelephoneActivity
import com.base.scanqrclear.ui.text.TextActivity import com.base.scanqrclear.ui.text.TextActivity
import com.base.scanqrclear.ui.website.WebsiteActivity import com.base.scanqrclear.ui.website.WebsiteActivity
import com.base.scanqrclear.ui.webview.WebBrowserActivity import com.base.scanqrclear.ui.widget.WhatsappDialog.showWhatsappDialog
import com.base.scanqrclear.ui.widget.guideview.Component import com.base.scanqrclear.ui.widget.guideview.Component
import com.base.scanqrclear.ui.widget.guideview.GuideBuilder import com.base.scanqrclear.ui.widget.guideview.GuideBuilder
import com.base.scanqrclear.ui.widget.guideview.LottieComponent import com.base.scanqrclear.ui.widget.guideview.LottieComponent
...@@ -44,9 +51,13 @@ import kotlin.random.Random ...@@ -44,9 +51,13 @@ import kotlin.random.Random
class CreateFragment : BaseFragment<FragmentCreateBinding>(FragmentCreateBinding::inflate) { class CreateFragment : BaseFragment<FragmentCreateBinding>(FragmentCreateBinding::inflate) {
private var adapter: FunctionAdapter? = null
private val functions by lazy(LazyThreadSafetyMode.NONE) { private val concatAdapter: ConcatAdapter = ConcatAdapter()
private var functionRvAdapter1: FunctionRvAdapter? = null
private var functionRvAdapter2: FunctionRvAdapter? = null
private val functions1 by lazy(LazyThreadSafetyMode.NONE) {
listOf( listOf(
FunctionUIBean(KEY_SCAN, R.mipmap.h_scan, resources.getString(R.string.scan)), FunctionUIBean(KEY_SCAN, R.mipmap.h_scan, resources.getString(R.string.scan)),
FunctionUIBean(KEY_WIFI, R.mipmap.h_wifi, resources.getString(R.string.wifi)), FunctionUIBean(KEY_WIFI, R.mipmap.h_wifi, resources.getString(R.string.wifi)),
...@@ -65,36 +76,38 @@ class CreateFragment : BaseFragment<FragmentCreateBinding>(FragmentCreateBinding ...@@ -65,36 +76,38 @@ class CreateFragment : BaseFragment<FragmentCreateBinding>(FragmentCreateBinding
) )
} }
private val functions2 by lazy(LazyThreadSafetyMode.NONE) {
listOf(
FunctionUIBean(KEY_WHATSAPP, R.mipmap.h_whatsapp, "Whatsapp"),
FunctionUIBean(KEY_FACEBOOK, R.mipmap.h_facebook, "Facebook"),
FunctionUIBean(KEY_INSTAGRAM, R.mipmap.h_instagram, "Instagram"),
FunctionUIBean(KEY_X, R.mipmap.h_x, "X"),
FunctionUIBean(KEY_SPOTIFY, R.mipmap.h_spotify, "Spotify"),
FunctionUIBean(KEY_PAYPAL, R.mipmap.h_paypal, "Paypal"),
)
}
override fun initView() { override fun initView() {
super.initView() super.initView()
binding.space.layoutParams.height = BarUtils.getStatusBarHeight() binding.space.layoutParams.height = BarUtils.getStatusBarHeight()
// binding.ivVip.updatePadding(top = BarUtils.getStatusBarHeight()) // binding.ivVip.updatePadding(top = BarUtils.getStatusBarHeight())
adapter = FunctionAdapter()
binding.rv.layoutManager = GridLayoutManager(requireContext(), 3) binding.rv.adapter = concatAdapter
binding.rv.adapter = adapter
adapter?.submitList(functions) functionRvAdapter1 = FunctionRvAdapter().apply {
adapter?.itemClick = { key -> itemClick = ::itemClick
val activity = requireActivity() as MainActivity? concatAdapter.addAdapter(this)
activity?.let { submitList(arrayListOf(functions1))
if (adsConfigBean.functionInShowAd) { }
AdsMgr.showInsert(it, false, object : AdsShowCallBack() {
override fun close(where: Int) { concatAdapter.addAdapter(AdAdapter().apply { submitList(listOf("")) })
itemKeyClick(key)
} functionRvAdapter2 = FunctionRvAdapter().apply {
tittle = resources.getString(R.string.other)
override fun failed(where: Int) { itemClick = ::itemClick
itemKeyClick(key) concatAdapter.addAdapter(this)
submitList(arrayListOf(functions2))
}
override fun googleFailed(where: Int) {
itemKeyClick(key)
}
})
} else {
itemKeyClick(key)
}
}
} }
if (adsConfigBean.homeShowNative) { if (adsConfigBean.homeShowNative) {
...@@ -104,6 +117,30 @@ class CreateFragment : BaseFragment<FragmentCreateBinding>(FragmentCreateBinding ...@@ -104,6 +117,30 @@ class CreateFragment : BaseFragment<FragmentCreateBinding>(FragmentCreateBinding
} }
} }
private fun itemClick(key: String) {
val activity = requireActivity() as MainActivity?
activity?.let {
if (adsConfigBean.functionInShowAd) {
AdsMgr.showInsert(it, false, object : AdsShowCallBack() {
override fun close(where: Int) {
itemKeyClick(key)
}
override fun failed(where: Int) {
itemKeyClick(key)
}
override fun googleFailed(where: Int) {
itemKeyClick(key)
}
})
} else {
itemKeyClick(key)
}
}
}
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
private fun setWeather() { private fun setWeather() {
val weatherEntity = WeatherUtils.getWeatherEntity() val weatherEntity = WeatherUtils.getWeatherEntity()
...@@ -143,7 +180,7 @@ class CreateFragment : BaseFragment<FragmentCreateBinding>(FragmentCreateBinding ...@@ -143,7 +180,7 @@ class CreateFragment : BaseFragment<FragmentCreateBinding>(FragmentCreateBinding
@SuppressLint("NotifyDataSetChanged") @SuppressLint("NotifyDataSetChanged")
private fun itemKeyClick(key: String) { private fun itemKeyClick(key: String) {
val bean = functions.find { it.key == key } val bean = functions1.find { it.key == key }
if (bean?.isPlaying == true) { if (bean?.isPlaying == true) {
bean.showGuide = false bean.showGuide = false
AppPreferences.getInstance().put("${key}_guide", false) AppPreferences.getInstance().put("${key}_guide", false)
...@@ -184,13 +221,19 @@ class CreateFragment : BaseFragment<FragmentCreateBinding>(FragmentCreateBinding ...@@ -184,13 +221,19 @@ class CreateFragment : BaseFragment<FragmentCreateBinding>(FragmentCreateBinding
KEY_MESSAGE -> { KEY_MESSAGE -> {
startActivity(Intent(requireContext(), MessageActivity::class.java)) startActivity(Intent(requireContext(), MessageActivity::class.java))
} }
KEY_WHATSAPP -> {
val activity = requireActivity() as MainActivity?
activity ?: return
activity.showWhatsappDialog(activity.launcher)
}
} }
} }
@SuppressLint("NotifyDataSetChanged") @SuppressLint("NotifyDataSetChanged")
override fun onResumeOneShoot() { override fun onResumeOneShoot() {
super.onResumeOneShoot() super.onResumeOneShoot()
adapter?.changeGuide() functionRvAdapter1?.functionAdapter?.changeGuide()
binding.root.viewTreeObserver.addOnGlobalLayoutListener { binding.root.viewTreeObserver.addOnGlobalLayoutListener {
showGuideScan() showGuideScan()
......
package com.base.scanqrclear.ui.main
import android.content.Context
import android.view.View
import android.view.ViewGroup
import com.base.scanqrclear.R
import com.base.scanqrclear.bean.FunctionUIBean
import com.base.scanqrclear.databinding.ItemFunctionRvBinding
import com.base.scanqrclear.ui.adapter.CommonViewHolder
import com.base.scanqrclear.utils.XmlEx.inflate
import com.chad.library.adapter4.BaseQuickAdapter
class FunctionRvAdapter : BaseQuickAdapter<List<FunctionUIBean>, CommonViewHolder>() {
var itemClick: ((key: String) -> Unit)? = null
var functionAdapter: FunctionAdapter? = null
var tittle: String? = null
override fun onBindViewHolder(holder: CommonViewHolder, position: Int, item: List<FunctionUIBean>?) {
item ?: return
val binding = ItemFunctionRvBinding.bind(holder.itemView)
if (tittle == null) {
binding.tvTitle.visibility = View.GONE
} else {
binding.tvTitle.visibility = View.VISIBLE
binding.tvTitle.text = tittle
}
val adapter = FunctionAdapter()
adapter.itemClick = itemClick
binding.rv.adapter = adapter
adapter.submitList(item)
functionAdapter = adapter
}
override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): CommonViewHolder {
return CommonViewHolder(R.layout.item_function_rv.inflate(parent))
}
}
\ No newline at end of file
package com.base.scanqrclear.ui.whatsappqr
import android.annotation.SuppressLint
import android.content.Context
import android.view.ViewGroup
import com.base.scanqrclear.R
import com.base.scanqrclear.bean.AreaCodeBean
import com.base.scanqrclear.databinding.ItemAreCodeBinding
import com.base.scanqrclear.ui.adapter.CommonViewHolder
import com.base.scanqrclear.utils.XmlEx.inflate
import com.chad.library.adapter4.BaseQuickAdapter
class AreCodeAdapter : BaseQuickAdapter<AreaCodeBean, CommonViewHolder>() {
var itemClick: ((item: AreaCodeBean) -> Unit)? = null
@SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: CommonViewHolder, position: Int, item: AreaCodeBean?) {
item ?: return
val binding = ItemAreCodeBinding.bind(holder.itemView)
binding.tvCode.text = "${item.code} ${item.area}"
binding.root.setOnClickListener {
itemClick?.invoke(item)
}
}
override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): CommonViewHolder {
return CommonViewHolder(R.layout.item_are_code.inflate(parent))
}
}
\ No newline at end of file
package com.base.scanqrclear.ui.widget
import android.annotation.SuppressLint
import android.app.Activity
import android.app.AlertDialog
import android.content.Context
import android.content.Intent
import android.text.Editable
import android.view.Gravity
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.app.ActivityOptionsCompat
import androidx.core.widget.addTextChangedListener
import com.base.scanqrclear.R
import com.base.scanqrclear.ads.AdsMgr
import com.base.scanqrclear.ads.AdsShowCallBack
import com.base.scanqrclear.bean.WhatsappUIBean
import com.base.scanqrclear.bean.WhatsappUIBean.Companion.createWhatsappQrString
import com.base.scanqrclear.databinding.DialogWhastsppBinding
import com.base.scanqrclear.qr.QrStyleActivity
import com.base.scanqrclear.ui.whatsappqr.AreaCodeActivity
import com.base.scanqrclear.utils.ActivityLauncher
import com.base.scanqrclear.utils.LogEx
object WhatsappDialog {
private val TAG = "WhatsappDialog"
@SuppressLint("SetTextI18n")
fun Activity.showWhatsappDialog(launcher: ActivityLauncher) {
val dialog = AlertDialog.Builder(this).create()
val binding = DialogWhastsppBinding.inflate(LayoutInflater.from(this))
dialog.setView(binding.root)
dialog.setCanceledOnTouchOutside(false)
dialog.show()
val params = dialog.window?.attributes
params?.width = ConstraintLayout.LayoutParams.MATCH_PARENT
// params?.height = resources.getDimensionPixelOffset(R.dimen.dp_400)
params?.gravity = Gravity.BOTTOM
// params?.y = 50
dialog.window?.attributes = params
dialog.window?.setBackgroundDrawableResource(android.R.color.transparent)
AdsMgr.showNative(binding.flAd, R.layout.layout_admob_native_custom)
binding.editNumber.addTextChangedListener { s: Editable? ->
binding.tvBtn.isEnabled = !s.isNullOrEmpty()
}
var code = 1
binding.tvAreaCode.setOnClickListener {
val intent = Intent(this@showWhatsappDialog, AreaCodeActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_NO_HISTORY
val options = ActivityOptionsCompat.makeCustomAnimation(
this,
R.anim.slide_in_from_right,
R.anim.slide_out_to_left
)
launcher.launch(intent, options) { result ->
LogEx.logDebug(TAG, "code=${result.resultCode}")
code = result.resultCode
binding.tvAreaCode.text = "+${code}"
}
}
val jump = {
dialog.dismiss()
val phone = "$code" + binding.editNumber.text.toString()
val bean = WhatsappUIBean(phone)
startActivity(Intent(this, QrStyleActivity::class.java).apply {
putExtra("qrString", bean.createWhatsappQrString())
})
}
binding.tvBtn.setOnClickListener {
AdsMgr.showInsert(this, false, object : AdsShowCallBack() {
override fun close(where: Int) {
jump.invoke()
}
override fun failed(where: Int) {
jump.invoke()
}
override fun googleFailed(where: Int) {
jump.invoke()
}
})
}
}
}
\ No newline at end of file
package com.base.scanqrclear.utils package com.base.scanqrclear.utils
import android.R
import android.app.ActivityOptions
import android.content.Intent import android.content.Intent
import androidx.activity.result.ActivityResult import androidx.activity.result.ActivityResult
import androidx.activity.result.ActivityResultCallback import androidx.activity.result.ActivityResultCallback
import androidx.activity.result.ActivityResultCaller import androidx.activity.result.ActivityResultCaller
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.app.ActivityOptionsCompat
class ActivityLauncher(activityResultCaller: ActivityResultCaller) { class ActivityLauncher(activityResultCaller: ActivityResultCaller) {
...@@ -37,10 +41,12 @@ class ActivityLauncher(activityResultCaller: ActivityResultCaller) { ...@@ -37,10 +41,12 @@ class ActivityLauncher(activityResultCaller: ActivityResultCaller) {
*/ */
fun launch( fun launch(
intent: Intent, intent: Intent,
activityResultCallback: ActivityResultCallback<ActivityResult>? = null options: ActivityOptionsCompat? = null,
activityResultCallback: ActivityResultCallback<ActivityResult>? = null,
) { ) {
this.activityResultCallback = activityResultCallback this.activityResultCallback = activityResultCallback
intentLauncher.launch(intent) intentLauncher.launch(intent, options)
} }
//endregion //endregion
......
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="300"
android:fromXDelta="-100%"
android:toXDelta="0%"
android:interpolator="@android:anim/linear_interpolator"/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="300"
android:fromXDelta="100%"
android:toXDelta="0%"
android:interpolator="@android:anim/linear_interpolator"/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="300"
android:fromXDelta="0%"
android:toXDelta="-100%"
android:interpolator="@android:anim/linear_interpolator"/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="300"
android:fromXDelta="0%"
android:toXDelta="100%"
android:interpolator="@android:anim/linear_interpolator"/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#BDC1C9" android:state_enabled="false" />
<item android:color="#ffffff" android:state_enabled="true" />
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/bg_6473f8_80" android:state_enabled="true" />
<item android:drawable="@drawable/bg_e5e6eb_80" android:state_enabled="false" />
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#E5E6EB" />
<corners android:radius="5dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#E5E6EB" />
<corners android:radius="80dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#F0F1F5" />
<corners
android:topLeftRadius="20dp"
android:topRightRadius="20dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffff" />
<corners android:radius="5dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="1dp"
android:color="#EAE9EF" />
<corners android:radius="5dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.whatsappqr.AreaCodeActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clTop"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent">
<FrameLayout
android:id="@+id/flBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/fanhui"
tools:ignore="ContentDescription" />
</FrameLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="@string/app_name"
android:textColor="#000000"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/flBack"
app:layout_constraintStart_toEndOf="@id/flBack"
app:layout_constraintTop_toTopOf="@id/flBack"
tools:ignore="HardcodedText" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_marginHorizontal="26dp"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@id/flBack">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="18dp"
android:src="@mipmap/shousuo"
tools:ignore="ContentDescription" />
<EditText
android:id="@+id/edit"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginHorizontal="20dp"
android:layout_marginVertical="8dp"
android:background="@null"
android:hint="@string/search"
android:importantForAutofill="no"
android:singleLine="true"
android:textColor="@color/black"
android:textSize="16sp"
tools:ignore="TextFields,TouchTargetSizeCheck,TextContrastCheck,VisualLintTextFieldSize" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/clTop"
tools:listitem="@layout/item_are_code" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_f0f1f5_20">
<ImageView
android:id="@+id/iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@mipmap/h_whatsapp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription,ImageContrastCheck" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="Whatsapp"
android:textColor="@color/black"
android:textSize="19sp"
app:layout_constraintBottom_toBottomOf="@id/iv"
app:layout_constraintStart_toEndOf="@id/iv"
app:layout_constraintTop_toTopOf="@id/iv"
tools:ignore="HardcodedText" />
<FrameLayout
android:id="@+id/flClose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:padding="10dp"
app:layout_constraintBottom_toBottomOf="@id/iv"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/iv">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/guanbi"
tools:ignore="ContentDescription,ImageContrastCheck" />
</FrameLayout>
<TextView
android:id="@+id/tvAreaCode"
android:layout_width="wrap_content"
android:layout_height="110dp"
android:layout_marginStart="16dp"
android:layout_marginTop="30dp"
android:background="@drawable/bg_e5e6eb_5"
android:gravity="center"
android:minWidth="42dp"
android:paddingHorizontal="10dp"
android:text="+1"
android:textColor="@color/black"
android:textSize="18sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv"
tools:ignore="HardcodedText" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="16dp"
android:background="@drawable/bg_ffffff_5"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="@id/tvAreaCode"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvAreaCode"
app:layout_constraintTop_toTopOf="@id/tvAreaCode">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="12dp"
android:text="@string/phone_number"
android:textColor="@color/black"
android:textSize="19sp" />
<EditText
android:id="@+id/editNumber"
android:layout_width="match_parent"
android:layout_height="52dp"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="12dp"
android:background="@drawable/bg_stroke_eae9ef_5"
android:gravity="center_vertical"
android:hint="@string/please_enter_your_phone_number"
android:importantForAutofill="no"
android:paddingHorizontal="16dp"
android:singleLine="true"
android:textColor="#999999"
android:textSize="16sp"
tools:ignore="TextFields,TextContrastCheck,VisualLintTextFieldSize" />
</LinearLayout>
<TextView
android:id="@+id/tvBtn"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="22dp"
android:background="@drawable/bg_btn_enable"
android:enabled="false"
android:gravity="center"
android:text="@string/create"
android:textColor="@color/color_bdc1c9_ffffff"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintTop_toBottomOf="@id/tvAreaCode" />
<com.base.scanqrclear.ads.NativeParentView
android:id="@+id/flAd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:layout_marginBottom="8dp"
android:background="@drawable/bg_ecf6ff_20"
android:minHeight="133dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvBtn">
<io.supercharge.shimmerlayout.ShimmerLayout
android:id="@+id/shimmerLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="16dp"
app:shimmer_angle="25"
app:shimmer_animation_duration="2000"
app:shimmer_auto_start="true"
app:shimmer_color="#33ffffff"
app:shimmer_mask_width="0.2">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/czhanweitu"
tools:ignore="ContentDescription,ImageContrastCheck" />
</io.supercharge.shimmerlayout.ShimmerLayout>
</com.base.scanqrclear.ads.NativeParentView>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -92,6 +92,7 @@ ...@@ -92,6 +92,7 @@
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginHorizontal="10dp" android:layout_marginHorizontal="10dp"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toTopOf="@id/fl_ad" app:layout_constraintBottom_toTopOf="@id/fl_ad"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true">
<TextView
android:id="@+id/tvCode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="14dp"
android:layout_marginBottom="10dp"
android:text="+86 China"
android:textColor="@color/black"
android:textSize="17sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginHorizontal="16dp"
android:background="#E5E9F3"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tvTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="17dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="12dp"
android:text="@string/other"
android:textColor="@color/black"
android:textSize="16sp"
android:visibility="gone" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:overScrollMode="never"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="3"
tools:listitem="@layout/item_function" />
</LinearLayout>
\ No newline at end of file
...@@ -263,5 +263,7 @@ ...@@ -263,5 +263,7 @@
<string name="replace_style">Replace Style</string> <string name="replace_style">Replace Style</string>
<string name="favorite">Favorite</string> <string name="favorite">Favorite</string>
<string name="regenerate">Regenerate</string> <string name="regenerate">Regenerate</string>
<string name="please_enter_your_phone_number">Please enter your phone number</string>
<string name="search">Search</string>
</resources> </resources>
\ No newline at end of file
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