Commit 228a91c4 authored by wanglei's avatar wanglei

[拆包]通知和字符串

parent 16f67d81
......@@ -56,7 +56,7 @@ object AdCountDownDialog {
@SuppressLint("SetTextI18n")
override fun onTick(millisUntilFinished: Long) {
val s = millisUntilFinished / 1000
tvCountdown?.text = "Ads are about to be shown(${s}s)"
tvCountdown?.text = tvCountdown.context.getString(R.string.ads_are_about_to_be_shown_s, s)
}
override fun onFinish() {
......
......@@ -11,6 +11,7 @@ import com.base.appzxhy.business.ads.AdState
import com.base.appzxhy.business.ads.AdsShowCallBack
import com.base.appzxhy.business.ads.AdsType
import com.base.appzxhy.business.ads.LimitUtils
import com.base.appzxhy.utils.LogEx
import com.google.android.gms.ads.AdError
import com.google.android.gms.ads.AdRequest
import com.google.android.gms.ads.FullScreenContentCallback
......@@ -25,6 +26,7 @@ import java.lang.ref.WeakReference
*/
class AdInterMgr {
private val TAG="AdInterMgr"
private var adState = AdState<InterstitialAd>()
private var showCallBack: AdsShowCallBack? = null
......@@ -63,7 +65,9 @@ class AdInterMgr {
val needLoad = adState.currentAd == null || !adAvailable()
if (needLoad) {
if (!adState.loadingAd) {
loadAd(activity, adEvent, isUnLimit, true)
loadAd(activity, adEvent, isUnLimit) {
showReadyAd(adEvent)
}
}
} else {
showReadyAd(adEvent)
......@@ -73,6 +77,11 @@ class AdInterMgr {
private fun showReadyAd(adEvent: AdEvent) {
val ac = adState.activityRef?.get()
if (ac == null || ac.isFinishing || ac.isDestroyed) {
LogEx.logDebug(TAG, "showReadyAd ac=null isFinishing isDestroyed")
return
}
adState.currentAd?.run {
fullScreenContentCallback = object : FullScreenContentCallback() {
override fun onAdShowedFullScreenContent() {
......@@ -127,7 +136,7 @@ class AdInterMgr {
context: Context,
adEvent: AdEvent,
isUnLimit: Boolean = false,
isShow: Boolean = false,
loadCallBack: (() -> Unit)? = null
) {
if (!isUnLimit) {
if (!LimitUtils.isAdShow(AdsType.INSERT, adEvent)) {
......@@ -145,9 +154,7 @@ class AdInterMgr {
object : InterstitialAdLoadCallback() {
override fun onAdLoaded(ad: InterstitialAd) {
adState.onAdLoaded(ad)
if (this@AdInterMgr.showCallBack != null || isShow) {
showReadyAd(adEvent)
}
loadCallBack?.invoke()
(adEvent as AdmobEvent).pullAd(ad.responseInfo)
LimitUtils.addRequestNum()
ad.onPaidEventListener = AdmobOnPaidEventListener(adEvent.scope)
......
......@@ -57,7 +57,7 @@ object NotificationUiUtil {
when (sendBean.actionId) {
JUNK_CLEAN -> {
val text = testNotificationId + "Clean up the junk files on your phone now!"
val text = testNotificationId + context.getString(R.string.notify_junk_clean)
sendBean.smallRemoteViews = RemoteViews(context.packageName, R.layout.notification_common_small).apply {
setTextViewText(R.id.tv1, text)
setImageViewResource(R.id.ivIcon, R.drawable.icon_clean_push)
......@@ -71,7 +71,7 @@ object NotificationUiUtil {
}
ANTIVIRUS -> {
val text = testNotificationId + ""
val text = testNotificationId + context.getString(R.string.notif_antivirus)
sendBean.smallRemoteViews = RemoteViews(context.packageName, R.layout.notification_common_small).apply {
setTextViewText(R.id.tv1, text)
setImageViewResource(R.id.ivIcon, R.drawable.icon_antivirus_push)
......@@ -85,7 +85,7 @@ object NotificationUiUtil {
}
BATTERY_INFO -> {
val text = testNotificationId + "Check your phone battery consumption recently!"
val text = testNotificationId + context.getString(R.string.notify_battry_info)
sendBean.smallRemoteViews = RemoteViews(context.packageName, R.layout.notification_common_small).apply {
setTextViewText(R.id.tv1, text)
setImageViewResource(R.id.ivIcon, R.drawable.icon_battery_info_push)
......@@ -99,7 +99,7 @@ object NotificationUiUtil {
}
LARGE_FILE_CLEAN -> {
val text = testNotificationId + "Clear out large files to free up your storage space!"
val text = testNotificationId + context.getString(R.string.notify_large_file)
sendBean.smallRemoteViews = RemoteViews(context.packageName, R.layout.notification_common_small).apply {
setTextViewText(R.id.tv1, text)
setImageViewResource(R.id.ivIcon, R.drawable.icon_large_file_cleaner_push)
......@@ -113,7 +113,7 @@ object NotificationUiUtil {
}
SIMILAR_PHOTOS -> {
val text = testNotificationId + "Clean Up Similar Photos – Save Space!"
val text = testNotificationId + context.getString(R.string.notify_similar_photos)
sendBean.smallRemoteViews = RemoteViews(context.packageName, R.layout.notification_common_small).apply {
setTextViewText(R.id.tv1, text)
setImageViewResource(R.id.ivIcon, R.drawable.icon_similar_pictures_push)
......@@ -127,7 +127,7 @@ object NotificationUiUtil {
}
SCREENSHOT_CLEAN -> {
val text = testNotificationId + "Free up space by clearing screenshot clutter!"
val text = testNotificationId + context.getString(R.string.notify_screenshot)
sendBean.smallRemoteViews = RemoteViews(context.packageName, R.layout.notification_common_small).apply {
setTextViewText(R.id.tv1, text)
setImageViewResource(R.id.ivIcon, R.drawable.icon_screenshot_clean_push)
......@@ -141,7 +141,7 @@ object NotificationUiUtil {
}
PHOTO_COMPRESSION -> {
val text = testNotificationId + "Free up your phone storage space by compressing photos."
val text = testNotificationId + context.getString(R.string.notify_photo_compression)
sendBean.smallRemoteViews = RemoteViews(context.packageName, R.layout.notification_common_small).apply {
setTextViewText(R.id.tv1, text)
setImageViewResource(R.id.ivIcon, R.drawable.icon_compression_push)
......
......@@ -142,7 +142,9 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(FragmentHomeBinding::infl
ANTIVIRUS -> {
val dialog = MalwareDialog(requireActivity())
dialog.action = {
(requireActivity() as MainActivity).permissionStorageJump(ANTIVIRUS)
if (it) {
(requireActivity() as MainActivity).permissionStorageJump(ANTIVIRUS)
}
}
dialog.showDialog()
......
......@@ -278,7 +278,7 @@ class MalwareCleanActivity : BaseActivity<ActivityMalwareCleanBinding>(ActivityM
private fun updateView(jump: Boolean) {
binding.ivLogo.visibility = if (appList.isEmpty()) View.GONE else View.VISIBLE
binding.tvCount.visibility = if (appList.isEmpty()) View.GONE else {
binding.tvCount.text = "${appList.size} issue"
binding.tvCount.text = getString(R.string.issue, appList.size.toString())
View.VISIBLE
}
binding.tvUnit.visibility = if (appList.isEmpty()) View.GONE else View.VISIBLE
......
......@@ -28,7 +28,7 @@
android:layout_height="@dimen/dp_30"
android:layout_marginTop="20dp"
android:layout_marginEnd="20dp"
android:src="@drawable/icon_close_pop"
android:src="@drawable/icon_close"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
......@@ -72,7 +72,7 @@
android:paddingVertical="10dp"
android:text="@string/exit"
android:textAlignment="center"
android:textColor="@color/white"
android:textColor="@color/colorPrimary"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@id/tvCleanNow"
......
......@@ -25,7 +25,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:text="Exit scanning"
android:text="@string/exit_scanning"
android:textColor="#000000"
android:textSize="19sp"
android:textStyle="bold"
......@@ -39,7 +39,7 @@
android:layout_marginHorizontal="35dp"
android:layout_marginTop="20dp"
android:gravity="center"
android:text="lf you exit, the scanning results will be discarded."
android:text="@string/lf_you_exit_the_scanning_results_will_be_discarded"
android:textColor="#000000"
android:textSize="15sp"
tools:ignore="HardcodedText" />
......@@ -58,7 +58,7 @@
android:layout_marginHorizontal="8dp"
android:background="@drawable/bg_stroke_577dfd_22"
android:gravity="center"
android:text="Exit"
android:text="@string/exit"
android:textColor="#577DFD"
android:textSize="16sp"
tools:ignore="HardcodedText" />
......@@ -70,7 +70,7 @@
android:layout_marginHorizontal="8dp"
android:background="@drawable/bg_577dfd_22"
android:gravity="center"
android:text="Continue"
android:text="@string/continue_"
android:textColor="#ffffff"
android:textSize="16sp"
tools:ignore="HardcodedText" />
......
......@@ -220,6 +220,17 @@ Please rest assured that we will handle your information in strict accordance wi
<string name="installed_application_information_access_and_sharing_statement">Installed application information access and sharing statement:</string>
<string name="we_take_the_confidentiality_of_your">We take the confidentiality of your information very seriously, and we and Trustlook SDK will not sell, license, transfer or disclose this information unless authorized by you.</string>
<string name="view_information_collection_instructions">View information collection instructions:</string>
<string name="notify_junk_clean">Clean up the junk files on your phone now!</string>
<string name="notif_antivirus">Your device may have potential threats. Tap to scan and eliminate them.</string>
<string name="notify_battry_info">Check your phone battery consumption recently!</string>
<string name="notify_large_file">Clear out large files to free up your storage space!</string>
<string name="notify_similar_photos">Clean Up Similar Photos – Save Space!</string>
<string name="notify_screenshot">Free up space by clearing screenshot clutter!</string>
<string name="notify_photo_compression">Free up your phone storage space by compressing photos.</string>
<string name="lf_you_exit_the_scanning_results_will_be_discarded">lf you exit, the scanning results will be discarded.</string>
<string name="exit_scanning">Exit scanning</string>
<string name="ads_are_about_to_be_shown_s">Ads are about to be shown(%1$ss)</string>
<string name="issue">%1$s issue</string>
</resources>
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