diff --git a/sample/build.gradle b/sample/build.gradle index c79271d..eb39c82 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -11,6 +11,9 @@ android { versionCode 1 versionName "1.0" } + buildFeatures { + viewBinding = true + } compileOptions { sourceCompatibility 1.8 targetCompatibility 1.8 diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index 47d1f9f..d8f60ce 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -17,6 +17,7 @@ + \ No newline at end of file diff --git a/sample/src/main/java/soup/neumorphism/sample/ColorSampleActivity.kt b/sample/src/main/java/soup/neumorphism/sample/ColorSampleActivity.kt new file mode 100644 index 0000000..aed5233 --- /dev/null +++ b/sample/src/main/java/soup/neumorphism/sample/ColorSampleActivity.kt @@ -0,0 +1,61 @@ +package soup.neumorphism.sample + +import android.content.res.ColorStateList +import android.graphics.Color +import android.os.Bundle +import android.view.LayoutInflater +import androidx.appcompat.app.AppCompatActivity +import soup.neumorphism.sample.databinding.ActivitySampleColorBinding + +class ColorSampleActivity : AppCompatActivity() { + + private lateinit var binding: ActivitySampleColorBinding + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + binding = ActivitySampleColorBinding.inflate(LayoutInflater.from(this)) + setContentView(binding.root) + + onBackgroundColorChanged(Color.RED) + } + + private fun onBackgroundColorChanged(backgroundColor: Int) { + binding.run { + card.setBackgroundColor(backgroundColor) + imageView.setBackgroundColor(backgroundColor) + imageButton.setBackgroundColor(backgroundColor) + button.setBackgroundColor(backgroundColor) + fab.setBackgroundColor(backgroundColor) + } + } + + private fun onBackgroundColorChanged(backgroundColor: ColorStateList?) { + binding.run { + card.setBackgroundColor(backgroundColor) + imageView.setBackgroundColor(backgroundColor) + imageButton.setBackgroundColor(backgroundColor) + button.setBackgroundColor(backgroundColor) + fab.setBackgroundColor(backgroundColor) + } + } + + private fun onStrokeColorChanged(strokeColor: ColorStateList?) { + binding.run { + card.setStrokeColor(strokeColor) + imageView.setStrokeColor(strokeColor) + imageButton.setStrokeColor(strokeColor) + button.setStrokeColor(strokeColor) + fab.setStrokeColor(strokeColor) + } + } + + private fun onStrokeWidthChanged(strokeWidth: Float) { + binding.run { + card.setStrokeWidth(strokeWidth) + imageView.setStrokeWidth(strokeWidth) + imageButton.setStrokeWidth(strokeWidth) + button.setStrokeWidth(strokeWidth) + fab.setStrokeWidth(strokeWidth) + } + } +} diff --git a/sample/src/main/java/soup/neumorphism/sample/MainActivity.kt b/sample/src/main/java/soup/neumorphism/sample/MainActivity.kt index ff875c3..2da2fe2 100644 --- a/sample/src/main/java/soup/neumorphism/sample/MainActivity.kt +++ b/sample/src/main/java/soup/neumorphism/sample/MainActivity.kt @@ -1,6 +1,8 @@ package soup.neumorphism.sample +import android.content.Intent import android.os.Bundle +import android.view.View import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() { @@ -8,5 +10,9 @@ class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) + + findViewById(R.id.button).setOnClickListener { + startActivity(Intent(this, ColorSampleActivity::class.java)) + } } } diff --git a/sample/src/main/res/drawable-night/gradation.xml b/sample/src/main/res/drawable-night/gradation.xml new file mode 100644 index 0000000..e212c87 --- /dev/null +++ b/sample/src/main/res/drawable-night/gradation.xml @@ -0,0 +1,8 @@ + + + + diff --git a/sample/src/main/res/drawable/gradation.xml b/sample/src/main/res/drawable/gradation.xml new file mode 100644 index 0000000..e835882 --- /dev/null +++ b/sample/src/main/res/drawable/gradation.xml @@ -0,0 +1,8 @@ + + + + diff --git a/sample/src/main/res/layout/activity_sample_color.xml b/sample/src/main/res/layout/activity_sample_color.xml new file mode 100644 index 0000000..3e7cdf4 --- /dev/null +++ b/sample/src/main/res/layout/activity_sample_color.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + +