Skip to content

Commit

Permalink
Merge pull request #2693 from mikepenz/develop
Browse files Browse the repository at this point in the history
dev -> main
  • Loading branch information
mikepenz authored Dec 18, 2020
2 parents 8ce3449 + 05f0b37 commit b825574
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 97 deletions.
23 changes: 3 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

## Latest releases 🛠

- Kotlin && New | [v8.2.0](https://github.com/mikepenz/MaterialDrawer/tree/v8.2.0)
- Kotlin && New | [v8.3.0](https://github.com/mikepenz/MaterialDrawer/tree/v8.3.0)
- Kotlin | [v7.0.0](https://github.com/mikepenz/MaterialDrawer/tree/v7.0.0) | (Builder approach like v6.x)
- Java && AndroidX | [v6.1.2](https://github.com/mikepenz/MaterialDrawer/tree/v6.1.2)
- Java && AppCompat | [v6.0.9](https://github.com/mikepenz/MaterialDrawer/tree/v6.0.9)
Expand Down Expand Up @@ -220,7 +220,7 @@ For advanced usecases. Please have a look at the provided sample activities.
The MaterialDrawer supports fetching images from URLs and setting them for the Profile icons. As the MaterialDrawer does not contain an ImageLoading library
the dev can choose his own implementation (Picasso, Glide, ...). This has to be done, before the first image should be loaded via URL. (Should be done in the Application, but any other spot before loading the first image is working too)
* SAMPLE using [PICASSO](https://github.com/square/picasso)
* [SAMPLE](https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/java/com/mikepenz/materialdrawer/app/CustomApplication.java) using [GLIDE](https://github.com/bumptech/glide)
* [SAMPLE](https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/java/com/mikepenz/materialdrawer/app/CustomApplication.kt) using [GLIDE](https://github.com/bumptech/glide)

```kotlin
//initialize and create the image loader logic
Expand Down Expand Up @@ -249,7 +249,7 @@ DrawerImageLoader.init(object : AbstractDrawerImageLoader() {
})
```

An implementation with [GLIDE v4](https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/java/com/mikepenz/materialdrawer/app/CustomApplication.java#L42) (See tag v6.1.1 for glide v3 sample) can be found in the sample application
An implementation with [GLIDE v4](https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/java/com/mikepenz/materialdrawer/app/CustomApplication.kt) (See tag v6.1.1 for glide v3 sample) can be found in the sample application

## JVM Target 1.8

Expand Down Expand Up @@ -310,42 +310,25 @@ Overwrite the Style of the BezelImageView for the whole MaterialDrawer
# Used by
(feel free to send me new projects)

* [wall:splash](https://play.google.com/store/apps/details?id=com.mikepenz.unsplash)
* [GitSkarios](https://play.google.com/store/apps/details?id=com.alorma.github)
* [Screener](https://play.google.com/store/apps/details?id=de.toastcode.screener)
* [Meldmail](https://play.google.com/store/apps/details?id=com.meldmail)
* [Academic Schedule](https://play.google.com/store/apps/details?id=com.auebcsschedule.ppt)
* [Strength](https://play.google.com/store/apps/details?id=com.e13engineering.strength)
* [Sprit Club](https://play.google.com/store/apps/details?id=at.idev.spritpreise)
* [FitHub](https://play.google.com/store/apps/details?id=com.gabilheri.fithub)
* [StickyNotes](https://play.google.com/store/apps/details?id=com.jsvmsoft.stickynotes)
* [Smartphone Italia](https://play.google.com/store/apps/details?id=rebus.smartphone.italia)
* [MLManager](https://github.com/javiersantos/MLManager)
* [Hold'Em Poker Manager](https://play.google.com/store/apps/details?id=pt.massena.holdemtracker.free)
* [Fimpl](https://play.google.com/store/apps/details?id=com.danielZET.fimpl)
* [+UEA](https://play.google.com/store/apps/details?id=br.edu.uea.app)
* [PixCell8](https://play.google.com/store/apps/details?id=com.pixcell8.prod)
* [TS3 Viewer for TeamSpeak 3](https://play.google.com/store/apps/details?id=com.game_state.ts3viewer)
* [Teacher Gradebook](https://play.google.com/store/apps/details?id=com.apolosoft.cuadernoprofesor)
* [Tabe3 News Reader](https://play.google.com/store/apps/details?id=com.tabe3.news)
* [Facepunch Droid](https://play.google.com/store/apps/details?id=com.apps.anker.facepunchdroid)
* [World Tourist Attractions](https://play.google.com/store/apps/details?id=indian.fig.whatsaround)
* [HipCar](https://play.google.com/store/apps/details?id=com.hipcar.android)
* [AS Sales Management](https://play.google.com/store/apps/details?id=com.armsoft.mtrade)
* [Sporza Voetbal](http://play.google.com/store/apps/details?id=be.vrt.mobile.android.sporza.voetbal)
* [Atmosphere](https://play.google.com/store/apps/details?id=com.peakpocketstudios.atmosphere)
* [Slidechat](https://play.google.com/store/apps/details?id=com.taddu.adfree.slidechat)
* [Fitness Challenge](https://play.google.com/store/apps/details?id=com.isidroid.fitchallenge)
* [European Capital of Culture - Pafos2017 official app](https://play.google.com/store/apps/details?id=com.trackandtalk.pafos17)
* [I'm Reading Quran - Kur'an Okuyorum](https://play.google.com/store/apps/details?id=com.homemade.kuranokuma)
* [Makota Money Manager](https://play.google.com/store/apps/details?id=be.jatra.makota)
* [Companion for Band](https://github.com/adithya321/Companion-for-Band)
* [Chisme for Sensu](https://play.google.com/store/apps/details?id=com.antonionicolaspina.sensu)
* [Recipedia](https://play.google.com/store/apps/details?id=com.md.recipedia)
* [Right Сourse - ruble course](https://play.google.com/store/apps/details?id=com.currency.work.currencychecker)
* [Gameru](https://play.google.com/store/apps/details?id=net.gameru)
* [Boost for reddit](https://play.google.com/store/apps/details?id=com.rubenmayayo.reddit)
* [Touch for Facebook](https://play.google.com/store/apps/details?id=com.fa.touch.free)
* [Calendula](https://github.com/citiususc/calendula)
* [MyTimes](https://github.com/debo1994/MyTimes)
* [VoIP By Antisip](https://play.google.com/store/apps/details?id=com.antisip.vbyantisip)
Expand Down
11 changes: 4 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ dependencies {
implementation "androidx.swiperefreshlayout:swiperefreshlayout:${versions.swiperefreshLayout}"

// used to showcase how to load images
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.bumptech.glide:glide:4.10.0'
kapt 'com.github.bumptech.glide:compiler:4.10.0'
implementation "androidx.constraintlayout:constraintlayout:${versions.constraintLayout}"
implementation("io.coil-kt:coil:1.1.0")

// needed to fix glide androidX support
implementation "com.android.support:support-annotations:28.0.0"
Expand All @@ -103,9 +100,9 @@ dependencies {

// icon fonts used inside the sample
// https://github.com/mikepenz/Android-Iconics
implementation 'com.mikepenz:google-material-typeface:3.0.1.4.original-kotlin@aar'
implementation 'com.mikepenz:fontawesome-typeface:5.3.1.2-kotlin@aar'
implementation 'com.mikepenz:octicons-typeface:3.2.0.6-kotlin@aar'
implementation 'com.mikepenz:google-material-typeface:3.0.1.6.original-kotlin@aar'
implementation 'com.mikepenz:fontawesome-typeface:5.9.0.2-kotlin@aar'
implementation 'com.mikepenz:octicons-typeface:11.1.0.0-kotlin@aar'

// kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ package com.mikepenz.materialdrawer.app
import android.graphics.Color
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions.centerCropTransform
import coil.load
import com.mikepenz.iconics.IconicsDrawable
import com.mikepenz.iconics.typeface.library.fontawesome.FontAwesome
import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial
Expand Down Expand Up @@ -77,7 +76,7 @@ class CollapsingToolbarActivity : AppCompatActivity() {
}

private fun loadBackdrop() {
Glide.with(this).load("https://unsplash.it/600/300/?random").apply(centerCropTransform()).into(binding.backdrop)
binding.backdrop.load("https://unsplash.it/600/300/?random")
}

private fun fillFab() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import android.graphics.drawable.Drawable
import android.net.Uri
import android.widget.ImageView
import androidx.multidex.MultiDexApplication
import com.bumptech.glide.Glide
import coil.clear
import coil.load
import com.mikepenz.iconics.Iconics
import com.mikepenz.iconics.IconicsDrawable
import com.mikepenz.iconics.utils.backgroundColorRes
Expand Down Expand Up @@ -39,11 +40,14 @@ class CustomApplication : MultiDexApplication() {
//initialize and create the image loader logic
DrawerImageLoader.init(object : AbstractDrawerImageLoader() {
override fun set(imageView: ImageView, uri: Uri, placeholder: Drawable, tag: String?) {
GlideApp.with(imageView.context).load(uri).placeholder(placeholder).into(imageView)
imageView.load(uri) {
allowHardware(false)
placeholder(placeholder)
}
}

override fun cancel(imageView: ImageView) {
Glide.with(imageView.context).clear(imageView)
imageView.clear()
}

override fun placeholder(ctx: Context, tag: String?): Drawable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class MultiDrawerActivity : AppCompatActivity() {
}

binding.sliderEnd.apply {
stickyHeaderView = layoutInflater.inflate(R.layout.header, null)
itemAdapter.add(
PrimaryDrawerItem().withName(R.string.drawer_item_home).withIcon(FontAwesome.Icon.faw_home).withIdentifier(1),
PrimaryDrawerItem().withName(R.string.drawer_item_free_play).withIcon(FontAwesome.Icon.faw_gamepad),
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package com.mikepenz.materialdrawer.app
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import androidx.core.os.bundleOf
import androidx.navigation.findNavController
import com.mikepenz.aboutlibraries.LibsBuilder
import com.mikepenz.materialdrawer.app.databinding.ActivitySampleNavBinding
import com.mikepenz.materialdrawer.model.DividerDrawerItem
import com.mikepenz.materialdrawer.model.NavigationDrawerItem
Expand All @@ -12,6 +14,7 @@ import com.mikepenz.materialdrawer.model.interfaces.withName
import com.mikepenz.materialdrawer.util.addItems
import com.mikepenz.materialdrawer.util.addStickyDrawerItems
import com.mikepenz.materialdrawer.util.setupWithNavController
import java.io.Serializable

class NavControllerActivity : AppCompatActivity() {
private lateinit var binding: ActivitySampleNavBinding
Expand All @@ -34,7 +37,8 @@ class NavControllerActivity : AppCompatActivity() {
NavigationDrawerItem(R.id.messageFragment2, PrimaryDrawerItem().withName("Fragment2"))
)
addStickyDrawerItems(
NavigationDrawerItem(R.id.messageFragment3, PrimaryDrawerItem().withName("Fragment3"))
NavigationDrawerItem(R.id.messageFragment3, PrimaryDrawerItem().withName("Fragment3")),
NavigationDrawerItem(R.id.about_libraries, PrimaryDrawerItem().withName("AboutLibs"), bundleOf("data" to (LibsBuilder() as Serializable)))
)
}

Expand Down
34 changes: 0 additions & 34 deletions app/src/main/res/layout/activity_nav_controller.xml

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_sample_nav.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolbar"
app:navGraph="@navigation/navigation" />
</androidx.constraintlayout.widget.ConstraintLayout>

Expand Down
6 changes: 5 additions & 1 deletion app/src/main/res/navigation/navigation.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/navigation"
app:startDestination="@id/fragmentHome">

Expand All @@ -23,6 +23,9 @@
<action
android:id="@+id/action_fragmentHome_to_messageFragment3"
app:destination="@id/messageFragment3" />
<action
android:id="@+id/action_fragmentHome_to_aboutLibsFragment"
app:destination="@id/about_libraries" />
</fragment>
<fragment
android:id="@+id/messageFragment1"
Expand Down Expand Up @@ -58,4 +61,5 @@
android:id="@+id/action_global_fragmentHome"
app:popUpTo="@id/fragmentHome" />

<include app:graph="@navigation/aboutlibs_navigation" />
</navigation>
14 changes: 7 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ buildscript {

ext {
release = [
versionName: "8.2.0",
versionCode: 8020
versionName: "8.3.0",
versionCode: 8030
]

setup = [
Expand All @@ -24,11 +24,11 @@ buildscript {
drawerlayout : '1.1.1',
constraintLayout : '2.0.4',
cardview : '1.0.0',
kotlin : "1.4.20",
fastadapter : "5.3.1",
iconics : "5.0.3",
aboutLibs : "8.6.0",
navigation : "2.3.1",
kotlin : "1.4.21",
fastadapter : "5.3.2",
iconics : "5.2.1",
aboutLibs : "8.6.3",
navigation : "2.3.2",
detekt : '1.14.2',
slidingpaneLayout : "1.1.0",
swiperefreshLayout: "1.1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ internal fun handleHeaderView(sliderView: MaterialDrawerSliderView) {
view.layoutParams = lps
}
}

if (Build.VERSION.SDK_INT >= 21) {
sliderView.elevation = 0f
}
//remove the padding of the recyclerView again we have the header on top of it
sliderView.recyclerView.setPadding(0, 0, 0, 0)
}
Expand All @@ -147,18 +149,18 @@ internal fun rebuildStickyFooterView(sliderView: MaterialDrawerSliderView) {
}

//fill the footer with items
fillStickyDrawerItemFooter(sliderView, it, View.OnClickListener { v ->
fillStickyDrawerItemFooter(sliderView, it) { v ->
val drawerItem = v.getTag(R.id.material_drawer_item) as IDrawerItem<*>
onFooterDrawerItemClick(sliderView, drawerItem, v, true)
})
}

it.visibility = View.VISIBLE
} ?: run {
//there was no footer yet. now just create one
handleFooterView(sliderView, View.OnClickListener { v ->
handleFooterView(sliderView) { v ->
val drawerItem = v.getTag(R.id.material_drawer_item) as IDrawerItem<*>
onFooterDrawerItemClick(sliderView, drawerItem, v, true)
})
}
}

sliderView.setStickyFooterSelection(sliderView.currentStickyFooterSelection, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ open class MaterialDrawerSliderView @JvmOverloads constructor(context: Context,
// set the footer (do this before the setAdapter because some devices will crash else
if (value != null) {
if (footerDivider) {
footerAdapter.add(ContainerDrawerItem().withView(value).withViewPosition(ContainerDrawerItem.Position.BOTTOM))
footerAdapter.add(ContainerDrawerItem().apply { view = value; viewPosition = ContainerDrawerItem.Position.BOTTOM })
} else {
footerAdapter.add(ContainerDrawerItem().withView(value).withViewPosition(ContainerDrawerItem.Position.NONE))
footerAdapter.add(ContainerDrawerItem().apply { view = value; viewPosition = ContainerDrawerItem.Position.NONE })
}
}
}
Expand Down Expand Up @@ -411,7 +411,12 @@ open class MaterialDrawerSliderView @JvmOverloads constructor(context: Context,
this.insets?.set(insets.systemWindowInsetLeft, insets.systemWindowInsetTop, insets.systemWindowInsetRight, insets.systemWindowInsetBottom)

if (headerView == null && accountHeader == null) {
recyclerView.updatePadding(top = insets.systemWindowInsetTop, bottom = insets.systemWindowInsetBottom)
if (stickyHeaderView == null) {
recyclerView.updatePadding(top = insets.systemWindowInsetTop)
}
if (stickyFooterView == null) {
recyclerView.updatePadding(bottom = insets.systemWindowInsetBottom)
}
}

setWillNotDraw(insetForeground == null)
Expand Down Expand Up @@ -609,6 +614,11 @@ open class MaterialDrawerSliderView @JvmOverloads constructor(context: Context,
consumed = item.onDrawerItemClickListener?.invoke(v, item, position) ?: false
}

//we have to notify the miniDrawer if existing, and if the event was not consumed yet
if (!consumed) {
consumed = miniDrawer?.onItemClick(item) ?: false
}

//call the drawer listener
onDrawerItemClickListener?.let { mOnDrawerItemClickListener ->
if (delayDrawerClickEvent > 0) {
Expand All @@ -618,11 +628,6 @@ open class MaterialDrawerSliderView @JvmOverloads constructor(context: Context,
}
}

//we have to notify the miniDrawer if existing, and if the event was not consumed yet
if (!consumed) {
consumed = miniDrawer?.onItemClick(item) ?: false
}

//if we were a expandable item we consume the event closing makes no sense
if (item.subItems.isNotEmpty()) {
//we consume the event and want no further handling
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ open class MiniDrawerSliderView @JvmOverloads constructor(context: Context, attr
fun setSelection(identifier: Long) {
if (identifier == -1L) {
selectExtension.deselect()
return
}
val count = adapter.itemCount
for (i in 0 until count) {
Expand Down

0 comments on commit b825574

Please sign in to comment.