Skip to content

Commit

Permalink
- introduce detekt and fix current problems
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepenz committed Oct 4, 2020
1 parent f3f8d5b commit c03274b
Show file tree
Hide file tree
Showing 15 changed files with 565 additions and 15 deletions.
530 changes: 530 additions & 0 deletions DEV/default-detekt-config.yml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class CompactHeaderDrawerActivity : AppCompatActivity() {

override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (actionBarDrawerToggle.onOptionsItemSelected(item)) {
return true;
return true
}
return super.onOptionsItemSelected(item)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class CrossfadeDrawerLayoutActvitiy : AppCompatActivity() {

override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (actionBarDrawerToggle.onOptionsItemSelected(item)) {
return true;
return true
}
return super.onOptionsItemSelected(item)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class DrawerActivity : AppCompatActivity() {
val profile4 = ProfileDrawerItem().apply { nameText = "Felix House"; descriptionText = "[email protected]"; iconRes = R.drawable.profile3; identifier = 103 }
val profile5 = ProfileDrawerItem().apply { nameText = "Mr. X"; descriptionText = "[email protected]"; iconRes = R.drawable.profile4; identifier = 104 }
val profile6 = ProfileDrawerItem().apply {
nameText = "Batman"; descriptionText = "[email protected]"; iconRes = R.drawable.profile5; identifier = 105; badgeText = "123";
nameText = "Batman"; descriptionText = "[email protected]"; iconRes = R.drawable.profile5; identifier = 105; badgeText = "123"
badgeStyle = BadgeStyle().apply {
textColor = ColorHolder.fromColor(Color.BLACK)
color = ColorHolder.fromColor(Color.WHITE)
Expand Down Expand Up @@ -163,7 +163,6 @@ class DrawerActivity : AppCompatActivity() {
}

false

}
setSavedInstance(savedInstanceState)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class FullscreenDrawerActivity : AppCompatActivity() {

override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (actionBarDrawerToggle.onOptionsItemSelected(item)) {
return true;
return true
}
return super.onOptionsItemSelected(item)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class MenuDrawerActivity : AppCompatActivity() {

override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (actionBarDrawerToggle.onOptionsItemSelected(item)) {
return true;
return true
}
return super.onOptionsItemSelected(item)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ open class CustomBaseViewHolder(var view: View) : RecyclerView.ViewHolder(view)
var icon: ImageView = view.findViewById<ImageView>(R.id.material_drawer_icon)
var name: TextView = view.findViewById<TextView>(R.id.material_drawer_name)
var description: TextView = view.findViewById<TextView>(R.id.material_drawer_description)

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ class CustomCenteredPrimaryDrawerItem : PrimaryDrawerItem() {

override val type: Int
get() = R.id.material_drawer_item_centered_primary

}
10 changes: 10 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ buildscript {
iconics : "5.0.3",
aboutLibs : "8.3.0",
navigation : "2.3.0",
detekt : '1.12.0',
slidingpaneLayout : "1.1.0",
swiperefreshLayout: "1.1.0"
]
Expand All @@ -45,6 +46,7 @@ buildscript {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:${versions.navigation}"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:${versions.detekt}"
classpath "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:${versions.aboutLibs}"
}
}
Expand All @@ -57,3 +59,11 @@ allprojects {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
}

subprojects {
apply from: '../detekt.gradle'

dependencies {
detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:${versions.detekt}"
}
}
7 changes: 7 additions & 0 deletions detekt.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apply plugin: "io.gitlab.arturbosch.detekt"

detekt {
toolVersion = "${versions.detekt}"
//input = files("src/main/kotlin")
config = files(buildscript.sourceFile.getParent().toString() + "/DEV/default-detekt-config.yml")
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,23 @@ import com.mikepenz.materialdrawer.model.utils.BadgeDrawableBuilder
open class BadgeStyle {
/** defines the drawable to use to define the rounded corners */
var gradientDrawable = R.drawable.material_drawer_badge

/** defines the background drawable */
var badgeBackground: Drawable? = null

/** the default color */
var color: ColorHolder? = null

/** the pressed color */
var colorPressed: ColorHolder? = null

/**
* the text size
* NOTE: Will only apply on 21+, also if applying, ensure to apply to all views
*/
var textSizeSp: Float? = null
private var _textColor: ColorHolder? = null

/** defines the default text color */
var textColor: ColorHolder?
get() = _textColor
Expand All @@ -36,28 +41,34 @@ open class BadgeStyle {
}

private var _textColorStateList: ColorStateList? = null

/** defines the alternative text color state list */
var textColorStateList: ColorStateList?
get() = _textColorStateList
set(value) {
_textColor = null
_textColorStateList = value
}

/** the corner radious */
var corners: DimenHolder? = null

/** dcustom padding to the bottom (default 2dp) */
var paddingTopBottom = DimenHolder.fromDp(2)

/** custom padding to the right (default 3dp) */
var paddingLeftRight = DimenHolder.fromDp(3)

/** the min width to set (default 20dp) */
var minWidth = DimenHolder.fromDp(20)

/**
* elevation to apply on the view
* NOTE: Will only apply on 21+, also if applying, ensure to apply to all views
*/
var elevation: DimenHolder? = null

constructor() {}
constructor()

constructor(@ColorInt color: Int, @ColorInt colorPressed: Int) {
this.color = ColorHolder.fromColor(color)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ abstract class AbstractDrawerItem<T, VH : RecyclerView.ViewHolder> : IDrawerItem
* @param holder
*/
override fun attachToWindow(holder: VH) {

}

/**
Expand All @@ -234,7 +233,6 @@ abstract class AbstractDrawerItem<T, VH : RecyclerView.ViewHolder> : IDrawerItem
* @param holder
*/
override fun detachFromWindow(holder: VH) {

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,5 @@ open class SectionDrawerItem : AbstractDrawerItem<SectionDrawerItem, SectionDraw
class ViewHolder internal constructor(internal val view: View) : RecyclerView.ViewHolder(view) {
internal val divider: View = view.findViewById(R.id.material_drawer_divider)
internal val name: TextView = view.findViewById(R.id.material_drawer_name)

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import com.mikepenz.materialdrawer.holder.StringHolder
/**
* Defines a general [IProfile] to be displayed in the [com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView] with the [com.mikepenz.materialdrawer.widget.AccountHeaderView]
*/
interface IProfile : IIdentifyable, Nameable, Iconable, Selectable, Tagable, Describable {
}
interface IProfile : IIdentifyable, Nameable, Iconable, Selectable, Tagable, Describable

@Deprecated("Please consider to replace with the actual property setter")
fun <T : IProfile> T.withEmail(@StringRes emailRes: Int): T {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ open class BezelImageView @JvmOverloads constructor(context: Context, attrs: Att
mMaskedPaint.colorFilter = mSelectorFilter
} else {
mMaskedPaint.colorFilter = mDesaturateColorFilter

}
} else {
mMaskedPaint.colorFilter = null
Expand Down

0 comments on commit c03274b

Please sign in to comment.