Skip to content

Commit

Permalink
Update the sample app
Browse files Browse the repository at this point in the history
  • Loading branch information
rayworks committed Jan 25, 2021
1 parent ad7b116 commit 4772c56
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
10 changes: 10 additions & 0 deletions app/src/main/java/com/rayworks/shadowwrapper/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -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.*

Expand Down Expand Up @@ -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 {
Expand Down
20 changes: 12 additions & 8 deletions app/src/main/res/layout/content_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>

<com.rayworks.shadowlib.RoundLinerLayoutNormal
<TextView
android:id="@+id/top_text"
android:text="@string/text_center"
android:layout_margin="8dp"
android:gravity="center"
android:textColor="@color/shadowColor"
android:layout_width="match_parent"
android:layout_height="120dp"/>

<!--<com.rayworks.shadowlib.RoundLinerLayoutNormal
app:rll_elevation="8dp"
app:rll_inset_left="8dp"
app:rll_inset_right="8dp"
Expand All @@ -33,14 +42,9 @@
android:layout_marginBottom="8dp"
android:layout_width="match_parent"
android:layout_height="120dp">
<TextView
android:text="@string/text_center"
android:layout_margin="8dp"
android:textColor="@color/shadowColor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</com.rayworks.shadowlib.RoundLinerLayoutNormal>
</com.rayworks.shadowlib.RoundLinerLayoutNormal>-->

<com.rayworks.shadowlib.RoundLinerLayoutNormal
android:descendantFocusability="beforeDescendants"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<dimen name="fab_margin">16dp</dimen>
<dimen name="radius_corner">6dp</dimen>
<dimen name="elevation">16dp</dimen>
<dimen name="radius">8dp</dimen>
</resources>

0 comments on commit 4772c56

Please sign in to comment.