From 4772c56af844c1497722224d7d5c25458b52695f Mon Sep 17 00:00:00 2001 From: rayworks Date: Mon, 25 Jan 2021 23:31:36 +0800 Subject: [PATCH] Update the sample app --- .../rayworks/shadowwrapper/MainActivity.kt | 10 ++++++++++ app/src/main/res/layout/content_main.xml | 20 +++++++++++-------- app/src/main/res/values/dimens.xml | 1 + 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/rayworks/shadowwrapper/MainActivity.kt b/app/src/main/java/com/rayworks/shadowwrapper/MainActivity.kt index 4bea338..1af2175 100644 --- a/app/src/main/java/com/rayworks/shadowwrapper/MainActivity.kt +++ b/app/src/main/java/com/rayworks/shadowwrapper/MainActivity.kt @@ -1,11 +1,13 @@ package com.rayworks.shadowwrapper +import android.graphics.Color import android.os.Bundle import android.view.Gravity import android.view.Menu import android.view.MenuItem import androidx.appcompat.app.AppCompatActivity import com.google.android.material.snackbar.Snackbar +import com.rayworks.shadowlib.ViewUtils.applyShadow import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.content_main.* @@ -45,6 +47,14 @@ class MainActivity : AppCompatActivity() { index %= colors.size layout_light.updateShadowBackground(shadowColorValue = colors[index]) } + + top_text.applyShadow( + Color.WHITE, + cornerRadiusValue = resources.getDimension(R.dimen.radius_corner), + shadowColorValue = resources.getColor(R.color.shadowColor), + elevationValue = resources.getDimensionPixelSize(R.dimen.radius), + shadowGravity = Gravity.CENTER + ) } override fun onCreateOptionsMenu(menu: Menu): Boolean { diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml index d5bf61c..c0c7a8b 100644 --- a/app/src/main/res/layout/content_main.xml +++ b/app/src/main/res/layout/content_main.xml @@ -24,7 +24,16 @@ app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent"/> - + + 16dp 6dp 16dp + 8dp