Merge pull request #6 from szkolny-eu/feature/iconics-update

Iconics update
This commit is contained in:
Kuba Szczodrzyński 2021-03-31 08:49:47 +02:00 committed by GitHub
commit 5ac1f94302
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 53 additions and 60 deletions

View File

@ -120,15 +120,15 @@ dependencies {
implementation "eu.szkolny:nachos:0e5dfcaceb"
implementation "eu.szkolny.selective-dao:annotation:27f8f3f194"
implementation "eu.szkolny:ssl-provider:1.0.0"
implementation "pl.szczodrzynski:navlib:0.7.2"
implementation "pl.szczodrzynski:navlib:0.8.0"
implementation "pl.szczodrzynski:numberslidingpicker:2921225f76"
implementation "pl.szczodrzynski:recyclertablayout:700f980584"
implementation "pl.szczodrzynski:tachyon:551943a6b5"
kapt "eu.szkolny.selective-dao:codegen:27f8f3f194"
// Iconics & related
implementation "com.mikepenz:iconics-core:5.2.8"
implementation "com.mikepenz:iconics-views:5.2.8"
implementation "com.mikepenz:iconics-core:5.3.0-b01"
implementation "com.mikepenz:iconics-views:5.3.0-b01"
implementation "com.mikepenz:community-material-typeface:5.8.55.0-kotlin@aar"
implementation "eu.szkolny:szkolny-font:1.3"

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

@ -3,9 +3,11 @@ package pl.szczodrzynski.edziennik.utils
import android.content.Context
import android.util.AttributeSet
import androidx.appcompat.widget.PopupMenu
import androidx.core.graphics.drawable.DrawableCompat
import com.google.android.material.textfield.TextInputEditText
import pl.szczodrzynski.edziennik.R
import com.mikepenz.iconics.IconicsDrawable
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
import com.mikepenz.iconics.utils.colorInt
import com.mikepenz.iconics.utils.sizeDp
open class TextInputDropDown : TextInputEditText {
constructor(context: Context) : super(context) {
@ -32,11 +34,12 @@ open class TextInputDropDown : TextInputEditText {
}
open fun create(context: Context) {
val drawable = context.resources.getDrawable(R.drawable.dropdown_arrow)
val wrappedDrawable = DrawableCompat.wrap(drawable)
DrawableCompat.setTint(wrappedDrawable, Themes.getPrimaryTextColor(context))
val drawable = IconicsDrawable(context, CommunityMaterial.Icon.cmd_chevron_down).apply {
colorInt = Themes.getPrimaryTextColor(context)
sizeDp = 24
}
setCompoundDrawablesWithIntrinsicBounds(null, null, wrappedDrawable, null)
setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null)
isFocusableInTouchMode = false
isCursorVisible = false
isLongClickable = false

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" />