Trim sources title when too long (#383)

This commit is contained in:
davidoskky 2021-11-22 07:09:12 +01:00 committed by GitHub
parent 60a908a44a
commit 6a8c2d7fcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 37 deletions

View File

@ -71,7 +71,7 @@ class SourcesActivity : AppCompatActivity() {
binding.recyclerView.setHasFixedSize(true) binding.recyclerView.setHasFixedSize(true)
binding.recyclerView.layoutManager = mLayoutManager binding.recyclerView.layoutManager = mLayoutManager
if (this@SourcesActivity.isNetworkAccessible(this@SourcesActivity.findViewById(R.id.recyclerView))) { if (this@SourcesActivity.isNetworkAccessible(binding.recyclerView)) {
api.sources.enqueue(object : Callback<List<Source>> { api.sources.enqueue(object : Callback<List<Source>> {
override fun onResponse( override fun onResponse(
call: Call<List<Source>>, call: Call<List<Source>>,

View File

@ -31,14 +31,13 @@
android:id="@+id/fab" android:id="@+id/fab"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="end|bottom|right" android:layout_gravity="end|bottom|end"
android:src="@drawable/ic_add_white_24dp" android:src="@drawable/ic_add_white_24dp"
android:paddingBottom="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingTop="@dimen/activity_vertical_margin" android:paddingTop="@dimen/activity_vertical_margin"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"/> android:contentDescription="@string/add_source" />
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -1,55 +1,49 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
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" xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp"> android:layout_height="48dp"
android:orientation="vertical">
<ImageView <ImageView
android:id="@+id/itemImage" android:id="@+id/itemImage"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginStart="16dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="16dp"
android:layout_width="36dp" android:layout_width="36dp"
android:layout_height="36dp"/> android:layout_height="36dp"
android:importantForAccessibility="no"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:layout_width="wrap_content"
android:layout_height="17dp"
android:id="@+id/sourceTitle" android:id="@+id/sourceTitle"
app:layout_constraintTop_toTopOf="parent" android:layout_width="0dp"
app:layout_constraintBottom_toBottomOf="parent" android:layout_height="17dp"
app:layout_constraintLeft_toRightOf="@+id/itemImage" android:layout_marginStart="8dp"
android:layout_marginStart="16dp" android:ellipsize="end"
android:layout_marginLeft="16dp" android:gravity="start"
android:maxLines="1"
android:textAlignment="textStart"
android:textSize="13sp" android:textSize="13sp"
android:textAlignment="viewStart" app:layout_constraintBottom_toBottomOf="parent"
tools:text="source title " app:layout_constraintEnd_toStartOf="@+id/deleteBtn"
android:gravity="start" /> app:layout_constraintStart_toEndOf="@+id/itemImage"
app:layout_constraintTop_toTopOf="parent"
tools:text="source title" />
<Button <Button
android:id="@+id/deleteBtn" android:id="@+id/deleteBtn"
android:background="@drawable/ic_remove_circle_outline_black_24dp"
style="@style/Widget.AppCompat.Button.Borderless" style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_marginEnd="8dp"
android:background="@drawable/ic_remove_circle_outline_black_24dp"
android:backgroundTint="?android:textColorSecondary" android:backgroundTint="?android:textColorSecondary"
android:elevation="4dp" android:elevation="4dp"
android:layout_marginTop="16dp" android:contentDescription="@string/remove_source"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="16dp" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="16dp" app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintRight_toRightOf="parent"
android:layout_marginRight="16dp"
android:layout_marginStart="8dp"
app:layout_constraintLeft_toRightOf="@+id/sourceTitle"
android:layout_marginLeft="8dp"
app:layout_constraintHorizontal_bias="1.0"
android:layout_width="34dp"
android:layout_height="34dp"/>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -168,4 +168,5 @@
<string name="reader_static_bar_title">Static bottom bar in the article viewer</string> <string name="reader_static_bar_title">Static bottom bar in the article viewer</string>
<string name="reader_static_bar_on">The bottom bar will always be displayed</string> <string name="reader_static_bar_on">The bottom bar will always be displayed</string>
<string name="reader_static_bar_off">The bottom bar can be shown through the floating button</string> <string name="reader_static_bar_off">The bottom bar can be shown through the floating button</string>
<string name="remove_source">Remove source</string>
</resources> </resources>