-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
676828e
commit a848f61
Showing
26 changed files
with
552 additions
and
48 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
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
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
41 changes: 41 additions & 0 deletions
41
DesignSystem/src/main/java/com/yourssu/design/system/language/Android.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,41 @@ | ||
package com.yourssu.design.system.language | ||
|
||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.annotation.ColorRes | ||
import androidx.appcompat.app.AppCompatActivity | ||
|
||
fun AppCompatActivity.setContentView(block: () -> View) { | ||
this.setContentView(block.invoke()) | ||
} | ||
|
||
const val WRAP_CONTENT = ViewGroup.LayoutParams.WRAP_CONTENT | ||
const val MATCH_PARENT = ViewGroup.LayoutParams.MATCH_PARENT | ||
|
||
fun View.setLayout( | ||
width: Int? = null, | ||
height: Int? = null, | ||
leftMarginPx: Int? = null, | ||
rightMarginPx: Int? = null, | ||
topMarginPx: Int? = null, | ||
bottomMarginPx: Int? = null, | ||
leftPaddingPx: Int? = null, | ||
rightPaddingPx: Int? = null, | ||
topPaddingPx: Int? = null, | ||
bottomPaddingPx: Int? = null, | ||
) { | ||
this.layoutParams = ViewGroup.MarginLayoutParams( | ||
width ?: WRAP_CONTENT, | ||
height ?: WRAP_CONTENT) | ||
.apply { | ||
leftMarginPx?.let { this.leftMargin = it } | ||
rightMarginPx?.let { this.rightMargin = it } | ||
topMarginPx?.let { this.topMargin = it } | ||
bottomMarginPx?.let { this.bottomMargin = it } | ||
} | ||
this.setPadding(leftPaddingPx ?: 0, topPaddingPx ?: 0, rightPaddingPx ?: 0, bottomPaddingPx ?: 0) | ||
} | ||
|
||
fun View.backgroundColor(@ColorRes color: Int) { | ||
this.setBackgroundColor(this.context.getColor(color)) | ||
} |
22 changes: 22 additions & 0 deletions
22
DesignSystem/src/main/java/com/yourssu/design/system/language/Badge.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,22 @@ | ||
package com.yourssu.design.system.language | ||
|
||
import android.content.Context | ||
import android.view.ViewGroup | ||
import com.yourssu.design.system.atom.Badge | ||
|
||
fun Context.badge(block: Badge.() -> Unit) = Badge(this).run { | ||
block.invoke(this) | ||
this | ||
} | ||
|
||
fun ViewGroup.badge(block: Badge.() -> Unit) = Badge(this.context).run { | ||
block.invoke(this) | ||
this@badge.addView(this) | ||
this | ||
} | ||
|
||
fun ComponentGroup.badge(block: Badge.() -> Unit) = Badge(this.componentContext).run { | ||
block.invoke(this) | ||
this@badge.addComponent(this) | ||
this | ||
} |
23 changes: 23 additions & 0 deletions
23
DesignSystem/src/main/java/com/yourssu/design/system/language/CheckBox.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,23 @@ | ||
package com.yourssu.design.system.language | ||
|
||
import android.content.Context | ||
import android.view.ViewGroup | ||
import com.yourssu.design.system.atom.CheckBox | ||
|
||
fun Context.checkBox(block: CheckBox.() -> Unit) = CheckBox(this).run { | ||
block.invoke(this) | ||
this | ||
} | ||
|
||
fun ViewGroup.checkBox(block: CheckBox.() -> Unit) = CheckBox(this.context).run { | ||
block.invoke(this) | ||
this@checkBox.addView(this) | ||
this | ||
} | ||
|
||
fun ComponentGroup.checkBox(block: CheckBox.() -> Unit) = | ||
CheckBox(this.componentContext).run { | ||
block.invoke(this) | ||
this@checkBox.addComponent(this) | ||
this | ||
} |
22 changes: 22 additions & 0 deletions
22
DesignSystem/src/main/java/com/yourssu/design/system/language/IconView.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,22 @@ | ||
package com.yourssu.design.system.language | ||
|
||
import android.content.Context | ||
import android.view.ViewGroup | ||
import com.yourssu.design.system.atom.IconView | ||
|
||
fun Context.iconView(block: IconView.() -> Unit) = IconView(this).run { | ||
block.invoke(this) | ||
this | ||
} | ||
|
||
fun ViewGroup.iconView(block: IconView.() -> Unit) = IconView(this.context).run { | ||
block.invoke(this) | ||
this@iconView.addView(this) | ||
this | ||
} | ||
|
||
fun ComponentGroup.iconView(block: IconView.() -> Unit) = IconView(this.componentContext).run { | ||
block.invoke(this) | ||
this@iconView.addComponent(this) | ||
this | ||
} |
22 changes: 22 additions & 0 deletions
22
DesignSystem/src/main/java/com/yourssu/design/system/language/Picker.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,22 @@ | ||
package com.yourssu.design.system.language | ||
|
||
import android.content.Context | ||
import android.view.ViewGroup | ||
import com.yourssu.design.system.atom.Picker | ||
|
||
fun Context.picker(block: Picker.() -> Unit) = Picker(this).run { | ||
block.invoke(this) | ||
this | ||
} | ||
|
||
fun ViewGroup.picker(block: Picker.() -> Unit) = Picker(this.context).run { | ||
block.invoke(this) | ||
this@picker.addView(this) | ||
this | ||
} | ||
|
||
fun ComponentGroup.picker(block: Picker.() -> Unit) = Picker(this.componentContext).run { | ||
block.invoke(this) | ||
this@picker.addComponent(this) | ||
this | ||
} |
22 changes: 22 additions & 0 deletions
22
DesignSystem/src/main/java/com/yourssu/design/system/language/ProfileImageView.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,22 @@ | ||
package com.yourssu.design.system.language | ||
|
||
import android.content.Context | ||
import android.view.ViewGroup | ||
import com.yourssu.design.system.atom.ProfileImageView | ||
|
||
fun Context.profileImageView(block: ProfileImageView.() -> Unit) = ProfileImageView(this).run { | ||
block.invoke(this) | ||
this | ||
} | ||
|
||
fun ViewGroup.profileImageView(block: ProfileImageView.() -> Unit) = ProfileImageView(this.context).run { | ||
block.invoke(this) | ||
this@profileImageView.addView(this) | ||
this | ||
} | ||
|
||
fun ComponentGroup.profileImageView(block: ProfileImageView.() -> Unit) = ProfileImageView(this.componentContext).run { | ||
block.invoke(this) | ||
this@profileImageView.addComponent(this) | ||
this | ||
} |
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
76 changes: 76 additions & 0 deletions
76
DesignSystem/src/main/java/com/yourssu/design/system/language/TextField.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,76 @@ | ||
package com.yourssu.design.system.language | ||
|
||
import android.content.Context | ||
import android.view.ViewGroup | ||
import com.yourssu.design.system.atom.PasswordTextField | ||
import com.yourssu.design.system.atom.SearchTextField | ||
import com.yourssu.design.system.atom.SimpleTextField | ||
import com.yourssu.design.system.atom.SuffixTextField | ||
|
||
fun Context.passwordTextField(block: PasswordTextField.() -> Unit) = PasswordTextField(this).run { | ||
block.invoke(this) | ||
this | ||
} | ||
|
||
fun ViewGroup.passwordTextField(block: PasswordTextField.() -> Unit) = PasswordTextField(this.context).run { | ||
block.invoke(this) | ||
this@passwordTextField.addView(this) | ||
this | ||
} | ||
|
||
fun ComponentGroup.passwordTextField(block: PasswordTextField.() -> Unit) = PasswordTextField(this.componentContext).run { | ||
block.invoke(this) | ||
this@passwordTextField.addComponent(this) | ||
this | ||
} | ||
|
||
fun Context.searchTextField(block: SearchTextField.() -> Unit) = SearchTextField(this).run { | ||
block.invoke(this) | ||
this | ||
} | ||
|
||
fun ViewGroup.searchTextField(block: SearchTextField.() -> Unit) = SearchTextField(this.context).run { | ||
block.invoke(this) | ||
this@searchTextField.addView(this) | ||
this | ||
} | ||
|
||
fun ComponentGroup.searchTextField(block: SearchTextField.() -> Unit) = SearchTextField(this.componentContext).run { | ||
block.invoke(this) | ||
this@searchTextField.addComponent(this) | ||
this | ||
} | ||
|
||
fun Context.simpleTextField(block: SimpleTextField.() -> Unit) = SimpleTextField(this).run { | ||
block.invoke(this) | ||
this | ||
} | ||
|
||
fun ViewGroup.simpleTextField(block: SimpleTextField.() -> Unit) = SimpleTextField(this.context).run { | ||
block.invoke(this) | ||
this@simpleTextField.addView(this) | ||
this | ||
} | ||
|
||
fun ComponentGroup.simpleTextField(block: SimpleTextField.() -> Unit) = SimpleTextField(this.componentContext).run { | ||
block.invoke(this) | ||
this@simpleTextField.addComponent(this) | ||
this | ||
} | ||
|
||
fun Context.suffixTextField(block: SuffixTextField.() -> Unit) = SuffixTextField(this).run { | ||
block.invoke(this) | ||
this | ||
} | ||
|
||
fun ViewGroup.suffixTextField(block: SuffixTextField.() -> Unit) = SuffixTextField(this.context).run { | ||
block.invoke(this) | ||
this@suffixTextField.addView(this) | ||
this | ||
} | ||
|
||
fun ComponentGroup.suffixTextField(block: SuffixTextField.() -> Unit) = SuffixTextField(this.componentContext).run { | ||
block.invoke(this) | ||
this@suffixTextField.addComponent(this) | ||
this | ||
} |
2 changes: 1 addition & 1 deletion
2
...m/yourssu/design/system/atom/TextField.kt → ...su/design/undercarriage/base/TextField.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
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 @@ | ||
/build |
Oops, something went wrong.