refactor: Use "compat" drawables where appropriate (#72)
Use AppCompatResources.getDrawable() and app:drawableStartCompat. Resolves existing lint issues.
This commit is contained in:
parent
c97c3a4156
commit
0bf459d385
|
@ -128,72 +128,6 @@
|
||||||
column="9"/>
|
column="9"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
<issue
|
|
||||||
id="UseCompatLoadingForDrawables"
|
|
||||||
message="Use `AppCompatResources.getDrawable()`"
|
|
||||||
errorLine1=" return ctx.getDrawable(R.drawable.avatar_default)!!"
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="src/main/java/app/pachli/MainActivity.kt"
|
|
||||||
line="546"
|
|
||||||
column="32"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="UseCompatTextViewDrawableXml"
|
|
||||||
message="Use `app:drawableStartCompat` instead of `android:drawableStart`"
|
|
||||||
errorLine1=" android:drawableStart="@drawable/ic_briefcase""
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="src/main/res/layout/activity_account.xml"
|
|
||||||
line="287"
|
|
||||||
column="29"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="UseCompatTextViewDrawableXml"
|
|
||||||
message="Use `app:drawableStartCompat` instead of `android:drawableStart`"
|
|
||||||
errorLine1=" android:drawableStart="@drawable/ic_plus_24dp""
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="src/main/res/layout/activity_tab_preference.xml"
|
|
||||||
line="60"
|
|
||||||
column="17"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="UseCompatTextViewDrawableXml"
|
|
||||||
message="Use `app:drawableStartCompat` instead of `android:drawableStart`"
|
|
||||||
errorLine1=" android:drawableStart="@drawable/ic_person_add_24dp""
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="src/main/res/layout/item_follow.xml"
|
|
||||||
line="17"
|
|
||||||
column="9"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="UseCompatTextViewDrawableXml"
|
|
||||||
message="Use `app:drawableStartCompat` instead of `android:drawableStart`"
|
|
||||||
errorLine1=" android:drawableStart="@drawable/ic_reblog_18dp""
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="src/main/res/layout/item_status.xml"
|
|
||||||
line="20"
|
|
||||||
column="9"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="UseCompatTextViewDrawableXml"
|
|
||||||
message="Use `app:drawableStartCompat` instead of `android:drawableStart`"
|
|
||||||
errorLine1=" android:drawableStart="@drawable/ic_poll_24dp""
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="src/main/res/layout/view_poll_preview.xml"
|
|
||||||
line="15"
|
|
||||||
column="9"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
<issue
|
||||||
id="MissingQuantity"
|
id="MissingQuantity"
|
||||||
message="For locale "bn" (Bangla) the following quantity should also be defined: `one` (e.g. "সসে 1টি আপেল খেল, সেটা ভাল")"
|
message="For locale "bn" (Bangla) the following quantity should also be defined: `one` (e.g. "সসে 1টি আপেল খেল, সেটা ভাল")"
|
||||||
|
|
|
@ -543,7 +543,7 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInje
|
||||||
|
|
||||||
override fun placeholder(ctx: Context, tag: String?): Drawable {
|
override fun placeholder(ctx: Context, tag: String?): Drawable {
|
||||||
if (tag == DrawerImageLoader.Tags.PROFILE.name || tag == DrawerImageLoader.Tags.PROFILE_DRAWER_ITEM.name) {
|
if (tag == DrawerImageLoader.Tags.PROFILE.name || tag == DrawerImageLoader.Tags.PROFILE_DRAWER_ITEM.name) {
|
||||||
return ctx.getDrawable(R.drawable.avatar_default)!!
|
return AppCompatResources.getDrawable(ctx, R.drawable.avatar_default)!!
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.placeholder(ctx, tag)
|
return super.placeholder(ctx, tag)
|
||||||
|
|
|
@ -284,7 +284,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:drawablePadding="6dp"
|
android:drawablePadding="6dp"
|
||||||
android:drawableStart="@drawable/ic_briefcase"
|
app:drawableStartCompat="@drawable/ic_briefcase"
|
||||||
android:textSize="?attr/status_text_medium"
|
android:textSize="?attr/status_text_medium"
|
||||||
android:textColor="?colorOnPrimaryContainer"
|
android:textColor="?colorOnPrimaryContainer"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
android:drawableStart="@drawable/ic_plus_24dp"
|
app:drawableStartCompat="@drawable/ic_plus_24dp"
|
||||||
android:drawablePadding="12dp"
|
android:drawablePadding="12dp"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:drawableStart="@drawable/ic_person_add_24dp"
|
app:drawableStartCompat="@drawable/ic_person_add_24dp"
|
||||||
android:drawablePadding="10dp"
|
android:drawablePadding="10dp"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
android:layout_marginStart="14dp"
|
android:layout_marginStart="14dp"
|
||||||
android:layout_marginTop="@dimen/status_reblogged_bar_padding_top"
|
android:layout_marginTop="@dimen/status_reblogged_bar_padding_top"
|
||||||
android:layout_marginEnd="14dp"
|
android:layout_marginEnd="14dp"
|
||||||
android:drawableStart="@drawable/ic_reblog_18dp"
|
app:drawableStartCompat="@drawable/ic_reblog_18dp"
|
||||||
android:drawablePadding="6dp"
|
android:drawablePadding="6dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:importantForAccessibility="no"
|
android:importantForAccessibility="no"
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:drawableStart="@drawable/ic_poll_24dp"
|
app:drawableStartCompat="@drawable/ic_poll_24dp"
|
||||||
android:drawablePadding="4dp"
|
android:drawablePadding="4dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:text="@string/create_poll_title"
|
android:text="@string/create_poll_title"
|
||||||
|
@ -34,4 +34,4 @@
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="4dp"
|
||||||
tools:text="5 Minutes" />
|
tools:text="5 Minutes" />
|
||||||
|
|
||||||
</merge>
|
</merge>
|
||||||
|
|
Loading…
Reference in New Issue