-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add a new sample GmailDrawerItem.kt to showcase gmail like design
- use in the MultiDrawerActivity.kt - FIX #2616
- Loading branch information
Showing
4 changed files
with
41 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
app/src/main/java/com/mikepenz/materialdrawer/app/drawerItems/GmailDrawerItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.mikepenz.materialdrawer.app.drawerItems | ||
|
||
import android.content.Context | ||
import android.view.View | ||
import com.google.android.material.shape.CornerFamily | ||
import com.google.android.material.shape.ShapeAppearanceModel | ||
import com.mikepenz.materialdrawer.app.R | ||
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem | ||
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem | ||
import com.mikepenz.materialdrawer.util.themeDrawerItem | ||
|
||
/** | ||
* Describes the main [IDrawerItem] bing used as primary item, following the guidelines | ||
*/ | ||
open class GmailDrawerItem : PrimaryDrawerItem() { | ||
|
||
override val type: Int | ||
get() = R.id.material_drawer_item_gmail_item | ||
|
||
override fun applyDrawerItemTheme(ctx: Context, view: View, selected_color: Int, animate: Boolean, shapeAppearanceModel: ShapeAppearanceModel) { | ||
themeDrawerItem(ctx, view, selected_color, animate, shapeAppearanceModel, R.dimen.gmail_material_drawer_item_background_padding_top_bottom, R.dimen.gmail_material_drawer_item_background_padding_start, R.dimen.gmail_material_drawer_item_background_padding_end) | ||
} | ||
|
||
override fun getShapeAppearanceModel(ctx: Context): ShapeAppearanceModel { | ||
val cornerRadius = ctx.resources.getDimensionPixelSize(R.dimen.gmail_material_drawer_item_corner_radius) | ||
return ShapeAppearanceModel.builder() | ||
.setTopRightCorner(CornerFamily.ROUNDED, cornerRadius.toFloat()) | ||
.setBottomRightCorner(CornerFamily.ROUNDED, cornerRadius.toFloat()) | ||
.build() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters