Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Fix colorfade
Browse files Browse the repository at this point in the history
  • Loading branch information
thrashedbrain committed Jan 10, 2021
1 parent dc4d075 commit e2bd48a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 2 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.github.thrashedbrain:GradientBackground:0.1'
implementation 'com.github.thrashedbrain:GradientBackground:0.2'
//implementation project (':gradientbackground')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected void onCreate(Bundle savedInstanceState) {
gradBg = new GradientBackground.Builder()
.addColor("#48cae4", "#023e8a")
.addColor("#006400", "#38b000")
.setDuration(10000)
.setDuration(8000)
.build();
gradBg.init();
gradBg.start(constraintLayout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import android.graphics.Color;
import android.graphics.drawable.AnimationDrawable;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -74,10 +71,11 @@ public void init(int radius){
drawable.setCornerRadius((float) radius);
animationDrawable.addFrame(drawable, duration);
}
animationDrawable.setExitFadeDuration(duration);

}

public void start(View view){
animationDrawable.setExitFadeDuration(duration);
view.setBackground(animationDrawable);
}

Expand Down

0 comments on commit e2bd48a

Please sign in to comment.