Skip to content

Commit

Permalink
增加代码设置属性
Browse files Browse the repository at this point in the history
  • Loading branch information
lihangleo2 committed Nov 4, 2020
1 parent cc68ffd commit b9dfdd1
Show file tree
Hide file tree
Showing 5 changed files with 173 additions and 58 deletions.
2 changes: 2 additions & 0 deletions app/src/main/java/com/leo/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.leo;

import android.content.Intent;
import android.databinding.BindingBuildInfo;
import android.databinding.DataBindingUtil;
import android.graphics.Color;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/leo/ShapeActivity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.leo;

import android.databinding.DataBindingUtil;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
Expand Down Expand Up @@ -30,5 +31,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
binding.shadowLayoutBindView.setOnClickListener(v -> {
binding.shadowLayoutBindView.setSelected(!binding.shadowLayoutBindView.isSelected());
});

}
}
32 changes: 16 additions & 16 deletions app/src/main/java/com/leo/StarShowActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ protected void onCreate(Bundle savedInstanceState) {
tab_leftShow.setOnClickListener(this);


skbar_corner.setMax((int) (ShadowLayout.getmCornerRadius() * 3));
skbar_corner.setProgress((int) ShadowLayout.getmCornerRadius());
skbar_corner.setMax((int) (ShadowLayout.getCornerRadius() * 3));
skbar_corner.setProgress((int) ShadowLayout.getCornerRadius());
skbar_corner.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
ShadowLayout.setmCornerRadius(progress);
ShadowLayout.setCornerRadius(progress);
}

@Override
Expand All @@ -69,12 +69,12 @@ public void onStopTrackingTouch(SeekBar seekBar) {
});


skbar_limit.setMax((int) (ShadowLayout.getmShadowLimit() * 3));
skbar_limit.setProgress((int) ShadowLayout.getmShadowLimit());
skbar_limit.setMax((int) (ShadowLayout.getShadowLimit() * 3));
skbar_limit.setProgress((int) ShadowLayout.getShadowLimit());
skbar_limit.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
ShadowLayout.setmShadowLimit(progress);
ShadowLayout.setShadowLimit(progress);
}

@Override
Expand All @@ -92,7 +92,7 @@ public void onStopTrackingTouch(SeekBar seekBar) {
skbar_x.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
ShadowLayout.setMDx(progress - 100);
ShadowLayout.setShadowOffsetX(progress - 100);
}

@Override
Expand All @@ -110,7 +110,7 @@ public void onStopTrackingTouch(SeekBar seekBar) {
skbar_y.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
ShadowLayout.setMDy(progress - 100);
ShadowLayout.setShadowOffsetY(progress - 100);
}

@Override
Expand All @@ -129,7 +129,7 @@ public void onStopTrackingTouch(SeekBar seekBar) {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
alpha = progress;
ShadowLayout.setmShadowColor(Color.argb(alpha, red, green, blue));
ShadowLayout.setShadowColor(Color.argb(alpha, red, green, blue));
}

@Override
Expand All @@ -148,7 +148,7 @@ public void onStopTrackingTouch(SeekBar seekBar) {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
red = progress;
ShadowLayout.setmShadowColor(Color.argb(alpha, red, green, blue));
ShadowLayout.setShadowColor(Color.argb(alpha, red, green, blue));
}

@Override
Expand All @@ -167,7 +167,7 @@ public void onStopTrackingTouch(SeekBar seekBar) {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
green = progress;
ShadowLayout.setmShadowColor(Color.argb(alpha, red, green, blue));
ShadowLayout.setShadowColor(Color.argb(alpha, red, green, blue));
}

@Override
Expand All @@ -186,7 +186,7 @@ public void onStopTrackingTouch(SeekBar seekBar) {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
blue = progress;
ShadowLayout.setmShadowColor(Color.argb(alpha, red, green, blue));
ShadowLayout.setShadowColor(Color.argb(alpha, red, green, blue));
}

@Override
Expand All @@ -208,19 +208,19 @@ public void onStopTrackingTouch(SeekBar seekBar) {
public void onClick(View v) {
switch (v.getId()) {
case R.id.tab_topShow:
ShadowLayout.setTopShow(!select(tab_topShow));
ShadowLayout.setShadowHiddenTop(select(tab_topShow));
break;

case R.id.tab_bottomShow:
ShadowLayout.setBottomShow(!select(tab_bottomShow));
ShadowLayout.setShadowHiddenBottom(select(tab_bottomShow));
break;

case R.id.tab_leftShow:
ShadowLayout.setLeftShow(!select(tab_leftShow));
ShadowLayout.setShadowHiddenLeft(select(tab_leftShow));
break;

case R.id.tab_rightShow:
ShadowLayout.setRightShow(!select(tab_rightShow));
ShadowLayout.setShadowHiddenRight(select(tab_rightShow));
break;
}
}
Expand Down
11 changes: 9 additions & 2 deletions app/src/main/res/layout/activity_shape.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,16 @@
android:textSize="15sp" />

<com.lihang.ShadowLayout
android:id="@+id/shadowLayout_corner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
app:hl_cornerRadius="10dp"
app:hl_strokeColor="#000">
app:hl_strokeColor="#000"
>



<TextView
android:layout_width="wrap_content"
Expand Down Expand Up @@ -123,6 +127,7 @@
</com.lihang.ShadowLayout>

<com.lihang.ShadowLayout
android:id="@+id/ShadowLayout_my_test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
Expand All @@ -131,7 +136,8 @@
app:hl_cornerRadius_leftTop="0dp"
app:hl_cornerRadius_rightBottom="0dp"
app:hl_strokeColor="#000"
app:hl_strokeColor_true="#ff0000">
app:hl_strokeColor_true="#ff0000"
>

<TextView
android:layout_width="wrap_content"
Expand Down Expand Up @@ -193,6 +199,7 @@


<com.lihang.ShadowLayout
android:id="@+id/ShadowLayout_press"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
Expand Down
Loading

0 comments on commit b9dfdd1

Please sign in to comment.