Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
L
location share white
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
location share white
Commits
df7669b5
Commit
df7669b5
authored
Nov 29, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...多语言验证
parent
5aee5b23
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
359 additions
and
147 deletions
+359
-147
build.gradle.kts
app/build.gradle.kts
+3
-0
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+6
-15
ConstObject.kt
...main/java/com/base/locationsharewhite/bean/ConstObject.kt
+6
-24
LanguageBean.kt
...ain/java/com/base/locationsharewhite/bean/LanguageBean.kt
+0
-2
BaseActivity.kt
...n/java/com/base/locationsharewhite/helper/BaseActivity.kt
+100
-35
MyApplication.kt
.../java/com/base/locationsharewhite/helper/MyApplication.kt
+29
-10
StayJobService.kt
...ava/com/base/locationsharewhite/service/StayJobService.kt
+1
-1
MainActivity.kt
.../java/com/base/locationsharewhite/ui/main/MainActivity.kt
+19
-36
LanguageActivity.kt
...va/com/base/locationsharewhite/ui/set/LanguageActivity.kt
+9
-13
SettingActivity.kt
...ava/com/base/locationsharewhite/ui/set/SettingActivity.kt
+6
-8
SplashActivity.kt
...a/com/base/locationsharewhite/ui/splash/SplashActivity.kt
+0
-1
activity_alpha_in.xml
app/src/main/res/anim/activity_alpha_in.xml
+10
-0
activity_alpha_out.xml
app/src/main/res/anim/activity_alpha_out.xml
+10
-0
activity_setting.xml
app/src/main/res/layout/activity_setting.xml
+1
-2
strings.xml
app/src/main/res/values-zh-rCN/strings.xml
+79
-0
strings.xml
app/src/main/res/values-zh/strings.xml
+80
-0
No files found.
app/build.gradle.kts
View file @
df7669b5
...
...
@@ -118,4 +118,7 @@ dependencies {
//work
implementation
(
"androidx.work:work-runtime-ktx:2.7.1"
)
// 请使用最新版本
// 语种切换框架:https://github.com/getActivity/MultiLanguages
implementation
(
"com.github.getActivity:MultiLanguages:9.3"
)
}
\ No newline at end of file
app/src/main/AndroidManifest.xml
View file @
df7669b5
...
...
@@ -60,61 +60,52 @@
<activity
android:name=
".ui.main.MainActivity"
android:exported=
"false"
android:launchMode=
"singleTask"
android:screenOrientation=
"portrait"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
<activity
android:name=
".ui.set.LanguageActivity"
android:exported=
"false"
android:launchMode=
"singleTop"
android:screenOrientation=
"portrait"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
<activity
android:name=
".ui.set.FeedbackActivity"
android:exported=
"false"
android:launchMode=
"singleTop"
android:screenOrientation=
"portrait"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
<activity
android:name=
".ui.set.SettingActivity"
android:exported=
"false"
android:launchMode=
"singleTop"
android:screenOrientation=
"portrait"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
<activity
android:name=
".ui.howuse.HowViewOtherActivity"
android:exported=
"false"
android:launchMode=
"singleTop"
android:screenOrientation=
"portrait"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
<activity
android:name=
".ui.howuse.HowUseActivity"
android:exported=
"false"
android:launchMode=
"singleTop"
android:screenOrientation=
"portrait"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
<activity
android:name=
".ui.main.LocationShareActivity"
android:exported=
"false"
android:launchMode=
"singleTop"
android:screenOrientation=
"portrait"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
<activity
android:name=
".ui.main.LocationCodeActivity"
android:exported=
"false"
android:launchMode=
"singleTop"
android:screenOrientation=
"portrait"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
<activity
android:name=
".ui.locationmap.LocationMapActivity"
android:exported=
"false"
android:launchMode=
"singleTop"
android:screenOrientation=
"portrait"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
<activity
android:name=
".ui.howuse.HowUseShareActivity"
android:exported=
"false"
android:launchMode=
"singleTop"
android:screenOrientation=
"portrait"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
<activity
android:name=
".ui.set.SettingActivity"
android:exported=
"false"
android:screenOrientation=
"portrait"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
...
...
app/src/main/java/com/base/locationsharewhite/bean/ConstObject.kt
View file @
df7669b5
...
...
@@ -23,39 +23,21 @@ object ConstObject {
AppPreferences
.
getInstance
().
put
(
"ifAgreePrivacy"
,
value
,
true
)
}
var
myLocationCode
=
""
var
appLanguageSp
=
Locale
.
getDefault
().
language
get
()
{
return
AppPreferences
.
getInstance
().
getString
(
"
myLocationCode
"
,
field
)
return
AppPreferences
.
getInstance
().
getString
(
"
languageSp
"
,
field
)
}
set
(
value
)
{
field
=
value
AppPreferences
.
getInstance
().
put
(
"
myLocationCode
"
,
value
,
true
)
AppPreferences
.
getInstance
().
put
(
"
languageSp
"
,
value
,
true
)
}
var
appLanguageSp
=
Locale
.
getDefault
().
language
+
"_"
+
Locale
.
getDefault
().
country
get
()
{
return
AppPreferences
.
getInstance
().
getString
(
"appLanguageSp"
,
field
)
}
set
(
value
)
{
field
=
value
AppPreferences
.
getInstance
().
put
(
"appLanguageSp"
,
value
,
true
)
}
var
changeLanguageSp
=
appLanguageSp
get
()
{
return
AppPreferences
.
getInstance
().
getString
(
"changeLanguageSp"
,
field
)
}
set
(
value
)
{
field
=
value
AppPreferences
.
getInstance
().
put
(
"changeLanguageSp"
,
value
,
true
)
}
var
topic_number
=
""
var
appLanguageCountrySp
=
Locale
.
getDefault
().
country
get
()
{
return
AppPreferences
.
getInstance
().
getString
(
"
topic_number
"
,
field
)
return
AppPreferences
.
getInstance
().
getString
(
"
languageCountrySp
"
,
field
)
}
set
(
value
)
{
field
=
value
AppPreferences
.
getInstance
().
put
(
"
topic_number
"
,
value
,
true
)
AppPreferences
.
getInstance
().
put
(
"
languageCountrySp
"
,
value
,
true
)
}
var
noShowFriendsShareGuide
=
false
...
...
app/src/main/java/com/base/locationsharewhite/bean/LanguageBean.kt
View file @
df7669b5
package
com.base.locationsharewhite.bean
import
java.util.Locale
data class
LanguageBean
(
val
key
:
String
,
...
...
@@ -8,7 +7,6 @@ data class LanguageBean(
val
country
:
String
,
)
{
var
isSelect
:
Boolean
=
false
var
isFollowSystem
:
Boolean
=
false
companion
object
{
const
val
English
=
"English"
...
...
app/src/main/java/com/base/locationsharewhite/helper/BaseActivity.kt
View file @
df7669b5
package
com.base.locationsharewhite.helper
import
android.app.Activity
import
android.app.Dialog
import
android.content.Context
import
android.content.Intent
import
android.os.Bundle
import
androidx.appcompat.app.AppCompatActivity
import
androidx.viewbinding.ViewBinding
import
com.base.locationsharewhite.R
import
com.base.locationsharewhite.bean.ConstObject.appLanguageCountrySp
import
com.base.locationsharewhite.bean.ConstObject.appLanguageSp
import
com.base.locationsharewhite.bean.ConstObject.changeLanguageSp
import
com.base.locationsharewhite.ui.main.MainActivity
import
com.base.locationsharewhite.utils.ActivityLauncher
import
com.base.locationsharewhite.utils.LogEx
import
com.hjq.language.MultiLanguages
import
java.util.Locale
import
java.util.concurrent.atomic.AtomicBoolean
abstract
class
BaseActivity
<
T
:
ViewBinding
>
:
AppCompatActivity
()
{
private
val
TAG
=
"BaseActivity"
private
val
TAG
=
javaClass
.
simpleName
protected
abstract
val
binding
:
T
lateinit
var
launcher
:
ActivityLauncher
private
var
currentLocale
:
Locale
?
=
null
var
isRunning
:
Boolean
=
false
//需要用时在onResume()最后一行赋值
var
onCreateI
=
0
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
onCreateI
++
LogEx
.
logDebug
(
TAG
,
"lifecycle onCreate ${javaClass.simpleName} $onCreateI"
)
launcher
=
ActivityLauncher
(
this
)
setContentView
(
binding
.
root
)
EventUtils
.
event
(
"page_${javaClass.simpleName}"
)
currentLocale
=
Locale
(
appLanguageSp
,
appLanguageCountrySp
)
initView
()
initListener
()
}
...
...
@@ -52,43 +61,99 @@ abstract class BaseActivity<T : ViewBinding> : AppCompatActivity() {
}
}
override
fun
attachBaseContext
(
newBase
:
Context
?)
{
super
.
attachBaseContext
(
MultiLanguages
.
attach
(
newBase
))
}
fun
changeLanguage
(
currentActivity
:
Activity
)
{
val
spLanguage
=
Locale
(
appLanguageSp
,
appLanguageCountrySp
)
val
flag
=
currentLocale
!=
spLanguage
var
restart
=
false
if
(
flag
)
{
restart
=
MultiLanguages
.
setAppLanguage
(
this
,
spLanguage
)
if
(
restart
)
{
currentLocale
=
Locale
(
appLanguageSp
,
appLanguageCountrySp
)
}
}
LogEx
.
logDebug
(
TAG
,
"changeLanguage "
+
"flag=$flag restart=$restart currentLocale=$currentLocale spLanguage=$spLanguage"
)
if
(
flag
||
restart
)
{
// 1.使用 recreate 来重启 Activity,效果差,有闪屏的缺陷
// recreate();
// 2.使用常规 startActivity 来重启 Activity,有从左向右的切换动画
// 稍微比 recreate 的效果好一点,但是这种并不是最佳的效果
// startActivity(new Intent(this, LanguageActivity.class));
// finish();
// 3.我们可以充分运用 Activity 跳转动画,在跳转的时候设置一个渐变的效果,相比前面的两种带来的体验是最佳的
//需要设置启动模式,避免AndroidManifest.xml设置singleTop启动模式导致重复启动不生效
//这种方式如果设置了singleTop或者singleTask的,再次回到该activity无法改变于语言,因为还在堆栈里没有重新创建
needRecreate
()
if
(
false
)
{
LogEx
.
logDebug
(
TAG
,
"changeLanguage recreate"
)
recreate
()
}
else
{
startActivity
(
Intent
(
this
,
currentActivity
::
class
.
java
))
overridePendingTransition
(
R
.
anim
.
activity_alpha_in
,
R
.
anim
.
activity_alpha_out
)
finish
()
}
}
}
/**
* 判断是否需要重新创建对SingleTop启动模式的有效
*/
fun
needRecreate
():
Boolean
{
return
TAG
.
contains
(
"MainActivity"
)
}
private
val
onResumeCalled
=
AtomicBoolean
(
false
)
private
var
onResumeOneShootI
=
0
open
fun
onResumeOneShoot
()
{
onResumeOneShootI
++
LogEx
.
logDebug
(
TAG
,
"lifecycle onResumeOneShootI ${javaClass.simpleName} $onResumeOneShootI"
)
}
private
var
onResumeI
=
0
override
fun
onResume
()
{
super
.
onResume
()
onResumeI
++
LogEx
.
logDebug
(
TAG
,
"lifecycle onResume ${javaClass.simpleName} $onResumeI"
)
if
(!
onResumeCalled
.
get
())
{
onResumeCalled
.
set
(
true
)
onResumeOneShoot
()
}
}
private
var
onStartI
=
0
override
fun
onStart
()
{
super
.
onStart
()
onStartI
++
LogEx
.
logDebug
(
TAG
,
"lifecycle onStart ${javaClass.simpleName} $onStartI"
)
}
fun
updateAppLanguage
(
activityLanguage
:
String
,
activityTag
:
String
?
=
null
,
activityChangeCallback
:
((
language
:
String
)
->
Unit
)?
=
null
):
Boolean
{
// LogEx.logDebug(
// TAG,
// "activityTag=$activityTag " +
// "appLanguageSp=$appLanguageSp " +
// "changeLanguageSp=$changeLanguageSp " +
// "activityLanguage=$activityLanguage"
// )
// var isRecreate = false
//
// if (appLanguageSp != changeLanguageSp || activityLanguage != changeLanguageSp) {
//
// changeAppLanguage(this, changeLanguageSp)
// // Restart the app
// appLanguageSp = changeLanguageSp
// activityChangeCallback?.invoke(changeLanguageSp)
// LogEx.logDebug(TAG, "activityTag=$activityTag recreate")
// isRecreate = true
//
// //https://stackoverflow.com/questions/63209993/getting-lifecycle-exception-while-recreating-the-activity
// //MIUI recreate
// this@BaseActivity.recreate()
// }
return
false
private
var
onStopI
=
0
override
fun
onStop
()
{
super
.
onStop
()
onStopI
++
LogEx
.
logDebug
(
TAG
,
"lifecycle onStop ${javaClass.simpleName} $onStopI"
)
onResumeCalled
.
set
(
false
)
}
fun
isLanguageRecreate
(
activityLanguage
:
String
):
Boolean
{
return
appLanguageSp
!=
changeLanguageSp
||
activityLanguage
!=
changeLanguageSp
private
var
onPauseI
=
0
override
fun
onPause
()
{
super
.
onPause
()
onPauseI
++
LogEx
.
logDebug
(
TAG
,
"lifecycle onPause ${javaClass.simpleName} $onPauseI"
)
}
}
\ No newline at end of file
app/src/main/java/com/base/locationsharewhite/helper/MyApplication.kt
View file @
df7669b5
...
...
@@ -3,11 +3,15 @@ package com.base.locationsharewhite.helper
import
FCMManager
import
android.app.Activity
import
android.app.Application
import
android.content.Context
import
android.content.Intent
import
android.os.Bundle
import
android.text.TextUtils
import
android.util.Log
import
com.base.locationsharewhite.ads.AdsConfigBean
import
com.base.locationsharewhite.ads.AdsMgr
import
com.base.locationsharewhite.bean.ConstObject.appLanguageCountrySp
import
com.base.locationsharewhite.bean.ConstObject.appLanguageSp
import
com.base.locationsharewhite.fcm.BatteryStatusReceiver
import
com.base.locationsharewhite.fcm.PackageStatusReceiver
import
com.base.locationsharewhite.fcm.ScreenStatusReceiver
...
...
@@ -17,6 +21,8 @@ import com.base.locationsharewhite.service.StayJobService.Companion.startJob
import
com.base.locationsharewhite.ui.splash.SplashActivity
import
com.base.locationsharewhite.utils.AppPreferences
import
com.base.locationsharewhite.utils.LogEx
import
com.hjq.language.MultiLanguages
import
com.hjq.language.OnLanguageListener
import
java.util.Locale
import
java.util.UUID
...
...
@@ -29,16 +35,6 @@ class MyApplication : Application() {
lateinit
var
appContext
:
MyApplication
// var splashLanguage: String = Locale.getDefault().language + "_" + Locale.getDefault().country
// var mainLanguage: String = Locale.getDefault().language + "_" + Locale.getDefault().country
// var setLanguage: String = Locale.getDefault().language + "_" + Locale.getDefault().country
// var settingsLanguage: String = Locale.getDefault().language + "_" + Locale.getDefault().country
// var howUseLanguage: String = Locale.getDefault().language + "_" + Locale.getDefault().country
// var renameLanguage: String = Locale.getDefault().language + "_" + Locale.getDefault().country
// var locationMapLanguage: String = Locale.getDefault().language + "_" + Locale.getDefault().country
var
umpCanAd
:
Boolean
=
true
@JvmField
var
PAUSED_VALUE
=
0
}
...
...
@@ -49,6 +45,29 @@ class MyApplication : Application() {
appContext
=
this
initUUid
()
initApp
()
// 初始化语种切换框架
MultiLanguages
.
init
(
this
)
// 设置语种变化监听器
MultiLanguages
.
setOnLanguageListener
(
object
:
OnLanguageListener
{
override
fun
onAppLocaleChange
(
oldLocale
:
Locale
,
newLocale
:
Locale
)
{
appLanguageSp
=
newLocale
.
language
appLanguageCountrySp
=
newLocale
.
country
Log
.
i
(
"MultiLanguages"
,
"监听到应用切换了语种,旧语种:$oldLocale,新语种:$newLocale"
)
}
override
fun
onSystemLocaleChange
(
oldLocale
:
Locale
,
newLocale
:
Locale
)
{
Log
.
i
(
"MultiLanguages"
,
"监听到系统切换了语种,旧语种:"
+
oldLocale
+
",新语种:"
+
newLocale
+
",是否跟随系统:"
+
MultiLanguages
.
isSystemLanguage
(
this
@MyApplication
)
)
}
})
}
override
fun
attachBaseContext
(
base
:
Context
?)
{
super
.
attachBaseContext
(
MultiLanguages
.
attach
(
base
))
}
private
fun
initUUid
()
{
...
...
app/src/main/java/com/base/locationsharewhite/service/StayJobService.kt
View file @
df7669b5
...
...
@@ -66,7 +66,7 @@ class StayJobService : JobService() {
}
var
isRunning
=
false
private
var
isRunning
=
false
private
const
val
JOB_INFO_ID
:
Int
=
101
private
const
val
JOB_PERIODIC
:
Long
=
5
*
1000L
fun
Context
.
startJob
()
{
...
...
app/src/main/java/com/base/locationsharewhite/ui/main/MainActivity.kt
View file @
df7669b5
...
...
@@ -2,7 +2,6 @@ package com.base.locationsharewhite.ui.main
import
android.Manifest
import
android.app.Dialog
import
android.app.job.JobService
import
android.content.Intent
import
android.graphics.Color
import
android.os.Build
...
...
@@ -15,11 +14,8 @@ import com.base.locationsharewhite.R
import
com.base.locationsharewhite.databinding.ActivityMainBinding
import
com.base.locationsharewhite.fcm.NotificationUiUtil.sendAllAllowedNotification
import
com.base.locationsharewhite.helper.BaseActivity
import
com.base.locationsharewhite.helper.MyApplication
import
com.base.locationsharewhite.location.LocationLoginUtils
import
com.base.locationsharewhite.map.MapUtils.addLocationMarker
import
com.base.locationsharewhite.service.StayJobService
import
com.base.locationsharewhite.service.StayJobService.Companion.ACTION_LOCATION_UPDATES
import
com.base.locationsharewhite.service.StayJobService.Companion.requestServiceLocationUpdates
import
com.base.locationsharewhite.ui.howuse.HowUseActivity
import
com.base.locationsharewhite.ui.locationmap.LocationMapActivity
...
...
@@ -33,7 +29,6 @@ import com.base.locationsharewhite.utils.PermissionUtils.checkBackgroundLocation
import
com.base.locationsharewhite.utils.PermissionUtils.checkLocationPermission
import
com.base.locationsharewhite.utils.PermissionUtils.checkLocationPermissionDeniedByUser
import
com.base.locationsharewhite.utils.PermissionUtils.requestLocationAllowAllTime
import
com.base.locationsharewhite.utils.ToastUtils.toast
import
com.google.android.gms.maps.CameraUpdateFactory
import
com.google.android.gms.maps.GoogleMap
import
com.google.android.gms.maps.OnMapReadyCallback
...
...
@@ -64,10 +59,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
binding
.
root
.
updatePadding
(
top
=
BarUtils
.
getStatusBarHeight
())
// if (isLanguageRecreate(MyApplication.mainLanguage)) {
// return
// }
mainPresenter
=
MainPresenter
(
this
)
actionId
=
intent
.
extras
?.
getInt
(
"actionId"
)
LogEx
.
logDebug
(
TAG
,
"initView actionId=$actionId"
,
true
)
...
...
@@ -81,7 +72,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
val
denyFlag2
=
checkBackgroundLocationPermissionDeniedByUser
()
LogEx
.
logDebug
(
TAG
,
"用户拒绝 denyFlag1=$denyFlag1 denyFlag2=$denyFlag2"
)
//访问运动数据
//https://developer.android.com/develop/sensors-and-location/location/transitions?hl=zh-cn
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
...
...
@@ -95,24 +85,29 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
mapFragment
?.
getMapAsync
(
this
)
LocationLoginUtils
.
login
()
}
override
fun
onResume
()
{
super
.
onResume
()
// val isRecreate = updateAppLanguage(MyApplication.mainLanguage, TAG) {
// MyApplication.mainLanguage = it
// }
// if (isRecreate) {
// return
// }
mainPresenter
.
startLocationJob
(
lifecycleScope
)
override
fun
onResumeOneShoot
()
{
super
.
onResumeOneShoot
()
showNotificationDialog
()
mainPresenter
.
startLocationJob
(
lifecycleScope
)
showAllowAllTimeDialog
()
isRunning
=
true
changeLanguage
(
this
)
}
private
fun
showNotificationDialog
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
)
{
launcher
.
launch
(
arrayOf
(
Manifest
.
permission
.
POST_NOTIFICATIONS
))
{
}
}
}
override
fun
onStop
()
{
super
.
onStop
()
mainPresenter
.
cancelLocationJob
()
}
private
fun
showAllowAllTimeDialog
()
{
...
...
@@ -143,12 +138,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
}
}
override
fun
initListener
()
{
super
.
initListener
()
// if (isLanguageRecreate(MyApplication.mainLanguage)) {
// return
// }
onBackPressedDispatcher
.
addCallback
{
showAppExitDialog
()
}
...
...
@@ -181,16 +173,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
}
}
override
fun
onPause
()
{
super
.
onPause
()
if
(
isRunning
)
{
mainPresenter
.
cancelLocationJob
()
}
}
var
reSetZoom
=
true
private
var
reSetZoom
=
true
override
fun
onMapReady
(
googleMap
:
GoogleMap
)
{
map
=
googleMap
...
...
app/src/main/java/com/base/locationsharewhite/ui/set/LanguageActivity.kt
View file @
df7669b5
...
...
@@ -3,17 +3,19 @@ package com.base.locationsharewhite.ui.set
import
android.content.Intent
import
android.graphics.Color
import
androidx.core.view.updatePadding
import
com.base.locationsharewhite.bean.ConstObject
import
com.base.locationsharewhite.bean.ConstObject
.appLanguageCountrySp
import
com.base.locationsharewhite.bean.ConstObject.appLanguageSp
import
com.base.locationsharewhite.bean.LanguageBean
import
com.base.locationsharewhite.databinding.ActivityLanguageBinding
import
com.base.locationsharewhite.helper.BaseActivity
import
com.base.locationsharewhite.helper.MyApplication
import
com.base.locationsharewhite.ui.howuse.HowUseActivity
import
com.base.locationsharewhite.utils.BarUtils
import
com.base.locationsharewhite.utils.ToastUtils.toast
import
com.hjq.language.MultiLanguages
import
java.util.Locale
class
LanguageActivity
:
BaseActivity
<
ActivityLanguageBinding
>()
{
private
val
TAG
=
"LanguageActivity"
private
lateinit
var
adapter
:
LanguageAdapter
...
...
@@ -21,14 +23,14 @@ class LanguageActivity : BaseActivity<ActivityLanguageBinding>() {
override
val
binding
:
ActivityLanguageBinding
by
lazy
{
ActivityLanguageBinding
.
inflate
(
layoutInflater
)
}
var
isGuide
:
Boolean
=
false
private
var
isGuide
:
Boolean
=
false
override
fun
initView
()
{
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
WHITE
)
binding
.
root
.
updatePadding
(
top
=
BarUtils
.
getStatusBarHeight
())
isGuide
=
intent
.
extras
?.
getBoolean
(
"isGuide"
)
?:
false
adapter
=
LanguageAdapter
(
click
=
{
adapter
=
LanguageAdapter
(
click
=
{
item
->
})
binding
.
rv
.
adapter
=
adapter
...
...
@@ -38,7 +40,7 @@ class LanguageActivity : BaseActivity<ActivityLanguageBinding>() {
private
fun
initData
()
{
val
languageBeanList
=
listOf
(
LanguageBean
(
LanguageBean
.
English
,
Locale
.
ENGLISH
.
language
,
Locale
.
ENGLISH
.
country
),
LanguageBean
(
LanguageBean
.
简体中文
,
Locale
.
CHINA
.
language
,
Locale
.
CHINA
.
country
),
LanguageBean
(
LanguageBean
.
简体中文
,
Locale
.
SIMPLIFIED_CHINESE
.
language
,
Locale
.
SIMPLIFIED_CHINESE
.
country
),
LanguageBean
(
LanguageBean
.
português
,
Locale
(
"pt"
,
"BR"
).
language
,
Locale
(
"pt"
,
"BR"
).
country
),
LanguageBean
(
LanguageBean
.
Español
,
Locale
(
"es"
).
language
,
Locale
(
"es"
).
country
),
LanguageBean
(
LanguageBean
.
Français
,
Locale
.
FRENCH
.
language
,
Locale
.
FRENCH
.
country
),
...
...
@@ -73,7 +75,8 @@ class LanguageActivity : BaseActivity<ActivityLanguageBinding>() {
val
selectLanguageBean
=
adapter
.
items
.
findLast
{
it
.
isSelect
}
selectLanguageBean
?:
return
@setOnClickListener
ConstObject
.
changeLanguageSp
=
selectLanguageBean
.
language
+
"_"
+
selectLanguageBean
.
country
appLanguageSp
=
selectLanguageBean
.
language
appLanguageCountrySp
=
selectLanguageBean
.
country
if
(
isGuide
)
{
startActivity
(
Intent
(
this
,
HowUseActivity
::
class
.
java
))
...
...
@@ -84,13 +87,6 @@ class LanguageActivity : BaseActivity<ActivityLanguageBinding>() {
override
fun
onResume
()
{
super
.
onResume
()
// val isRecreate = updateAppLanguage(MyApplication.setLanguage, TAG) {
// MyApplication.setLanguage = it
// }
// if (isRecreate) {
// return
// }
}
}
\ No newline at end of file
app/src/main/java/com/base/locationsharewhite/ui/set/SettingActivity.kt
View file @
df7669b5
...
...
@@ -9,7 +9,6 @@ import androidx.core.view.updatePadding
import
com.base.locationsharewhite.R
import
com.base.locationsharewhite.databinding.ActivitySettingBinding
import
com.base.locationsharewhite.helper.BaseActivity
import
com.base.locationsharewhite.helper.MyApplication
import
com.base.locationsharewhite.helper.config.AppConfig
import
com.base.locationsharewhite.location.LocationLoginUtils
import
com.base.locationsharewhite.ui.views.RateDialog.showRateDialog
...
...
@@ -34,7 +33,7 @@ class SettingActivity : BaseActivity<ActivitySettingBinding>() {
override
fun
initListener
()
{
super
.
initListener
()
onBackPressedDispatcher
.
addCallback
{
finish
()
finish
ToMain
()
}
binding
.
flFanhui
.
setOnClickListener
{
onBackPressedDispatcher
.
onBackPressed
()
...
...
@@ -60,14 +59,13 @@ class SettingActivity : BaseActivity<ActivitySettingBinding>() {
}
}
override
fun
onResumeOneShoot
()
{
super
.
onResumeOneShoot
()
changeLanguage
(
this
)
}
override
fun
onResume
()
{
super
.
onResume
()
// val isRecreate = updateAppLanguage(MyApplication.settingsLanguage, TAG) {
// MyApplication.settingsLanguage = it
// }
// if (isRecreate) {
// return
// }
LocationLoginUtils
.
login
()
LocationLoginUtils
.
loginCallBack
=
{
runOnUiThread
{
...
...
app/src/main/java/com/base/locationsharewhite/ui/splash/SplashActivity.kt
View file @
df7669b5
...
...
@@ -63,7 +63,6 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView {
}
override
fun
agreePrivacy
()
{
AdsMgr
.
showOpen
(
this
,
object
:
AdsShowCallBack
()
{
override
fun
show
()
{
LogEx
.
logDebug
(
TAG
,
"AdsShowCallBack show"
)
...
...
app/src/main/res/anim/activity_alpha_in.xml
0 → 100644
View file @
df7669b5
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<alpha
android:duration=
"1000"
android:fromAlpha=
"0"
android:interpolator=
"@android:anim/accelerate_interpolator"
android:toAlpha=
"1"
/>
</set>
\ No newline at end of file
app/src/main/res/anim/activity_alpha_out.xml
0 → 100644
View file @
df7669b5
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<alpha
android:duration=
"1000"
android:fromAlpha=
"1"
android:interpolator=
"@android:anim/accelerate_interpolator"
android:toAlpha=
"0"
/>
</set>
\ No newline at end of file
app/src/main/res/layout/activity_setting.xml
View file @
df7669b5
...
...
@@ -99,8 +99,7 @@
android:layout_marginTop=
"18dp"
android:background=
"?android:attr/selectableItemBackground"
android:clickable=
"true"
android:focusable=
"true"
android:visibility=
"gone"
>
android:focusable=
"true"
>
<ImageView
android:layout_width=
"wrap_content"
...
...
app/src/main/res/values-zh-rCN/strings.xml
0 → 100644
View file @
df7669b5
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<resources>
<string
name=
"moment_please_s"
>
请时刻...%1$d%%
</string>
<string
name=
"friend_location_map"
>
朋友位置图
</string>
<string
name=
"view_friend_locations_on_the_map"
>
在地图上查看好友位置
</string>
<string
name=
"my_location_code"
>
我的位置代码
</string>
<string
name=
"share_location_code"
>
分享我的位置
</string>
<string
name=
"share_my_location"
>
分享我的位置
</string>
<string
name=
"how_to_use"
>
如何使用?
</string>
<string
name=
"settings"
>
设置
</string>
<string
name=
"friends"
>
朋友们
</string>
<string
name=
"friend_tips"
>
当您将位置代码发送给朋友并粘贴该代码以成功共享位置时,大约需要 1-10 分钟才能建立位置共享链接。请耐心等待!
</string>
<string
name=
"got_it"
>
知道了
</string>
<string
name=
"do_not_show_again"
>
不再显示
</string>
<string
name=
"no_friend_location_information"
>
没有好友位置信息
</string>
<string
name=
"street_map"
>
街道地图
</string>
<string
name=
"satellite_map"
>
卫星地图
</string>
<string
name=
"location_code_tips"
>
复制下面的位置代码并将其发送给朋友。当您的朋友将位置代码粘贴到应用程序中并单击“共享”时,您就可以获得他们的位置。
</string>
<string
name=
"copy"
>
复制
</string>
<string
name=
"location_code_share_tips"
>
请您的朋友向您发送位置代码。\n然后将您朋友的位置代码粘贴到下面,\n单击共享按钮共享您的位置。\n
</string>
<string
name=
"enter_others_location_code"
>
输入其他\n位置代码
</string>
<string
name=
"share_my_location_da"
>
分享我的位置
</string>
<string
name=
"what_do_you_want_to_do"
>
你想让我做什么?
</string>
<string
name=
"share_my_nlocation"
>
分享我的\n位置
</string>
<string
name=
"view_others_nlocation"
>
查看其他\n位置
</string>
<string
name=
"how_to_share_my_location"
>
如何分享我的位置?
</string>
<string
name=
"just_2_steps"
>
只需 2 步
</string>
<string
name=
"how_share_location_step_1"
>
1. 请您的朋友向您发送位置代码。
</string>
<string
name=
"how_share_location_step_2"
>
2. 然后在下面粘贴您朋友的位置代码并单击共享按钮共享您的位置。
</string>
<string
name=
"more_two_use"
>
温馨提示:需要两人以上同时下载AP才能使用
</string>
<string
name=
"next"
>
下一个
</string>
<string
name=
"let_s_go"
>
我们走吧
</string>
<string
name=
"how_to_view_others_location"
>
如何查看别人的位置?
</string>
<string
name=
"how_view_other_step_1"
>
1. 复制下面的位置代码并将其发送给朋友。\n
</string>
<string
name=
"how_view_other_step_2"
>
2.当您的朋友在应用中粘贴LLocation\n代码并点击分享时,您就可以获得他们的位置\n
</string>
<string
name=
"hello_ndefault"
>
您好,\n默认!
</string>
<string
name=
"rename"
>
重命名
</string>
<string
name=
"language"
>
语言
</string>
<string
name=
"rate_us"
>
评价我们
</string>
<string
name=
"feedback"
>
反馈
</string>
<string
name=
"about_us"
>
关于我们
</string>
<string
name=
"share_app"
>
分享应用程序
</string>
<string
name=
"enter_your_suggestion_please"
>
请输入您的建议
</string>
<string
name=
"within_500_characters"
>
500字以内
</string>
<string
name=
"thanks_for_your_feedback"
>
感谢您的反馈
</string>
<string
name=
"thank_you_for_your_nsupport"
>
感谢您的支持!\n
</string>
<string
name=
"cancel"
>
取消
</string>
<string
name=
"rate"
>
速度
</string>
<string
name=
"are_you_sure_you_want_to_exit_the_app"
>
您确定要\n退出该应用程序吗?
</string>
<string
name=
"quit"
>
辞职
</string>
<string
name=
"hello"
>
你好
</string>
<string
name=
"a_simple_name_can_make_nothers_find_you_faster"
>
一个简单的名字可以让\n其他人更快地找到你!
</string>
<string
name=
"enter_your_name"
>
输入你的名字
</string>
<string
name=
"name_is_empty"
>
名称为空
</string>
<string
name=
"me"
>
我
</string>
<string
name=
"delete"
>
删除
</string>
<string
name=
"home"
>
家
</string>
<string
name=
"my_code"
>
我的代码
</string>
<string
name=
"share"
>
分享
</string>
<string
name=
"preparing_advertisement"
>
准备广告
</string>
<string
name=
"enter_friend_nickname"
>
输入好友昵称
</string>
<string
name=
"view"
>
看法
</string>
<string
name=
"sharing_location_with_1_people"
>
与 1 人共享位置
</string>
<string
name=
"location_sharing_not_enabled_yet"
>
尚未启用位置共享
</string>
<string
name=
"copy_my_code_to_a_friend_to_view_his_her_location"
>
将我的代码复制给朋友以查看他/她的位置!
</string>
<string
name=
"open"
>
打开
</string>
<string
name=
"sort_by"
>
排序方式
</string>
<string
name=
"allow_all_time_tip"
>
您需要在设置中将“位置”设置为“始终允许”。如果没有,这个应用程序将无法正常工作。
</string>
<string
name=
"allow_all_time_step_1"
>
1.点击下面的“打开设置”
</string>
<string
name=
"allow_all_time_step_2"
>
2.单击“权限”,然后单击“位置”
</string>
<string
name=
"allow_all_time_step_3"
>
3.设置为一直允许
</string>
<string
name=
"allow_all_the_time"
>
允许所有时间
</string>
<string
name=
"open_settings"
>
打开设置
</string>
<string
name=
"privacy_policy"
>
隐私政策
</string>
<string
name=
"set_to_allow_all_the_time"
>
设置为一直允许
</string>
<string
name=
"phone_tracker"
>
电话追踪器
</string>
<string
name=
"background_for_location"
>
应用程序在后台运行以进行位置更新
</string>
<string
name=
"sharing_location_people"
>
与 1 人共享位置
</string>
</resources>
\ No newline at end of file
app/src/main/res/values-zh/strings.xml
0 → 100644
View file @
df7669b5
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<resources>
<string
name=
"moment_please_s"
>
请稍后...%1$d%%
</string>
<string
name=
"friend_location_map"
>
朋友位置图
</string>
<string
name=
"view_friend_locations_on_the_map"
>
在地图上查看好友位置
</string>
<string
name=
"my_location_code"
>
我的位置代码
</string>
<string
name=
"share_location_code"
>
分享我的位置
</string>
<string
name=
"share_my_location"
>
分享我的位置
</string>
<string
name=
"how_to_use"
>
如何使用?
</string>
<string
name=
"settings"
>
设置
</string>
<string
name=
"friends"
>
朋友们
</string>
<string
name=
"friend_tips"
>
当您将位置代码发送给朋友并粘贴该代码以成功共享位置时,大约需要 1-10 分钟才能建立位置共享链接。请耐心等待!
</string>
<string
name=
"got_it"
>
知道了
</string>
<string
name=
"do_not_show_again"
>
不再显示
</string>
<string
name=
"no_friend_location_information"
>
没有好友位置信息
</string>
<string
name=
"street_map"
>
街道地图
</string>
<string
name=
"satellite_map"
>
卫星地图
</string>
<string
name=
"location_code_tips"
>
复制下面的位置代码并将其发送给朋友。当您的朋友将位置代码粘贴到应用程序中并单击“共享”时,您就可以获得他们的位置。
</string>
<string
name=
"copy"
>
复制
</string>
<string
name=
"location_code_share_tips"
>
请您的朋友向您发送位置代码。\n然后将您朋友的位置代码粘贴到下面,\n单击共享按钮共享您的位置。\n
</string>
<string
name=
"enter_others_location_code"
>
输入其他\n位置代码
</string>
<string
name=
"share_my_location_da"
>
分享我的位置
</string>
<string
name=
"what_do_you_want_to_do"
>
你想让我做什么?
</string>
<string
name=
"share_my_nlocation"
>
分享我的\n位置
</string>
<string
name=
"view_others_nlocation"
>
查看其他\n位置
</string>
<string
name=
"how_to_share_my_location"
>
如何分享我的位置?
</string>
<string
name=
"just_2_steps"
>
只需 2 步
</string>
<string
name=
"how_share_location_step_1"
>
1. 请您的朋友向您发送位置代码。
</string>
<string
name=
"how_share_location_step_2"
>
2. 然后在下面粘贴您朋友的位置代码并单击共享按钮共享您的位置。
</string>
<string
name=
"more_two_use"
>
温馨提示:需要两人以上同时下载AP才能使用
</string>
<string
name=
"next"
>
下一个
</string>
<string
name=
"let_s_go"
>
我们走吧
</string>
<string
name=
"how_to_view_others_location"
>
如何查看别人的位置?
</string>
<string
name=
"how_view_other_step_1"
>
1. 复制下面的位置代码并将其发送给朋友。\n
</string>
<string
name=
"how_view_other_step_2"
>
2.当您的朋友在应用中粘贴LLocation\n代码并点击分享时,您就可以获得他们的位置\n
</string>
<string
name=
"hello_ndefault"
>
您好,\n默认!
</string>
<string
name=
"rename"
>
重命名
</string>
<string
name=
"language"
>
语言
</string>
<string
name=
"rate_us"
>
评价我们
</string>
<string
name=
"feedback"
>
反馈
</string>
<string
name=
"about_us"
>
关于我们
</string>
<string
name=
"share_app"
>
分享应用程序
</string>
<string
name=
"enter_your_suggestion_please"
>
请输入您的建议
</string>
<string
name=
"within_500_characters"
>
500字以内
</string>
<string
name=
"thanks_for_your_feedback"
>
感谢您的反馈
</string>
<string
name=
"thank_you_for_your_nsupport"
>
感谢您的支持!\n
</string>
<string
name=
"cancel"
>
取消
</string>
<string
name=
"rate"
>
速度
</string>
<string
name=
"are_you_sure_you_want_to_exit_the_app"
>
您确定要\n退出该应用程序吗?
</string>
<string
name=
"quit"
>
辞职
</string>
<string
name=
"hello"
>
你好
</string>
<string
name=
"a_simple_name_can_make_nothers_find_you_faster"
>
一个简单的名字可以让\n其他人更快地找到你!
</string>
<string
name=
"enter_your_name"
>
输入你的名字
</string>
<string
name=
"name_is_empty"
>
名称为空
</string>
<string
name=
"me"
>
我
</string>
<string
name=
"delete"
>
删除
</string>
<string
name=
"home"
>
家
</string>
<string
name=
"my_code"
>
我的代码
</string>
<string
name=
"share"
>
分享
</string>
<string
name=
"preparing_advertisement"
>
准备广告
</string>
<string
name=
"enter_friend_nickname"
>
输入好友昵称
</string>
<string
name=
"view"
>
看法
</string>
<string
name=
"sharing_location_with_1_people"
>
与 1 人共享位置
</string>
<string
name=
"location_sharing_not_enabled_yet"
>
尚未启用位置共享
</string>
<string
name=
"copy_my_code_to_a_friend_to_view_his_her_location"
>
将我的代码复制给朋友以查看他/她的位置!
</string>
<string
name=
"open"
>
打开
</string>
<string
name=
"sort_by"
>
排序方式
</string>
<string
name=
"allow_all_time_tip"
>
您需要在设置中将“位置”设置为“始终允许”。如果没有,这个应用程序将无法正常工作。
</string>
<string
name=
"allow_all_time_step_1"
>
1.点击下面的“打开设置”
</string>
<string
name=
"allow_all_time_step_2"
>
2.单击“权限”,然后单击“位置”
</string>
<string
name=
"allow_all_time_step_3"
>
3.设置为一直允许
</string>
<string
name=
"allow_all_the_time"
>
允许所有时间
</string>
<string
name=
"open_settings"
>
打开设置
</string>
<string
name=
"privacy_policy"
>
隐私政策
</string>
<string
name=
"set_to_allow_all_the_time"
>
设置为一直允许
</string>
<string
name=
"phone_tracker"
>
电话追踪器
</string>
<string
name=
"background_for_location"
>
应用程序在后台运行以进行位置更新
</string>
<string
name=
"sharing_location_people"
>
与 1 人共享位置
</string>
</resources>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment