Android 12系统源码_窗口动画(二)应用程序间的切换动画

前言

在 Android 系统中,系统主要是通过AppTransitionController和AppTransition这两个类是用于管理应用程序间切换动画的重要类。

一、简介

1、AppTransitionController

AppTransitionController 是一个系统级别的类,用于管理应用程序间切换时的动画效果。其作用包括:

  • 动画类型管理:控制不同应用切换时的动画类型,如窗口动画、应用切换动画等。
  • 动画资源管理:管理和加载与切换动画相关的资源,如动画文件、持续时间等。
  • 调度动画:决定何时开始和结束应用程序切换的动画。

2、AppTransition

AppTransition 是 AppTransitionController 的一部分,负责实际执行应用切换动画。主要功能包括:

  • 动画执行:根据 AppTransitionController 的设置,执行应用程序间的切换动画。
  • 动画参数设置:配置和管理动画的参数,例如动画类型、持续时间、插值器等。
  • 状态监控:监控动画执行的状态,以便在动画完成或被取消时进行适当的处理。

3、使用场景和重要性

这两个类在 Android 系统中的重要性体现在以下几个方面:

  • 用户体验:应用程序切换时的流畅动画可以显著提升用户体验,这些动画通过 AppTransitionController 和 AppTransition 进行管理和优化。
  • 系统一致性:Android 系统通过这些类确保应用程序切换时的动画表现一致性,使整个系统看起来更加统一。
  • 定制性:开发者可以通过这些类定制应用切换时的动画效果,以满足特定应用或设备的需求。

二、对象的创建

1、AppTransition和AppTransitionController实例对象的创建。

AppTransition和AppTransitionController实例对象都是在DisplayContent对象的构造方法中被创建的。

frameworks/base/services/core/java/com/android/server/wm/DisplayContent.java

class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowContainer>implements WindowManagerPolicy.DisplayContentInfo {DisplayContent(Display display, RootWindowContainer root) {super(root.mWindowManager);       ...代码省略...mAppTransition = new AppTransition(mWmService.mContext, mWmService, this);mAppTransition.registerListenerLocked(mWmService.mActivityManagerAppTransitionNotifier);mAppTransition.registerListenerLocked(mFixedRotationTransitionListener);mAppTransitionController = new AppTransitionController(mWmService, this);...代码省略...}}

2、关于DisplayContent对象

我们在Android 12系统源码_窗口管理(七)DisplayContent简介这篇文章有讲过,DisplayContent 用于管理屏幕,一块DisplayContent 对象实例代表一个屏幕设备,这样有多个屏幕的设备就可以创建多个DisplayContent 对象,虽然多数设备只有一个显示屏,但它们同样可以创建多个 DisplayContent 对象,如投屏的时候,可以创建一个虚拟的DisplayContent,DisplayContent会根据窗口的显示位置将窗口进行分组,隶属于同一个DisplayContent的窗口将会显示在同一个屏幕中,每一个DisplayContent都对应一个唯一的ID,在添加窗口时可以通过指定这个ID决定其将被显示在对应的个屏幕中。DisplayContent是一个非常具有隔离性的一个概念。处于不同DisplayContent的两个窗口在布局、显示顺序以及动画处理上不会产生任何耦合,而如果我们想让不同DisplayContent的窗口切换动画不同,就可以通过定制该DisplayContent对应的AppTransition和AppTransitionController来实现。

三、AppTransition

来看下AppTransition的相关的源码。

frameworks/base/services/core/java/com/android/server/wm/AppTransition.java

public class AppTransition implements Dump {static final int DEFAULT_APP_TRANSITION_DURATION = 336;//应用默认专场动画的执行时间private final Context mContext;private final WindowManagerService mService;private final DisplayContent mDisplayContent;private final TransitionAnimation mTransitionAnimation;//应用间的切换动画private final int mConfigShortAnimTime;private final Interpolator mDecelerateInterpolator;private final Interpolator mThumbnailFadeInInterpolator;private final Interpolator mThumbnailFadeOutInterpolator;private final Interpolator mLinearOutSlowInInterpolator;private final Interpolator mFastOutLinearInInterpolator;private final Interpolator mFastOutSlowInInterpolator;private final int mClipRevealTranslationY;private final boolean mGridLayoutRecentsEnabled;private final boolean mLowRamRecentsEnabled;private final int mDefaultWindowAnimationStyleResId;private RemoteAnimationController mRemoteAnimationController;final Handler mHandler;AppTransition(Context context, WindowManagerService service, DisplayContent displayContent) {mContext = context;mService = service;mHandler = new Handler(service.mH.getLooper());mDisplayContent = displayContent;mTransitionAnimation = new TransitionAnimation(context, DEBUG_ANIM, TAG);mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,com.android.internal.R.interpolator.linear_out_slow_in);mFastOutLinearInInterpolator = AnimationUtils.loadInterpolator(context,com.android.internal.R.interpolator.fast_out_linear_in);mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,com.android.internal.R.interpolator.fast_out_slow_in);mConfigShortAnimTime = context.getResources().getInteger(com.android.internal.R.integer.config_shortAnimTime);mDecelerateInterpolator = AnimationUtils.loadInterpolator(context,com.android.internal.R.interpolator.decelerate_cubic);mThumbnailFadeInInterpolator = new Interpolator() {@Overridepublic float getInterpolation(float input) {// Linear response for first fraction, then complete after that.if (input < RECENTS_THUMBNAIL_FADEIN_FRACTION) {return 0f;}float t = (input - RECENTS_THUMBNAIL_FADEIN_FRACTION) /(1f - RECENTS_THUMBNAIL_FADEIN_FRACTION);return mFastOutLinearInInterpolator.getInterpolation(t);}};mThumbnailFadeOutInterpolator = new Interpolator() {@Overridepublic float getInterpolation(float input) {// Linear response for first fraction, then complete after that.if (input < RECENTS_THUMBNAIL_FADEOUT_FRACTION) {float t = input / RECENTS_THUMBNAIL_FADEOUT_FRACTION;return mLinearOutSlowInInterpolator.getInterpolation(t);}return 1f;}};mClipRevealTranslationY = (int) (CLIP_REVEAL_TRANSLATION_Y_DP* mContext.getResources().getDisplayMetrics().density);mGridLayoutRecentsEnabled = SystemProperties.getBoolean("ro.recents.grid", false);mLowRamRecentsEnabled = ActivityManager.isLowRamDeviceStatic();final TypedArray windowStyle = mContext.getTheme().obtainStyledAttributes(com.android.internal.R.styleable.Window);mDefaultWindowAnimationStyleResId = windowStyle.getResourceId(com.android.internal.R.styleable.Window_windowAnimationStyle, 0);windowStyle.recycle();}/**** @param lp 窗口参数* @param transit 窗口切换动画类型* @param enter 是否是进入* @param frame 如果是进入动画,则是动画结束后窗口的位置,如果是退出动画,则是动画开始时窗口的位置* @return 返回的就是最终的窗口转换动画*/Animation loadAnimation(LayoutParams lp, int transit, boolean enter, int uiMode,int orientation, Rect frame, Rect displayFrame, Rect insets,@Nullable Rect surfaceInsets, @Nullable Rect stableInsets, boolean isVoiceInteraction,boolean freeform, WindowContainer container) {if (mNextAppTransitionOverrideRequested&& (container.canCustomizeAppTransition() || mOverrideTaskTransition)) {mNextAppTransitionType = NEXT_TRANSIT_TYPE_CUSTOM;}Animation a;if (isKeyguardGoingAwayTransitOld(transit) && enter) {a = mTransitionAnimation.loadKeyguardExitAnimation(mNextAppTransitionFlags,transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER);} else if (transit == TRANSIT_OLD_KEYGUARD_OCCLUDE) {a = null;} else if (transit == TRANSIT_OLD_KEYGUARD_UNOCCLUDE && !enter) {a = mTransitionAnimation.loadKeyguardUnoccludeAnimation();} else if (transit == TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE) {a = null;} else if (isVoiceInteraction && (transit == TRANSIT_OLD_ACTIVITY_OPEN|| transit == TRANSIT_OLD_TASK_OPEN|| transit == TRANSIT_OLD_TASK_TO_FRONT)) {a = mTransitionAnimation.loadVoiceActivityOpenAnimation(enter);ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM,"applyAnimation voice: anim=%s transit=%s isEntrance=%b Callers=%s", a,appTransitionOldToString(transit), enter, Debug.getCallers(3));} else if (isVoiceInteraction && (transit == TRANSIT_OLD_ACTIVITY_CLOSE|| transit == TRANSIT_OLD_TASK_CLOSE|| transit == TRANSIT_OLD_TASK_TO_BACK)) {a = mTransitionAnimation.loadVoiceActivityExitAnimation(enter);ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM,"applyAnimation voice: anim=%s transit=%s isEntrance=%b Callers=%s", a,appTransitionOldToString(transit), enter, Debug.getCallers(3));} else if (transit == TRANSIT_OLD_ACTIVITY_RELAUNCH) {a = mTransitionAnimation.createRelaunchAnimation(frame, insets,mDefaultNextAppTransitionAnimationSpec != null? mDefaultNextAppTransitionAnimationSpec.rect : null);ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM,"applyAnimation: anim=%s transit=%s Callers=%s", a,appTransitionOldToString(transit), Debug.getCallers(3));} else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_CUSTOM) {a = mTransitionAnimation.loadAppTransitionAnimation(mNextAppTransitionPackage,enter ? mNextAppTransitionEnter : mNextAppTransitionExit);ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM,"applyAnimation: anim=%s nextAppTransition=ANIM_CUSTOM transit=%s "+ "isEntrance=%b Callers=%s",a, appTransitionOldToString(transit), enter, Debug.getCallers(3));} else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_CUSTOM_IN_PLACE) {a = mTransitionAnimation.loadAppTransitionAnimation(mNextAppTransitionPackage, mNextAppTransitionInPlace);ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM,"applyAnimation: anim=%s nextAppTransition=ANIM_CUSTOM_IN_PLACE "+ "transit=%s Callers=%s",a, appTransitionOldToString(transit), Debug.getCallers(3));} else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_CLIP_REVEAL) {a = mTransitionAnimation.createClipRevealAnimationLockedCompat(transit, enter, frame, displayFrame,mDefaultNextAppTransitionAnimationSpec != null? mDefaultNextAppTransitionAnimationSpec.rect : null);ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM,"applyAnimation: anim=%s nextAppTransition=ANIM_CLIP_REVEAL "+ "transit=%s Callers=%s",a, appTransitionOldToString(transit), Debug.getCallers(3));} else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_SCALE_UP) {a = mTransitionAnimation.createScaleUpAnimationLockedCompat(transit, enter, frame,mDefaultNextAppTransitionAnimationSpec != null? mDefaultNextAppTransitionAnimationSpec.rect : null);ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM,"applyAnimation: anim=%s nextAppTransition=ANIM_SCALE_UP transit=%s "+ "isEntrance=%s Callers=%s",a, appTransitionOldToString(transit), enter, Debug.getCallers(3));} else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_SCALE_UP ||mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_SCALE_DOWN) {mNextAppTransitionScaleUp =(mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_SCALE_UP);final HardwareBuffer thumbnailHeader = getAppTransitionThumbnailHeader(container);a = mTransitionAnimation.createThumbnailEnterExitAnimationLockedCompat(enter,mNextAppTransitionScaleUp, frame, transit, thumbnailHeader,mDefaultNextAppTransitionAnimationSpec != null? mDefaultNextAppTransitionAnimationSpec.rect : null);ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM,"applyAnimation: anim=%s nextAppTransition=%s transit=%s isEntrance=%b "+ "Callers=%s",a,  mNextAppTransitionScaleUp? "ANIM_THUMBNAIL_SCALE_UP" : "ANIM_THUMBNAIL_SCALE_DOWN",appTransitionOldToString(transit), enter, Debug.getCallers(3));} else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_UP ||mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_DOWN) {mNextAppTransitionScaleUp =(mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_UP);AppTransitionAnimationSpec spec = mNextAppTransitionAnimationsSpecs.get(container.hashCode());a = mTransitionAnimation.createAspectScaledThumbnailEnterExitAnimationLocked(enter,mNextAppTransitionScaleUp, orientation, transit, frame, insets, surfaceInsets,stableInsets, freeform, spec != null ? spec.rect : null,mDefaultNextAppTransitionAnimationSpec != null? mDefaultNextAppTransitionAnimationSpec.rect : null);ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM,"applyAnimation: anim=%s nextAppTransition=%s transit=%s isEntrance=%b "+ "Callers=%s",a, mNextAppTransitionScaleUp? "ANIM_THUMBNAIL_ASPECT_SCALE_UP": "ANIM_THUMBNAIL_ASPECT_SCALE_DOWN",appTransitionOldToString(transit), enter, Debug.getCallers(3));} else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_OPEN_CROSS_PROFILE_APPS && enter) {a = mTransitionAnimation.loadCrossProfileAppEnterAnimation();ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM,"applyAnimation NEXT_TRANSIT_TYPE_OPEN_CROSS_PROFILE_APPS: "+ "anim=%s transit=%s isEntrance=true Callers=%s",a, appTransitionOldToString(transit), Debug.getCallers(3));} else if (isChangeTransitOld(transit)) {// In the absence of a specific adapter, we just want to keep everything stationary.a = new AlphaAnimation(1.f, 1.f);a.setDuration(WindowChangeAnimationSpec.ANIMATION_DURATION);ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM,"applyAnimation: anim=%s transit=%s isEntrance=%b Callers=%s",a, appTransitionOldToString(transit), enter, Debug.getCallers(3));} else {int animAttr = 0;switch (transit) {case TRANSIT_OLD_ACTIVITY_OPEN:case TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN:animAttr = enter? WindowAnimation_activityOpenEnterAnimation: WindowAnimation_activityOpenExitAnimation;break;case TRANSIT_OLD_ACTIVITY_CLOSE:case TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE:animAttr = enter? WindowAnimation_activityCloseEnterAnimation: WindowAnimation_activityCloseExitAnimation;break;case TRANSIT_OLD_TASK_OPEN:animAttr = enter? WindowAnimation_taskOpenEnterAnimation: WindowAnimation_taskOpenExitAnimation;break;case TRANSIT_OLD_TASK_CLOSE:animAttr = enter? WindowAnimation_taskCloseEnterAnimation: WindowAnimation_taskCloseExitAnimation;break;case TRANSIT_OLD_TASK_TO_FRONT:animAttr = enter? WindowAnimation_taskToFrontEnterAnimation: WindowAnimation_taskToFrontExitAnimation;break;case TRANSIT_OLD_TASK_TO_BACK:animAttr = enter? WindowAnimation_taskToBackEnterAnimation: WindowAnimation_taskToBackExitAnimation;break;case TRANSIT_OLD_WALLPAPER_OPEN:animAttr = enter? WindowAnimation_wallpaperOpenEnterAnimation: WindowAnimation_wallpaperOpenExitAnimation;break;case TRANSIT_OLD_WALLPAPER_CLOSE:animAttr = enter? WindowAnimation_wallpaperCloseEnterAnimation: WindowAnimation_wallpaperCloseExitAnimation;break;case TRANSIT_OLD_WALLPAPER_INTRA_OPEN:animAttr = enter? WindowAnimation_wallpaperIntraOpenEnterAnimation: WindowAnimation_wallpaperIntraOpenExitAnimation;break;case TRANSIT_OLD_WALLPAPER_INTRA_CLOSE:animAttr = enter? WindowAnimation_wallpaperIntraCloseEnterAnimation: WindowAnimation_wallpaperIntraCloseExitAnimation;break;case TRANSIT_OLD_TASK_OPEN_BEHIND:animAttr = enter? WindowAnimation_launchTaskBehindSourceAnimation: WindowAnimation_launchTaskBehindTargetAnimation;break;// TODO(b/189386466): Use activity transition as the fallback. Investigate if we//  need new TaskFragment transition.case TRANSIT_OLD_TASK_FRAGMENT_OPEN:animAttr = enter? WindowAnimation_activityOpenEnterAnimation: WindowAnimation_activityOpenExitAnimation;break;// TODO(b/189386466): Use activity transition as the fallback. Investigate if we//  need new TaskFragment transition.case TRANSIT_OLD_TASK_FRAGMENT_CLOSE:animAttr = enter? WindowAnimation_activityCloseEnterAnimation: WindowAnimation_activityCloseExitAnimation;break;}//动画a = animAttr != 0 ? loadAnimationAttr(lp, animAttr, transit) : null;ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM,"applyAnimation: anim=%s animAttr=0x%x transit=%s isEntrance=%b "+ "Callers=%s",a, animAttr, appTransitionOldToString(transit), enter,Debug.getCallers(3));}setAppTransitionFinishedCallbackIfNeeded(a);return a;}/**** @param lp 窗口参数* @param animAttr 动画资源id* @param transit 窗口切换动画类型* @return Animation动画*/@NullableAnimation loadAnimationAttr(LayoutParams lp, int animAttr, int transit) {return mTransitionAnimation.loadAnimationAttr(lp, animAttr, transit);}}

frameworks/base/core/java/com/android/internal/policy/TransitionAnimation.java

public class TransitionAnimation {@Nullablepublic Animation loadAnimationAttr(LayoutParams lp, int animAttr, int transit) {int resId = Resources.ID_NULL;Context context = mContext;if (animAttr >= 0) {AttributeCache.Entry ent = getCachedAnimations(lp);if (ent != null) {context = ent.context;resId = ent.array.getResourceId(animAttr, 0);}}resId = updateToTranslucentAnimIfNeeded(resId, transit);if (ResourceId.isValid(resId)) {return loadAnimationSafely(context, resId, mTag);}return null;}private static int updateToTranslucentAnimIfNeeded(int anim, @TransitionOldType int transit) {if (transit == TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN&& anim == R.anim.activity_open_enter) {return R.anim.activity_translucent_open_enter;}if (transit == TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE&& anim == R.anim.activity_close_exit) {return R.anim.activity_translucent_close_exit;}return anim;}}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/48783.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

《简历宝典》20 - 简历中“自我评价”,如何能够“画龙点睛”

前两节我们针对 “项目经历” 和 “技术能力” 模块做了内功与实战的讲解&#xff0c;可以说是重中之重&#xff0c;是简历优化新思路的核心所在。这一节开始对自我评价做讲解&#xff0c;自我评价一般都会放置在简历的末尾&#xff0c;HR在迅速浏览完个人信息、技术能力、学历…

VScode 批量操作

VScode 批量操作 批量修改 按住 alt/option 键&#xff0c; 选择需要批量操作的位置 如果是多行&#xff0c;则按住 altshift 键 可以直接操作 但是有时候比如变量命名&#xff0c;可能需要递增操作的命名 需要下载插件 Increment Selection 按照1的方法多选光标之后&am…

后端面试题日常练-day04 【Java基础】

题目 希望这些选择题能够帮助您进行后端面试的准备&#xff0c;答案在文末 在Java中&#xff0c;以下哪个关键字用于表示接口&#xff1f; a) interface b) implements c) extends d) interfaceOf Java中的静态变量有什么特点&#xff1f; a) 静态变量属于对象实例 b) 静态变…

html+css+js前端作业 王者荣耀官网5个页面带js

htmlcssjs前端作业 王者荣耀官网5个页面带js 下载地址 https://download.csdn.net/download/qq_42431718/89574989 目录1 目录2 目录3 项目视频 王者荣耀5个页面&#xff08;带js&#xff09; 页面1 页面2 页面3 页面4 页面5

php接口返回的json字符串,json_decode()失败,原来是多了红点

问题&#xff1a; 调用某个接口返回的json&#xff0c;json_decode()失败&#xff0c;返回数据为null&#xff0c; echo json_last_error();返回错误码 4 经过多次调试发现&#xff1a;多出来一个红点&#xff0c;预览是看不到的。 解决&#xff1a;要去除BOM头部 $resul…

【SmartBi】错位时的解决办法

【背景】 使用SmartBi时&#xff0c;有时会存在分页后某一个位置的字段错位的情况。 【分析】 很可能是单元格的延申导致挤占位置&#xff0c;使后续位置相关单元格错位。 【解决思路】 取消相应单元格的SmartBi属性中的延申选项。将相应单元格合并或拉长&#xff0c;确保…

vue 搜索框

效果 创建搜索组件&#xff1a; 在Vue项目中&#xff0c;首先需要创建一个搜索组件。这个组件通常包含一个输入框和一个搜索按钮。使用v-model指令将输入框与组件的数据属性&#xff08;如searchKeyword&#xff09;进行双向绑定&#xff0c;以便获取用户输入的关键词。处理搜索…

【前端】JavaScript入门及实战66-70

文章目录 66 原型(1)67 原型(2)68 toString69 垃圾回收70 数组 66 原型(1) <!DOCTYPE html> <html> <head> <title></title> <meta charset "utf-8"> <script type"text/javascript">/*原型prototype我们所创…

Linux网络:传输层协议TCP(二)三次挥手四次握手详解

目录 一、TCP的连接管理机制 1.1三次握手 1.2四次挥手 二、理解 TIME_WAIT 状态 2.1解决TIME_WAIT 状态引起的 bind 失败的方法 三、理解CLOSE_WAIT状态 一、TCP的连接管理机制 在正常情况下, TCP 要经过三次握手建立连接, 四次挥手断开连接 1.1三次握手 三次握手顾名思…

Docker从零开始:安装、部署到卸载,一文搞定全流程

Docker是一种开源容器化平台&#xff0c;它允许开发者将应用程序及其依赖打包成轻量级、可移植的容器。这些容器能确保软件在任何环境中稳定运行&#xff0c;无论是开发者的笔记本电脑还是生产服务器。Docker流行的原因在于其提供的隔离性、可移植性和可扩展性&#xff0c;它简…

2024年展望:人工智能领域将呈现怎样的发展趋势?

2024年&#xff0c;人工智能&#xff08;AI&#xff09;领域将继续保持强劲的发展势头&#xff0c;并呈现出多个重要的发展趋势。以下是对该领域未来发展趋势的详细展望&#xff1a; 一、技术创新与融合 多模态生成式AI的崛起&#xff1a; 多模态生成式AI系统能够处理文本、声…

C# 将字符串数组以树型结构化

例如字符串数组&#xff1a; string[] arr { "1","3-4-5-6-7", "2","3-4","3-4-5","3-4-5-6", "3", "6", "4", "6-1", "6-2", "5", "6-1-1&…

李艳波医生怎么挂号?

对于想要预约李艳波医生的患者来说&#xff0c;北京仁爱堂提供了两种便捷的预约方式&#xff1a;来院面诊和视频会诊。来院面诊是传统的就诊方式&#xff0c;患者可以直接前往仁爱堂&#xff0c;与李艳波医生面对面交流&#xff0c;详细了解自己的病情并接受专业的治疗建议。这…

LangChain自定义Embedding封装 之 ERNIE Bot

LangChain自定义Embedding封装 之 ERNIE Bot 百度飞浆平台的 ERNIE Bot 导入下面方法 和 环境 &#xff0c;即可验证 embedding ERNIE_Bot_embedding() class ERNIE_Bot_embedding(BaseModel, Embeddings):client: Anyroot_validator()def validate_environment(cls, value…

解决Github Copilot无效,无法使用的问题

如果是在Copilot的终端报错 Invalid copilot token: missing token: 403 原因有三种 1&#xff0c;你的账号没有订阅正版的服务&#xff0c;解决办法是购买正版服务 2&#xff0c;你在购买服务的时候&#xff0c;Github上 billing information 地址信息和支付卡片的地址信息不…

Amazon Bedrock基础指南:参考资料、模型特点、价格、使用方法及运行时API执行示例

这次我整理了2023年9月28日正式发布的Amazon Bedrock的基本信息和Runtime API的执行示例。此外&#xff0c;还在文中插入了最基本的术语解释&#xff0c;以帮助理解令牌和参数的概念。 ※本文及其他由本文作者发表的文章中所包含的源代码均为自主研究活动的一部分。如需使用&am…

关卡1-3:Git

关卡1-3&#xff1a;Git Git基础fork并拉取本次课程的源创建一个gitee自己的仓库 这个是internLM的3期训练营的通关笔记。 任务&#xff1a; 熟悉git熟悉使用git托管平台&#xff0c;常见有github、giteefork官方的训练营的教程项目&#xff0c;提交文件到自己的项目&#xf…

项目部署到服务器

(相关资源都给出来了) 1 下载MobaXterm,然后打开 正常连接输入你的服务器IP&#xff0c;用户名可以起名为root 2 将JDK,Tomcat,mysql安装包 布置到服务器中&#xff08;JDK官网地址&#xff1a;https://www.oracle.com/java/technologies/downloads/#java8 mysql官网地址: …

openGauss触发器详解

openGauss 是一款开源关系型数据库管理系统&#xff0c;广泛应用于企业级应用中。随着数据量的增长和业务逻辑的复杂化&#xff0c;数据库管理和操作的自动化需求越来越高。触发器&#xff08;Triggers&#xff09;作为数据库中重要的编程工具&#xff0c;能够极大地简化复杂操…

【python】OpenCV—Point Polygon Test

文章目录 1、完整代码2、涉及到的库cv2.pointPolygonTestcv2.minMaxLoc 1、完整代码 from __future__ import print_function from __future__ import division import cv2 as cv import numpy as np # Create an image r 100 src np.zeros((4*r, 4*r), dtypenp.uint8) # 创…