From 37a5bea79b21e9a1b4a58ae4bd0a09d6437f0f87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Tue, 24 Mar 2020 16:29:45 +0100 Subject: [PATCH] [Libraries] Update gradle, NavLib and Firebase. --- app/build.gradle | 1 + .../szczodrzynski/edziennik/MainActivity.kt | 16 ++-- .../data/firebase/FirebaseService.kt | 8 +- .../res/layout/material_drawer_header.xml | 88 ++++++++++++++++--- .../layout/material_drawer_item_profile.xml | 36 +++++++- build.gradle | 18 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- 7 files changed, 135 insertions(+), 34 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 71e7a7dc..ca5c9fcd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -128,6 +128,7 @@ dependencies { implementation "com.mikepenz:iconics-core:${versions.iconics}" 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}" diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt b/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt index dadaf833..8f53b625 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt @@ -31,8 +31,8 @@ import com.mikepenz.iconics.typeface.library.szkolny.font.SzkolnyFont import com.mikepenz.materialdrawer.model.DividerDrawerItem import com.mikepenz.materialdrawer.model.ProfileDrawerItem import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem -import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem -import com.mikepenz.materialdrawer.model.interfaces.IProfile +import com.mikepenz.materialdrawer.model.interfaces.* +import com.mikepenz.materialdrawer.model.utils.withIsHiddenInMiniDrawer import kotlinx.coroutines.* import org.greenrobot.eventbus.EventBus import org.greenrobot.eventbus.Subscribe @@ -90,7 +90,6 @@ import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetSeparatorItem import pl.szczodrzynski.navlib.drawer.NavDrawer import pl.szczodrzynski.navlib.drawer.items.DrawerPrimaryItem -import pl.szczodrzynski.navlib.drawer.items.withAppTitle import java.io.File import java.io.IOException import java.util.* @@ -361,7 +360,7 @@ class MainActivity : AppCompatActivity(), CoroutineScope { false } drawerProfileLongClickListener = { _, profile, _, view -> - if (profile is ProfileDrawerItem) { + if (view != null && profile is ProfileDrawerItem) { showProfileContextMenu(profile, view) true } @@ -915,7 +914,8 @@ class MainActivity : AppCompatActivity(), CoroutineScope { bottomSheet.removeAllContextual() bottomSheet.toggleGroupEnabled = false drawer.close() - drawer.setSelection(target.id, fireOnClick = false) + if (drawer.getSelection() != target.id) + drawer.setSelection(target.id, fireOnClick = false) navView.toolbar.setTitle(target.title ?: target.name) navView.bottomBar.fabEnable = false navView.bottomBar.fabExtended = false @@ -1063,7 +1063,7 @@ class MainActivity : AppCompatActivity(), CoroutineScope { val item = DrawerPrimaryItem() .withIdentifier(target.id.toLong()) .withName(target.name) - .withHiddenInMiniDrawer(!app.config.ui.miniMenuButtons.contains(target.id)) + .withIsHiddenInMiniDrawer(!app.config.ui.miniMenuButtons.contains(target.id)) .also { if (target.description != null) it.withDescription(target.description!!) } .also { if (target.icon != null) it.withIcon(target.icon!!) } .also { if (target.title != null) it.withAppTitle(getString(target.title!!)) } @@ -1127,7 +1127,7 @@ class MainActivity : AppCompatActivity(), CoroutineScope { drawer.addProfileSettings(*drawerProfiles.toTypedArray()) } - private fun showProfileContextMenu(profile: IProfile<*>, view: View) { + private fun showProfileContextMenu(profile: IProfile, view: View) { val profileId = profile.identifier.toInt() val popupMenu = PopupMenu(this, view) popupMenu.menu.add(0, 1, 1, R.string.profile_menu_open_settings) @@ -1140,7 +1140,7 @@ class MainActivity : AppCompatActivity(), CoroutineScope { } loadTarget(DRAWER_ITEM_SETTINGS, null) } else if (item.itemId == 2) { - ProfileRemoveDialog(this, profileId, profile.name?.getText(this)?.toString() ?: "?") + ProfileRemoveDialog(this, profileId, profile.name?.getText(this) ?: "?") } true } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/FirebaseService.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/FirebaseService.kt index a7c9f656..6396a87c 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/FirebaseService.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/FirebaseService.kt @@ -9,8 +9,8 @@ import android.app.PendingIntent import android.app.PendingIntent.CanceledException import android.content.Intent import android.util.Log -import com.google.firebase.iid.zzaq -import com.google.firebase.iid.zzv +import com.google.firebase.iid.zzad +import com.google.firebase.iid.zzaz import com.google.firebase.messaging.zzc import com.google.gson.JsonObject import pl.szczodrzynski.edziennik.* @@ -36,7 +36,7 @@ open class FirebaseService : zzc() { // apparently this gets the correct intent from some // kind of queue inside Firebase's InstanceID Receiver - final override fun zza(intent: Intent?) = zzaq.zza()?.zzb() + final override fun zza(intent: Intent?) = zzaz.zza()?.zzb() final override fun zzb(intent: Intent?): Boolean { val action = intent?.action if (action == "com.google.firebase.messaging.NOTIFICATION_OPEN") { @@ -80,7 +80,7 @@ open class FirebaseService : zzc() { val ackBundle = Bundle( "google.message_id" to messageId ) - zzv.zza(this).zza(2, ackBundle) + zzad.zza(this).zza(2, ackBundle) } // check for duplicate message // and add it to queue diff --git a/app/src/main/res/layout/material_drawer_header.xml b/app/src/main/res/layout/material_drawer_header.xml index 49479cd7..b286b60c 100644 --- a/app/src/main/res/layout/material_drawer_header.xml +++ b/app/src/main/res/layout/material_drawer_header.xml @@ -1,6 +1,6 @@ - + + + + + + + + - + diff --git a/app/src/main/res/layout/material_drawer_item_profile.xml b/app/src/main/res/layout/material_drawer_item_profile.xml index 3eb6e9ef..e1ac9f8e 100644 --- a/app/src/main/res/layout/material_drawer_item_profile.xml +++ b/app/src/main/res/layout/material_drawer_item_profile.xml @@ -4,6 +4,8 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="@dimen/material_drawer_item_profile" + android:clipChildren="false" + android:clipToPadding="false" android:orientation="horizontal" android:paddingStart="@dimen/material_drawer_vertical_padding" android:paddingLeft="@dimen/material_drawer_vertical_padding" @@ -44,7 +46,7 @@ android:textDirection="anyRtl" android:textSize="@dimen/material_drawer_item_profile_text" app:layout_constraintBottom_toTopOf="@id/material_drawer_email" - app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintEnd_toStartOf="@+id/material_drawer_badge_container" app:layout_constraintStart_toEndOf="@id/material_drawer_profileIcon" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_chainStyle="packed" @@ -69,9 +71,37 @@ android:textDirection="anyRtl" android:textSize="@dimen/material_drawer_item_profile_description" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintEnd_toStartOf="@+id/material_drawer_badge_container" app:layout_constraintStart_toEndOf="@id/material_drawer_profileIcon" app:layout_constraintTop_toBottomOf="@id/material_drawer_name" tools:text="Some drawer text" /> - \ No newline at end of file + + + + + diff --git a/build.gradle b/build.gradle index a975a0fc..d5327e9e 100644 --- a/build.gradle +++ b/build.gradle @@ -17,6 +17,8 @@ buildscript { ] versions = [ + gradleAndroid : "4.0.0-beta03", + kotlin : ext.kotlin_version, ktx : "1.2.0", @@ -32,24 +34,24 @@ buildscript { navigationFragment: "1.0.0", legacy : "1.0.0", - room : "2.2.4", + room : "2.2.5", lifecycle : "2.2.0", - work : "2.3.2", + work : "2.3.4", firebase : '17.2.2', - firebasemessaging: "20.1.0", + firebasemessaging: "20.1.3", play_services : "17.0.0", materialdialogs : "0.9.6.0", - materialdrawer : "cad66092a6", + materialdrawer : "817e45765c367034b03046aaea6e95eeabcb40e9", iconics : "4.0.1", font_cmd : "3.5.95.1-kotlin", - navlib : "5c8b13c0d9db0d9e822fdae82c8afca6c01ab41e", + navlib : "43f5ecdef5ac33a552936684978a3cd022e612a7", gifdrawable : "1.2.15", - retrofit : '2.6.2' + retrofit : "2.6.4" ] } @@ -61,11 +63,11 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.0.0-beta01' + classpath "com.android.tools.build:gradle:${versions.gradleAndroid}" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}" classpath 'me.tatarka:gradle-retrolambda:3.7.0' classpath 'com.google.gms:google-services:4.3.3' classpath 'io.fabric.tools:gradle:1.28.1' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0920d4e0..d4331d8b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.1-all.zip