mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
Theming test
This commit is contained in:
parent
cddb60d717
commit
1d2f3ab1bb
19 changed files with 113 additions and 73 deletions
|
|
@ -34,7 +34,7 @@
|
|||
<activity
|
||||
android:name=".ui.activities.MainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme.NoActionBar.Transparent"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="stateHidden|adjustResize">
|
||||
<nav-graph android:value="@navigation/navigation" />
|
||||
<intent-filter>
|
||||
|
|
@ -73,12 +73,12 @@
|
|||
<activity
|
||||
android:name=".ui.activities.LoginActivity"
|
||||
android:label="@string/LoginActivityName"
|
||||
android:theme="@style/AppTheme.NoActionBar.Transparent"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.activities.IntroActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar.Transparent"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
</activity>
|
||||
<activity
|
||||
|
|
@ -116,7 +116,7 @@
|
|||
</activity>
|
||||
<activity
|
||||
android:name=".ui.activities.GroupFormActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar.Transparent"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:parentActivityName=".ui.activities.MainActivity"
|
||||
tools:ignore="UnusedAttribute">
|
||||
<meta-data
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/brand_50" />
|
||||
<solid android:color="?colorPrimaryDark" />
|
||||
<corners android:radius="@dimen/bar_radius"/>
|
||||
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
|
||||
</shape>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/white" />
|
||||
<solid android:color="?colorContentBackground" />
|
||||
<corners android:radius="@dimen/rounded_button_radius"/>
|
||||
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
|
||||
</shape>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/brand_200"/>
|
||||
<solid android:color="?colorPrimaryOffset"/>
|
||||
<corners android:radius="20dip"/>
|
||||
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
|
||||
</shape>
|
||||
|
|
@ -91,7 +91,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@color/brand_200"
|
||||
android:background="?colorPrimaryOffset"
|
||||
android:elevation="0dp"
|
||||
android:fillViewport="false"
|
||||
|
||||
|
|
@ -101,7 +101,7 @@
|
|||
|
||||
app:layout_collapseMode="pin"
|
||||
app:tabGravity="fill"
|
||||
app:tabIndicatorColor="@android:color/white"
|
||||
app:tabIndicatorColor="?colorContentBackground"
|
||||
app:tabMode="fixed" />
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
|
@ -125,13 +125,13 @@
|
|||
android:id="@+id/bottom_navigation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:background="@color/brand_100"
|
||||
android:background="?colorPrimary"
|
||||
app:bb_tabXmlResource="@xml/main_menu_tasks"
|
||||
app:bb_inActiveTabColor="@color/brand_500"
|
||||
app:bb_inActiveTabColor="?colorPrimaryDistinct"
|
||||
app:bb_activeTabColor="@color/white"
|
||||
app:bb_behavior="underNavbar"
|
||||
app:bb_badgesHideWhenActive="true"
|
||||
app:bb_badgeBackgroundColor="@color/brand_400"
|
||||
app:bb_badgeBackgroundColor="?colorBadgeBackground"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginBottom="-5dp"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@color/brand"
|
||||
android:background="?colorPrimary"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="vertical"
|
||||
|
|
@ -79,7 +79,7 @@
|
|||
android:layout_height="36dp"
|
||||
android:drawablePadding="6dp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/textColorSecondaryDark"
|
||||
android:textColor="?textColorSecondaryDark"
|
||||
android:textSize="14sp"
|
||||
tools:text="Lvl 12 Warrior"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/brand_200"
|
||||
android:background="?colorPrimaryOffset"
|
||||
android:orientation="vertical"
|
||||
tools:context="com.habitrpg.android.habitica.ui.fragments.NavigationDrawerFragment">
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@
|
|||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginRight="8dp"
|
||||
fab:menu_fab_size="normal"
|
||||
fab:menu_colorNormal="@color/brand_400"
|
||||
fab:menu_colorPressed="@color/brand_500"
|
||||
fab:menu_colorNormal="?colorPrimaryOffset"
|
||||
fab:menu_colorPressed="?colorPrimaryOffset"
|
||||
fab:menu_colorRipple="#FFFFFF"
|
||||
fab:menu_animationDelayPerItem="50"
|
||||
fab:menu_icon="@drawable/fab_add"
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
|
||||
fab:fab_colorNormal="@color/white"
|
||||
fab:fab_colorPressed="@color/brand_500"
|
||||
fab:fab_colorPressed="?colorPrimaryDistinct"
|
||||
fab:fab_colorRipple="#FFFFFF"
|
||||
|
||||
fab:fab_shadowColor="#000"
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
|
||||
fab:fab_colorNormal="@color/white"
|
||||
fab:fab_colorPressed="@color/brand_500"
|
||||
fab:fab_colorPressed="?colorPrimaryDistinct"
|
||||
fab:fab_colorRipple="#FFFFFF"
|
||||
|
||||
fab:fab_shadowColor="#000"
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
|
||||
fab:fab_colorNormal="@color/white"
|
||||
fab:fab_colorPressed="@color/brand_500"
|
||||
fab:fab_colorPressed="?colorPrimaryDistinct"
|
||||
fab:fab_colorRipple="#FFFFFF"
|
||||
|
||||
fab:fab_shadowColor="#000"
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
|
||||
fab:fab_colorNormal="@color/white"
|
||||
fab:fab_colorPressed="@color/brand_500"
|
||||
fab:fab_colorPressed="?colorPrimaryDistinct"
|
||||
fab:fab_colorRipple="#FFFFFF"
|
||||
|
||||
fab:fab_shadowColor="#000"
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|right"
|
||||
tools:text="2"
|
||||
android:background="@drawable/layout_rounded_bg_brand"
|
||||
android:background="@drawable/layout_rounded_bg_primary"
|
||||
android:paddingLeft="2dp"
|
||||
android:paddingRight="2dp"
|
||||
android:textSize="12sp"
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="GemPurchaseListItem">
|
||||
<item name="android:textColor">@color/brand_300</item>
|
||||
<item name="android:gravity">center_horizontal</item>
|
||||
<item name="android:textSize">12sp</item>
|
||||
<item name="android:drawableLeft">@drawable/ic_check_purple</item>
|
||||
<item name="android:layout_gravity">center</item>
|
||||
<item name="android:drawablePadding">4dp</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.ActionBar.Transparent">
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
<item name="android:windowTranslucentNavigation">true</item>
|
||||
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||
<item name="android:windowTranslucentStatus">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="windowActionBarOverlay">true</item>
|
||||
</style>
|
||||
<style name="AppTheme.NoActionBar.Transparent">
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
<item name="android:windowTranslucentNavigation">true</item>
|
||||
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||
<item name="android:windowTranslucentStatus">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
@ -1,4 +1,14 @@
|
|||
<resources>
|
||||
<attr name="colorPrimaryOffset" format="color" />
|
||||
<attr name="colorPrimaryDistinct" format="color" />
|
||||
<attr name="colorBadgeBackground" format="color" />
|
||||
<attr name="colorContentBackground" format="color" />
|
||||
<attr name="colorContentBackgroundOffset" format="color" />
|
||||
<attr name="colorWindowBackground" format="color" />
|
||||
<attr name="textColorPrimary" format="color" />
|
||||
<attr name="textColorSecondary" format="color" />
|
||||
<attr name="textColorPrimaryDark" format="color" />
|
||||
<attr name="textColorSecondaryDark" format="color" />
|
||||
<attr name="statsColor" format="color" />
|
||||
<attr name="statsTitle" format="string" />
|
||||
<attr name="title" format="string" />
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
<color name="green_100">#24CC8F</color>
|
||||
<color name="green_50">#20B780</color>
|
||||
<color name="green_10">#1CA372</color>
|
||||
<color name="green_5">#168059</color>
|
||||
|
||||
<color name="teal_500">#8eedf6</color>
|
||||
<color name="teal_100">#3BCAD7</color>
|
||||
|
|
@ -46,6 +47,7 @@
|
|||
<color name="blue_100">#50B5E9</color>
|
||||
<color name="blue_50">#46A7D9</color>
|
||||
<color name="blue_10">#2995cd</color>
|
||||
<color name="blue_5">#217AA6</color>
|
||||
|
||||
|
||||
<color name="gray_10">#34313a</color>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<!-- Application theme. -->
|
||||
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
|
||||
<style name="AppTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">
|
||||
<item name="android:listSeparatorTextViewStyle">@style/MyOwnListSeperatorTextViewStyle</item>
|
||||
|
||||
<item name="android:elevation" tools:targetApi="21">0dp</item>
|
||||
|
|
@ -19,6 +19,17 @@
|
|||
<item name="colorPrimary">@color/brand</item>
|
||||
<item name="colorPrimaryDark">@color/brand_50</item>
|
||||
<item name="colorAccent">@color/brand</item>
|
||||
<item name="colorPrimaryOffset">@color/brand_200</item>
|
||||
<item name="colorPrimaryDistinct">@color/brand_500</item>
|
||||
<item name="colorBadgeBackground">@color/brand_400</item>
|
||||
|
||||
<item name="textColorPrimary">@color/gray_50</item>
|
||||
<item name="textColorSecondary">@color/gray_200</item>
|
||||
<item name="textColorPrimaryDark">@color/white</item>
|
||||
<item name="textColorSecondaryDark">@color/brand_500</item>
|
||||
|
||||
<item name="colorContentBackground">@color/white</item>
|
||||
<item name="colorWindowBackground">@color/gray_700</item>
|
||||
|
||||
<item name="popupMenuStyle">@style/PopupTheme</item>
|
||||
<item name="actionOverflowMenuStyle">@style/PopupTheme</item>
|
||||
|
|
@ -46,6 +57,13 @@
|
|||
|
||||
<style name="AppTheme.ActionBar.Transparent" parent="AppTheme.ActionBar">
|
||||
<item name="actionBarStyle">@style/ActionBarTransparent</item>
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
<item name="android:windowTranslucentNavigation">true</item>
|
||||
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||
<item name="android:windowTranslucentStatus">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="windowActionBarOverlay">true</item>
|
||||
</style>
|
||||
|
||||
<style name="ActionBarTransparent">
|
||||
|
|
@ -55,9 +73,33 @@
|
|||
<style name="AppTheme.NoActionBar" parent="AppTheme">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
<item name="android:windowTranslucentNavigation">true</item>
|
||||
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||
<item name="android:windowTranslucentStatus">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBar.Transparent">
|
||||
<style name="AppTheme.NoActionBar.Green">
|
||||
<item name="colorPrimary">@color/green_10</item>
|
||||
<item name="colorPrimaryDark">@color/green_5</item>
|
||||
<item name="colorAccent">@color/green_100</item>
|
||||
<item name="colorPrimaryOffset">@color/green_50</item>
|
||||
<item name="colorPrimaryDistinct">@color/green_500</item>
|
||||
<item name="colorBadgeBackground">@color/green_100</item>
|
||||
<item name="textColorSecondaryDark">@color/green_500</item>
|
||||
<item name="android:textColorLink">@color/green_100</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBar.Blue">
|
||||
<item name="colorPrimary">@color/blue_10</item>
|
||||
<item name="colorPrimaryDark">@color/blue_5</item>
|
||||
<item name="colorAccent">@color/blue_100</item>
|
||||
<item name="colorPrimaryOffset">@color/blue_50</item>
|
||||
<item name="colorPrimaryDistinct">@color/blue_500</item>
|
||||
<item name="colorBadgeBackground">@color/blue_100</item>
|
||||
<item name="textColorSecondaryDark">@color/blue_500</item>
|
||||
<item name="android:textColorLink">@color/blue_100</item>
|
||||
</style>
|
||||
|
||||
<style name="AppThemeWithActionBarBlackText" parent="AppTheme.ActionBar">
|
||||
|
|
@ -204,9 +246,9 @@
|
|||
<item name="android:textColor">@color/brand_300</item>
|
||||
<item name="android:gravity">center_horizontal</item>
|
||||
<item name="android:textSize">12sp</item>
|
||||
<item name="android:drawableLeft">@drawable/ic_check_purple_24dp</item>
|
||||
<item name="android:drawableLeft">@drawable/ic_check_purple</item>
|
||||
<item name="android:layout_gravity">center</item>
|
||||
<item name="android:drawablePadding">8dp</item>
|
||||
<item name="android:drawablePadding">4dp</item>
|
||||
</style>
|
||||
|
||||
<style name="SubscriptionListTitle" parent="GemPurchaseListItem">
|
||||
|
|
|
|||
|
|
@ -2,7 +2,15 @@ package com.habitrpg.android.habitica.extensions
|
|||
|
||||
import android.app.Service
|
||||
import android.content.Context
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
|
||||
val Context.layoutInflater: LayoutInflater
|
||||
get() = this.getSystemService(Service.LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
||||
|
||||
|
||||
fun Context.getThemeColor(colorRes: Int): Int {
|
||||
val value = TypedValue()
|
||||
theme.resolveAttribute(colorRes, value, true)
|
||||
return value.data
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import android.os.Bundle
|
|||
import android.preference.PreferenceManager
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import com.habitrpg.android.habitica.HabiticaApplication
|
||||
import com.habitrpg.android.habitica.HabiticaBaseApplication
|
||||
|
|
@ -43,6 +44,7 @@ abstract class BaseActivity : AppCompatActivity() {
|
|||
configuration.setLocale(languageHelper.locale)
|
||||
resources.updateConfiguration(configuration, resources.displayMetrics)
|
||||
|
||||
delegate.setLocalNightMode(AppCompatDelegate.MODE_NIGHT_NO)
|
||||
super.onCreate(savedInstanceState)
|
||||
habiticaApplication
|
||||
injectActivity(HabiticaBaseApplication.component)
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import android.graphics.Canvas
|
|||
import android.graphics.drawable.BitmapDrawable
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.preference.PreferenceManager
|
||||
import android.util.Log
|
||||
import android.util.TypedValue
|
||||
import android.view.*
|
||||
|
|
@ -175,6 +176,13 @@ 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 themeID = sharedPreferences.getInt("theme", R.style.AppTheme_NoActionBar)
|
||||
setTheme(themeID)
|
||||
sharedPreferences.edit {
|
||||
this.putInt("theme", R.style.AppTheme_NoActionBar_Blue)
|
||||
}
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
if (!HabiticaBaseApplication.checkUserAuthentication(this, hostConfig)) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import android.view.Gravity
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.GravityCompat
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import com.habitrpg.android.habitica.HabiticaBaseApplication
|
||||
|
|
@ -15,6 +14,7 @@ import com.habitrpg.android.habitica.R
|
|||
import com.habitrpg.android.habitica.data.InventoryRepository
|
||||
import com.habitrpg.android.habitica.data.SocialRepository
|
||||
import com.habitrpg.android.habitica.data.UserRepository
|
||||
import com.habitrpg.android.habitica.extensions.getThemeColor
|
||||
import com.habitrpg.android.habitica.extensions.notNull
|
||||
import com.habitrpg.android.habitica.helpers.RxErrorHandler
|
||||
import com.habitrpg.android.habitica.models.inventory.Quest
|
||||
|
|
@ -78,8 +78,8 @@ class NavigationDrawerFragment : DialogFragment() {
|
|||
if (quest == null || questContent == null || !quest.active) {
|
||||
questMenuView.visibility = View.GONE
|
||||
context.notNull {
|
||||
adapter.tintColor = ContextCompat.getColor(it, R.color.brand_300)
|
||||
adapter.backgroundTintColor = ContextCompat.getColor(it, R.color.brand_200)
|
||||
adapter.tintColor = it.getThemeColor(R.attr.colorPrimary)
|
||||
adapter.backgroundTintColor = it.getThemeColor(R.attr.colorPrimaryOffset)
|
||||
}
|
||||
adapter.items.filter { it.identifier == SIDEBAR_TAVERN }.forEach {
|
||||
it.additionalInfo = null
|
||||
|
|
@ -125,7 +125,7 @@ class NavigationDrawerFragment : DialogFragment() {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val context = context
|
||||
adapter = if (context != null) {
|
||||
NavigationDrawerAdapter(ContextCompat.getColor(context, R.color.brand_300), ContextCompat.getColor(context, R.color.brand_200))
|
||||
NavigationDrawerAdapter(context.getThemeColor(R.attr.colorPrimary), context.getThemeColor(R.attr.colorPrimaryOffset))
|
||||
} else {
|
||||
NavigationDrawerAdapter(0, 0)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ package com.habitrpg.android.habitica.ui.fragments.tasks
|
|||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.FragmentPagerAdapter
|
||||
import android.view.*
|
||||
import androidx.fragment.app.FragmentPagerAdapter
|
||||
import com.github.clans.fab.FloatingActionButton
|
||||
import com.github.clans.fab.FloatingActionMenu
|
||||
import com.habitrpg.android.habitica.HabiticaBaseApplication
|
||||
|
|
@ -12,7 +12,6 @@ import com.habitrpg.android.habitica.R
|
|||
import com.habitrpg.android.habitica.components.AppComponent
|
||||
import com.habitrpg.android.habitica.data.TagRepository
|
||||
import com.habitrpg.android.habitica.events.TaskTappedEvent
|
||||
import com.habitrpg.android.habitica.extensions.notNull
|
||||
import com.habitrpg.android.habitica.helpers.RxErrorHandler
|
||||
import com.habitrpg.android.habitica.helpers.TaskFilterHelper
|
||||
import com.habitrpg.android.habitica.models.tasks.Task
|
||||
|
|
@ -117,25 +116,22 @@ class TasksFragment : BaseMainFragment() {
|
|||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
val id = item.itemId
|
||||
|
||||
when (id) {
|
||||
return when (item.itemId) {
|
||||
R.id.action_search -> {
|
||||
showFilterDialog()
|
||||
return true
|
||||
true
|
||||
}
|
||||
R.id.action_reload -> {
|
||||
refreshItem = item
|
||||
refresh()
|
||||
return true
|
||||
true
|
||||
}
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
private fun showFilterDialog() {
|
||||
context.notNull {
|
||||
context?.let {
|
||||
val dialog = TaskFilterDialog(it, HabiticaBaseApplication.component)
|
||||
if (user != null) {
|
||||
dialog.setTags(user?.tags?.createSnapshot() ?: emptyList())
|
||||
|
|
|
|||
|
|
@ -3,18 +3,20 @@ package com.habitrpg.android.habitica.ui.views
|
|||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.drawable.Drawable
|
||||
import androidx.core.content.ContextCompat
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.extensions.getThemeColor
|
||||
import com.habitrpg.android.habitica.ui.helpers.bindView
|
||||
import java.math.RoundingMode
|
||||
import java.text.NumberFormat
|
||||
|
||||
|
||||
class ValueBar(context: Context, attrs: AttributeSet?) : FrameLayout(context, attrs) {
|
||||
|
||||
private val iconView: ImageView by bindView(R.id.ic_header)
|
||||
|
|
@ -147,8 +149,8 @@ class ValueBar(context: Context, attrs: AttributeSet?) : FrameLayout(context, at
|
|||
textColor = ContextCompat.getColor(context, R.color.gray_10)
|
||||
progressBar.setBackgroundResource(R.drawable.layout_rounded_bg_light_gray)
|
||||
} else {
|
||||
textColor = ContextCompat.getColor(context, R.color.brand_500)
|
||||
progressBar.setBackgroundResource(R.drawable.layout_rounded_bg_brand)
|
||||
textColor = context.getThemeColor(R.attr.textColorPrimaryDark)
|
||||
progressBar.setBackgroundResource(R.drawable.layout_rounded_bg_primary)
|
||||
}
|
||||
valueTextView.setTextColor(textColor)
|
||||
descriptionTextView.setTextColor(textColor)
|
||||
|
|
|
|||
Loading…
Reference in a new issue