mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
Fix design issues
This commit is contained in:
parent
268161e798
commit
f7aa5068b7
12 changed files with 72 additions and 29 deletions
|
|
@ -4,9 +4,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
android:choiceMode="singleChoice"
|
||||
android:dividerHeight="0dp"
|
||||
android:fitsSystemWindows="true"
|
||||
android:orientation="vertical"
|
||||
tools:context="com.habitrpg.android.habitica.ui.fragments.NavigationDrawerFragment">
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
android:visibility="gone"/>
|
||||
<TextView
|
||||
android:id="@+id/additionalInfoView"
|
||||
style="@style/Body1"
|
||||
android:textSize="12sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
|||
|
|
@ -10,4 +10,5 @@
|
|||
android:textColor="@color/white"
|
||||
android:paddingLeft="@dimen/drawer_padding"
|
||||
android:paddingRight="@dimen/drawer_padding"
|
||||
android:textAllCaps="true"/>
|
||||
android:textAllCaps="true"
|
||||
android:gravity="center_vertical"/>
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
android:layout_weight="1"
|
||||
android:text="@string/boss_art"
|
||||
android:textColor="@color/white"
|
||||
style="@style/Body1" />
|
||||
android:textSize="16sp" />
|
||||
<TextView
|
||||
android:id="@+id/artCreditTextView"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -35,8 +35,8 @@
|
|||
android:layout_marginRight="@dimen/spacing_medium"/>
|
||||
<ImageView
|
||||
android:id="@+id/caretView"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp" />
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:id="@+id/questImageSeparator"
|
||||
|
|
@ -45,7 +45,8 @@
|
|||
<FrameLayout
|
||||
android:id="@+id/questImageWrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:clipChildren="true">
|
||||
<com.habitrpg.android.habitica.ui.views.WrapContentDraweeView
|
||||
android:id="@+id/questImageView"
|
||||
android:layout_width="219dp"
|
||||
|
|
@ -54,11 +55,21 @@
|
|||
android:paddingBottom="@dimen/spacing_large"
|
||||
android:paddingLeft="@dimen/spacing_large"
|
||||
android:paddingRight="@dimen/spacing_large"
|
||||
android:layout_gravity="center_horizontal" /></FrameLayout>
|
||||
android:layout_gravity="center_horizontal" />
|
||||
<com.habitrpg.android.habitica.ui.views.WrapContentDraweeView
|
||||
android:id="@+id/questFlourishesImageView"
|
||||
android:layout_width="310dp"
|
||||
android:layout_height="219dp"
|
||||
android:layout_marginTop="@dimen/spacing_large"
|
||||
android:paddingBottom="@dimen/spacing_large"
|
||||
android:paddingLeft="@dimen/spacing_large"
|
||||
android:paddingRight="@dimen/spacing_large"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
</FrameLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/spacing_small"
|
||||
android:layout_marginBottom="@dimen/spacing_medium"
|
||||
android:paddingLeft="@dimen/spacing_large"
|
||||
android:paddingRight="@dimen/spacing_large"
|
||||
android:layout_marginTop="@dimen/spacing_large">
|
||||
|
|
@ -90,19 +101,33 @@
|
|||
app:textColor="@color/white"
|
||||
app:barBackgroundColor="@color/white_15_alpha"
|
||||
app:barHeight="8dp"
|
||||
app:labelSpacing="@dimen/spacing_medium"
|
||||
android:paddingLeft="@dimen/spacing_large"
|
||||
android:paddingRight="@dimen/spacing_large" />
|
||||
<TextView
|
||||
android:id="@+id/rageMeterView"
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Boss Rage"
|
||||
style="@style/Body1"
|
||||
android:layout_marginBottom="@dimen/spacing_small"
|
||||
android:layout_marginBottom="@dimen/spacing_medium"
|
||||
android:layout_marginTop="@dimen/spacing_large"
|
||||
android:paddingLeft="@dimen/spacing_large"
|
||||
android:paddingRight="@dimen/spacing_large"
|
||||
android:textColor="@color/white"/>
|
||||
android:paddingRight="@dimen/spacing_large">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/rage_attack"
|
||||
style="@style/Body1"
|
||||
android:textColor="@color/white"/>
|
||||
<TextView
|
||||
android:id="@+id/rageMeterView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Boss Rage"
|
||||
android:textSize="14sp"
|
||||
android:layout_marginLeft="@dimen/spacing_medium"
|
||||
android:textColor="@color/white"/>
|
||||
</LinearLayout>
|
||||
<com.habitrpg.android.habitica.ui.views.ValueBar
|
||||
android:id="@+id/bossRageView"
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -111,6 +136,7 @@
|
|||
app:textColor="@color/white"
|
||||
app:barBackgroundColor="@color/white_15_alpha"
|
||||
app:barHeight="8dp"
|
||||
app:labelSpacing="@dimen/spacing_medium"
|
||||
android:paddingLeft="@dimen/spacing_large"
|
||||
android:paddingRight="@dimen/spacing_large"
|
||||
android:layout_marginBottom="@dimen/spacing_large"/>
|
||||
|
|
|
|||
|
|
@ -27,11 +27,12 @@
|
|||
android:orientation="horizontal" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/labelWrapper"
|
||||
android:layout_below="@id/progressBar"
|
||||
android:layout_toRightOf="@id/ic_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp">
|
||||
android:paddingTop="4dp">
|
||||
<ImageView
|
||||
android:id="@+id/secondaryIconView"
|
||||
android:layout_width="@dimen/icon_size"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
tools:parentTag="android.widget.LinearLayout">
|
||||
<View
|
||||
android:id="@+id/separator"
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -14,7 +15,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/spacing_large"
|
||||
android:paddingRight="@dimen/spacing_large"
|
||||
android:gravity="center_vertical">
|
||||
<TextView
|
||||
android:id="@+id/titleTextView"
|
||||
|
|
@ -42,6 +42,6 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="center"
|
||||
android:layout_marginRight="16dp" />
|
||||
android:paddingRight="32dp" />
|
||||
</LinearLayout>
|
||||
</merge>
|
||||
|
|
@ -45,6 +45,7 @@
|
|||
<attr name="barHeight" format="dimension" />
|
||||
<attr name="lightBackground" format="boolean" />
|
||||
<attr name="description" format="string" />
|
||||
<attr name="labelSpacing" format="dimension" />
|
||||
</declare-styleable>
|
||||
<declare-styleable name="HabiticaProgressBar">
|
||||
<attr name="barForegroundColor" />
|
||||
|
|
@ -81,5 +82,6 @@
|
|||
<attr name="color" format="color" />
|
||||
<attr name="identifier" />
|
||||
<attr name="hasAdditionalInfo" format="boolean" />
|
||||
<attr name="titleSize" format="dimension" />
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -776,6 +776,6 @@
|
|||
<string name="world_boss_description_subtitle">%s attacks!</string>
|
||||
<string name="questShop_owner_long">Ian the Quest Guide</string>
|
||||
<string name="seasonalShop_owner_long">Seasonal Sorceress</string>
|
||||
<string name="rage_attack" formatted="false">Rage attack: %s</string>
|
||||
<string name="rage_attack">Rage attack:</string>
|
||||
<string name="tavern_description_world_boss">Oh dear, pay no heed to the monster below -- this is still a safe haven to chat on your breaks.</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -143,4 +143,8 @@ class CollapsibleSectionView(context: Context?, attrs: AttributeSet?) : LinearLa
|
|||
isCollapsed = true
|
||||
}
|
||||
}
|
||||
|
||||
fun setCaretOffset(offset: Int) {
|
||||
caretView.setPadding(0, 0, offset, 0)
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import android.graphics.drawable.Drawable
|
|||
import android.support.v4.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
|
||||
|
|
@ -20,6 +21,7 @@ class ValueBar(context: Context?, attrs: AttributeSet?) : FrameLayout(context, a
|
|||
private val valueTextView: TextView by bindView(R.id.valueLabel)
|
||||
private val descriptionTextView: TextView by bindView(R.id.descriptionLabel)
|
||||
private val progressBar: HabiticaProgressBar by bindView(R.id.progressBar)
|
||||
private val labelWrapper: ViewGroup by bindView(R.id.labelWrapper)
|
||||
|
||||
private val formatter = NumberFormat.getInstance()
|
||||
|
||||
|
|
@ -45,7 +47,7 @@ class ValueBar(context: Context?, attrs: AttributeSet?) : FrameLayout(context, a
|
|||
|
||||
private fun updateBar() {
|
||||
this.progressBar.set(currentValue, maxValue)
|
||||
this.setValueText(formatter.format(currentValue) + "/" + formatter.format(maxValue.toInt()))
|
||||
this.setValueText(formatter.format(currentValue) + " / " + formatter.format(maxValue.toInt()))
|
||||
}
|
||||
|
||||
init {
|
||||
|
|
@ -60,6 +62,10 @@ class ValueBar(context: Context?, attrs: AttributeSet?) : FrameLayout(context, a
|
|||
progressBar.barForegroundColor = attributes?.getColor(R.styleable.ValueBar_barForegroundColor, 0) ?: 0
|
||||
progressBar.barBackgroundColor = attributes?.getColor(R.styleable.ValueBar_barBackgroundColor, 0) ?: 0
|
||||
|
||||
val labelSpacing = attributes?.getDimension(R.styleable.ValueBar_labelSpacing, context.resources.getDimension(R.dimen.spacing_small))
|
||||
if (labelSpacing != null) {
|
||||
labelWrapper.setPadding(0, labelSpacing.toInt(), 0, 0)
|
||||
}
|
||||
|
||||
barHeight = attributes?.getDimension(R.styleable.ValueBar_barHeight, context.resources.getDimension(R.dimen.bar_size))?.toInt()
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import android.text.Editable
|
|||
import android.text.TextWatcher
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.EditText
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.ImageButton
|
||||
|
|
@ -72,8 +73,8 @@ class ChatBarView : FrameLayout {
|
|||
|
||||
val navbarHeight = NavbarUtils.getNavbarHeight(context)
|
||||
val finalHeight = currentHeight + navbarHeight
|
||||
chatBarContainer.layoutParams.height = finalHeight
|
||||
invalidate()
|
||||
layoutParams.height = finalHeight
|
||||
(parent as? View)?.invalidate()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ class QuestProgressView : LinearLayout {
|
|||
|
||||
private val questImageWrapper: FrameLayout by bindView(R.id.questImageWrapper)
|
||||
private val questImageView: SimpleDraweeView by bindView(R.id.questImageView)
|
||||
private val questFlourishesImageView: SimpleDraweeView by bindView(R.id.questFlourishesImageView)
|
||||
private val questImageTitle: View by bindView(R.id.questImageTitle)
|
||||
private val artCreditTextView: TextView by bindView(R.id.artCreditTextView)
|
||||
private val questImageSeparator: View by bindView(R.id.questImageSeparator)
|
||||
|
|
@ -101,6 +102,10 @@ class QuestProgressView : LinearLayout {
|
|||
|
||||
rageStrikeDescriptionView.setOnClickListener { showStrikeDescriptionAlert() }
|
||||
|
||||
val density = resources.displayMetrics.density
|
||||
|
||||
questDescriptionSection.setCaretOffset((12 * density).toInt())
|
||||
|
||||
preferences = context.getSharedPreferences("collapsible_sections", 0)
|
||||
if (preferences?.getBoolean("boss_art_collapsed", false) == true) {
|
||||
hideQuestImage()
|
||||
|
|
@ -140,7 +145,7 @@ class QuestProgressView : LinearLayout {
|
|||
if (quest.boss.hasRage()) {
|
||||
rageMeterView.visibility = View.VISIBLE
|
||||
bossRageView.visibility = View.VISIBLE
|
||||
rageMeterView.text = context.getString(R.string.rage_attack, quest.boss.rage?.title)
|
||||
rageMeterView.text = quest.boss.rage?.title
|
||||
bossRageView.set(progress.progress?.rage ?: 0.0, quest.boss?.rage?.value ?: 0.0)
|
||||
if (progress.hasRageStrikes()) {
|
||||
setupRageStrikeViews()
|
||||
|
|
@ -166,6 +171,7 @@ class QuestProgressView : LinearLayout {
|
|||
}
|
||||
questDescriptionView.text = MarkdownParser.parseMarkdown(quest.notes)
|
||||
DataBindingUtils.loadImage(questImageView, "quest_"+quest.key, "gif")
|
||||
DataBindingUtils.loadImage(questFlourishesImageView, "quest_"+quest.key+"_flourishes")
|
||||
val lightColor = quest.colors?.lightColor
|
||||
if (lightColor != null) {
|
||||
questDescriptionSection.separatorColor = lightColor
|
||||
|
|
@ -312,7 +318,7 @@ class QuestProgressView : LinearLayout {
|
|||
|
||||
|
||||
private fun showQuestImage() {
|
||||
questImageView.visibility = View.VISIBLE
|
||||
questImageWrapper.visibility = View.VISIBLE
|
||||
DataBindingUtils.loadImage(questImageView, "quest_"+quest?.key)
|
||||
val editPreferences = preferences?.edit()
|
||||
editPreferences?.putBoolean("boss_art_collapsed", false)
|
||||
|
|
@ -321,7 +327,7 @@ class QuestProgressView : LinearLayout {
|
|||
}
|
||||
|
||||
private fun hideQuestImage() {
|
||||
questImageView.visibility = View.GONE
|
||||
questImageWrapper.visibility = View.GONE
|
||||
val editPreferences = preferences?.edit()
|
||||
editPreferences?.putBoolean("boss_art_collapsed", true)
|
||||
editPreferences?.apply()
|
||||
|
|
|
|||
Loading…
Reference in a new issue