Fix about text

This commit is contained in:
h4h13 2019-11-05 00:29:44 +05:30
parent ee83fef6a7
commit 89fa903f53
5 changed files with 26 additions and 89 deletions

View file

@ -69,7 +69,7 @@ class AboutActivity : AbsBaseActivity(), View.OnClickListener {
loadContributors()
setSupportActionBar(toolbar)
ToolbarContentTintHelper.colorBackButton(toolbar )
appVersion.text = getAppVersion()
version.setSummary ( getAppVersion())
setUpView()
}

View file

@ -18,16 +18,17 @@ import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.FrameLayout
import androidx.constraintlayout.widget.ConstraintLayout
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.hide
import code.name.monkey.retromusic.util.DensityUtil
import code.name.monkey.retromusic.extensions.show
import kotlinx.android.synthetic.main.list_item_view.view.*
/**
* Created by hemanths on 2019-10-02.
*/
class ListItemView : FrameLayout {
constructor(context: Context) : super(context) {
init(context, null)
}
@ -47,10 +48,7 @@ class ListItemView : FrameLayout {
if (typedArray.hasValue(R.styleable.ListItemView_listItemIcon)) {
icon.setImageDrawable(typedArray.getDrawable(R.styleable.ListItemView_listItemIcon))
} else {
val params = title.layoutParams as ConstraintLayout.LayoutParams
val startDP = DensityUtil.dip2px(context, 72.0f)
params.setMargins(startDP, title.paddingTop, title.paddingRight, title.paddingBottom)
summary.setPadding(startDP, title.paddingTop, title.paddingRight, title.paddingBottom)
icon.hide()
}
@ -62,4 +60,9 @@ class ListItemView : FrameLayout {
}
typedArray.recycle()
}
fun setSummary(appVersion: String) {
summary.show()
summary.text = appVersion
}
}

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="8dp"
@ -24,106 +23,42 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
<code.name.monkey.retromusic.views.ListItemView
android:id="@+id/changelog"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="?attr/rectSelector"
android:gravity="center_vertical"
android:minHeight="@dimen/md_listitem_height"
android:orientation="vertical"
android:paddingStart="12dp"
android:paddingTop="8dp"
android:paddingEnd="12dp"
android:paddingBottom="8dp"
app:layout_constrainedWidth="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/sb4"
tools:ignore="PrivateResource">
app:listItemSummary="@string/changelog_summary"
app:listItemTitle="@string/changelog" />
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/changelog"
android:textAppearance="@style/TextViewSubtitle1"
android:textStyle="bold" />
<code.name.monkey.retromusic.views.BaselineGridTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/changelog_summary"
app:lineHeightHint="24sp" />
</LinearLayout>
<LinearLayout
<code.name.monkey.retromusic.views.ListItemView
android:id="@+id/openSource"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="?attr/rectSelector"
android:gravity="center_vertical"
android:minHeight="@dimen/md_listitem_height"
android:orientation="vertical"
android:paddingStart="12dp"
android:paddingTop="8dp"
android:paddingEnd="12dp"
android:paddingBottom="8dp"
app:layout_constrainedWidth="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/changelog"
tools:ignore="PrivateResource">
app:listItemSummary="@string/pref_summary_open_source_licences"
app:listItemTitle="@string/pref_title_open_source_licences" />
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_title_open_source_licences"
android:textAppearance="@style/TextViewSubtitle1"
android:textStyle="bold" />
<code.name.monkey.retromusic.views.BaselineGridTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_summary_open_source_licences"
app:lineHeightHint="24sp" />
</LinearLayout>
<LinearLayout
<code.name.monkey.retromusic.views.ListItemView
android:id="@+id/version"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="?attr/rectSelector"
android:gravity="center_vertical"
android:minHeight="@dimen/md_listitem_height"
android:orientation="vertical"
android:paddingStart="12dp"
android:paddingTop="8dp"
android:paddingEnd="12dp"
android:paddingBottom="8dp"
app:layout_constrainedWidth="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/openSource"
tools:ignore="PrivateResource">
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/version"
android:textAppearance="@style/TextViewSubtitle1"
android:textStyle="bold" />
<code.name.monkey.retromusic.views.BaselineGridTextView
android:id="@+id/appVersion"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="0.0.0"
app:lineHeightHint="24sp" />
</LinearLayout>
app:listItemSummary="@string/pref_summary_open_source_licences"
app:listItemTitle="@string/version" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/madeText"

View file

@ -41,7 +41,6 @@
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:textAppearance="@style/TextViewSubtitle1"
android:textStyle="bold"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toTopOf="@+id/text"
app:layout_constraintEnd_toEndOf="parent"

View file

@ -29,9 +29,9 @@
android:layout_height="72dp"
android:layout_margin="8dp"
app:civ_border="false"
tools:srcCompat="@tools:sample/backgrounds/scenic[20]"
app:civ_shadow="false"
app:srcCompat="@drawable/ic_person_flat" />
app:srcCompat="@drawable/ic_person_flat"
tools:srcCompat="@tools:sample/backgrounds/scenic[20]" />
<LinearLayout
android:layout_width="match_parent"
@ -48,8 +48,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textStyle="bold"
android:textAppearance="@style/TextViewHeadline5"
android:textStyle="bold"
tools:text="Name" />
<code.name.monkey.retromusic.views.BaselineGridTextView