mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-08-01 11:40:34 +00:00
fix manual langauge selection
This commit is contained in:
parent
3733d65573
commit
145d6bae40
6 changed files with 21 additions and 18 deletions
|
|
@ -150,8 +150,8 @@ android {
|
|||
buildConfigField "String", "TESTING_LEVEL", "\"production\""
|
||||
multiDexEnabled true
|
||||
|
||||
versionCode 2123
|
||||
versionName "1.9"
|
||||
versionCode 2126
|
||||
versionName "1.9.1"
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import com.habitrpg.android.habitica.models.responses.TaskDirectionData
|
|||
import com.habitrpg.android.habitica.models.tasks.Task
|
||||
import com.habitrpg.android.habitica.models.user.Stats
|
||||
import com.habitrpg.android.habitica.models.user.User
|
||||
import java.util.ArrayList
|
||||
import java.util.*
|
||||
|
||||
class ScoreTaskLocallyInteractor {
|
||||
companion object {
|
||||
|
|
@ -25,7 +25,7 @@ class ScoreTaskLocallyInteractor {
|
|||
|
||||
if (task.checklist?.size ?: 0 > 0) {
|
||||
if (task.type == Task.TYPE_TODO) {
|
||||
nextDelta *= 1 + (task.checklist?.map { if (it.completed) 1 else 0 }?.reduce { acc, i -> 0 }
|
||||
nextDelta *= 1 + (task.checklist?.map { if (it.completed) 1 else 0 }?.reduce { _, _ -> 0 }
|
||||
?: 0)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -277,12 +277,12 @@ open class Task : RealmObject, Parcelable {
|
|||
constructor()
|
||||
|
||||
protected constructor(`in`: Parcel) {
|
||||
this.userId = `in`.readString()
|
||||
this.userId = `in`.readString() ?: ""
|
||||
this.priority = `in`.readValue(Float::class.java.classLoader) as? Float ?: 0f
|
||||
this.text = `in`.readString()
|
||||
this.text = `in`.readString() ?: ""
|
||||
this.notes = `in`.readString()
|
||||
this.attribute = `in`.readString()
|
||||
this.type = `in`.readString()
|
||||
this.type = `in`.readString() ?: ""
|
||||
this.value = `in`.readDouble()
|
||||
this.tags = RealmList()
|
||||
`in`.readList(this.tags, TaskTag::class.java.classLoader)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.habitrpg.android.habitica.ui.activities
|
||||
|
||||
import android.content.res.Configuration
|
||||
import android.os.Bundle
|
||||
import android.preference.PreferenceManager
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
|
|
@ -9,9 +11,11 @@ import com.habitrpg.android.habitica.HabiticaBaseApplication
|
|||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.components.AppComponent
|
||||
import com.habitrpg.android.habitica.events.ShowConnectionProblemEvent
|
||||
import com.habitrpg.android.habitica.helpers.LanguageHelper
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import java.util.*
|
||||
|
||||
|
||||
abstract class BaseActivity : AppCompatActivity() {
|
||||
|
|
@ -32,6 +36,13 @@ abstract class BaseActivity : AppCompatActivity() {
|
|||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
val languageHelper = LanguageHelper(sharedPreferences.getString("language", "en"))
|
||||
Locale.setDefault(languageHelper.locale)
|
||||
val configuration = Configuration()
|
||||
configuration.setLocale(languageHelper.locale)
|
||||
resources.updateConfiguration(configuration, resources.displayMetrics)
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
habiticaApplication
|
||||
injectActivity(HabiticaBaseApplication.component)
|
||||
|
|
|
|||
|
|
@ -175,11 +175,6 @@ open class MainActivity : BaseActivity(), TutorialView.OnTutorialReaction {
|
|||
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||
launchTrace = FirebasePerformance.getInstance().newTrace("MainActivityLaunch")
|
||||
launchTrace?.start()
|
||||
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
val languageHelper = LanguageHelper(sharedPreferences.getString("language", "en"))
|
||||
Locale.setDefault(languageHelper.locale)
|
||||
val configuration = Configuration()
|
||||
configuration.setLocale(languageHelper.locale)
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
if (!HabiticaBaseApplication.checkUserAuthentication(this, hostConfig)) {
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ package com.habitrpg.android.habitica.ui.views.stats
|
|||
import android.app.ProgressDialog
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import android.view.LayoutInflater
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.components.AppComponent
|
||||
import com.habitrpg.android.habitica.data.UserRepository
|
||||
|
|
@ -23,7 +23,7 @@ class BulkAllocateStatsDialog(context: Context, component: AppComponent?) : Aler
|
|||
|
||||
var subscription: Disposable? = null
|
||||
|
||||
private var allocatedPoints: Int
|
||||
private val allocatedPoints: Int
|
||||
get() {
|
||||
var value = 0
|
||||
value += strengthSliderView.currentValue
|
||||
|
|
@ -32,9 +32,6 @@ class BulkAllocateStatsDialog(context: Context, component: AppComponent?) : Aler
|
|||
value += perceptionSliderView.currentValue
|
||||
return value
|
||||
}
|
||||
set(value) {
|
||||
return
|
||||
}
|
||||
|
||||
private var pointsToAllocate = 0
|
||||
set(value) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue