-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from MoyeoRun/feature/default-button
[#22] RectangleButton, RoundButton CustomView 추가
- Loading branch information
Showing
8 changed files
with
101 additions
and
3 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
app/src/main/java/com/moyerun/moyeorun_android/views/RectangleButton.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,12 @@ | ||
package com.moyerun.moyeorun_android.views | ||
|
||
import android.content.Context | ||
import android.util.AttributeSet | ||
import android.view.ContextThemeWrapper | ||
import androidx.appcompat.widget.AppCompatButton | ||
import com.moyerun.moyeorun_android.R | ||
|
||
class RectangleButton constructor( | ||
context: Context, | ||
attrs: AttributeSet? = null | ||
) : AppCompatButton(ContextThemeWrapper(context, R.style.RectangleButtonTheme), attrs) |
12 changes: 12 additions & 0 deletions
12
app/src/main/java/com/moyerun/moyeorun_android/views/RoundButton.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,12 @@ | ||
package com.moyerun.moyeorun_android.views | ||
|
||
import android.content.Context | ||
import android.util.AttributeSet | ||
import android.view.ContextThemeWrapper | ||
import androidx.appcompat.widget.AppCompatButton | ||
import com.moyerun.moyeorun_android.R | ||
|
||
class RoundButton constructor( | ||
context: Context, | ||
attrs: AttributeSet? = null | ||
) : AppCompatButton(ContextThemeWrapper(context, R.style.RoundButtonTheme), attrs) |
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,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:state_enabled="true" android:state_pressed="false"> | ||
<shape android:shape="rectangle" > | ||
<solid android:color="@color/main_blue"/> | ||
</shape> | ||
</item> | ||
<item android:state_enabled="true" android:state_pressed="true"> | ||
<shape android:shape="rectangle"> | ||
<solid android:color="@color/button_pressed_true"/> | ||
</shape> | ||
</item> | ||
<item android:state_enabled="false"> | ||
<shape android:shape="rectangle"> | ||
<solid android:color="@color/button_enable_false"/> | ||
</shape> | ||
</item> | ||
</selector> |
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,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:state_pressed="true" android:color="@color/main_white" /> | ||
<item android:state_enabled="false" android:color="@color/button_text_enable_false"/> | ||
<item android:color="@color/main_white" /> | ||
</selector> |
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,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:state_enabled="true" android:state_pressed="false"> | ||
<shape android:shape="rectangle"> | ||
<solid android:color="@color/main_blue"/> | ||
<corners android:radius="4dp"/> | ||
</shape> | ||
</item> | ||
<item android:state_enabled="true" android:state_pressed="true"> | ||
<shape android:shape="rectangle"> | ||
<solid android:color="@color/button_pressed_true"/> | ||
<corners android:radius="4dp"/> | ||
</shape> | ||
</item> | ||
<item android:state_enabled="false"> | ||
<shape android:shape="rectangle"> | ||
<solid android:color="@color/button_enable_false"/> | ||
<corners android:radius="4dp"/> | ||
</shape> | ||
</item> | ||
</selector> |
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,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:state_pressed="true" android:color="@color/main_white" /> | ||
<item android:state_enabled="false" android:color="@color/button_text_enable_false"/> | ||
<item android:color="@color/main_white" /> | ||
</selector> |
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,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<style name="RectangleButtonTheme"> | ||
<item name="buttonStyle">@style/RectangleButton</item> | ||
</style> | ||
<style name="RectangleButton" parent="Widget.AppCompat.Button"> | ||
<item name="android:background">@drawable/selector_rectangle_button</item> | ||
<item name="android:textSize">21dp</item> | ||
<item name="android:textColor">@drawable/selector_rectangle_button_text</item> | ||
<item name="android:minHeight">88dp</item> | ||
</style> | ||
|
||
<style name="RoundButtonTheme"> | ||
<item name="buttonStyle">@style/RoundButton</item> | ||
</style> | ||
<style name="RoundButton" parent="Widget.AppCompat.Button"> | ||
<item name="android:background">@drawable/selector_round_button</item> | ||
<item name="android:textSize">21dp</item> | ||
<item name="android:textColor">@drawable/selector_round_button_text</item> | ||
</style> | ||
</resources> |