mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-09 22:08:44 +00:00
Fixed rtl support in header
This commit is contained in:
parent
39bd321492
commit
30690389b3
3 changed files with 135 additions and 117 deletions
|
|
@ -7,85 +7,91 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@color/brand"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/brand"
|
||||
android:paddingEnd="@dimen/header_border_spacing"
|
||||
android:paddingLeft="@dimen/header_border_spacing"
|
||||
android:paddingRight="@dimen/header_border_spacing"
|
||||
android:paddingStart="@dimen/header_border_spacing"
|
||||
android:paddingEnd="@dimen/header_border_spacing">
|
||||
android:paddingStart="@dimen/header_border_spacing">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.habitrpg.android.habitica.ui.AvatarView
|
||||
android:id="@+id/avatarView"
|
||||
android:layout_width="@dimen/avatar_header_width"
|
||||
android:layout_height="@dimen/avatar_header_height"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
app:showBackground="true"
|
||||
app:showMount="true"
|
||||
app:showPet="true" />
|
||||
android:id="@+id/avatarView"
|
||||
android:layout_width="@dimen/avatar_header_width"
|
||||
android:layout_height="@dimen/avatar_header_height"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
app:showBackground="true"
|
||||
app:showMount="true"
|
||||
app:showPet="true"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/LL_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.habitrpg.android.habitica.ui.views.ValueBar
|
||||
android:id="@+id/hpBar"
|
||||
layout="@layout/value_bar"
|
||||
android:id="@+id/LL_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/header_bar_spacing"
|
||||
app:barForegroundColor="@color/hpColor"
|
||||
app:description="@string/HP_default" />
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.habitrpg.android.habitica.ui.views.ValueBar
|
||||
android:id="@+id/xpBar"
|
||||
layout="@layout/value_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/header_bar_spacing"
|
||||
app:barForegroundColor="@color/xpColor"
|
||||
app:description="@string/XP_default" />
|
||||
android:id="@+id/hpBar"
|
||||
layout="@layout/value_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/header_bar_spacing"
|
||||
app:barForegroundColor="@color/hpColor"
|
||||
app:description="@string/HP_default"/>
|
||||
|
||||
<com.habitrpg.android.habitica.ui.views.ValueBar
|
||||
android:id="@+id/mpBar"
|
||||
layout="@layout/value_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:barForegroundColor="@color/mpColor"
|
||||
app:description="@string/MP_default" />
|
||||
android:id="@+id/xpBar"
|
||||
layout="@layout/value_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/header_bar_spacing"
|
||||
app:barForegroundColor="@color/xpColor"
|
||||
app:description="@string/XP_default"/>
|
||||
|
||||
<com.habitrpg.android.habitica.ui.views.ValueBar
|
||||
android:id="@+id/mpBar"
|
||||
layout="@layout/value_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:barForegroundColor="@color/mpColor"
|
||||
app:description="@string/MP_default"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="6dp"
|
||||
android:gravity="center_vertical">
|
||||
<TextView
|
||||
android:id="@+id/lvl_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="36dp"
|
||||
android:drawablePadding="6dp"
|
||||
android:gravity="center"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/textColorSecondaryDark"
|
||||
tools:text="Lvl 12 Warrior" />
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingBottom="6dp"
|
||||
android:paddingTop="2dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lvl_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="36dp"
|
||||
android:drawablePadding="6dp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/textColorSecondaryDark"
|
||||
android:textSize="14sp"
|
||||
tools:text="Lvl 12 Warrior"/>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
<com.habitrpg.android.habitica.ui.views.CurrencyViews
|
||||
android:id="@+id/currencyView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:hasLightBackground="false"/>
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<com.habitrpg.android.habitica.ui.views.CurrencyViews
|
||||
android:id="@+id/currencyView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:hasLightBackground="false"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
@ -1,65 +1,73 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_marginBottom="@dimen/bar_padding"
|
||||
android:orientation="horizontal"
|
||||
android:id="@+id/value_bar_layout">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/value_bar_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/bar_padding"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ic_header"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/bar_icon_padding"
|
||||
android:layout_marginEnd="@dimen/bar_icon_padding"
|
||||
android:layout_alignTop="@+id/progressBar"
|
||||
android:layout_alignBottom="@id/progressBar"
|
||||
android:scaleType="center"
|
||||
android:contentDescription="Bar Icon"
|
||||
android:visibility="gone"/>
|
||||
<com.habitrpg.android.habitica.ui.views.HabiticaProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_toRightOf="@id/ic_header"
|
||||
android:layout_toEndOf="@id/ic_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bar_size"
|
||||
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:paddingTop="4dp">
|
||||
<ImageView
|
||||
android:id="@+id/secondaryIconView"
|
||||
android:layout_width="@dimen/icon_size"
|
||||
android:layout_height="@dimen/icon_size"
|
||||
android:layout_marginRight="@dimen/spacing_small"
|
||||
android:visibility="gone"/>
|
||||
<TextView
|
||||
android:id="@+id/valueLabel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textSize="12sp"
|
||||
tools:text="50/50" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/descriptionIconView"
|
||||
android:layout_width="@dimen/icon_size"
|
||||
android:layout_height="@dimen/icon_size"
|
||||
android:layout_marginRight="@dimen/spacing_small"
|
||||
android:visibility="gone"/>
|
||||
<TextView
|
||||
android:id="@+id/descriptionLabel"
|
||||
android:id="@+id/ic_header"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center|right"
|
||||
android:textSize="12sp"
|
||||
tools:text="Health" />
|
||||
android:layout_alignBottom="@id/progressBar"
|
||||
android:layout_alignTop="@+id/progressBar"
|
||||
android:layout_marginEnd="@dimen/bar_icon_padding"
|
||||
android:layout_marginRight="@dimen/bar_icon_padding"
|
||||
android:contentDescription="Bar Icon"
|
||||
android:scaleType="center"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<com.habitrpg.android.habitica.ui.views.HabiticaProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bar_size"
|
||||
android:layout_toEndOf="@id/ic_header"
|
||||
android:layout_toRightOf="@id/ic_header"
|
||||
android:orientation="horizontal"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/labelWrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/progressBar"
|
||||
android:layout_toEndOf="@id/ic_header"
|
||||
android:layout_toRightOf="@id/ic_header"
|
||||
android:paddingTop="4dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/secondaryIconView"
|
||||
android:layout_width="@dimen/icon_size"
|
||||
android:layout_height="@dimen/icon_size"
|
||||
android:layout_marginEnd="@dimen/spacing_small"
|
||||
android:layout_marginRight="@dimen/spacing_small"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/valueLabel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textSize="12sp"
|
||||
tools:text="50/50"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/descriptionIconView"
|
||||
android:layout_width="@dimen/icon_size"
|
||||
android:layout_height="@dimen/icon_size"
|
||||
android:layout_marginEnd="@dimen/spacing_small"
|
||||
android:layout_marginRight="@dimen/spacing_small"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/descriptionLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center|end"
|
||||
android:textSize="12sp"
|
||||
tools:text="Health"/>
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.habitrpg.android.habitica.ui.views
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.util.AttributeSet
|
||||
import android.util.TypedValue
|
||||
import android.widget.LinearLayout
|
||||
|
|
@ -53,6 +54,9 @@ class CurrencyViews : LinearLayout {
|
|||
this.addView(view)
|
||||
val params = view.layoutParams as LayoutParams
|
||||
params.setMargins(margin, 0, 0, 0)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
params.marginStart = margin
|
||||
}
|
||||
view.layoutParams = params
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue