-
-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # anylayer/src/main/java/per/goweii/anylayer/floats/FloatLayer.java # anylayer/src/main/java/per/goweii/anylayer/toast/ToastLayer.java # anylayer/src/main/java/per/goweii/anylayer/utils/Utils.java
- Loading branch information
Showing
21 changed files
with
468 additions
and
137 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
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
101 changes: 101 additions & 0 deletions
101
anylayer-ktx/src/main/java/per/goweii/anylayer/ktx/FloatLayers.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,101 @@ | ||
package per.goweii.anylayer.ktx | ||
|
||
import android.view.View | ||
import androidx.annotation.LayoutRes | ||
import per.goweii.anylayer.floats.FloatLayer | ||
|
||
fun <T : FloatLayer> T.setFloatView(@LayoutRes layoutId: Int) = this.apply { | ||
this.floatView(layoutId) | ||
} | ||
|
||
fun <T : FloatLayer> T.setFloatView(floatView: View) = this.apply { | ||
this.floatView(floatView) | ||
} | ||
|
||
fun <T : FloatLayer> T.setDefPercentX(p: Float) = this.apply { | ||
this.defPercentX(p) | ||
} | ||
|
||
fun <T : FloatLayer> T.setDefPercentY(p: Float) = this.apply { | ||
this.defPercentY(p) | ||
} | ||
|
||
fun <T : FloatLayer> T.setDefAlpha(alpha: Float) = this.apply { | ||
this.defAlpha(alpha) | ||
} | ||
|
||
fun <T : FloatLayer> T.setDefScale(scale: Float) = this.apply { | ||
this.defScale(scale) | ||
} | ||
|
||
fun <T : FloatLayer> T.setNormalAlpha(alpha: Float) = this.apply { | ||
this.normalAlpha(alpha) | ||
} | ||
|
||
fun <T : FloatLayer> T.setNormalScale(scale: Float) = this.apply { | ||
this.normalScale(scale) | ||
} | ||
|
||
fun <T : FloatLayer> T.setLowProfileAlpha(alpha: Float) = this.apply { | ||
this.lowProfileAlpha(alpha) | ||
} | ||
|
||
fun <T : FloatLayer> T.setLowProfileScale(scale: Float) = this.apply { | ||
this.lowProfileScale(scale) | ||
} | ||
|
||
fun <T : FloatLayer> T.setLowProfileIndent(indent: Float) = this.apply { | ||
this.lowProfileIndent(indent) | ||
} | ||
|
||
fun <T : FloatLayer> T.setLowProfileDelay(delay: Long) = this.apply { | ||
this.lowProfileDelay(delay) | ||
} | ||
|
||
fun <T : FloatLayer> T.setSnapEdge(edge: Int) = this.apply { | ||
this.snapEdge(edge) | ||
} | ||
|
||
fun <T : FloatLayer> T.setOutside(outside: Boolean) = this.apply { | ||
this.outside(outside) | ||
} | ||
|
||
fun <T : FloatLayer> T.setMarginLeft(margin: Int) = this.apply { | ||
this.marginLeft(margin) | ||
} | ||
|
||
fun <T : FloatLayer> T.setMarginTop(margin: Int) = this.apply { | ||
this.marginTop(margin) | ||
} | ||
|
||
fun <T : FloatLayer> T.setMarginRight(margin: Int) = this.apply { | ||
this.marginRight(margin) | ||
} | ||
|
||
fun <T : FloatLayer> T.setMarginBottom(margin: Int) = this.apply { | ||
this.marginBottom(margin) | ||
} | ||
|
||
fun <T : FloatLayer> T.setPaddingLeft(padding: Int) = this.apply { | ||
this.paddingLeft(padding) | ||
} | ||
|
||
fun <T : FloatLayer> T.setPaddingTop(padding: Int) = this.apply { | ||
this.paddingTop(padding) | ||
} | ||
|
||
fun <T : FloatLayer> T.setPaddingRight(padding: Int) = this.apply { | ||
this.paddingRight(padding) | ||
} | ||
|
||
fun <T : FloatLayer> T.setPaddingBottom(padding: Int) = this.apply { | ||
this.paddingBottom(padding) | ||
} | ||
|
||
fun <T : FloatLayer> T.doOnFloatClick(onFloatClick: T.(view: View) -> Unit) = this.apply { | ||
this.onFloatClick { _, view -> this.onFloatClick(view) } | ||
} | ||
|
||
fun <T : FloatLayer> T.doOnFloatLongClick(onFloatClick: T.(view: View) -> Boolean) = this.apply { | ||
this.onFloatLongClick { _, view -> this.onFloatClick(view) } | ||
} |
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
28 changes: 28 additions & 0 deletions
28
anylayer-ktx/src/main/java/per/goweii/anylayer/ktx/GuideLayers.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,28 @@ | ||
package per.goweii.anylayer.ktx | ||
|
||
import android.view.View | ||
import androidx.annotation.ColorInt | ||
import androidx.annotation.ColorRes | ||
import androidx.annotation.IdRes | ||
import per.goweii.anylayer.Layer | ||
import per.goweii.anylayer.guide.GuideLayer | ||
|
||
fun <T : GuideLayer> T.setBackgroundColorInt(@ColorInt colorInt: Int) = this.apply { | ||
this.backgroundColorInt(colorInt) | ||
} | ||
|
||
fun <T : GuideLayer> T.setBackgroundColorRes(@ColorRes colorRes: Int) = this.apply { | ||
this.backgroundColorRes(colorRes) | ||
} | ||
|
||
fun <T : GuideLayer> T.addMapping(mapping: GuideLayer.Mapping) = this.apply { | ||
this.mapping(mapping) | ||
} | ||
|
||
fun <T : GuideLayer> T.addMapping(init: GuideLayer.Mapping.() -> Unit) = this.apply { | ||
this.mapping(GuideLayer.Mapping().apply { init() }) | ||
} | ||
|
||
fun GuideLayer.Mapping.doOnClick(@IdRes viewId: Int, onClickListener: GuideLayer.Mapping.(view: View) -> Unit) = this.apply { | ||
this.onClick(Layer.OnClickListener { _, v -> this.onClickListener(v) }, viewId) | ||
} |
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
69 changes: 69 additions & 0 deletions
69
anylayer-ktx/src/main/java/per/goweii/anylayer/ktx/NotificationLayers.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,69 @@ | ||
package per.goweii.anylayer.ktx | ||
|
||
import android.graphics.drawable.Drawable | ||
import android.view.View | ||
import androidx.annotation.DrawableRes | ||
import androidx.annotation.LayoutRes | ||
import androidx.annotation.StringRes | ||
import per.goweii.anylayer.notification.NotificationLayer | ||
|
||
|
||
fun <T : NotificationLayer> T.setContentView(contentView: View) = this.apply { | ||
this.contentView(contentView) | ||
} | ||
|
||
fun <T : NotificationLayer> T.setContentView(@LayoutRes contentViewId: Int) = this.apply { | ||
this.contentView(contentViewId) | ||
} | ||
|
||
fun <T : NotificationLayer> T.setIcon(@DrawableRes icon: Int) = this.apply { | ||
this.icon(icon) | ||
} | ||
|
||
fun <T : NotificationLayer> T.setIcon(icon: Drawable) = this.apply { | ||
this.icon(icon) | ||
} | ||
|
||
fun <T : NotificationLayer> T.setLabel(label: CharSequence) = this.apply { | ||
this.label(label) | ||
} | ||
|
||
fun <T : NotificationLayer> T.setLabel(@StringRes label: Int) = this.apply { | ||
this.label(label) | ||
} | ||
|
||
fun <T : NotificationLayer> T.setTime(time: CharSequence) = this.apply { | ||
this.time(time) | ||
} | ||
|
||
fun <T : NotificationLayer> T.setTitle(title: CharSequence) = this.apply { | ||
this.title(title) | ||
} | ||
|
||
fun <T : NotificationLayer> T.setTitle(@StringRes title: Int) = this.apply { | ||
this.title(title) | ||
} | ||
|
||
fun <T : NotificationLayer> T.setDesc(desc: CharSequence) = this.apply { | ||
this.desc(desc) | ||
} | ||
|
||
fun <T : NotificationLayer> T.setDesc(@StringRes desc: Int) = this.apply { | ||
this.desc(desc) | ||
} | ||
|
||
fun <T : NotificationLayer> T.setDuration(duration: Long) = this.apply { | ||
this.duration(duration) | ||
} | ||
|
||
fun <T : NotificationLayer> T.doOnNotificationClick(onNotificationClick: T.(view: View) -> Unit) = this.apply { | ||
this.onNotificationClick { _, view -> this.onNotificationClick(view) } | ||
} | ||
|
||
fun <T : NotificationLayer> T.doOnNotificationLongClick(onNotificationClick: T.(view: View) -> Boolean) = this.apply { | ||
this.onNotificationLongClick { _, view -> this.onNotificationClick(view) } | ||
} | ||
|
||
fun <T : NotificationLayer> T.setAutoDismiss(autoDismiss: Boolean) = this.apply { | ||
this.autoDismiss(autoDismiss) | ||
} |
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
Oops, something went wrong.