From e91d99652c1395bc5f95a0b25691fdf6f3951b80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Sun, 21 Mar 2021 14:36:30 +0100 Subject: [PATCH] [Gradle] Extract szkolny-font dependency. Migrate Iconics to v5. --- app/build.gradle | 9 +- .../java/pl/szczodrzynski/edziennik/App.kt | 2 - .../szczodrzynski/edziennik/MainActivity.kt | 12 +- .../ui/modules/agenda/AgendaFragment.kt | 15 +- .../ui/modules/behaviour/NoticesAdapter.kt | 29 ++- .../ui/modules/home/CounterActivity.kt | 11 +- .../edziennik/ui/modules/home/HomeFragment.kt | 7 +- .../modules/home/cards/HomeTimetableCard.kt | 29 ++- .../ui/modules/homework/HomeworkFragment.kt | 2 +- .../ui/modules/login/LoginFormFragment.kt | 11 +- .../ui/modules/messages/MessageFragment.kt | 7 +- .../settings/SettingsLicenseActivity.kt | 9 +- .../modules/settings/SettingsNewFragment.java | 207 +++++------------ .../ui/modules/timetable/TimetableFragment.kt | 2 +- .../ui/modules/views/AttachmentAdapter.kt | 25 ++- .../WidgetNotificationsProvider.kt | 8 +- .../timetable/WidgetTimetableFactory.java | 20 +- .../timetable/WidgetTimetableProvider.kt | 20 +- .../utils/SwipeRefreshLayoutNoIndicator.java | 208 ++++++++++++++++++ .../utils/SwipeRefreshLayoutNoTouch.java | 51 +++++ build.gradle | 2 +- settings.gradle | 2 +- szkolny-font/build.gradle | 50 ----- szkolny-font/consumer-proguard-rules.pro | 1 - szkolny-font/gradle.properties | 40 ---- szkolny-font/src/main/AndroidManifest.xml | 19 -- .../library/szkolny/font/SzkolnyFont.kt | 87 -------- .../main/res/font/szkolny_font_font_v1_1.ttf | Bin 11232 -> 0 bytes .../src/main/res/values/font_addon.xml | 2 - 29 files changed, 441 insertions(+), 446 deletions(-) create mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/utils/SwipeRefreshLayoutNoIndicator.java create mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/utils/SwipeRefreshLayoutNoTouch.java delete mode 100644 szkolny-font/build.gradle delete mode 100644 szkolny-font/consumer-proguard-rules.pro delete mode 100644 szkolny-font/gradle.properties delete mode 100644 szkolny-font/src/main/AndroidManifest.xml delete mode 100644 szkolny-font/src/main/java/com/mikepenz/iconics/typeface/library/szkolny/font/SzkolnyFont.kt delete mode 100644 szkolny-font/src/main/res/font/szkolny_font_font_v1_1.ttf delete mode 100644 szkolny-font/src/main/res/values/font_addon.xml diff --git a/app/build.gradle b/app/build.gradle index 7b2c0b9a..4ad2fc5f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -127,14 +127,9 @@ dependencies { implementation "com.google.android.material:material:${versions.material}" implementation "com.google.firebase:firebase-messaging:${versions.firebasemessaging}" - //implementation "com.github.kuba2k2.MaterialDrawer:library:e603091449" - implementation "com.mikepenz:crossfader:1.6.0" // do not update - implementation "com.mikepenz:iconics-core:${versions.iconics}" + implementation "pl.szczodrzynski:NavLib:v0.7.0" implementation "com.mikepenz:iconics-views:${versions.iconics}" implementation "com.mikepenz:community-material-typeface:${versions.font_cmd}@aar" - implementation "com.mikepenz:materialize:1.2.1" - - implementation "com.github.kuba2k2:NavLib:${versions.navlib}" implementation "com.afollestad.material-dialogs:commons:${versions.materialdialogs}" implementation "com.afollestad.material-dialogs:core:${versions.materialdialogs}" @@ -171,7 +166,7 @@ dependencies { implementation "eu.szkolny:mhttp:af4b62e6e9" implementation "eu.szkolny:nachos:0e5dfcaceb" //implementation project(":Navigation") - implementation project(":szkolny-font") + implementation "eu.szkolny:szkolny-font:1dab7d64ed" implementation "com.github.ChuckerTeam.Chucker:library:3.0.1" //releaseImplementation "com.github.ChuckerTeam.Chucker:library-no-op:3.0.1" diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/App.kt b/app/src/main/java/pl/szczodrzynski/edziennik/App.kt index 88bdc603..0bc6f2e0 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/App.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/App.kt @@ -26,7 +26,6 @@ import com.google.firebase.messaging.FirebaseMessaging import com.google.gson.Gson import com.hypertrack.hyperlog.HyperLog import com.mikepenz.iconics.Iconics -import com.mikepenz.iconics.typeface.library.szkolny.font.SzkolnyFont import im.wangchao.mhttp.MHttp import kotlinx.coroutines.* import me.leolin.shortcutbadger.ShortcutBadger @@ -159,7 +158,6 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope { .errorActivity(CrashActivity::class.java) .apply() Iconics.init(applicationContext) - Iconics.registerFont(SzkolnyFont) App.db = AppDb(this) Themes.themeInt = config.ui.theme devMode = config.debugMode diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt b/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt index 084cace6..099763d2 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt @@ -23,16 +23,16 @@ import androidx.lifecycle.Observer import androidx.navigation.NavOptions import com.danimahardhika.cafebar.CafeBar import com.google.android.material.dialog.MaterialAlertDialogBuilder -import com.mikepenz.iconics.IconicsColor import com.mikepenz.iconics.IconicsDrawable -import com.mikepenz.iconics.IconicsSize import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial -import com.mikepenz.iconics.typeface.library.szkolny.font.SzkolnyFont +import com.mikepenz.iconics.utils.colorInt +import com.mikepenz.iconics.utils.sizeDp import com.mikepenz.materialdrawer.model.DividerDrawerItem import com.mikepenz.materialdrawer.model.ProfileDrawerItem import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem import com.mikepenz.materialdrawer.model.interfaces.* import com.mikepenz.materialdrawer.model.utils.withIsHiddenInMiniDrawer +import eu.szkolny.font.SzkolnyFont import kotlinx.coroutines.* import org.greenrobot.eventbus.EventBus import org.greenrobot.eventbus.Subscribe @@ -519,7 +519,11 @@ class MainActivity : AppCompatActivity(), CoroutineScope { navView.coordinator.postDelayed({ CafeBar.builder(this) .content(R.string.rate_snackbar_text) - .icon(IconicsDrawable(this).icon(CommunityMaterial.Icon2.cmd_star_outline).size(IconicsSize.dp(20)).color(IconicsColor.colorInt(Themes.getPrimaryTextColor(this)))) + .icon(IconicsDrawable(this).apply { + icon = CommunityMaterial.Icon2.cmd_star_outline + sizeDp = 20 + colorInt = Themes.getPrimaryTextColor(this@MainActivity) + }) .positiveText(R.string.rate_snackbar_positive) .positiveColor(-0xb350b0) .negativeText(R.string.rate_snackbar_negative) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaFragment.kt index ec212cea..35750f43 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaFragment.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaFragment.kt @@ -16,12 +16,12 @@ import com.github.tibolte.agendacalendarview.CalendarPickerController import com.github.tibolte.agendacalendarview.models.BaseCalendarEvent import com.github.tibolte.agendacalendarview.models.CalendarEvent import com.github.tibolte.agendacalendarview.models.IDayItem -import com.mikepenz.iconics.IconicsColor import com.mikepenz.iconics.IconicsDrawable -import com.mikepenz.iconics.IconicsSize import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial.Icon2 -import com.mikepenz.iconics.typeface.library.szkolny.font.SzkolnyFont +import com.mikepenz.iconics.utils.colorInt +import com.mikepenz.iconics.utils.sizeDp +import eu.szkolny.font.SzkolnyFont import kotlinx.coroutines.* import pl.szczodrzynski.edziennik.App import pl.szczodrzynski.edziennik.MainActivity @@ -278,10 +278,11 @@ class AgendaFragment : Fragment(), CoroutineScope { val unreadEventDates = mutableSetOf() events.forEach { event -> - val eventIcon = IconicsDrawable(activity) - .icon(CommunityMaterial.Icon.cmd_checkbox_blank_circle) - .size(IconicsSize.dp(10)) - .color(IconicsColor.colorInt(event.eventColor)) + val eventIcon = IconicsDrawable(activity).apply { + icon = CommunityMaterial.Icon.cmd_checkbox_blank_circle + sizeDp = 10 + colorInt = event.eventColor + } dayList.add(EventDay(event.startTimeCalendar, eventIcon)) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/behaviour/NoticesAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/behaviour/NoticesAdapter.kt index f495d61e..93f21191 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/behaviour/NoticesAdapter.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/behaviour/NoticesAdapter.kt @@ -13,9 +13,9 @@ import androidx.cardview.widget.CardView import androidx.recyclerview.widget.RecyclerView import com.mikepenz.iconics.IconicsDrawable import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial -import com.mikepenz.iconics.typeface.library.szkolny.font.SzkolnyFont import com.mikepenz.iconics.utils.colorRes import com.mikepenz.iconics.utils.sizeDp +import eu.szkolny.font.SzkolnyFont import pl.szczodrzynski.edziennik.App import pl.szczodrzynski.edziennik.R import pl.szczodrzynski.edziennik.data.api.LOGIN_TYPE_MOBIDZIENNIK @@ -49,17 +49,26 @@ class NoticesAdapter//getting the context and product list with constructor holder.noticesItemAddedDate.text = Date.fromMillis(notice.addedDate).formattedString if (notice.type == Notice.TYPE_POSITIVE) { - holder.noticesItemType.setImageDrawable(IconicsDrawable(context, CommunityMaterial.Icon2.cmd_plus_circle_outline) - .colorRes(R.color.md_green_600) - .sizeDp(36)) + holder.noticesItemType.setImageDrawable( + IconicsDrawable(context, CommunityMaterial.Icon2.cmd_plus_circle_outline).apply { + colorRes = R.color.md_green_600 + sizeDp = 36 + } + ) } else if (notice.type == Notice.TYPE_NEGATIVE) { - holder.noticesItemType.setImageDrawable(IconicsDrawable(context, CommunityMaterial.Icon.cmd_alert_decagram_outline) - .colorRes(R.color.md_red_600) - .sizeDp(36)) + holder.noticesItemType.setImageDrawable( + IconicsDrawable(context, CommunityMaterial.Icon.cmd_alert_decagram_outline).apply { + colorRes = R.color.md_red_600 + sizeDp = 36 + } + ) } else { - holder.noticesItemType.setImageDrawable(IconicsDrawable(context, SzkolnyFont.Icon.szf_message_processing_outline) - .colorRes(R.color.md_blue_500) - .sizeDp(36)) + holder.noticesItemType.setImageDrawable( + IconicsDrawable(context, SzkolnyFont.Icon.szf_message_processing_outline).apply { + colorRes = R.color.md_blue_500 + sizeDp = 36 + } + ) } if (!notice.seen) { diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/CounterActivity.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/CounterActivity.kt index e337f720..868b330f 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/CounterActivity.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/CounterActivity.kt @@ -7,9 +7,9 @@ package pl.szczodrzynski.edziennik.ui.modules.home import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import com.mikepenz.iconics.IconicsDrawable -import com.mikepenz.iconics.typeface.library.szkolny.font.SzkolnyFont import com.mikepenz.iconics.utils.colorInt import com.mikepenz.iconics.utils.sizeDp +import eu.szkolny.font.SzkolnyFont import kotlinx.coroutines.* import pl.szczodrzynski.edziennik.* import pl.szczodrzynski.edziennik.data.db.entity.Lesson @@ -59,9 +59,12 @@ class CounterActivity : AppCompatActivity(), CoroutineScope { } } - b.bellSync.setImageDrawable(IconicsDrawable(this@CounterActivity, SzkolnyFont.Icon.szf_alarm_bell_outline) - .colorInt(0xff404040.toInt()) - .sizeDp(36)) + b.bellSync.setImageDrawable( + IconicsDrawable(this@CounterActivity, SzkolnyFont.Icon.szf_alarm_bell_outline).apply { + colorInt = 0xff404040.toInt() + sizeDp = 36 + } + ) b.bellSync.onClick { BellSyncTimeChooseDialog(activity = this@CounterActivity) } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeFragment.kt index 8afd7c04..944c60e8 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeFragment.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeFragment.kt @@ -19,14 +19,13 @@ import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerViewAccessibilityDelegate import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial.Icon -import com.mikepenz.iconics.typeface.library.szkolny.font.SzkolnyFont +import eu.szkolny.font.SzkolnyFont import kotlinx.coroutines.* import pl.szczodrzynski.edziennik.* import pl.szczodrzynski.edziennik.data.db.entity.LoginStore import pl.szczodrzynski.edziennik.databinding.FragmentHomeBinding import pl.szczodrzynski.edziennik.ui.dialogs.home.StudentNumberDialog import pl.szczodrzynski.edziennik.ui.modules.home.cards.* -import pl.szczodrzynski.edziennik.utils.Themes import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetSeparatorItem import kotlin.coroutines.CoroutineContext @@ -75,7 +74,7 @@ class HomeFragment : Fragment(), CoroutineScope { private lateinit var activity: MainActivity private lateinit var b: FragmentHomeBinding - private lateinit var job: Job + private val job: Job = Job() override val coroutineContext: CoroutineContext get() = job + Dispatchers.Main @@ -83,10 +82,8 @@ class HomeFragment : Fragment(), CoroutineScope { activity = (getActivity() as MainActivity?) ?: return null context ?: return null app = activity.application as App - context!!.theme.applyStyle(Themes.appTheme, true) b = FragmentHomeBinding.inflate(inflater) b.refreshLayout.setParent(activity.swipeRefreshLayout) - job = Job() return b.root } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeTimetableCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeTimetableCard.kt index 68363ec6..a530eefc 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeTimetableCard.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeTimetableCard.kt @@ -15,8 +15,8 @@ import androidx.core.view.setMargins import androidx.lifecycle.Observer import com.mikepenz.iconics.IconicsDrawable import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial -import com.mikepenz.iconics.typeface.library.szkolny.font.SzkolnyFont import com.mikepenz.iconics.utils.sizeDp +import eu.szkolny.font.SzkolnyFont import kotlinx.coroutines.* import org.greenrobot.eventbus.EventBus import org.greenrobot.eventbus.Subscribe @@ -87,17 +87,26 @@ class HomeTimetableCard( } holder.root += b.root - b.settings.setImageDrawable(IconicsDrawable(activity, CommunityMaterial.Icon2.cmd_settings_outline) - .colorAttr(activity, R.attr.colorIcon) - .sizeDp(20)) + b.settings.setImageDrawable( + IconicsDrawable(activity, CommunityMaterial.Icon2.cmd_settings_outline).apply { + colorAttr(activity, R.attr.colorIcon) + sizeDp = 20 + } + ) - b.bellSync.setImageDrawable(IconicsDrawable(activity, SzkolnyFont.Icon.szf_alarm_bell_outline) - .colorAttr(activity, R.attr.colorIcon) - .sizeDp(20)) + b.bellSync.setImageDrawable( + IconicsDrawable(activity, SzkolnyFont.Icon.szf_alarm_bell_outline).apply { + colorAttr(activity, R.attr.colorIcon) + sizeDp = 20 + } + ) - b.showCounter.setImageDrawable(IconicsDrawable(activity, CommunityMaterial.Icon.cmd_fullscreen) - .colorAttr(activity, R.attr.colorIcon) - .sizeDp(20)) + b.showCounter.setImageDrawable( + IconicsDrawable(activity, CommunityMaterial.Icon.cmd_fullscreen).apply { + colorAttr(activity, R.attr.colorIcon) + sizeDp = 20 + } + ) b.bellSync.setOnClickListener { BellSyncTimeChooseDialog( diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/homework/HomeworkFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/homework/HomeworkFragment.kt index 30abcd02..f757570a 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/homework/HomeworkFragment.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/homework/HomeworkFragment.kt @@ -12,7 +12,7 @@ import android.view.ViewGroup import android.widget.Toast import androidx.fragment.app.Fragment import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial -import com.mikepenz.iconics.typeface.library.szkolny.font.SzkolnyFont +import eu.szkolny.font.SzkolnyFont import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginFormFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginFormFragment.kt index 8776f355..9e00200b 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginFormFragment.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginFormFragment.kt @@ -97,11 +97,12 @@ class LoginFormFragment : Fragment(), CoroutineScope { b.textEdit.id = credential.name b.textEdit.setText(arguments?.getString(credential.keyName) ?: "") - b.textLayout.startIconDrawable = IconicsDrawable(activity) - .icon(credential.icon) - .sizeDp(24) - .paddingDp(2) - .colorAttr(activity, R.attr.colorOnBackground) + b.textLayout.startIconDrawable = IconicsDrawable(activity).apply { + icon = credential.icon + sizeDp = 24 + paddingDp = 2 + colorAttr(activity, R.attr.colorOnBackground) + } this.b.formContainer.addView(b.root) credentials[credential] = b diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/MessageFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/MessageFragment.kt index b2623b64..19106004 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/MessageFragment.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/MessageFragment.kt @@ -65,9 +65,10 @@ class MessageFragment : Fragment(), CoroutineScope { if (!isAdded) return b.closeButton.setImageDrawable( - IconicsDrawable(activity, CommunityMaterial.Icon2.cmd_window_close) - .colorAttr(activity, android.R.attr.textColorSecondary) - .sizeDp(12) + IconicsDrawable(activity, CommunityMaterial.Icon2.cmd_window_close).apply { + colorAttr(activity, android.R.attr.textColorSecondary) + sizeDp = 12 + } ) b.closeButton.setOnClickListener { activity.navigateUp() } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsLicenseActivity.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsLicenseActivity.kt index eb1a23e1..192f1273 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsLicenseActivity.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsLicenseActivity.kt @@ -38,10 +38,11 @@ class SettingsLicenseActivity : MaterialAboutActivity() { license: OpenSourceLicense, libraryUrl: String): MaterialAboutCard { val licenseItem = MaterialAboutActionItem.Builder() - .icon(IconicsDrawable(this) - .icon(CommunityMaterial.Icon.cmd_book_outline) - .colorInt(foregroundColor) - .sizeDp(18)) + .icon(IconicsDrawable(this).apply { + icon = CommunityMaterial.Icon.cmd_book_outline + colorInt = foregroundColor + sizeDp = 18 + }) .setIconGravity(MaterialAboutActionItem.GRAVITY_TOP) .text(libraryTitle) .subText(String.format(getString(license.resourceId), copyrightYear, copyrightName)) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsNewFragment.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsNewFragment.java index e1541d54..3a6bffe4 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsNewFragment.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsNewFragment.java @@ -25,11 +25,11 @@ import com.danielstone.materialaboutlibrary.items.MaterialAboutSwitchItem; import com.danielstone.materialaboutlibrary.items.MaterialAboutTitleItem; import com.danielstone.materialaboutlibrary.model.MaterialAboutCard; import com.danielstone.materialaboutlibrary.model.MaterialAboutList; -import com.mikepenz.iconics.IconicsColor; import com.mikepenz.iconics.IconicsDrawable; -import com.mikepenz.iconics.IconicsSize; +import com.mikepenz.iconics.typeface.IIcon; import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial; -import com.mikepenz.iconics.typeface.library.szkolny.font.SzkolnyFont; +import com.mikepenz.iconics.utils.IconicsConvertersKt; +import com.mikepenz.iconics.utils.IconicsDrawableExtensionsKt; import com.theartofdev.edmodo.cropper.CropImage; import com.theartofdev.edmodo.cropper.CropImageView; import com.wdullaer.materialdatetimepicker.time.TimePickerDialog; @@ -40,6 +40,8 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import eu.szkolny.font.SzkolnyFont; +import kotlin.Unit; import pl.szczodrzynski.edziennik.App; import pl.szczodrzynski.edziennik.BuildConfig; import pl.szczodrzynski.edziennik.ExtensionsKt; @@ -90,6 +92,15 @@ public class SettingsNewFragment extends MaterialAboutFragment { private int secondaryTextOnPrimaryBg = -1; private int iconSizeDp = 20; + private IconicsDrawable icon(IIcon icon, int sizeDp, int color) { + return new IconicsDrawable(activity).apply((drawable) -> { + drawable.setIcon(icon); + IconicsConvertersKt.setSizeDp(drawable, sizeDp); + IconicsDrawableExtensionsKt.setColorInt(drawable, color); + return Unit.INSTANCE; + }); + } + private MaterialAboutCard getCardWithItems(CharSequence title, ArrayList items, boolean primaryColor) { MaterialAboutCard card = new MaterialAboutCard.Builder().title(title).cardColor(0xff1976D2).build(); card.getItems().addAll(items); @@ -120,10 +131,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { return new MaterialAboutActionItem( getString(R.string.settings_more_text), null, - new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon.cmd_chevron_down) - .size(IconicsSize.dp(14)) - .color(IconicsColor.colorInt(iconColor)), + icon(CommunityMaterial.Icon.cmd_chevron_down, 14, iconColor), onClickAction ); } @@ -209,10 +217,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { new MaterialAboutActionItem( getString(R.string.settings_profile_change_password_text), getString(R.string.settings_profile_change_password_subtext), - new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon2.cmd_key_variant) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor)) + icon(CommunityMaterial.Icon2.cmd_key_variant, iconSizeDp, iconColor) ) .setOnClickAction(() -> { @@ -223,10 +228,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { new MaterialAboutActionItem( getString(R.string.settings_add_student_text), getString(R.string.settings_add_student_subtext), - new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon.cmd_account_plus_outline) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor)) + icon(CommunityMaterial.Icon.cmd_account_plus_outline, iconSizeDp, iconColor) ) .setOnClickAction(() -> { startActivity(new Intent(activity, LoginActivity.class)); @@ -237,10 +239,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { new MaterialAboutActionItem( getString(R.string.settings_profile_notifications_text), getString(R.string.settings_profile_notifications_subtext), - new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon.cmd_filter_outline) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor)) + icon(CommunityMaterial.Icon.cmd_filter_outline, iconSizeDp, iconColor) ) .setOnClickAction(() -> { new NotificationFilterDialog(activity, null, null); @@ -251,10 +250,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { new MaterialAboutActionItem( getString(R.string.settings_profile_remove_text), getString(R.string.settings_profile_remove_subtext), - new IconicsDrawable(activity) - .icon(SzkolnyFont.Icon.szf_delete_empty_outline) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor)) + icon(SzkolnyFont.Icon.szf_delete_empty_outline, iconSizeDp, iconColor) ) .setOnClickAction(() -> { new ProfileRemoveDialog(activity, app.getProfile().getId(), app.getProfile().getName(), false); @@ -269,10 +265,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { new MaterialAboutSwitchItem.Builder() .text(R.string.settings_profile_sync_text) .subText(R.string.settings_profile_sync_subtext) - .icon(new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon.cmd_account_convert) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor))) + .icon(icon(CommunityMaterial.Icon.cmd_account_convert, iconSizeDp, iconColor)) .setChecked(app.getProfile().getSyncEnabled()) .setOnCheckedChanged(((item, isChecked) -> { app.getProfile().setSyncEnabled(isChecked); @@ -302,10 +295,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { new MaterialAboutSwitchItem.Builder() .text(R.string.settings_theme_snowfall_text) .subText(R.string.settings_theme_snowfall_subtext) - .icon(new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon2.cmd_snowflake) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor))) + .icon(icon(CommunityMaterial.Icon2.cmd_snowflake, iconSizeDp, iconColor)) .setChecked(app.getConfig().getUi().getSnowfall()) .setOnCheckedChanged((item, isChecked) -> { app.getConfig().getUi().setSnowfall(isChecked); @@ -320,10 +310,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { new MaterialAboutActionItem( getString(R.string.settings_theme_theme_text), Themes.INSTANCE.getThemeName(activity), - new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon2.cmd_palette_outline) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor)) + icon(CommunityMaterial.Icon2.cmd_palette_outline, iconSizeDp, iconColor) ) .setOnClickAction(() -> { new MaterialDialog.Builder(activity) @@ -345,10 +332,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { new MaterialAboutSwitchItem.Builder() .text(R.string.settings_theme_mini_drawer_text) .subText(R.string.settings_theme_mini_drawer_subtext) - .icon(new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon.cmd_dots_vertical) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor))) + .icon(icon(CommunityMaterial.Icon.cmd_dots_vertical, iconSizeDp, iconColor)) .setChecked(app.getConfig().getUi().getMiniMenuVisible()) .setOnCheckedChanged((item, isChecked) -> { // 0,1 1 @@ -370,10 +354,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { new MaterialAboutActionItem( getString(R.string.settings_theme_mini_drawer_buttons_text), null, - new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon.cmd_format_list_checks) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor)) + icon(CommunityMaterial.Icon.cmd_format_list_checks, iconSizeDp, iconColor) ) .setOnClickAction(() -> { List buttonIds = new ArrayList<>(); @@ -434,10 +415,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { new MaterialAboutActionItem( getString(R.string.settings_theme_drawer_header_text), null, - new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon2.cmd_image_outline) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor)) + icon(CommunityMaterial.Icon2.cmd_image_outline, iconSizeDp, iconColor) ) .setOnClickAction(() -> { if (app.getConfig().getUi().getHeaderBackground() != null) { @@ -468,10 +446,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { new MaterialAboutActionItem( getString(R.string.settings_theme_app_background_text), getString(R.string.settings_theme_app_background_subtext), - new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon2.cmd_image_filter_hdr) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor)) + icon(CommunityMaterial.Icon2.cmd_image_filter_hdr, iconSizeDp, iconColor) ) .setOnClickAction(() -> { if (app.getConfig().getUi().getAppBackground() != null) { @@ -497,10 +472,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { items.add( new MaterialAboutSwitchItem.Builder( ) .text(R.string.settings_theme_open_drawer_on_back_pressed_text) - .icon(new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon2.cmd_menu_open) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor))) + .icon(icon(CommunityMaterial.Icon2.cmd_menu_open, iconSizeDp, iconColor)) .setChecked(app.getConfig().getUi().getOpenDrawerOnBackPressed()) .setOnCheckedChanged((item, isChecked) -> { app.getConfig().getUi().setOpenDrawerOnBackPressed(isChecked); @@ -549,10 +521,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { return new MaterialAboutSwitchItem.Builder() .text(R.string.settings_sync_wifi_text) .subText(R.string.settings_sync_wifi_subtext) - .icon(new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon2.cmd_wifi_strength_2) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor))) + .icon(icon(CommunityMaterial.Icon2.cmd_wifi_strength_2, iconSizeDp, iconColor)) .setChecked(app.getConfig().getSync().getOnlyWifi()) .setOnCheckedChanged((item, isChecked) -> { app.getConfig().getSync().setOnlyWifi(isChecked); @@ -570,10 +539,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { syncCardIntervalItem = new MaterialAboutActionSwitchItem.Builder() .text(R.string.settings_sync_sync_interval_text) .subText(R.string.settings_sync_sync_interval_subtext_disabled) - .icon(new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon.cmd_download_outline) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor))) + .icon(icon(CommunityMaterial.Icon.cmd_download_outline, iconSizeDp, iconColor)) .build(); syncCardIntervalItem.setSubTextChecked(getSyncCardIntervalSubText()); syncCardIntervalItem.setChecked(app.getConfig().getSync().getEnabled()); @@ -644,10 +610,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { new MaterialAboutSwitchItem( "Cisza na lekcjach", "Nie odtwarzaj dźwięku powiadomień podczas lekcji", - new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon2.cmd_volume_off) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor)) + icon(CommunityMaterial.Icon2.cmd_volume_off, iconSizeDp, iconColor) ) .setChecked(app.appConfig.quietDuringLessons) .setOnChangeAction((isChecked) -> { @@ -661,10 +624,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { syncCardQuietHoursItem = new MaterialAboutActionSwitchItem.Builder() .text(R.string.settings_sync_quiet_hours_text) .subText(R.string.settings_sync_quiet_hours_subtext_disabled) - .icon(new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon.cmd_bell_sleep_outline) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor))) + .icon(icon(CommunityMaterial.Icon.cmd_bell_sleep_outline, iconSizeDp, iconColor)) .build(); syncCardQuietHoursItem.setChecked(app.getConfig().getSync().getQuietHoursEnabled()); syncCardQuietHoursItem.setSubTextChecked(getSyncCardQuietHoursSubText()); @@ -721,10 +681,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { new MaterialAboutActionItem( getString(R.string.settings_sync_web_push_text), getString(R.string.settings_sync_web_push_subtext), - new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon2.cmd_laptop) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor)) + icon(CommunityMaterial.Icon2.cmd_laptop, iconSizeDp, iconColor) ) .setOnClickAction(() -> { activity.loadTarget(MainActivity.TARGET_WEB_PUSH, null); @@ -739,10 +696,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { new MaterialAboutActionItem( "Dźwięk powiadomień", "Szkolny.eu", - new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon2.cmd_volume_high) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor)) + icon(CommunityMaterial.Icon2.cmd_volume_high, iconSizeDp, iconColor) ) .setOnClickAction(() -> { @@ -752,10 +706,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { items.add( new MaterialAboutSwitchItem.Builder() .text(R.string.settings_sync_updates_text) - .icon(new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon.cmd_cellphone_arrow_down) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor))) + .icon(icon(CommunityMaterial.Icon.cmd_cellphone_arrow_down, iconSizeDp, iconColor)) .setChecked(app.getConfig().getSync().getNotifyAboutUpdates()) .setOnCheckedChanged((item, isChecked) -> { app.getConfig().getSync().setNotifyAboutUpdates(isChecked); @@ -770,10 +721,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { new MaterialAboutActionItem( getString(R.string.settings_sync_notifications_settings_text), getString(R.string.settings_sync_notifications_settings_subtext), - new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon2.cmd_settings_outline) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor)) + icon(CommunityMaterial.Icon2.cmd_settings_outline, iconSizeDp, iconColor) ) .setOnClickAction(() -> { String channel = app.getNotificationChannelsManager().getData().getKey(); @@ -846,10 +794,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { return new MaterialAboutSwitchItem.Builder() .text(R.string.settings_register_shared_events_text) .subText(R.string.settings_register_shared_events_subtext) - .icon(new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon2.cmd_share_outline) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor))) + .icon(icon(CommunityMaterial.Icon2.cmd_share_outline, iconSizeDp, iconColor)) .setChecked(app.getProfile().getEnableSharedEvents()) .setOnCheckedChanged((item, isChecked) -> { app.getProfile().setEnableSharedEvents(isChecked); @@ -877,28 +822,19 @@ public class SettingsNewFragment extends MaterialAboutFragment { items.add(new MaterialAboutActionItem( getString(R.string.menu_grades_config), null, - new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon2.cmd_numeric_5_box_outline) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor)) + icon(CommunityMaterial.Icon2.cmd_numeric_5_box_outline, iconSizeDp, iconColor) ).setOnClickAction(() -> new GradesConfigDialog(activity, false, null, null))); items.add(new MaterialAboutActionItem( getString(R.string.menu_attendance_config), null, - new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon.cmd_calendar_remove_outline) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor)) + icon(CommunityMaterial.Icon.cmd_calendar_remove_outline, iconSizeDp, iconColor) ).setOnClickAction(() -> new AttendanceConfigDialog(activity, false, null, null))); registerCardAllowRegistrationItem = new MaterialAboutSwitchItem.Builder() .text(R.string.settings_register_allow_registration_text) .subText(R.string.settings_register_allow_registration_subtext) - .icon(new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon.cmd_account_circle_outline) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor))) + .icon(icon(CommunityMaterial.Icon.cmd_account_circle_outline, iconSizeDp, iconColor)) .build(); registerCardAllowRegistrationItem.setChecked(app.getProfile().getRegistration() == REGISTRATION_ENABLED); registerCardAllowRegistrationItem.setOnCheckedChangedAction((item, isChecked) -> { @@ -955,10 +891,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { registerCardBellSyncItem = new MaterialAboutActionItem( getString(R.string.settings_register_bell_sync_text), getRegisterCardBellSyncSubText(), - new IconicsDrawable(activity) - .icon(SzkolnyFont.Icon.szf_alarm_bell_outline) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor)) + icon(SzkolnyFont.Icon.szf_alarm_bell_outline, iconSizeDp, iconColor) ); registerCardBellSyncItem.setOnClickAction(() -> { new MaterialDialog.Builder(activity) @@ -1025,10 +958,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { new MaterialAboutSwitchItem.Builder() .text(R.string.settings_register_count_in_seconds_text) .subText(R.string.settings_register_count_in_seconds_subtext) - .icon(new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon2.cmd_timer) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor))) + .icon(icon(CommunityMaterial.Icon2.cmd_timer, iconSizeDp, iconColor)) .setChecked(app.getConfig().getTimetable().getCountInSeconds()) .setOnCheckedChanged((item, isChecked) -> { app.getConfig().getTimetable().setCountInSeconds(isChecked); @@ -1041,10 +971,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { items.add( new MaterialAboutSwitchItem.Builder() .text(R.string.settings_register_show_teacher_absences_text) - .icon(new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon.cmd_account_arrow_right_outline) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor))) + .icon(icon(CommunityMaterial.Icon.cmd_account_arrow_right_outline, iconSizeDp, iconColor)) .setChecked(app.getProfile().getStudentData("showTeacherAbsences", true)) .setOnCheckedChanged((item, isChecked) -> { app.getProfile().putStudentData("showTeacherAbsences", isChecked); @@ -1059,10 +986,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { items.add( new MaterialAboutSwitchItem.Builder() .text(R.string.settings_register_hide_sticks_from_old) - .icon(new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon2.cmd_numeric_1_box_outline) - .size(IconicsSize.dp(iconSizeDp)) - .color(IconicsColor.colorInt(iconColor))) + .icon(icon(CommunityMaterial.Icon2.cmd_numeric_1_box_outline, iconSizeDp, iconColor)) .setChecked(app.getConfig().forProfile().getGrades().getHideSticksFromOld()) .setOnCheckedChanged((item, isChecked) -> { app.getConfig().forProfile().getGrades().setHideSticksFromOld(isChecked); @@ -1098,10 +1022,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { pref_about_version = new MaterialAboutActionItem.Builder() .text(R.string.settings_about_version_text) .subText(BuildConfig.VERSION_NAME + ", " + BuildConfig.BUILD_TYPE) - .icon(new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon2.cmd_information_outline) - .color(IconicsColor.colorInt(primaryTextOnPrimaryBg)) - .size(IconicsSize.dp(iconSizeDp))) + .icon(icon(CommunityMaterial.Icon2.cmd_information_outline, iconSizeDp, primaryTextOnPrimaryBg)) .build(); final int[] clickCounter = {0}; pref_about_version.setOnClickAction(() -> { @@ -1120,30 +1041,21 @@ public class SettingsNewFragment extends MaterialAboutFragment { items.add(new MaterialAboutActionItem.Builder() .text(R.string.settings_about_privacy_policy_text) - .icon(new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon2.cmd_shield_outline) - .color(IconicsColor.colorInt(primaryTextOnPrimaryBg)) - .size(IconicsSize.dp(iconSizeDp))) + .icon(icon(CommunityMaterial.Icon2.cmd_shield_outline, iconSizeDp, primaryTextOnPrimaryBg)) .setOnClickAction(ConvenienceBuilder.createWebsiteOnClickAction(activity, Uri.parse("https://szkolny.eu/privacy-policy"))) .build()); items.add(new MaterialAboutActionItem.Builder() .text(R.string.settings_about_discord_text) .subText(R.string.settings_about_discord_subtext) - .icon(new IconicsDrawable(activity) - .icon(SzkolnyFont.Icon.szf_discord_outline) - .color(IconicsColor.colorInt(primaryTextOnPrimaryBg)) - .size(IconicsSize.dp(iconSizeDp))) + .icon(icon(SzkolnyFont.Icon.szf_discord_outline, iconSizeDp, primaryTextOnPrimaryBg)) .setOnClickAction(ConvenienceBuilder.createWebsiteOnClickAction(activity, Uri.parse("https://szkolny.eu/discord"))) .build()); items.add(new MaterialAboutActionItem.Builder() .text(R.string.settings_about_language_text) .subText(R.string.settings_about_language_subtext) - .icon(new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon2.cmd_translate) - .color(IconicsColor.colorInt(primaryTextOnPrimaryBg)) - .size(IconicsSize.dp(iconSizeDp))) + .icon(icon(CommunityMaterial.Icon2.cmd_translate, iconSizeDp, primaryTextOnPrimaryBg)) .setOnClickAction(() -> { new MaterialDialog.Builder(activity) .title(getString(R.string.settings_about_language_dialog_title)) @@ -1178,10 +1090,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { items.add(new MaterialAboutActionItem.Builder() .text(R.string.settings_about_update_text) .subText(R.string.settings_about_update_subtext) - .icon(new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon2.cmd_update) - .color(IconicsColor.colorInt(primaryTextOnPrimaryBg)) - .size(IconicsSize.dp(iconSizeDp))) + .icon(icon(CommunityMaterial.Icon2.cmd_update, iconSizeDp, primaryTextOnPrimaryBg)) .setOnClickAction(() -> { //open browser or intent here NetworkUtils net = new NetworkUtils(app); @@ -1201,19 +1110,13 @@ public class SettingsNewFragment extends MaterialAboutFragment { items.add(new MaterialAboutActionItem.Builder() .text(R.string.settings_about_changelog_text) - .icon(new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon2.cmd_radar) - .color(IconicsColor.colorInt(primaryTextOnPrimaryBg)) - .size(IconicsSize.dp(iconSizeDp))) + .icon(icon(CommunityMaterial.Icon2.cmd_radar, iconSizeDp, primaryTextOnPrimaryBg)) .setOnClickAction(() -> new ChangelogDialog(activity, null, null)) .build()); items.add(new MaterialAboutActionItem.Builder() .text(R.string.settings_about_licenses_text) - .icon(new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon.cmd_code_braces) - .color(IconicsColor.colorInt(primaryTextOnPrimaryBg)) - .size(IconicsSize.dp(iconSizeDp))) + .icon(icon(CommunityMaterial.Icon.cmd_code_braces, iconSizeDp, primaryTextOnPrimaryBg)) .setOnClickAction(() -> { Intent intent = new Intent(activity, SettingsLicenseActivity.class); startActivity(intent); @@ -1222,10 +1125,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { /*items.add(new MaterialAboutActionItem.Builder() .text(R.string.settings_about_intro_text) - .icon(new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon2.cmd_projector_screen) - .color(IconicsColor.colorInt(iconColor)) - .size(IconicsSize.dp(iconSizeDp))) + .icon(icon(CommunityMaterial.Icon2.cmd_projector_screen, iconSizeDp, iconColor)) .setOnClickAction(() -> { if (tryingToDevMode[0]) { if (getParentFragment() instanceof SettingsGeneralFragment) { @@ -1246,10 +1146,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { items.add(new MaterialAboutActionItem.Builder() .text(R.string.settings_about_crash_text) .subText(R.string.settings_about_crash_subtext) - .icon(new IconicsDrawable(activity) - .icon(CommunityMaterial.Icon.cmd_bug_outline) - .color(IconicsColor.colorInt(primaryTextOnPrimaryBg)) - .size(IconicsSize.dp(iconSizeDp))) + .icon(icon(CommunityMaterial.Icon.cmd_bug_outline, iconSizeDp, primaryTextOnPrimaryBg)) .setOnClickAction(() -> { throw new RuntimeException("MANUAL CRASH"); }) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/TimetableFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/TimetableFragment.kt index 52441e25..2e3695cc 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/TimetableFragment.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/TimetableFragment.kt @@ -18,8 +18,8 @@ import androidx.fragment.app.Fragment import androidx.viewpager.widget.ViewPager import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial.Icon2 -import com.mikepenz.iconics.typeface.library.szkolny.font.SzkolnyFont import com.wdullaer.materialdatetimepicker.date.DatePickerDialog +import eu.szkolny.font.SzkolnyFont import kotlinx.coroutines.* import pl.szczodrzynski.edziennik.App import pl.szczodrzynski.edziennik.MainActivity diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/AttachmentAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/AttachmentAdapter.kt index 1975f39e..99abba4d 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/AttachmentAdapter.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/AttachmentAdapter.kt @@ -11,11 +11,10 @@ import androidx.core.view.isVisible import androidx.recyclerview.widget.RecyclerView import com.google.android.material.chip.Chip import com.mikepenz.iconics.IconicsDrawable -import com.mikepenz.iconics.typeface.IIcon import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial -import com.mikepenz.iconics.typeface.library.szkolny.font.SzkolnyFont import com.mikepenz.iconics.utils.paddingDp import com.mikepenz.iconics.utils.sizeDp +import eu.szkolny.font.SzkolnyFont import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job @@ -60,7 +59,7 @@ class AttachmentAdapter( val fileName = item.name.substringBefore(":http") // create an icon for the attachment - val icon: IIcon = when (Utils.getExtensionFromFileName(fileName)) { + val attachmentIcon = when (Utils.getExtensionFromFileName(fileName)) { "doc", "docx", "odt", "rtf" -> SzkolnyFont.Icon.szf_file_word_outline "xls", "xlsx", "ods" -> SzkolnyFont.Icon.szf_file_excel_outline "ppt", "pptx", "odp" -> SzkolnyFont.Icon.szf_file_powerpoint_outline @@ -82,15 +81,17 @@ class AttachmentAdapter( } ?: fileName } - b.chip.chipIcon = IconicsDrawable(context) - .icon(icon) - .colorAttr(context, R.attr.colorOnSurface) - .sizeDp(24) - .paddingDp(2) - b.chip.closeIcon = IconicsDrawable(context) - .icon(CommunityMaterial.Icon.cmd_check) - .colorAttr(context, R.attr.colorOnSurface) - .sizeDp(18) + b.chip.chipIcon = IconicsDrawable(context).apply { + icon = attachmentIcon + colorAttr(context, R.attr.colorSurface) + sizeDp = 24 + paddingDp = 2 + } + b.chip.closeIcon = IconicsDrawable(context).apply { + icon = CommunityMaterial.Icon.cmd_check + colorAttr(context, R.attr.colorOnSurface) + sizeDp = 18 + } b.chip.isCloseIconVisible = item.isDownloaded && !item.isDownloading // prevent progress bar flickering diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/notifications/WidgetNotificationsProvider.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/notifications/WidgetNotificationsProvider.kt index aec64aef..3832b6c7 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/notifications/WidgetNotificationsProvider.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/notifications/WidgetNotificationsProvider.kt @@ -48,10 +48,10 @@ class WidgetNotificationsProvider : AppWidgetProvider() { views.setImageViewBitmap( R.id.widgetNotificationsSync, - IconicsDrawable(context, CommunityMaterial.Icon.cmd_download_outline) - .colorInt(Color.WHITE) - .sizeDp(iconSize) - .toBitmap() + IconicsDrawable(context, CommunityMaterial.Icon.cmd_download_outline).apply { + colorInt = Color.WHITE + sizeDp = iconSize + }.toBitmap() ) views.setViewVisibility(R.id.widgetNotificationsLoading, View.GONE) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableFactory.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableFactory.java index 6f81bf2c..8a351b1f 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableFactory.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableFactory.java @@ -24,13 +24,14 @@ import android.widget.RemoteViewsService; import androidx.annotation.DrawableRes; -import com.mikepenz.iconics.IconicsColor; import com.mikepenz.iconics.IconicsDrawable; -import com.mikepenz.iconics.IconicsSize; import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial; +import com.mikepenz.iconics.utils.IconicsConvertersKt; +import com.mikepenz.iconics.utils.IconicsDrawableExtensionsKt; import java.util.List; +import kotlin.Unit; import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.utils.models.Date; import pl.szczodrzynski.edziennik.utils.models.ItemWidgetTimetableModel; @@ -126,6 +127,15 @@ public class WidgetTimetableFactory implements RemoteViewsService.RemoteViewsFac return resultBitmap; } + private Bitmap homeIconBitmap() { + return new IconicsDrawable(context).apply((drawable) -> { + IconicsConvertersKt.setColorRes(drawable, R.color.md_red_500); + IconicsConvertersKt.setSizeDp(drawable, 10); + IconicsDrawableExtensionsKt.icon(drawable, CommunityMaterial.Icon2.cmd_home); + return Unit.INSTANCE; + }).toBitmap(); + } + @Override public RemoteViews getViewAt(int i) { RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.row_widget_timetable_item); @@ -270,19 +280,19 @@ public class WidgetTimetableFactory implements RemoteViewsService.RemoteViewsFac if (lesson.eventColors.size() >= 1) { views.setViewVisibility(R.id.widgetTimetableEvent1, View.VISIBLE); if (lesson.eventColors.get(0) == -1) - views.setBitmap(R.id.widgetTimetableEvent1, "setImageBitmap", new IconicsDrawable(context).color(IconicsColor.colorRes(R.color.md_red_500)).size(IconicsSize.dp(10)).icon(CommunityMaterial.Icon2.cmd_home).toBitmap()); + views.setBitmap(R.id.widgetTimetableEvent1, "setImageBitmap", homeIconBitmap()); else views.setBitmap(R.id.widgetTimetableEvent1, "setImageBitmap", getColoredBitmap(context, R.drawable.event_color_circle, lesson.eventColors.get(0), eventIndicatorSize, eventIndicatorSize)); if (lesson.eventColors.size() >= 2) { views.setViewVisibility(R.id.widgetTimetableEvent2, View.VISIBLE); if (lesson.eventColors.get(1) == -1) - views.setBitmap(R.id.widgetTimetableEvent2, "setImageBitmap", new IconicsDrawable(context).color(IconicsColor.colorRes(R.color.md_red_500)).size(IconicsSize.dp(10)).icon(CommunityMaterial.Icon2.cmd_home).toBitmap()); + views.setBitmap(R.id.widgetTimetableEvent2, "setImageBitmap", homeIconBitmap()); else views.setBitmap(R.id.widgetTimetableEvent2, "setImageBitmap", getColoredBitmap(context, R.drawable.event_color_circle, lesson.eventColors.get(1), eventIndicatorSize, eventIndicatorSize)); if (lesson.eventColors.size() >= 3) { views.setViewVisibility(R.id.widgetTimetableEvent3, View.VISIBLE); if (lesson.eventColors.get(2) == -1) - views.setBitmap(R.id.widgetTimetableEvent3, "setImageBitmap", new IconicsDrawable(context).color(IconicsColor.colorRes(R.color.md_red_500)).size(IconicsSize.dp(10)).icon(CommunityMaterial.Icon2.cmd_home).toBitmap()); + views.setBitmap(R.id.widgetTimetableEvent3, "setImageBitmap", homeIconBitmap()); else views.setBitmap(R.id.widgetTimetableEvent3, "setImageBitmap", getColoredBitmap(context, R.drawable.event_color_circle, lesson.eventColors.get(2), eventIndicatorSize, eventIndicatorSize)); } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableProvider.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableProvider.kt index bc284ba2..07db9ea2 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableProvider.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableProvider.kt @@ -115,13 +115,21 @@ class WidgetTimetableProvider : AppWidgetProvider() { views.setOnClickPendingIntent(R.id.widgetTimetableSync, getPendingSelfIntent(context, ACTION_SYNC_DATA)) - views.setImageViewBitmap(R.id.widgetTimetableRefresh, IconicsDrawable(context, CommunityMaterial.Icon2.cmd_refresh) - .colorInt(Color.WHITE) - .sizeDp(if (config.bigStyle) 24 else 16).toBitmap()) + views.setImageViewBitmap( + R.id.widgetTimetableRefresh, + IconicsDrawable(context, CommunityMaterial.Icon2.cmd_refresh).apply { + colorInt = Color.WHITE + sizeDp = if (config.bigStyle) 24 else 16 + }.toBitmap() + ) - views.setImageViewBitmap(R.id.widgetTimetableSync, IconicsDrawable(context, CommunityMaterial.Icon.cmd_download_outline) - .colorInt(Color.WHITE) - .sizeDp(if (config.bigStyle) 24 else 16).toBitmap()) + views.setImageViewBitmap( + R.id.widgetTimetableSync, + IconicsDrawable(context, CommunityMaterial.Icon.cmd_download_outline).apply { + colorInt = Color.WHITE + sizeDp = if (config.bigStyle) 24 else 16 + }.toBitmap() + ) prepareAppWidget(app, appWidgetId, views, config, bellSyncDiffMillis) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/utils/SwipeRefreshLayoutNoIndicator.java b/app/src/main/java/pl/szczodrzynski/edziennik/utils/SwipeRefreshLayoutNoIndicator.java new file mode 100644 index 00000000..75192eec --- /dev/null +++ b/app/src/main/java/pl/szczodrzynski/edziennik/utils/SwipeRefreshLayoutNoIndicator.java @@ -0,0 +1,208 @@ +/* + * Copyright 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package pl.szczodrzynski.edziennik.utils; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.view.View; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; + +/** + * The SwipeRefreshLayout should be used whenever the user can refresh the + * contents of a view via a vertical swipe gesture. The activity that + * instantiates this view should add an OnRefreshListener to be notified + * whenever the swipe to refresh gesture is completed. The SwipeRefreshLayout + * will notify the listener each and every time the gesture is completed again; + * the listener is responsible for correctly determining when to actually + * initiate a refresh of its content. If the listener determines there should + * not be a refresh, it must call setRefreshing(false) to cancel any visual + * indication of a refresh. If an activity wishes to show just the progress + * animation, it should call setRefreshing(true). To disable the gesture and + * progress animation, call setEnabled(false) on the view. + *

+ * This layout should be made the parent of the view that will be refreshed as a + * result of the gesture and can only support one direct child. This view will + * also be made the target of the gesture and will be forced to match both the + * width and the height supplied in this layout. The SwipeRefreshLayout does not + * provide accessibility events; instead, a menu item must be provided to allow + * refresh of the content wherever this gesture is used. + *

+ */ +public class SwipeRefreshLayoutNoIndicator extends SwipeRefreshLayout { + + private SwipeRefreshLayoutNoTouch parent; + + @Override + public void setEnabled(boolean enabled) { + if (parent == null) + return; + parent.setEnabled(enabled); + super.setEnabled(enabled); + } + + public void setParent(SwipeRefreshLayoutNoTouch parent) { + this.parent = parent; + } + + /** + * Simple constructor to use when creating a SwipeRefreshLayout from code. + * + * @param context + */ + public SwipeRefreshLayoutNoIndicator(@NonNull Context context) { + this(context, null); + } + + /** + * Constructor that is called when inflating SwipeRefreshLayout from XML. + * + * @param context + * @param attrs + */ + public SwipeRefreshLayoutNoIndicator(@NonNull Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + } + + @Override + public boolean onInterceptTouchEvent(MotionEvent ev) { + ev.setSource(0x10000000); + boolean parentConsumed = parent.onInterceptTouchEvent(ev); + boolean superConsumed = super.onInterceptTouchEvent(ev); + return parentConsumed && superConsumed; + /*if (super.onInterceptTouchEvent(ev)) + return parent.onInterceptTouchEvent(ev); + return false;*/ + } + + @Override + public void requestDisallowInterceptTouchEvent(boolean b) { + parent.requestDisallowInterceptTouchEvent(b); + } + + // NestedScrollingParent + + @Override + public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes) { + parent.onStartNestedScroll(child, target, nestedScrollAxes); + return !parent.isRefreshing() && super.onStartNestedScroll(child, target, nestedScrollAxes); + } + + @Override + public void onNestedScrollAccepted(View child, View target, int axes) { + parent.onNestedScrollAccepted(child, target, axes); + } + + @Override + public void onNestedPreScroll(View target, int dx, int dy, int[] consumed) { + parent.onNestedPreScroll(target, dx, dy, consumed); + } + + @Override + public int getNestedScrollAxes() { + return parent.getNestedScrollAxes(); + } + + @Override + public void onStopNestedScroll(View target) { + parent.onStopNestedScroll(target); + } + + @Override + public void onNestedScroll(final View target, final int dxConsumed, final int dyConsumed, + final int dxUnconsumed, final int dyUnconsumed) { + parent.onNestedScroll(target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); + } + + // NestedScrollingChild + + @Override + public void setNestedScrollingEnabled(boolean enabled) { + if (parent == null) + return; + //parent.setNestedScrollingEnabled(enabled); + super.setNestedScrollingEnabled(enabled); + } + + @Override + public boolean isNestedScrollingEnabled() { + return parent.isNestedScrollingEnabled(); + } + + @Override + public boolean startNestedScroll(int axes) { + return parent.startNestedScroll(axes); + } + + @Override + public void stopNestedScroll() { + parent.stopNestedScroll(); + } + + @Override + public boolean hasNestedScrollingParent() { + return parent.hasNestedScrollingParent(); + } + + @Override + public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, + int dyUnconsumed, int[] offsetInWindow) { + return super.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow); + } + + @Override + public boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow) { + return super.dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow); + } + + @Override + public boolean onNestedPreFling(View target, float velocityX, + float velocityY) { + return parent.onNestedPreFling(target, velocityX, velocityY); + } + + @Override + public boolean onNestedFling(View target, float velocityX, float velocityY, + boolean consumed) { + return parent.onNestedFling(target, velocityX, velocityY, consumed); + } + + @Override + public boolean dispatchNestedFling(float velocityX, float velocityY, boolean consumed) { + return parent.dispatchNestedFling(velocityX, velocityY, consumed); + } + + @Override + public boolean dispatchNestedPreFling(float velocityX, float velocityY) { + return parent.dispatchNestedPreFling(velocityX, velocityY); + } + + @Override + public boolean onTouchEvent(MotionEvent ev) { + ev.setSource(0x10000000); + /*boolean consumed = super.onTouchEvent(ev); + if (consumed) { + return false; + }*/ + return parent.onTouchEvent(ev); + } + + +} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/utils/SwipeRefreshLayoutNoTouch.java b/app/src/main/java/pl/szczodrzynski/edziennik/utils/SwipeRefreshLayoutNoTouch.java new file mode 100644 index 00000000..0b2daf51 --- /dev/null +++ b/app/src/main/java/pl/szczodrzynski/edziennik/utils/SwipeRefreshLayoutNoTouch.java @@ -0,0 +1,51 @@ +package pl.szczodrzynski.edziennik.utils; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.view.View; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; + + +public class SwipeRefreshLayoutNoTouch extends SwipeRefreshLayout { + public SwipeRefreshLayoutNoTouch(@NonNull Context context) { + super(context); + } + + public SwipeRefreshLayoutNoTouch(@NonNull Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + } + + @Override + public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes) { + return false; + } + + @Override + public boolean onInterceptTouchEvent(MotionEvent ev) { + if (ev.getSource() == 0x10000000) { + // forward the event to super + return super.onInterceptTouchEvent(ev); + } + // discard all the other events + return false; + + /*if (ev.getAction() == MotionEvent.ACTION_UP || ev.getAction() == MotionEvent.ACTION_CANCEL) + return false; + super.onInterceptTouchEvent(ev); + return false;*/ + } + + @Override + public boolean onTouchEvent(MotionEvent ev) { + if (ev.getSource() == 0x10000000) { + // forward the event to super + return super.onTouchEvent(ev); + } + // discard all the other events + return false; + } +} diff --git a/build.gradle b/build.gradle index c0fb9910..fd64a16a 100644 --- a/build.gradle +++ b/build.gradle @@ -44,7 +44,7 @@ buildscript { materialdialogs : "0.9.6.0", materialdrawer : "817e45765c367034b03046aaea6e95eeabcb40e9", - iconics : "4.0.1", + iconics : "5.2.8", font_cmd : "3.5.95.1-kotlin", navlib : "28cdab341470dffa5f331379fe9702482681d7de", diff --git a/settings.gradle b/settings.gradle index 680b7d04..a1b55163 100644 --- a/settings.gradle +++ b/settings.gradle @@ -3,7 +3,7 @@ include ':wear' include ':codegen' include ':annotation' rootProject.name='Szkolny.eu' -include ':app', ':szkolny-font' +include ':app' /* include ':Navigation' project(':Navigation').projectDir = new File(settingsDir, '../Navigation/navlib')*/ diff --git a/szkolny-font/build.gradle b/szkolny-font/build.gradle deleted file mode 100644 index 70d20b0d..00000000 --- a/szkolny-font/build.gradle +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2019 Mike Penz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -apply plugin: 'com.android.library' - -apply plugin: 'kotlin-android' - -android { - compileSdkVersion setup.compileSdk - - defaultConfig { - minSdkVersion setup.minSdk - targetSdkVersion setup.targetSdk - consumerProguardFiles 'consumer-proguard-rules.pro' - versionCode 11 - versionName "1.1" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - debugMinify { - debuggable = true - minifyEnabled = true - proguardFiles 'proguard-android.txt' - } - } -} -if (project.hasProperty('pushall') || project.hasProperty('SzkolnyFontonly')) { - apply from: '../gradle-mvn-push.gradle' -} - -dependencies { - implementation "com.mikepenz:iconics-core:${versions.iconics}" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${versions.kotlin}" -} diff --git a/szkolny-font/consumer-proguard-rules.pro b/szkolny-font/consumer-proguard-rules.pro deleted file mode 100644 index 61d1083d..00000000 --- a/szkolny-font/consumer-proguard-rules.pro +++ /dev/null @@ -1 +0,0 @@ --keep class com.mikepenz.iconics.typeface.library.szkolny.font.SzkolnyFont { *; } diff --git a/szkolny-font/gradle.properties b/szkolny-font/gradle.properties deleted file mode 100644 index 82ee377a..00000000 --- a/szkolny-font/gradle.properties +++ /dev/null @@ -1,40 +0,0 @@ -# -# Copyright 2014 Mike Penz -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Settings specified in this file will override any Gradle settings -# configured through the IDE. - -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html - -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true -VERSION_NAME=1.0 -VERSION_CODE=1 - -POM_NAME=Android-Iconics Szkolny.eu Icon Font Typeface Library -POM_ARTIFACT_ID=szkolny-font-typeface -POM_PACKAGING=aar diff --git a/szkolny-font/src/main/AndroidManifest.xml b/szkolny-font/src/main/AndroidManifest.xml deleted file mode 100644 index e4bf2179..00000000 --- a/szkolny-font/src/main/AndroidManifest.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - diff --git a/szkolny-font/src/main/java/com/mikepenz/iconics/typeface/library/szkolny/font/SzkolnyFont.kt b/szkolny-font/src/main/java/com/mikepenz/iconics/typeface/library/szkolny/font/SzkolnyFont.kt deleted file mode 100644 index 5e23dbd1..00000000 --- a/szkolny-font/src/main/java/com/mikepenz/iconics/typeface/library/szkolny/font/SzkolnyFont.kt +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2019 Mike Penz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.mikepenz.iconics.typeface.library.szkolny.font - -import com.mikepenz.iconics.typeface.IIcon -import com.mikepenz.iconics.typeface.ITypeface -import com.mikepenz.iconics.typeface.library.szkolny.R -import java.util.* - -@Suppress("EnumEntryName") -object SzkolnyFont : ITypeface { - - override val fontRes: Int - get() = R.font.szkolny_font_font_v1_1 - - override val characters: Map by lazy { - Icon.values().associate { it.name to it.character } - } - - override val mappingPrefix: String - get() = "szf" - - override val fontName: String - get() = "Szkolny Font" - - override val version: String - get() = "1.1" - - override val iconCount: Int - get() = characters.size - - override val icons: List - get() = characters.keys.toCollection(LinkedList()) - - override val author: String - get() = "Kuba" - - override val url: String - get() = "" - - override val description: String - get() = "" - - override val license: String - get() = "" - - override val licenseUrl: String - get() = "" - - override fun getIcon(key: String): IIcon = Icon.valueOf(key) - - enum class Icon constructor(override val character: Char) : IIcon { - szf_alarm_bell_outline('\ue800'), - szf_calendar_plus_outline('\ue801'), - szf_calendar_today_outline('\ue802'), - szf_clipboard_list_outline('\ue803'), - szf_delete_empty_outline('\ue804'), - szf_discord_outline('\ue805'), - szf_file_code_outline('\ue806'), - szf_file_excel_outline('\ue807'), - szf_file_image_outline('\ue808'), - szf_file_music_outline('\ue809'), - szf_file_pdf_outline('\ue80a'), - szf_file_percent_outline('\ue80b'), - szf_file_powerpoint_outline('\ue80c'), - szf_file_video_outline('\ue80d'), - szf_file_word_outline('\ue80e'), - szf_message_processing_outline('\ue80f'), - szf_notebook_outline('\ue810'), - szf_zip_box_outline('\ue811'); - - override val typeface: ITypeface by lazy { SzkolnyFont } - } -} \ No newline at end of file diff --git a/szkolny-font/src/main/res/font/szkolny_font_font_v1_1.ttf b/szkolny-font/src/main/res/font/szkolny_font_font_v1_1.ttf deleted file mode 100644 index 33ad627f3fa830143956fc4b3e8e5d0bb8abaaf2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11232 zcmd^FTWn*;d7e3k=feA)ltis`s3VG!c#$ZI(q3elOI>ZP*IH5QC2dDbE=BEXb&aI8 z_fn&7n>3E>ICg;K!4HAcpmu?x?a?}EZP!7aAV34R1vY4cwy4__XyXWI0`$Ro=%Uj0 zn?q98YPGhTrcXW8;rui6&&+@SXNDq_5Mn3K5}vG%WzS}m=R?=g@?UtTAI*043@Q&j zM+lun{jt(garOBVzjzt-KOlsgDLu8Jh(Eq#Af)*R=vU@eFD`Aq{8AqEZ9>ee7mMqw zXm_CgE=u|0;(l%KFA% zPX6mFgfyW}w^rB6t3N#%d54fl4*0)I81E+1O$G@!JbG%H*cOW$%cOyTBmH6h`(e5` zf3ZkFyFQYlkM&ZtP$Je^`EB|V5wQMs4l9utDkc3F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?&u#|b5q$@B_hPPVjb7!z?d@i@e&kk?3vD(}6 jv$#A+KUc!m2`Jbc=ijh!)YADTz4Lj^@FgUQVM6{JoP(I) diff --git a/szkolny-font/src/main/res/values/font_addon.xml b/szkolny-font/src/main/res/values/font_addon.xml deleted file mode 100644 index 3ea04e70..00000000 --- a/szkolny-font/src/main/res/values/font_addon.xml +++ /dev/null @@ -1,2 +0,0 @@ - -