Fix about text

main
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() loadContributors()
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
ToolbarContentTintHelper.colorBackButton(toolbar ) ToolbarContentTintHelper.colorBackButton(toolbar )
appVersion.text = getAppVersion() version.setSummary ( getAppVersion())
setUpView() setUpView()
} }

View File

@ -18,16 +18,17 @@ import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import android.view.View import android.view.View
import android.widget.FrameLayout import android.widget.FrameLayout
import androidx.constraintlayout.widget.ConstraintLayout
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.hide 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.* import kotlinx.android.synthetic.main.list_item_view.view.*
/** /**
* Created by hemanths on 2019-10-02. * Created by hemanths on 2019-10-02.
*/ */
class ListItemView : FrameLayout { class ListItemView : FrameLayout {
constructor(context: Context) : super(context) { constructor(context: Context) : super(context) {
init(context, null) init(context, null)
} }
@ -47,10 +48,7 @@ class ListItemView : FrameLayout {
if (typedArray.hasValue(R.styleable.ListItemView_listItemIcon)) { if (typedArray.hasValue(R.styleable.ListItemView_listItemIcon)) {
icon.setImageDrawable(typedArray.getDrawable(R.styleable.ListItemView_listItemIcon)) icon.setImageDrawable(typedArray.getDrawable(R.styleable.ListItemView_listItemIcon))
} else { } 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() icon.hide()
} }
@ -62,4 +60,9 @@ class ListItemView : FrameLayout {
} }
typedArray.recycle() typedArray.recycle()
} }
fun setSummary(appVersion: String) {
summary.show()
summary.text = appVersion
}
} }

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android" <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:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:cardCornerRadius="8dp" app:cardCornerRadius="8dp"
@ -24,106 +23,42 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
<code.name.monkey.retromusic.views.ListItemView
android:id="@+id/changelog" android:id="@+id/changelog"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" 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_constrainedWidth="true"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0" app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/sb4" app:layout_constraintTop_toBottomOf="@id/sb4"
tools:ignore="PrivateResource"> app:listItemSummary="@string/changelog_summary"
app:listItemTitle="@string/changelog" />
<code.name.monkey.retromusic.views.ListItemView
<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
android:id="@+id/openSource" android:id="@+id/openSource"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" 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_constrainedWidth="true"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0" app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/changelog" 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 <code.name.monkey.retromusic.views.ListItemView
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
android:id="@+id/version" android:id="@+id/version"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" 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_constrainedWidth="true"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0" app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/openSource" app:layout_constraintTop_toBottomOf="@id/openSource"
tools:ignore="PrivateResource"> app:listItemSummary="@string/pref_summary_open_source_licences"
app:listItemTitle="@string/version" />
<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>
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/madeText" android:id="@+id/madeText"

View File

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

View File

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