Skip to content

Commit

Permalink
🎉Release 1.3,给星闪Logo做个"闪烁效果"
Browse files Browse the repository at this point in the history
  • Loading branch information
Hny0305Lin committed Jul 5, 2024
1 parent 244893b commit 4e2309b
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.haohanyh.linmengjia.nearlink.nlchat.fun.ChatCore;

import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.ColorStateList;

import com.google.android.material.floatingactionbutton.FloatingActionButton;

public class ChatUIAnimationUtils {
// 定义静态全局变量来管理时间
public static final long DURATION_SHORT = 1000; // 1秒渐变
public static final double DURATION_LONG = 2022.1104; // 2秒左右渐变,星闪规范发布日

public static void animateBackgroundColorChange(Context context, FloatingActionButton button, int startColorRes, int endColorRes) {
int startColor = context.getResources().getColor(startColorRes);
int endColor = context.getResources().getColor(endColorRes);

ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), startColor, endColor);
colorAnimation.setDuration((long) DURATION_LONG); // 动画持续时间,单位为毫秒
colorAnimation.setRepeatCount(ValueAnimator.INFINITE); // 无限循环
colorAnimation.setRepeatMode(ValueAnimator.REVERSE); // 反转颜色渐变
colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animator) {
button.setBackgroundTintList(ColorStateList.valueOf((int) animator.getAnimatedValue()));
}
});
colorAnimation.start();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.database.Cursor;
import android.hardware.usb.UsbManager;
Expand Down Expand Up @@ -53,6 +54,7 @@
import com.haohanyh.linmengjia.nearlink.nlchat.fun.ChatCore.ChatMessageQueueUpdater;
import com.haohanyh.linmengjia.nearlink.nlchat.fun.ChatCore.ChatProcessorForExtract;
import com.haohanyh.linmengjia.nearlink.nlchat.fun.ChatCore.ChatSaveMessageDatabaseManager;
import com.haohanyh.linmengjia.nearlink.nlchat.fun.ChatCore.ChatUIAnimationUtils;
import com.haohanyh.linmengjia.nearlink.nlchat.fun.ChatCore.ChatUtils;
import com.haohanyh.linmengjia.nearlink.nlchat.fun.Premission.NearLinkChatGetSomePermission;
import com.haohanyh.linmengjia.nearlink.nlchat.fun.R.array;
Expand Down Expand Up @@ -639,6 +641,8 @@ public void onClick(View view) {
if (view.getId() == id.btnGO) {
MainAPP.Vibrate(this);
btnGO.setEnabled(false);//一次点击后不可再次点击,因为已经把星闪网络给启动了
btnGO.setBackgroundTintList(ColorStateList.valueOf(getResources().getColor(color.nearlinkgreen_deep)));
ChatUIAnimationUtils.animateBackgroundColorChange(MainActivity.this, btnGO, color.nearlinkgreen_deep, color.nearlinkgreen_light);
InitToOpen();
} else if (view.getId() == id.menu_labels_right_btn_nearlink) {
MainAPP.Vibrate(this);
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<color name="blue_biaozhun_logowai_transparent">#4500CEFC</color>

<color name="nearlinkgreen">#00C08B</color>
<color name="nearlinkgreen_deep">#FF00C08B</color>
<color name="nearlinkgreen_light">#7C00C08B</color>

<color name="snackbar_log_v">#330033</color>
<color name="snackbar_log_d">#0099FF</color>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>
<string name="app_name">NLChat</string>
<string name="app_package">com.haohanyh.linmengjia.nearlink.nlchat.fun</string>
<string name="app_version">1.3.56.2024.0706</string>
<string name="app_version">1.3.57.2024.0706</string>

<string name="appwarn">NLChat,浩瀚银河宗旨为用爱和魔法创造Android APP。</string>
<string name="thanks3q">友情感谢</string>
Expand Down

0 comments on commit 4e2309b

Please sign in to comment.