mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
minor fixes
This commit is contained in:
parent
298bd3e434
commit
f80de5dc49
9 changed files with 97 additions and 25 deletions
|
|
@ -4,8 +4,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.activities.PrefsActivity"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="@color/content_background">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -17,9 +17,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:theme="@style/Toolbar.Modern"
|
||||
android:background="?attr/headerBackgroundColor"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Dark"/>
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
<androidx.core.widget.NestedScrollView
|
||||
|
|
|
|||
|
|
@ -1237,4 +1237,19 @@
|
|||
<string name="gems_support">Purchasing Gems supports our small team at Habitica</string>
|
||||
<string name="month_released">Month Released</string>
|
||||
<string name="incorrect_password">The password was incorrect</string>
|
||||
|
||||
<string name="habitica_official">Habitica Official</string>
|
||||
<string name="academics">Academics</string>
|
||||
<string name="advocacy_causes">Advocacy + Causes</string>
|
||||
<string name="creativity">Creativity</string>
|
||||
<string name="entertainment">Entertainment</string>
|
||||
<string name="finance">Finance</string>
|
||||
<string name="health_fitness">Health + Fitness</string>
|
||||
<string name="hobbies_occupations">Hobbies + Occupations</string>
|
||||
<string name="location_based">Location-based</string>
|
||||
<string name="mental_health">Mental Health + Self Care</string>
|
||||
<string name="getting_organized">Getting Organized</string>
|
||||
<string name="self_improvement">Self Improvement</string>
|
||||
<string name="spirituality">Spirituality</string>
|
||||
<string name="time_management">Time Management + Accountability</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -234,6 +234,41 @@
|
|||
<item>compact</item>
|
||||
<item>minimal</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<bool name="isTabletUI">false</bool>
|
||||
|
||||
<string-array name="challenge_category_values">
|
||||
<item>habitica_official</item>
|
||||
<item>academics</item>
|
||||
<item>advocacy_causes</item>
|
||||
<item>creativity</item>
|
||||
<item>entertainment</item>
|
||||
<item>finance</item>
|
||||
<item>health_fitness</item>
|
||||
<item>hobbies_occupations</item>
|
||||
<item>location_based</item>
|
||||
<item>mental_health</item>
|
||||
<item>getting_organized</item>
|
||||
<item>self_improvement</item>
|
||||
<item>spirituality'</item>
|
||||
<item>time_management'</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="challenge_category_labels">
|
||||
<item>@string/habitica_official</item>
|
||||
<item>@string/academics</item>
|
||||
<item>@string/advocacy_causes</item>
|
||||
<item>@string/creativity</item>
|
||||
<item>@string/entertainment</item>
|
||||
<item>@string/finance</item>
|
||||
<item>@string/health_fitness</item>
|
||||
<item>@string/hobbies_occupations</item>
|
||||
<item>@string/location_based</item>
|
||||
<item>@string/mental_health</item>
|
||||
<item>@string/getting_organized</item>
|
||||
<item>@string/self_improvement</item>
|
||||
<item>@string/spirituality</item>
|
||||
<item>@string/time_management</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ open class TaskGroupPlan : RealmObject(), BaseObject {
|
|||
var assigningUsername: String? = null
|
||||
var assignedUsers: RealmList<String> = RealmList()
|
||||
|
||||
var approvalRequested: Boolean = false
|
||||
var approvalApproved: Boolean = false
|
||||
var approvalRequired: Boolean = false
|
||||
var approvalRequested: Boolean? = false
|
||||
var approvalApproved: Boolean? = false
|
||||
var approvalRequired: Boolean? = false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import android.widget.EditText
|
|||
import android.widget.TextView
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.appcompat.widget.AppCompatCheckedTextView
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.components.UserComponent
|
||||
|
|
@ -219,8 +218,7 @@ class ChallengeFormActivity : BaseActivity() {
|
|||
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
val toolbar = findViewById<Toolbar>(R.id.toolbar)
|
||||
setSupportActionBar(toolbar)
|
||||
setupToolbar(findViewById(R.id.toolbar))
|
||||
|
||||
val intent = intent
|
||||
val bundle = intent.extras
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ class PurchaseDialog(context: Context, component: UserComponent?, val item: Shop
|
|||
observable = inventoryRepository.purchaseQuest(shopItem.key).cast(Any::class.java)
|
||||
} else if (shopItem.purchaseType == "debuffPotion") {
|
||||
observable = userRepository.useSkill(shopItem.key, null).cast(Any::class.java)
|
||||
} else if (shopItem.purchaseType == "customization" || shopItem.purchaseType == "background" || shopItem.purchaseType == "customizationSet") {
|
||||
} else if (shopItem.purchaseType == "customization" || shopItem.purchaseType == "background" || shopItem.purchaseType == "backgrounds" || shopItem.purchaseType == "customizationSet") {
|
||||
observable = userRepository.unlockPath(item.unlockPath ?: "", item.value).cast(Any::class.java)
|
||||
} else if (shopItem.purchaseType == "debuffPotion") {
|
||||
observable = userRepository.useSkill(shopItem.key, null).cast(Any::class.java)
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ class YesterdailyDialog private constructor(
|
|||
) : HabiticaAlertDialog(context) {
|
||||
|
||||
private lateinit var yesterdailiesList: LinearLayout
|
||||
|
||||
init {
|
||||
val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as? LayoutInflater
|
||||
val view = inflater?.inflate(R.layout.dialog_yesterdaily, null)
|
||||
|
|
@ -94,21 +95,29 @@ class YesterdailyDialog private constructor(
|
|||
task.completed = !task.completed
|
||||
configureTaskView(taskView, task)
|
||||
|
||||
if (task.checklist?.size ?: 0 > 0) {
|
||||
if ((task.checklist?.size ?: 0) > 0) {
|
||||
val checklistContainer = taskView.findViewById<ViewGroup>(R.id.checklistView)
|
||||
checklistContainer.removeAllViews()
|
||||
for (item in task.checklist ?: emptyList<ChecklistItem>()) {
|
||||
val checklistView = inflater.inflate(R.layout.checklist_item_row, checklistContainer, false) as ViewGroup
|
||||
val checklistView = inflater.inflate(
|
||||
R.layout.checklist_item_row,
|
||||
checklistContainer,
|
||||
false
|
||||
) as ViewGroup
|
||||
configureChecklistView(checklistView, task, item)
|
||||
checklistContainer.addView(checklistView)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (task.checklist?.size ?: 0 > 0) {
|
||||
if ((task.checklist?.size ?: 0) > 0) {
|
||||
val checklistContainer = taskView.findViewById<ViewGroup>(R.id.checklistView)
|
||||
for (item in task.checklist ?: emptyList<ChecklistItem>()) {
|
||||
val checklistView = inflater.inflate(R.layout.checklist_item_row, checklistContainer, false) as ViewGroup
|
||||
val checklistView = inflater.inflate(
|
||||
R.layout.checklist_item_row,
|
||||
checklistContainer,
|
||||
false
|
||||
) as ViewGroup
|
||||
configureChecklistView(checklistView, task, item)
|
||||
checklistContainer.addView(checklistView)
|
||||
}
|
||||
|
|
@ -128,12 +137,14 @@ class YesterdailyDialog private constructor(
|
|||
val checkboxHolder = checklistView.findViewById<View>(R.id.checkBoxHolder) as? ViewGroup
|
||||
checkboxHolder?.setOnClickListener { _ ->
|
||||
item.completed = !item.completed
|
||||
taskRepository.scoreChecklistItem(task.id ?: "", item.id ?: "").subscribe({ }, RxErrorHandler.handleEmptyError())
|
||||
taskRepository.scoreChecklistItem(task.id ?: "", item.id ?: "")
|
||||
.subscribe({ }, RxErrorHandler.handleEmptyError())
|
||||
configureChecklistView(checklistView, task, item)
|
||||
}
|
||||
checklistView.setOnClickListener {
|
||||
item.completed = !item.completed
|
||||
taskRepository.scoreChecklistItem(task.id ?: "", item.id ?: "").subscribe({ }, RxErrorHandler.handleEmptyError())
|
||||
taskRepository.scoreChecklistItem(task.id ?: "", item.id ?: "")
|
||||
.subscribe({ }, RxErrorHandler.handleEmptyError())
|
||||
configureChecklistView(checklistView, task, item)
|
||||
}
|
||||
checkboxHolder?.setBackgroundResource(
|
||||
|
|
@ -225,8 +236,12 @@ class YesterdailyDialog private constructor(
|
|||
return@filter true
|
||||
}
|
||||
.firstElement()
|
||||
.map {
|
||||
it.filter { !it.isGroupTask }
|
||||
}
|
||||
.zipWith(
|
||||
taskRepository.getTasksFlowable(TaskType.DAILY, null, emptyArray()).firstElement()
|
||||
taskRepository.getTasksFlowable(TaskType.DAILY, null, emptyArray())
|
||||
.firstElement()
|
||||
.map {
|
||||
val taskMap = mutableMapOf<String, Int>()
|
||||
it.forEachIndexed { index, task -> taskMap[task.id ?: ""] = index }
|
||||
|
|
@ -239,10 +254,22 @@ class YesterdailyDialog private constructor(
|
|||
{ tasks ->
|
||||
val additionalData = HashMap<String, Any>()
|
||||
additionalData["task count"] = tasks.size
|
||||
AmplitudeManager.sendEvent("show cron", AmplitudeManager.EVENT_CATEGORY_BEHAVIOUR, AmplitudeManager.EVENT_HITTYPE_EVENT, additionalData)
|
||||
AmplitudeManager.sendEvent(
|
||||
"show cron",
|
||||
AmplitudeManager.EVENT_CATEGORY_BEHAVIOUR,
|
||||
AmplitudeManager.EVENT_HITTYPE_EVENT,
|
||||
additionalData
|
||||
)
|
||||
|
||||
if (tasks.isNotEmpty()) {
|
||||
displayedDialog = WeakReference(showDialog(activity, userRepository, taskRepository, tasks))
|
||||
displayedDialog = WeakReference(
|
||||
showDialog(
|
||||
activity,
|
||||
userRepository,
|
||||
taskRepository,
|
||||
tasks
|
||||
)
|
||||
)
|
||||
} else {
|
||||
lastCronRun = Date()
|
||||
userRepository.runCron()
|
||||
|
|
|
|||
|
|
@ -129,8 +129,8 @@ class TaskSerializer : JsonSerializer<Task>, JsonDeserializer<Task> {
|
|||
if (approvalObject.has("requested")) group.approvalRequested = approvalObject.getAsJsonPrimitive("requested").asBooleanOrFalse
|
||||
if (approvalObject.has("approved")) group.approvalApproved = approvalObject.getAsJsonPrimitive("approved").asBooleanOrFalse
|
||||
if (approvalObject.has("required")) group.approvalRequired = approvalObject.getAsJsonPrimitive("required").asBooleanOrFalse
|
||||
task.group = group
|
||||
}
|
||||
task.group = group
|
||||
}
|
||||
// Work around since Realm does not support Arrays of ints
|
||||
getMonthlyDays(json, task)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import android.appwidget.AppWidgetManager
|
|||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.RemoteViews
|
||||
|
|
@ -95,8 +94,7 @@ class AvatarStatsWidgetProvider : BaseWidgetProvider() {
|
|||
columns: Int,
|
||||
rows: Int
|
||||
): RemoteViews {
|
||||
showAvatar[widgetId] =
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) columns > 4 else columns > 3
|
||||
showAvatar[widgetId] = columns > 3
|
||||
if (showAvatar[widgetId] == true) {
|
||||
remoteViews.setViewVisibility(R.id.avatar_view, View.VISIBLE)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue