[UI] Update UI to maintain icon size consistency.

This commit is contained in:
Kuba Szczodrzyński 2021-03-29 22:55:56 +02:00
parent 7e38445c98
commit ebbb9e4904
29 changed files with 41 additions and 51 deletions

View File

@ -165,6 +165,7 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
.errorActivity(CrashActivity::class.java)
.apply()
Iconics.init(applicationContext)
Iconics.respectFontBoundsDefault = true
// initialize companion object values
App.db = AppDb(this)

View File

@ -505,7 +505,7 @@ class MainActivity : AppCompatActivity(), CoroutineScope {
.content(R.string.rate_snackbar_text)
.icon(IconicsDrawable(this).apply {
icon = CommunityMaterial.Icon3.cmd_star_outline
sizeDp = 20
sizeDp = 24
colorInt = Themes.getPrimaryTextColor(this@MainActivity)
})
.positiveText(R.string.rate_snackbar_positive)

View File

@ -127,7 +127,7 @@ public class AttendanceFragment_ extends Fragment {
CafeBar.builder(activity)
.to(activity.getNavView().getCoordinator())
.content(R.string.sync_old_data_info)
.icon(new IconicsDrawable(activity).icon(CommunityMaterial.Icon.cmd_download_outline).size(IconicsSize.dp(20)).color(IconicsColor.colorInt(Themes.INSTANCE.getPrimaryTextColor(activity))))
.icon(new IconicsDrawable(activity).icon(CommunityMaterial.Icon.cmd_download_outline).size(IconicsSize.dp(24)).color(IconicsColor.colorInt(Themes.INSTANCE.getPrimaryTextColor(activity))))
.positiveText(R.string.refresh)
.positiveColor(0xff4caf50)
.negativeText(R.string.ok)

View File

@ -90,21 +90,21 @@ class HomeTimetableCard(
b.settings.setImageDrawable(
IconicsDrawable(activity, CommunityMaterial.Icon.cmd_cog_outline).apply {
colorAttr(activity, R.attr.colorIcon)
sizeDp = 20
sizeDp = 24
}
)
b.bellSync.setImageDrawable(
IconicsDrawable(activity, SzkolnyFont.Icon.szf_alarm_bell_outline).apply {
colorAttr(activity, R.attr.colorIcon)
sizeDp = 20
sizeDp = 24
}
)
b.showCounter.setImageDrawable(
IconicsDrawable(activity, CommunityMaterial.Icon2.cmd_fullscreen).apply {
colorAttr(activity, R.attr.colorIcon)
sizeDp = 20
sizeDp = 24
}
)

View File

@ -15,7 +15,6 @@ import androidx.core.widget.addTextChangedListener
import androidx.fragment.app.Fragment
import com.google.android.material.textfield.TextInputLayout
import com.mikepenz.iconics.IconicsDrawable
import com.mikepenz.iconics.utils.paddingDp
import com.mikepenz.iconics.utils.sizeDp
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@ -100,7 +99,6 @@ class LoginFormFragment : Fragment(), CoroutineScope {
b.textLayout.startIconDrawable = IconicsDrawable(activity).apply {
icon = credential.icon
sizeDp = 24
paddingDp = 2
colorAttr(activity, R.attr.colorOnBackground)
}

View File

@ -67,7 +67,7 @@ class MessageFragment : Fragment(), CoroutineScope {
b.closeButton.setImageDrawable(
IconicsDrawable(activity, CommunityMaterial.Icon3.cmd_window_close).apply {
colorAttr(activity, android.R.attr.textColorSecondary)
sizeDp = 12
sizeDp = 16
}
)
b.closeButton.setOnClickListener { activity.navigateUp() }

View File

@ -26,7 +26,7 @@ class SettingsLicenseActivity : MaterialAboutActivity() {
get() = IconicsDrawable(this).apply {
icon = CommunityMaterial.Icon.cmd_book_outline
colorInt = foregroundColor
sizeDp = 18
sizeDp = 24
}
override fun onCreate(savedInstanceState: Bundle?) {

View File

@ -25,7 +25,7 @@ class SettingsUtil(
fun refresh() = onRefresh()
private fun IIcon.asDrawable(color: Int? = null, size: Int = 20) =
private fun IIcon.asDrawable(color: Int? = null, size: Int = 24) =
IconicsDrawable(activity).apply {
icon = this@asDrawable
sizeDp = size
@ -66,7 +66,7 @@ class SettingsUtil(
val moreItem = MaterialAboutActionItem.Builder()
.text(R.string.settings_more_text)
.icon(CommunityMaterial.Icon.cmd_chevron_down.asDrawable(iconColor, size = 14))
.icon(CommunityMaterial.Icon.cmd_chevron_down.asDrawable(iconColor, size = 24))
.build()
moreItem.setOnClickAction {

View File

@ -12,7 +12,6 @@ import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.chip.Chip
import com.mikepenz.iconics.IconicsDrawable
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
import com.mikepenz.iconics.utils.paddingDp
import com.mikepenz.iconics.utils.sizeDp
import eu.szkolny.font.SzkolnyFont
import kotlinx.coroutines.CoroutineScope
@ -85,12 +84,11 @@ class AttachmentAdapter(
icon = attachmentIcon
colorAttr(context, R.attr.colorOnSurface)
sizeDp = 24
paddingDp = 2
}
b.chip.closeIcon = IconicsDrawable(context).apply {
icon = CommunityMaterial.Icon.cmd_check
colorAttr(context, R.attr.colorOnSurface)
sizeDp = 18
sizeDp = 24
}
b.chip.isCloseIconVisible = item.isDownloaded && !item.isDownloading

View File

@ -32,7 +32,7 @@ class WidgetNotificationsProvider : AppWidgetProvider() {
for (appWidgetId in appWidgetIds) {
val config = widgetConfigs.getJsonObject(appWidgetId.toString())?.let { app.gson.fromJson(it, WidgetConfig::class.java) } ?: continue
val iconSize = if (config.bigStyle) 24 else 16
val iconSize = if (config.bigStyle) 28 else 20
val views: RemoteViews = if (config.bigStyle) {
RemoteViews(app.packageName, if (config.darkTheme) R.layout.widget_notifications_dark_big else R.layout.widget_notifications_big)

View File

@ -130,7 +130,7 @@ public class WidgetTimetableFactory implements RemoteViewsService.RemoteViewsFac
private Bitmap homeIconBitmap() {
return new IconicsDrawable(context).apply((drawable) -> {
IconicsConvertersKt.setColorRes(drawable, R.color.md_red_500);
IconicsConvertersKt.setSizeDp(drawable, 10);
IconicsConvertersKt.setSizeDp(drawable, 14);
IconicsDrawableExtensionsKt.icon(drawable, CommunityMaterial.Icon2.cmd_home);
return Unit.INSTANCE;
}).toBitmap();

View File

@ -119,7 +119,7 @@ class WidgetTimetableProvider : AppWidgetProvider() {
R.id.widgetTimetableRefresh,
IconicsDrawable(context, CommunityMaterial.Icon3.cmd_refresh).apply {
colorInt = Color.WHITE
sizeDp = if (config.bigStyle) 24 else 16
sizeDp = if (config.bigStyle) 28 else 20
}.toBitmap()
)
@ -127,7 +127,7 @@ class WidgetTimetableProvider : AppWidgetProvider() {
R.id.widgetTimetableSync,
IconicsDrawable(context, CommunityMaterial.Icon.cmd_download_outline).apply {
colorInt = Color.WHITE
sizeDp = if (config.bigStyle) 24 else 16
sizeDp = if (config.bigStyle) 28 else 20
}.toBitmap()
)

View File

@ -57,7 +57,7 @@
android:scaleType="centerInside"
app:iiv_color="?android:textColorSecondary"
app:iiv_icon="cmd-chevron-down"
app:iiv_size="18dp"
app:iiv_size="24dp"
tools:src="@android:drawable/ic_menu_more" />
</LinearLayout>

View File

@ -66,7 +66,7 @@
android:scaleType="centerInside"
app:iiv_color="?android:textColorSecondary"
app:iiv_icon="cmd-chevron-down"
app:iiv_size="18dp"
app:iiv_size="24dp"
tools:src="@android:drawable/ic_menu_more" />
</LinearLayout>

View File

@ -66,7 +66,7 @@
android:scaleType="centerInside"
app:iiv_color="?android:textColorSecondary"
app:iiv_icon="cmd-chevron-down"
app:iiv_size="18dp"
app:iiv_size="24dp"
tools:src="@android:drawable/ic_menu_more" />
</LinearLayout>

View File

@ -77,7 +77,7 @@
android:scaleType="centerInside"
app:iiv_color="?android:textColorSecondary"
app:iiv_icon="cmd-chevron-down"
app:iiv_size="18dp"
app:iiv_size="24dp"
tools:background="@android:drawable/ic_menu_more" />
</LinearLayout>

View File

@ -178,27 +178,27 @@
<ImageView
android:id="@+id/settings"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?selectableItemBackgroundBorderless"
android:padding="10dp"
android:padding="12dp"
android:visibility="gone"
tools:src="@sample/settings" />
<ImageView
android:id="@+id/bellSync"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?selectableItemBackgroundBorderless"
android:padding="10dp"
android:padding="12dp"
tools:src="@sample/settings" />
<ImageView
android:id="@+id/showCounter"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?selectableItemBackgroundBorderless"
android:padding="10dp"
android:padding="12dp"
tools:src="@sample/settings" />
</LinearLayout>

View File

@ -132,7 +132,7 @@
android:scaleType="centerInside"
app:iiv_color="?android:textColorSecondary"
app:iiv_icon="cmd-help-circle-outline"
app:iiv_size="16dp"
app:iiv_size="24dp"
tools:src="@android:drawable/ic_menu_help" />
</LinearLayout>

View File

@ -145,11 +145,11 @@
app:iiv_end_icon="cmd-chevron-down"
app:iiv_end_color="?android:textColorSecondary"
app:iiv_end_size="16dp"
app:iiv_end_size="24dp"
app:iiv_end_checked_icon="cmd-chevron-up"
app:iiv_end_checked_color="?android:textColorSecondary"
app:iiv_end_checked_size="16dp"/>
app:iiv_end_checked_size="24dp"/>
<LinearLayout
android:id="@+id/moreLayout"

View File

@ -24,7 +24,7 @@
android:scaleType="centerInside"
app:iiv_color="?android:textColorSecondary"
app:iiv_icon="cmd-chevron-down"
app:iiv_size="16dp"
app:iiv_size="24dp"
tools:src="@android:drawable/ic_menu_more" />
<TextView
@ -85,7 +85,7 @@
android:scaleType="centerInside"
app:iiv_color="?android:textColorSecondary"
app:iiv_icon="cmd-playlist-edit"
app:iiv_size="16dp"
app:iiv_size="24dp"
tools:src="@android:drawable/ic_menu_edit" />
</LinearLayout>
</layout>

View File

@ -167,7 +167,7 @@
android:scaleType="centerInside"
app:iiv_color="?android:textColorSecondary"
app:iiv_icon="cmd-help-circle-outline"
app:iiv_size="16dp"
app:iiv_size="24dp"
tools:src="@android:drawable/ic_menu_help" />
<View

View File

@ -57,7 +57,7 @@
android:scaleType="centerInside"
app:iiv_color="?android:textColorSecondary"
app:iiv_icon="cmd-chevron-down"
app:iiv_size="18dp"
app:iiv_size="24dp"
tools:src="@android:drawable/ic_menu_more" />
</LinearLayout>

View File

@ -47,7 +47,7 @@
android:scaleType="centerInside"
app:iiv_color="?android:textColorSecondary"
app:iiv_icon="cmd-chevron-down"
app:iiv_size="18dp"
app:iiv_size="24dp"
tools:src="@android:drawable/ic_menu_more" />
</LinearLayout>

View File

@ -42,7 +42,7 @@
android:scaleType="centerInside"
app:iiv_color="?android:textColorSecondary"
app:iiv_icon="cmd-chevron-down"
app:iiv_size="18dp"
app:iiv_size="24dp"
tools:src="@android:drawable/ic_menu_more" />
</LinearLayout>
</layout>

View File

@ -106,7 +106,7 @@
android:layout_height="24dp"
app:iiv_color="?colorOnError"
app:iiv_icon="cmd-alert-circle-outline"
app:iiv_size="20dp" />
app:iiv_size="24dp" />
<TextView
android:id="@+id/errorText"

View File

@ -60,6 +60,6 @@
android:background="?selectableItemBackgroundBorderless"
app:iiv_color="?colorOnBackground"
app:iiv_icon="cmd-image-search-outline"
app:iiv_size="36dp" />
app:iiv_size="40dp" />
</LinearLayout>
</layout>

View File

@ -204,7 +204,6 @@
android:id="@+id/replyIcon"
android:layout_width="24dp"
android:layout_height="24dp"
android:padding="4dp"
app:iiv_color="?android:textColorSecondary"
app:iiv_icon="cmd-reply-outline"
tools:srcCompat="@android:drawable/ic_menu_revert" />
@ -234,7 +233,6 @@
android:id="@+id/forwardIcon"
android:layout_width="24dp"
android:layout_height="24dp"
android:padding="4dp"
app:iiv_color="?android:textColorSecondary"
app:iiv_icon="cmd-arrow-right"
tools:srcCompat="@android:drawable/ic_media_ff" />
@ -265,7 +263,6 @@
<com.mikepenz.iconics.view.IconicsImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:padding="4dp"
app:iiv_color="?android:textColorSecondary"
app:iiv_icon="cmd-delete-outline"
tools:srcCompat="@android:drawable/ic_menu_delete" />
@ -295,7 +292,6 @@
<com.mikepenz.iconics.view.IconicsImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:padding="4dp"
app:iiv_color="?android:textColorSecondary"
app:iiv_icon="cmd-download-outline"
tools:srcCompat="@android:drawable/ic_menu_delete" />

View File

@ -288,7 +288,6 @@
<com.mikepenz.iconics.view.IconicsImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:padding="4dp"
app:iiv_color="?android:textColorSecondary"
app:iiv_icon="cmd-reply"
tools:srcCompat="@android:drawable/ic_menu_revert" />
@ -317,7 +316,6 @@
<com.mikepenz.iconics.view.IconicsImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:padding="4dp"
app:iiv_color="?android:textColorSecondary"
app:iiv_icon="cmd-share"
tools:srcCompat="@android:drawable/ic_media_ff" />
@ -345,7 +343,6 @@
<com.mikepenz.iconics.view.IconicsImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:padding="4dp"
app:iiv_color="?android:textColorSecondary"
app:iiv_icon="cmd-delete"
tools:srcCompat="@android:drawable/ic_menu_delete" />

View File

@ -17,7 +17,7 @@
android:layout_height="60dp"
android:layout_gravity="center_vertical"
android:background="@color/md_red_500"
android:padding="20dp"
android:padding="18dp"
app:iiv_color="@color/md_white_1000"
app:iiv_icon="cmd-delete"
tools:srcCompat="@tools:sample/avatars" />
@ -27,7 +27,7 @@
android:layout_height="60dp"
android:layout_gravity="center_vertical"
android:background="@color/md_green_500"
android:padding="20dp"
android:padding="18dp"
app:iiv_color="@color/md_white_1000"
app:iiv_icon="cmd-pencil"
tools:srcCompat="@tools:sample/avatars" />