Commit 52d971a7 authored by wanglei's avatar wanglei

...

parent b370d6fe
......@@ -54,7 +54,7 @@ object AdmobHelper {
val showLanPage = "showLanPage"
//开屏加载ad时间
val open_ad_loading = "open_loading"
val open_ad_loading = "open_ad_loading"
//创建pdf加载ad时间
val create_pdf_loading = "create_pdf_loading"
......
......@@ -30,9 +30,9 @@ object AdmobOpenUtils {
}
fun loadAppOpenAd(skip: Boolean = false, onLoad: ((where: Int) -> Unit)? = null) {
fun loadAppOpenAd(onLoad: ((where: Int) -> Unit)? = null) {
if (mOpenAd != null || skip) {
if (mOpenAd != null) {
onLoad?.invoke(1)
return
}
......@@ -77,6 +77,7 @@ object AdmobOpenUtils {
) {
if (activity.isFinishing || activity.isDestroyed) {
LogEx.logDebug(TAG, "activity isDestroyed")
return
}
if (!AdDisplayUtils.shouldShowOpenAd()) {
......
......@@ -69,4 +69,13 @@ object ConstObject {
AppPreferences.getInstance().put("haveGuideGesture", value, true)
}
var languageSp = LanguageBean.English
get() {
return AppPreferences.getInstance().getString("languageSp", field)
}
set(value) {
field = value
AppPreferences.getInstance().put("languageSp", value, true)
}
}
\ No newline at end of file
package com.base.pdfviewerscannerwhite.bean
data class LanguageBean(
val key: String
) {
var isSelect: Boolean = false
companion object {
const val English = "English"
const val 简体中文 = "简体中文"
const val português = "português"
const val Español = "Español "
const val Français = "Français"
const val Deutsch = "Deutsch"
const val ไทย = "ไทย"
const val Bahasa_Indonesia = "Bahasa Indonesia"
const val Melayu = "Melayu"
const val Tiếng_Việt = "Tiếng Việt"
const val 日本語 = "日本語"
const val Italiano = "Italiano"
const val 한국인 = "한국인"
const val Nederlands = "Nederlands"
const val 繁體中文 = "繁體中文"
const val Türk = "Türk"
}
}
\ No newline at end of file
......@@ -19,6 +19,7 @@ import com.base.pdfviewerscannerwhite.helper.EventUtils
import com.base.pdfviewerscannerwhite.helper.MyApplication
import com.base.pdfviewerscannerwhite.ui.main.MainActivity
import com.base.pdfviewerscannerwhite.ui.splash.SplashActivity
import com.base.pdfviewerscannerwhite.utils.LogEx
import kotlin.random.Random
......@@ -120,6 +121,7 @@ class StayNotificationService : Service() {
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
LogEx.logDebug(TAG, "onStartCommand intent=$intent")
if (intent == null) {
EventUtils.event("onStartCommand", "Foreground System auto launch intent=null isRunning=$isRunning")
return START_NOT_STICKY
......
package com.base.pdfviewerscannerwhite.ui.set
import android.content.Context
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.base.pdfviewerscannerwhite.R
import com.base.pdfviewerscannerwhite.bean.LanguageBean
import com.base.pdfviewerscannerwhite.databinding.ItemLanguageSetBinding
import com.base.pdfviewerscannerwhite.utils.XmlEx.inflate
import com.chad.library.adapter4.BaseQuickAdapter
class LanguageAdapter : BaseQuickAdapter<LanguageBean, LanguageAdapter.LanguageViewHolder>() {
inner class LanguageViewHolder(view: View) : ViewHolder(view)
override fun onBindViewHolder(holder: LanguageViewHolder, position: Int, item: LanguageBean?) {
item ?: return
val binding = ItemLanguageSetBinding.bind(holder.itemView)
binding.ivSelector.isSelected = item.isSelect
}
override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): LanguageViewHolder {
return LanguageViewHolder(R.layout.item_language_set.inflate(parent))
}
}
\ No newline at end of file
......@@ -47,6 +47,9 @@ class SetActivity : BaseActivity<ActivitySetBinding>() {
)
startActivity(intent)
}
binding.llLanguage.setOnClickListener {
startActivity(Intent(this, SetLanguageActivity::class.java))
}
}
}
\ No newline at end of file
package com.base.pdfviewerscannerwhite.ui.set
import com.base.pdfviewerscannerwhite.bean.ConstObject.languageSp
import com.base.pdfviewerscannerwhite.bean.LanguageBean
import com.base.pdfviewerscannerwhite.databinding.ActivitySetLanguageBinding
import com.base.pdfviewerscannerwhite.helper.BaseActivity
class SetLanguageActivity : BaseActivity<ActivitySetLanguageBinding>() {
override val binding: ActivitySetLanguageBinding by lazy {
ActivitySetLanguageBinding.inflate(layoutInflater)
}
private lateinit var adapter: LanguageAdapter
override fun initView() {
TODO("Not yet implemented")
adapter = LanguageAdapter()
binding.rv.adapter = adapter
initData()
}
private fun initData() {
val list = listOf(
LanguageBean(LanguageBean.English),
LanguageBean(LanguageBean.简体中文),
LanguageBean(LanguageBean.português),
LanguageBean(LanguageBean.Español),
LanguageBean(LanguageBean.Français),
LanguageBean(LanguageBean.Deutsch),
LanguageBean(LanguageBean.ไทย),
LanguageBean(LanguageBean.Bahasa_Indonesia),
LanguageBean(LanguageBean.Melayu),
LanguageBean(LanguageBean.Tiếng_Việt),
LanguageBean(LanguageBean.日本語),
LanguageBean(LanguageBean.Italiano),
LanguageBean(LanguageBean.한국인),
LanguageBean(LanguageBean.Nederlands),
LanguageBean(LanguageBean.繁體中文),
LanguageBean(LanguageBean.Türk),
)
list.find { it.key == languageSp }?.isSelect = true
adapter.submitList(list)
}
}
\ No newline at end of file
package com.base.pdfviewerscannerwhite.ui.splash
import com.base.pdfviewerscannerwhite.databinding.ActivityLanguageBinding
import com.base.pdfviewerscannerwhite.helper.BaseActivity
class LanguageActivity : BaseActivity<ActivityLanguageBinding>() {
override val binding: ActivityLanguageBinding by lazy {
ActivityLanguageBinding.inflate(layoutInflater)
}
override fun initView() {
}
}
\ No newline at end of file
......@@ -21,11 +21,10 @@ class SplashPresenter(
* 超时跳转
*/
fun startJumpJob(lifecycleCoroutineScope: LifecycleCoroutineScope) {
loadingTime = 30
if (jumpJob == null) {
val startTime = System.currentTimeMillis()
jumpJob = lifecycleCoroutineScope.launch {
LogEx.logDebug(TAG, "loadingTime=$loadingTime")
LogEx.logDebug(TAG, "open_ad_loading=$loadingTime")
delay(loadingTime * 1000L)
val endTime = System.currentTimeMillis()
LogEx.logDebug(TAG, "超时跳转 time=${endTime - startTime}")
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#1A00B8DE" />
<corners android:radius="14dp" />
</shape>
\ 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="@mipmap/yuyan_weixuan" android:state_selected="false" />
<item android:drawable="@mipmap/yuyan_xuan" android:state_selected="true" />
</selector>
\ No newline at end of file
......@@ -37,8 +37,9 @@
app:layout_constraintStart_toEndOf="@id/fl_fanhui"
app:layout_constraintTop_toTopOf="@id/fl_fanhui" />
<LinearLayout
android:id="@+id/ll_rate"
android:id="@+id/ll_language"
android:layout_width="match_parent"
android:layout_height="61dp"
android:layout_marginHorizontal="15dp"
......@@ -47,6 +48,47 @@
android:background="@drawable/bg_fbfbfb_15"
app:layout_constraintTop_toBottomOf="@id/fl_fanhui">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="18dp"
android:src="@mipmap/pingjia"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="12dp"
android:layout_weight="1"
android:includeFontPadding="false"
android:text="@string/language"
android:textColor="#333333"
android:textSize="16sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="20dp"
android:src="@mipmap/jianotou"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_rate"
android:layout_width="match_parent"
android:layout_height="61dp"
android:layout_marginHorizontal="15dp"
android:layout_marginVertical="15dp"
android:layout_marginTop="15dp"
android:background="@drawable/bg_fbfbfb_15"
app:layout_constraintTop_toBottomOf="@id/ll_language">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......
......@@ -7,4 +7,53 @@
android:layout_height="match_parent"
tools:context=".ui.set.SetLanguageActivity">
<FrameLayout
android:id="@+id/fl_fanhui"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="15dp"
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_b"
tools:ignore="ContentDescription" />
</FrameLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/select_language"
android:textColor="@color/black"
android:textSize="19sp"
app:layout_constraintBottom_toBottomOf="@id/fl_fanhui"
app:layout_constraintStart_toEndOf="@id/fl_fanhui"
app:layout_constraintTop_toTopOf="@id/fl_fanhui" />
<TextView
android:layout_width="58dp"
android:layout_height="28dp"
android:layout_marginEnd="18dp"
android:background="@drawable/bg_1a00b8de_14"
android:gravity="center"
android:text="@string/ok"
android:textColor="#00B8DE"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/fl_fanhui"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/fl_fanhui" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="match_parent"
android:layout_height="0dp"
tools:listitem="@layout/item_language_set"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/fl_fanhui" />
</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:background="?android:attr/selectableItemBackground"
android:layout_height="60dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:textColor="@color/black"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="English" />
<ImageView
android:id="@+id/iv_selector"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="20dp"
android:src="@drawable/bg_selector_yuan"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
<View
android:background="#EEEEEE"
android:layout_width="match_parent"
android:layout_height="1px"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -54,5 +54,7 @@
<string name="final_modification_from_old_to_new">Final modification (From old to new)</string>
<string name="name_a_z">Name (A-Z)</string>
<string name="name_z_a">Name (Z-A)</string>
<string name="language">Language</string>
<string name="select_language">Select language</string>
</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