Add headerSubtitle to ActionHeaderLayout
This commit is contained in:
@@ -51,19 +51,30 @@ class ActionHeaderLayout : RelativeLayout {
|
|||||||
binding = ViewActionHeaderBinding.bind(view)
|
binding = ViewActionHeaderBinding.bind(view)
|
||||||
|
|
||||||
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.ActionHeaderLayout)
|
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.ActionHeaderLayout)
|
||||||
val textPrimary = typedArray.getString(R.styleable.ActionHeaderLayout_headerTitle)
|
val textTitle = typedArray.getString(R.styleable.ActionHeaderLayout_headerTitle)
|
||||||
|
val textSubtitle = typedArray.getString(R.styleable.ActionHeaderLayout_headerSubtitle)
|
||||||
|
|
||||||
typedArray.recycle()
|
typedArray.recycle()
|
||||||
|
|
||||||
textPrimary?.let {
|
textTitle?.let {
|
||||||
binding.txtTitle.text = it
|
binding.txtTitle.text = it
|
||||||
}
|
}
|
||||||
|
|
||||||
|
textSubtitle?.let {
|
||||||
|
binding.txtSubtitle.visibility = View.VISIBLE
|
||||||
|
binding.txtSubtitle.text = it
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setHeader(header: String?) {
|
fun setTitle(header: String?) {
|
||||||
binding.txtTitle.text = header
|
binding.txtTitle.text = header
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setSubTitle(subHeader: String?) {
|
||||||
|
binding.txtSubtitle.visibility = View.VISIBLE
|
||||||
|
binding.txtSubtitle.text = subHeader
|
||||||
|
}
|
||||||
|
|
||||||
fun addClickListener(onclickListener: OnClickListener?) {
|
fun addClickListener(onclickListener: OnClickListener?) {
|
||||||
binding.imgAction.visibility = View.VISIBLE
|
binding.imgAction.visibility = View.VISIBLE
|
||||||
binding.imgAction.setOnClickListener(onclickListener)
|
binding.imgAction.setOnClickListener(onclickListener)
|
||||||
|
|||||||
@@ -952,7 +952,7 @@ class AppDetailsFragment : BaseFragment<FragmentDetailsBinding>() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
txtPermissionCount.text = ("${app.permissions.size} permissions")
|
headerPermission.setSubTitle(("${app.permissions.size} permissions"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,14 +34,6 @@
|
|||||||
android:id="@+id/header_permission"
|
android:id="@+id/header_permission"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:headerTitle="@string/details_permission" />
|
app:headerTitle="@string/details_permission"
|
||||||
|
tools:headerSubtitle="36 permissions" />
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
|
||||||
android:id="@+id/txt_permission_count"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingStart="@dimen/padding_xsmall"
|
|
||||||
android:paddingEnd="@dimen/padding_xsmall"
|
|
||||||
android:textAppearance="@style/TextAppearance.Aurora.Line1"
|
|
||||||
tools:text="16 permissions" />
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -34,23 +34,14 @@
|
|||||||
android:id="@+id/header_privacy"
|
android:id="@+id/header_privacy"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
app:headerSubtitle="@string/exodus_powered"
|
||||||
app:headerTitle="@string/details_privacy" />
|
app:headerTitle="@string/details_privacy" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
|
||||||
android:id="@+id/txt_subtitle"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@id/header_privacy"
|
|
||||||
android:text="@string/exodus_powered"
|
|
||||||
android:textAppearance="@style/TextAppearance.Aurora.Line3" />
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:id="@+id/txt_status"
|
android:id="@+id/txt_status"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/txt_subtitle"
|
android:layout_below="@id/header_privacy"
|
||||||
android:layout_alignStart="@id/txt_subtitle"
|
|
||||||
android:layout_alignEnd="@id/txt_subtitle"
|
|
||||||
android:text="@string/exodus_progress"
|
android:text="@string/exodus_progress"
|
||||||
android:textAppearance="@style/TextAppearance.Aurora.Line1" />
|
android:textAppearance="@style/TextAppearance.Aurora.Line1" />
|
||||||
|
|
||||||
@@ -60,8 +51,6 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/txt_status"
|
android:layout_below="@id/txt_status"
|
||||||
android:layout_alignStart="@id/txt_subtitle"
|
|
||||||
android:layout_alignEnd="@id/txt_subtitle"
|
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:text="@string/action_request_analysis"
|
android:text="@string/action_request_analysis"
|
||||||
app:cornerRadius="@dimen/margin_small" />
|
app:cornerRadius="@dimen/margin_small" />
|
||||||
|
|||||||
@@ -31,11 +31,23 @@
|
|||||||
style="@style/AuroraTextStyle.Subtitle.Alt"
|
style="@style/AuroraTextStyle.Subtitle.Alt"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:layout_toStartOf="@id/img_action"
|
android:layout_toStartOf="@id/img_action"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
tools:text="Header" />
|
tools:text="Title" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txt_subtitle"
|
||||||
|
style="@style/AuroraTextStyle.Line2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/txt_title"
|
||||||
|
android:layout_toStartOf="@id/img_action"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:text="Subtitle"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/img_action"
|
android:id="@+id/img_action"
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
<declare-styleable name="ActionHeaderLayout">
|
<declare-styleable name="ActionHeaderLayout">
|
||||||
<attr name="headerTitle" format="string" />
|
<attr name="headerTitle" format="string" />
|
||||||
|
<attr name="headerSubtitle" format="string" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
<declare-styleable name="StateButton">
|
<declare-styleable name="StateButton">
|
||||||
|
|||||||
Reference in New Issue
Block a user