Commit 18d30d44 authored by wanglei's avatar wanglei

...

parent 26a0da28
...@@ -25,7 +25,7 @@ object AdmobBannerUtils { ...@@ -25,7 +25,7 @@ object AdmobBannerUtils {
fun showCollapsibleBannerAd(context: Context, parent: ViewGroup) { fun showCollapsibleBannerAd(context: Context, parent: ViewGroup) {
val isShowBanner = AppPreferences.getInstance().getString("isShowBanner", "0").toInt() val isShowBanner = AppPreferences.getInstance().getString("isShowBanner", "0").toInt()
if (isShowBanner == 0) { if (isShowBanner == 0 && !BuildConfig.DEBUG) {
return return
} }
if (adView != null) { if (adView != null) {
......
...@@ -13,7 +13,6 @@ import com.base.pdfviewerscannerwhite.utils.ActivityLauncher ...@@ -13,7 +13,6 @@ import com.base.pdfviewerscannerwhite.utils.ActivityLauncher
import com.base.pdfviewerscannerwhite.utils.ActivityManagerUtils import com.base.pdfviewerscannerwhite.utils.ActivityManagerUtils
import com.base.pdfviewerscannerwhite.utils.LanguageUtils.changeAppLanguage import com.base.pdfviewerscannerwhite.utils.LanguageUtils.changeAppLanguage
import com.base.pdfviewerscannerwhite.utils.LogEx import com.base.pdfviewerscannerwhite.utils.LogEx
import java.util.Locale
abstract class BaseActivity<T : ViewBinding> : AppCompatActivity() { abstract class BaseActivity<T : ViewBinding> : AppCompatActivity() {
private val TAG = "BaseActivity" private val TAG = "BaseActivity"
...@@ -58,7 +57,6 @@ abstract class BaseActivity<T : ViewBinding> : AppCompatActivity() { ...@@ -58,7 +57,6 @@ abstract class BaseActivity<T : ViewBinding> : AppCompatActivity() {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
} }
fun updateAppLanguage( fun updateAppLanguage(
......
...@@ -10,6 +10,7 @@ import com.base.pdfviewerscannerwhite.fcm.FCMManager ...@@ -10,6 +10,7 @@ import com.base.pdfviewerscannerwhite.fcm.FCMManager
import com.base.pdfviewerscannerwhite.ui.splash.SplashActivity import com.base.pdfviewerscannerwhite.ui.splash.SplashActivity
import com.base.pdfviewerscannerwhite.utils.ActivityManagerUtils import com.base.pdfviewerscannerwhite.utils.ActivityManagerUtils
import com.base.pdfviewerscannerwhite.utils.AppPreferences import com.base.pdfviewerscannerwhite.utils.AppPreferences
import com.base.pdfviewerscannerwhite.utils.LanguageUtils
import com.base.pdfviewerscannerwhite.utils.LogEx import com.base.pdfviewerscannerwhite.utils.LogEx
import com.facebook.FacebookSdk import com.facebook.FacebookSdk
import com.tom_roush.pdfbox.android.PDFBoxResourceLoader import com.tom_roush.pdfbox.android.PDFBoxResourceLoader
...@@ -65,6 +66,10 @@ class MyApplication : Application() { ...@@ -65,6 +66,10 @@ class MyApplication : Application() {
pdfSelectLanguage = ConstObject.appLanguageSp pdfSelectLanguage = ConstObject.appLanguageSp
pdfSplitLanguage = ConstObject.appLanguageSp pdfSplitLanguage = ConstObject.appLanguageSp
wordLanguage = ConstObject.appLanguageSp wordLanguage = ConstObject.appLanguageSp
ConstObject.changeLanguageSp = ConstObject.appLanguageSp
LogEx.logDebug(TAG, "appLanguageSp=${ConstObject.appLanguageSp} changeLanguageSp=${ConstObject.changeLanguageSp}")
LanguageUtils.changeAppLanguage(this)
} }
...@@ -105,7 +110,7 @@ class MyApplication : Application() { ...@@ -105,7 +110,7 @@ class MyApplication : Application() {
} }
override fun onActivityStarted(activity: Activity) { override fun onActivityStarted(activity: Activity) {
LogEx.logDebug(TAG, "onActivityStarted") // LogEx.logDebug(TAG, "onActivityStarted")
count++ count++
lastTimeResume = System.currentTimeMillis() lastTimeResume = System.currentTimeMillis()
......
...@@ -11,6 +11,7 @@ import androidx.activity.OnBackPressedCallback ...@@ -11,6 +11,7 @@ import androidx.activity.OnBackPressedCallback
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import com.base.pdfviewerscannerwhite.R import com.base.pdfviewerscannerwhite.R
import com.base.pdfviewerscannerwhite.ads.admob.AdmobBannerUtils
import com.base.pdfviewerscannerwhite.bean.ConstObject import com.base.pdfviewerscannerwhite.bean.ConstObject
import com.base.pdfviewerscannerwhite.bean.ConstObject.BOOKMARK_DATA_TYPE import com.base.pdfviewerscannerwhite.bean.ConstObject.BOOKMARK_DATA_TYPE
import com.base.pdfviewerscannerwhite.bean.ConstObject.DOCUMENT_DATA_TYPE import com.base.pdfviewerscannerwhite.bean.ConstObject.DOCUMENT_DATA_TYPE
...@@ -67,6 +68,12 @@ class MainActivity : BaseActivity<ActivityMain2Binding>(), MainView { ...@@ -67,6 +68,12 @@ class MainActivity : BaseActivity<ActivityMain2Binding>(), MainView {
mainPresenter = MainPresenter(this, this, lifecycleScope) mainPresenter = MainPresenter(this, this, lifecycleScope)
mainPresenter.initScannerLauncher(this) mainPresenter.initScannerLauncher(this)
if (checkStorePermission()) {
binding.flBanner.visibility = View.VISIBLE
AdmobBannerUtils.showCollapsibleBannerAd(this, binding.flBanner)
}
addDeskShortCut() addDeskShortCut()
} }
......
...@@ -38,7 +38,7 @@ object LanguageUtils { ...@@ -38,7 +38,7 @@ object LanguageUtils {
return systemLanguage return systemLanguage
} }
fun isSupportSystemLanguage(): Boolean { fun isSupportSystemLanguage(): Boolean {
return supportLanguage.contains(getSystemLanguage()) return supportLanguage.contains(getSystemLanguage())
} }
...@@ -48,9 +48,10 @@ object LanguageUtils { ...@@ -48,9 +48,10 @@ object LanguageUtils {
//Android 7.0以上的方法 //Android 7.0以上的方法
config.setLocale(locale) config.setLocale(locale)
config.setLocales(LocaleList(locale)); config.setLocales(LocaleList(locale))
context.createConfigurationContext(config); context.createConfigurationContext(config)
context.resources.updateConfiguration(config, context.resources.displayMetrics) context.resources.updateConfiguration(config, context.resources.displayMetrics)
} }
} }
\ No newline at end of file
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
android:id="@+id/ll_bottom" android:id="@+id/ll_bottom"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="64dp" android:layout_height="64dp"
android:layout_marginBottom="60dp"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"> app:layout_constraintBottom_toBottomOf="parent">
...@@ -243,6 +244,13 @@ ...@@ -243,6 +244,13 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<FrameLayout
android:id="@+id/fl_banner"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/ll_bottom" />
<TextView <TextView
android:id="@+id/tv_test" android:id="@+id/tv_test"
android:layout_width="wrap_content" android:layout_width="wrap_content"
......
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