Remove hardcoded strings, add contentdescriptions

This commit is contained in:
Matthieu 2022-07-28 20:56:29 +02:00
parent 7ed25c7f1d
commit fa20a7731a
4 changed files with 6 additions and 5 deletions

View File

@ -6,7 +6,6 @@ import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.os.Build
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
@ -24,6 +23,7 @@ import org.pixeldroid.app.utils.api.objects.Status
import org.pixeldroid.app.utils.db.AppDatabase
import org.pixeldroid.app.utils.db.entities.UserDatabaseEntity
import org.pixeldroid.app.utils.di.PixelfedAPIHolder
import org.pixeldroid.app.utils.getColorFromAttr
import retrofit2.HttpException
import java.io.IOException
import java.time.Instant
@ -171,7 +171,6 @@ class NotificationsWorker(
}.putExtra(USER_NOTIFICATION_TAG, user.user_id)
.putExtra(INSTANCE_NOTIFICATION_TAG, user.instance_uri)
val builder = NotificationCompat.Builder(applicationContext, makeChannelId(uniqueUserId, notification.type))
.setSmallIcon(
when (notification.type) {
@ -184,7 +183,7 @@ class NotificationsWorker(
null -> R.drawable.ic_comment_empty
}
)
.setColor(Color.parseColor("#6200EE"))
.setColor(applicationContext.getColorFromAttr(R.attr.colorPrimary))
.setContentTitle(
notification.account?.username?.let { username ->
applicationContext.getString(

View File

@ -58,7 +58,7 @@
app:layout_constraintTop_toBottomOf="@id/notification_type"
tools:src="@drawable/ic_default_user"
tools:srcCompat="@tools:sample/backgrounds/scenic"
android:contentDescription="TODO" />
android:contentDescription="@string/notification_thumbnail" />
<TextView
android:id="@+id/notification_post_description"

View File

@ -15,7 +15,7 @@
android:id="@+id/postPreview"
android:layout_width="0dp"
android:layout_height="0dp"
android:contentDescription="TODO"
android:contentDescription="@string/post_preview"
android:padding="1dp"
app:layout_columnWeight="1"
app:layout_constraintDimensionRatio="H,1:1"

View File

@ -289,4 +289,6 @@ For more info about Pixelfed, you can check here: https://pixelfed.org"</string>
<string name="from_other_domain">from %1$s</string>
<string name="add_images_error">Error while adding images</string>
<string name="notification_thumbnail">"Thumbnail of image in this notification's post"</string>
<string name="post_preview">Preview of a post</string>
</resources>