Browse Source

lottie动画;声音光圈;

czq 2 years ago
parent
commit
4af3bf39b1

+ 5 - 0
.idea/jarRepositories.xml

@@ -31,5 +31,10 @@
       <option name="name" value="maven" />
       <option name="url" value="https://jitpack.io" />
     </remote-repository>
+    <remote-repository>
+      <option name="id" value="maven2" />
+      <option name="name" value="maven2" />
+      <option name="url" value="https://repo1.maven.org/maven2/" />
+    </remote-repository>
   </component>
 </project>

+ 3 - 0
.idea/misc.xml

@@ -3,6 +3,7 @@
   <component name="DesignSurface">
     <option name="filePathToZoomLevelMap">
       <map>
+        <entry key="..\:/Progect/gitee/EffectDemo/app/src/main/res/layout/activity_congratulations.xml" value="0.1" />
         <entry key="..\:/Progect/gitee/EffectDemo/app/src/main/res/layout/activity_count_down.xml" value="0.25" />
         <entry key="..\:/Progect/gitee/EffectDemo/app/src/main/res/layout/activity_drag_select.xml" value="0.12708333333333333" />
         <entry key="..\:/Progect/gitee/EffectDemo/app/src/main/res/layout/activity_enty_anim.xml" value="0.11979166666666667" />
@@ -10,7 +11,9 @@
         <entry key="..\:/Progect/gitee/EffectDemo/app/src/main/res/layout/activity_main.xml" value="0.1375" />
         <entry key="..\:/Progect/gitee/EffectDemo/app/src/main/res/layout/activity_progress.xml" value="0.22" />
         <entry key="..\:/Progect/gitee/EffectDemo/app/src/main/res/layout/activity_quxian.xml" value="0.13645833333333332" />
+        <entry key="..\:/Progect/gitee/EffectDemo/app/src/main/res/layout/activity_sound.xml" value="0.1234375" />
         <entry key="..\:/Progect/gitee/EffectDemo/app/src/main/res/layout/activity_spine.xml" value="0.13333333333333333" />
+        <entry key="..\:/Progect/gitee/EffectDemo/app/src/main/res/layout/activity_stars.xml" value="0.1" />
         <entry key="..\:/Progect/gitee/EffectDemo/app/src/main/res/layout/activity_test.xml" value="0.18" />
         <entry key="..\:/Progect/gitee/EffectDemo/app/src/main/res/layout/activity_test2.xml" value="0.17" />
         <entry key="..\:/Progect/gitee/EffectDemo/app/src/main/res/layout/activity_view.xml" value="0.25" />

+ 21 - 0
app/build.gradle

@@ -66,6 +66,27 @@ dependencies {
     implementation 'com.github.huburt-Hu:NewbieGuide:v2.4.0'
     implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
     implementation 'com.airbnb.android:lottie:5.2.0'
+    implementation 'com.github.JadeKkang:like_view:v1.0'
 //    implementation project(':libgdx_spine')
 
+//    implementation  'com.umeng.umsdk:common:9.4.7'// 必选
+//    implementation  'com.umeng.umsdk:asms:1.4.0'// 必选
+//
+//    implementation  'com.umeng.umsdk:uverify:2.5.1'// 必选
+//    implementation  'com.umeng.umsdk:uverify-main:2.0.3'// 必选
+//    implementation  'com.umeng.umsdk:uverify-logger:2.0.3'// 必选
+//    implementation  'com.umeng.umsdk:uverify-crashshield:2.0.3'// 必选
+//
+//
+//    implementation 'com.umeng.umsdk:utdid:1.5.2.1'
+//
+//    api 'com.umeng.umsdk:push:6.3.3'
+//    implementation 'com.umeng.umsdk:alicloud-httpdns:1.3.2.3'
+//    implementation 'com.umeng.umsdk:alicloud-utils:2.0.0'
+//    implementation 'com.umeng.umsdk:alicloud_beacon:1.0.5'
+//    api 'com.umeng.umsdk:agoo-accs:3.4.2.7'
+//    implementation 'com.umeng.umsdk:agoo_aranger:1.0.6'
+//    implementation 'com.umeng.umsdk:agoo_networksdk:3.5.8'
+//    implementation 'com.umeng.umsdk:agoo_tnet4android:3.1.14.10'
+
 }

+ 7 - 5
app/src/main/AndroidManifest.xml

@@ -4,6 +4,8 @@
     package="com.xunao.effectdemo">
 
     <uses-sdk tools:overrideLibrary="com.qmuiteam.qmui" />
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
 
     <application
         android:allowBackup="true"
@@ -12,11 +14,7 @@
         android:roundIcon="@mipmap/ic_launcher_round"
         android:supportsRtl="true"
         android:theme="@style/AppTheme">
-        <activity
-            android:name=".CountDownActivity"
-            android:exported="false"
-            android:label="@string/title_activity_count_down"
-            android:theme="@style/AppTheme.NoActionBar" />
+
         <activity android:name=".activity.MainActivity">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -48,6 +46,10 @@
             android:name=".activity.CountDownActivity"
             android:screenOrientation="landscape" />
         <activity android:name=".activity.LottieActivity"/>
+        <activity android:name=".activity.CongratulationsActivity"/>
+        <activity android:name=".activity.SoundActivity"/>
+        <activity android:name=".activity.StarsActivity"/>
+
     </application>
 
 </manifest>

File diff suppressed because it is too large
+ 0 - 0
app/src/main/assets/lottie_1.json


File diff suppressed because it is too large
+ 0 - 0
app/src/main/assets/lottie_2.json


File diff suppressed because it is too large
+ 0 - 0
app/src/main/assets/lottie_3.json


File diff suppressed because it is too large
+ 0 - 0
app/src/main/assets/lottie_4.json


File diff suppressed because it is too large
+ 0 - 0
app/src/main/assets/lottie_5.json


File diff suppressed because it is too large
+ 0 - 0
app/src/main/assets/love.json


File diff suppressed because it is too large
+ 0 - 0
app/src/main/assets/stars.json


+ 29 - 0
app/src/main/java/com/xunao/effectdemo/App.java

@@ -14,5 +14,34 @@ public class App extends Application {
 	@Override
 	public void onCreate() {
 		super.onCreate();
+		initUmengSDK();
+	}
+
+	/**
+	 * 初始化友盟SDK
+	 */
+	private void initUmengSDK() {
+		//日志开关
+//		UMConfigure.setLogEnabled(true);
+		//预初始化
+//		PushHelper.preInit(this);
+//		//是否同意隐私政策
+//		boolean agreed = true;
+//		if (!agreed) {
+//			return;
+//		}
+//		boolean isMainProcess = UMUtils.isMainProgress(this);
+//		if (isMainProcess) {
+//			//启动优化:建议在子线程中执行初始化
+//			new Thread(new Runnable() {
+//				@Override
+//				public void run() {
+//					PushHelper.init(getApplicationContext());
+//				}
+//			}).start();
+//		} else {
+//			//若不是主进程(":channel"结尾的进程),直接初始化sdk,不可在子线程中执行
+//			PushHelper.init(getApplicationContext());
+//		}
 	}
 }

+ 25 - 0
app/src/main/java/com/xunao/effectdemo/activity/CongratulationsActivity.kt

@@ -0,0 +1,25 @@
+package com.xunao.effectdemo.activity
+
+import android.app.Activity
+import android.os.Bundle
+import com.xunao.effectdemo.R
+import kotlinx.android.synthetic.main.activity_congratulations.*
+import kotlinx.android.synthetic.main.activity_lottie.*
+
+/**
+ * author : 程中强
+ * e-mail : 740479946@qq.com
+ * date : 2022/8/2214:51
+ * desc :
+ * version: 1.0
+ */
+class CongratulationsActivity : Activity() {
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        setContentView(R.layout.activity_congratulations)
+        btn_start.setOnClickListener{v->
+            lottie_view.playAnimation()
+        }
+    }
+}

+ 16 - 1
app/src/main/java/com/xunao/effectdemo/activity/MainActivity.java

@@ -18,7 +18,7 @@ import com.xunao.effectdemo.R;
  */
 public class MainActivity extends Activity {
 
-	Button btn1,btn2,btn3,btn4,btn5,btn6,btn7,btn8,btn9,btn10;
+	Button btn1,btn2,btn3,btn4,btn5,btn6,btn7,btn8,btn9,btn10,btn11,btn12,btn13;
 	Intent intent;
 
 	@Override
@@ -82,5 +82,20 @@ public class MainActivity extends Activity {
 			intent = new Intent(MainActivity.this,LottieActivity.class);
 			startActivity(intent);
 		});
+		btn11 = findViewById(R.id.btn_11);
+		btn11.setOnClickListener(v->{
+			intent = new Intent(MainActivity.this,CongratulationsActivity.class);
+			startActivity(intent);
+		});
+		btn12 = findViewById(R.id.btn_12);
+		btn12.setOnClickListener(v->{
+			intent = new Intent(MainActivity.this,SoundActivity.class);
+			startActivity(intent);
+		});
+		btn13 = findViewById(R.id.btn_13);
+		btn13.setOnClickListener(v->{
+			intent = new Intent(MainActivity.this,StarsActivity.class);
+			startActivity(intent);
+		});
 	}
 }

+ 188 - 0
app/src/main/java/com/xunao/effectdemo/activity/SoundActivity.java

@@ -0,0 +1,188 @@
+package com.xunao.effectdemo.activity;
+
+
+import android.animation.Animator;
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.util.Log;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.animation.Animation;
+import android.view.animation.ScaleAnimation;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.Nullable;
+
+import com.airbnb.lottie.LottieAnimationView;
+import com.xuexiang.xui.widget.imageview.RadiusImageView;
+import com.xunao.effectdemo.R;
+import com.xunao.effectdemo.bean.World;
+import com.xunao.effectdemo.utils.FileUtil;
+import com.xunao.effectdemo.utils.MediaRecorderDemo;
+
+import java.io.File;
+
+/**
+ * author : 程中强
+ * e-mail : 740479946@qq.com
+ * date : 2022/8/2310:44
+ * desc :
+ * version: 1.0
+ */
+public class SoundActivity extends Activity {
+
+	float volume = 10000;
+	private MediaRecorderDemo mRecorder;
+	private static final int msgWhat = 0x1001;
+	private static final int refreshTime = 100;
+	private TextView tv;
+	private RadiusImageView imv1;
+	ScaleAnimation scaleAnim;
+	private RelativeLayout rl;
+
+	private Handler handler = new Handler() {
+		@Override
+		public void handleMessage(Message msg) {
+			super.handleMessage(msg);
+			if (this.hasMessages(msgWhat)) {
+				return;
+			}
+			volume = mRecorder.getMaxAmplitude();  //获取声压值
+			if(volume > 0 && volume < 1000000) {
+				World.setDbCount(20 * (float)(Math.log10(volume)));  //将声压值转为分贝值
+
+				scaleAnim = new ScaleAnimation(World.getStart(), World.getToAnim(), World.getStart(), World.getToAnim(), Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
+				scaleAnim.setDuration(0);
+				scaleAnim.setFillAfter(true);
+				imv1.startAnimation(scaleAnim);
+
+			}
+			handler.sendEmptyMessageDelayed(msgWhat, refreshTime);
+		}
+	};
+
+
+	@SuppressLint("ClickableViewAccessibility")
+	@Override
+	protected void onCreate(@Nullable Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		setContentView(R.layout.activity_sound);
+		tv = findViewById(R.id.tv_sound);
+		imv1 = findViewById(R.id.imv_1);
+
+		mRecorder = new MediaRecorderDemo();
+
+		tv.setOnClickListener(v->{
+			File file = FileUtil.createFile("temp.amr");
+			if (file != null) {
+				Log.v("file", "file =" + file.getAbsolutePath());
+				startRecord(file);
+			} else {
+				Toast.makeText(getApplicationContext(), "创建文件失败", Toast.LENGTH_LONG).show();
+			}
+		});
+		imv1.setOnClickListener(v->{
+
+		});
+		rl = findViewById(R.id.rl_main);
+		rl.setOnClickListener(v->{
+		});
+		rl.setOnTouchListener((view,event)->{
+			switch (event.getAction()) {
+				case MotionEvent.ACTION_DOWN:
+
+					LottieAnimationView lottieAnimationView = new LottieAnimationView(SoundActivity.this); // 新建一个button
+					lottieAnimationView.setAnimation("love.json");
+					lottieAnimationView.loop(false);
+
+					lottieAnimationView.addAnimatorListener(new Animator.AnimatorListener() {
+						@Override
+						public void onAnimationStart(Animator animator) {
+
+						}
+
+						@Override
+						public void onAnimationEnd(Animator animator) {
+							rl.removeView(lottieAnimationView);
+						}
+
+						@Override
+						public void onAnimationCancel(Animator animator) {
+
+						}
+
+						@Override
+						public void onAnimationRepeat(Animator animator) {
+
+						}
+					});
+					RelativeLayout.LayoutParams msl1 = new RelativeLayout.LayoutParams(
+							200, 200);
+					msl1.leftMargin = (int) event.getX()-100;
+					msl1.topMargin = (int) event.getY()-100;
+					lottieAnimationView.setLayoutParams(msl1);
+					rl.addView(lottieAnimationView);
+					lottieAnimationView.playAnimation();
+					Log.e("MyTag","点击事件2");
+					break;
+				case MotionEvent.ACTION_UP:
+
+					break;
+			}
+			return false;
+		});
+
+	}
+
+	private void startListenAudio() {
+		handler.sendEmptyMessageDelayed(msgWhat, refreshTime);
+	}
+
+	/**
+	 * 开始记录
+	 * @param fFile
+	 */
+	public void startRecord(File fFile){
+		try{
+			mRecorder.setMyRecAudioFile(fFile);
+			if (mRecorder.startRecorder()) {
+				startListenAudio();
+			}else{
+				Toast.makeText(this, "启动录音失败", Toast.LENGTH_SHORT).show();
+			}
+		}catch(Exception e){
+			Toast.makeText(this, "录音机已被占用或录音权限被禁止", Toast.LENGTH_SHORT).show();
+			e.printStackTrace();
+		}
+	}
+
+
+	@Override
+	protected void onResume() {
+		super.onResume();
+//		soundDiscView = (SoundDiscView) findViewById(R.id.soundDiscView);
+
+	}
+
+	/**
+	 * 停止记录
+	 */
+	@Override
+	protected void onPause() {
+		super.onPause();
+		mRecorder.delete(); //停止记录并删除录音文件
+		handler.removeMessages(msgWhat);
+	}
+
+	@Override
+	protected void onDestroy() {
+		handler.removeMessages(msgWhat);
+		mRecorder.delete();
+		super.onDestroy();
+	}
+}

+ 29 - 0
app/src/main/java/com/xunao/effectdemo/activity/StarsActivity.java

@@ -0,0 +1,29 @@
+package com.xunao.effectdemo.activity;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+import androidx.annotation.Nullable;
+
+import com.airbnb.lottie.LottieAnimationView;
+import com.xunao.effectdemo.R;
+
+/**
+ * author : 程中强
+ * e-mail : 740479946@qq.com
+ * date : 2022/8/2317:47
+ * desc :
+ * version: 1.0
+ */
+public class StarsActivity extends Activity {
+
+	LottieAnimationView animationView;
+	@Override
+	protected void onCreate(@Nullable Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		setContentView(R.layout.activity_stars);
+		animationView = findViewById(R.id.lottie_view);
+		animationView.setRepeatCount(0);
+		animationView.setOnClickListener(v->animationView.playAnimation());
+	}
+}

+ 8 - 8
app/src/main/java/com/xunao/effectdemo/activity/TestActivity.java

@@ -154,14 +154,14 @@ public class TestActivity extends Activity {
 		@Override
 		public boolean onTouch(View view, MotionEvent motionEvent) {
 			//定义一个裁剪数据对象.随便定义一个就行,本demo用不到这个clipData.
-			ClipData clipData = new ClipData(ClipData.newPlainText("view1", "aaa"));
-
-			//定义一个拖拽阴影
-			View.DragShadowBuilder myShadow = new View.DragShadowBuilder(view);
-
-			//开始拖拽. 第三个参数在拖拽过程用来传递数据,这里我传view即被拖动的view自己,
-			//后面可在DragEvent中获得这个参数view
-			view.startDrag(clipData, myShadow, view, 0);
+//			ClipData clipData = new ClipData(ClipData.newPlainText("view1", "aaa"));
+//
+//			//定义一个拖拽阴影
+//			View.DragShadowBuilder myShadow = new View.DragShadowBuilder(view);
+//
+//			//开始拖拽. 第三个参数在拖拽过程用来传递数据,这里我传view即被拖动的view自己,
+//			//后面可在DragEvent中获得这个参数view
+//			view.startDrag(clipData, myShadow, view, 0);
 
 			return false;
 		}

+ 35 - 0
app/src/main/java/com/xunao/effectdemo/bean/World.java

@@ -0,0 +1,35 @@
+package com.xunao.effectdemo.bean;
+
+
+
+public class World {
+
+	public static float dbCount = 40;
+
+	private static float lastDbCount = dbCount;
+
+	public static float getLastDbCount() {
+		return lastDbCount;
+	}
+
+	private static float min = 0.5f;  //设置声音最低变化
+	private static float value = 0;   // 声音分贝值
+	public static void setDbCount(float dbValue) {
+		if (dbValue > lastDbCount) {
+			value = dbValue - lastDbCount > min ? dbValue - lastDbCount : min;
+		}else{
+			value = dbValue - lastDbCount < -min ? dbValue - lastDbCount : -min;
+		}
+		dbCount = lastDbCount + value * 0.5f ; //防止声音变化太快
+		lastDbCount = dbCount;
+	}
+
+	public static float getStart(){
+		return 0.8f+lastDbCount/150;
+	}
+
+	public static float getToAnim(){
+		return 0.8f+dbCount/150;
+	}
+	
+}

+ 73 - 0
app/src/main/java/com/xunao/effectdemo/utils/FileUtil.java

@@ -0,0 +1,73 @@
+package com.xunao.effectdemo.utils;
+
+import android.os.Environment;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Created by su on 2016/6/4.
+ */
+public class FileUtil {
+
+    private static final String TAG = "FileUtil";
+
+    public static final String LOCAL = "SoundMeter";
+
+    public static final String LOCAL_PATH = Environment.getExternalStorageDirectory().getPath() + File.separator;
+
+    /**
+     * 录音文件目录
+     */
+    public static final String REC_PATH = LOCAL_PATH + LOCAL + File.separator;
+
+
+
+    /**
+     * 自动在SD卡创建相关的目录
+     */
+    static {
+        File dirRootFile = new File(LOCAL_PATH);
+        if (!dirRootFile.exists()) {
+            dirRootFile.mkdirs();
+        }
+        File recFile = new File(REC_PATH);
+        if (!recFile.exists()) {
+            recFile.mkdirs();
+        }
+    }
+
+    private FileUtil() {
+    }
+
+    /**
+     * 判断是否存在存储空间	 *
+     *
+     * @return
+     */
+    public static boolean isExitSDCard() {
+        return Environment.getExternalStorageState().equals(
+                Environment.MEDIA_MOUNTED);
+    }
+
+    private static boolean hasFile(String fileName) {
+        File f = createFile(fileName);
+        return null != f && f.exists();
+    }
+
+    public static File createFile(String fileName) {
+
+        File myCaptureFile = new File(REC_PATH + fileName);
+        if (myCaptureFile.exists()) {
+            myCaptureFile.delete();
+        }
+        try {
+            myCaptureFile.createNewFile();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return myCaptureFile;
+    }
+
+
+}

+ 108 - 0
app/src/main/java/com/xunao/effectdemo/utils/MediaRecorderDemo.java

@@ -0,0 +1,108 @@
+package com.xunao.effectdemo.utils;
+
+import android.media.MediaRecorder;
+import android.os.Handler;
+import android.util.Log;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * author : 程中强
+ * e-mail : 740479946@qq.com
+ * date : 2022/8/2217:48
+ * desc :
+ * version: 1.0
+ */
+public class MediaRecorderDemo {
+
+	private final String TAG = "MediaRecord";
+	public  File myRecAudioFile ;
+	private MediaRecorder mMediaRecorder ;
+	public boolean isRecording = false ;
+
+	public float getMaxAmplitude() {
+		if (mMediaRecorder != null) {
+			try {
+				return mMediaRecorder.getMaxAmplitude();
+			} catch (IllegalArgumentException e) {
+				e.printStackTrace();
+				return 0;
+			}
+		} else {
+			return 5;
+		}
+	}
+
+	public File getMyRecAudioFile() {
+		return myRecAudioFile;
+	}
+
+	public void setMyRecAudioFile(File myRecAudioFile) {
+		this.myRecAudioFile = myRecAudioFile;
+	}
+
+	/**
+	 * 录音
+	 * @return 是否成功开始录音
+	 */
+	public boolean startRecorder(){
+		if (myRecAudioFile == null) {
+			return false;
+		}
+		try {
+			mMediaRecorder = new MediaRecorder();
+
+			mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
+			mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
+			mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
+			mMediaRecorder.setOutputFile(myRecAudioFile.getAbsolutePath());
+
+			mMediaRecorder.prepare();
+			mMediaRecorder.start();
+			isRecording = true;
+			return true;
+		} catch(IOException exception) {
+			mMediaRecorder.reset();
+			mMediaRecorder.release();
+			mMediaRecorder = null;
+			isRecording = false ;
+			exception.printStackTrace();
+		}catch(IllegalStateException e){
+			stopRecording();
+			e.printStackTrace();
+			isRecording = false ;
+		}
+		return false;
+	}
+
+
+
+
+	public void stopRecording() {
+		if (mMediaRecorder != null){
+			if(isRecording){
+				try{
+					mMediaRecorder.stop();
+					mMediaRecorder.release();
+				}catch(Exception e){
+					e.printStackTrace();
+				}
+			}
+			mMediaRecorder = null;
+			isRecording = false ;
+		}
+	}
+
+
+
+
+	public void delete() {
+		stopRecording();
+		if (myRecAudioFile != null) {
+			myRecAudioFile.delete();
+			myRecAudioFile = null;
+		}
+	}
+
+}

+ 88 - 0
app/src/main/res/layout/activity_congratulations.xml

@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:orientation="vertical"
+    android:layout_height="match_parent">
+
+   <LinearLayout
+       android:layout_width="match_parent"
+       android:layout_height="match_parent"
+       android:orientation="vertical">
+       <RelativeLayout
+           android:layout_gravity="center"
+           android:layout_width="wrap_content"
+           android:layout_height="wrap_content">
+           <com.airbnb.lottie.LottieAnimationView
+               android:layout_width="200dp"
+               android:layout_height="200dp"
+               android:id="@+id/lottie_view"
+               app:lottie_autoPlay="false"
+               app:lottie_fileName="lottie_1.json"
+               app:lottie_loop="false"
+               tools:ignore="MissingClass" />
+           <Button
+               android:id="@+id/btn_start"
+               android:text="点击"
+               android:layout_centerInParent="true"
+               android:background="@color/xui_config_color_red"
+               android:layout_width="50dp"
+               android:layout_height="50dp"/>
+       </RelativeLayout>
+       <com.airbnb.lottie.LottieAnimationView
+           android:layout_width="200dp"
+           android:layout_height="200dp"
+           android:layout_gravity="center"
+           app:lottie_autoPlay="true"
+           app:lottie_fileName="lottie_2.json"
+           app:lottie_loop="false"
+           tools:ignore="MissingClass" />
+       <com.airbnb.lottie.LottieAnimationView
+           android:layout_width="200dp"
+           android:layout_height="200dp"
+           android:layout_gravity="center"
+           app:lottie_autoPlay="true"
+           app:lottie_fileName="lottie_1.json"
+           app:lottie_loop="true"
+           tools:ignore="MissingClass" />
+       <com.airbnb.lottie.LottieAnimationView
+           android:layout_width="200dp"
+           android:layout_height="200dp"
+           android:layout_gravity="center"
+           app:lottie_autoPlay="true"
+           app:lottie_fileName="lottie_3.json"
+           app:lottie_loop="false"
+           tools:ignore="MissingClass" />
+       <com.airbnb.lottie.LottieAnimationView
+           android:layout_width="200dp"
+           android:layout_height="200dp"
+           android:layout_gravity="center"
+           app:lottie_autoPlay="true"
+           app:lottie_fileName="lottie_4.json"
+           app:lottie_loop="false"
+           tools:ignore="MissingClass" />
+
+       <RelativeLayout
+           android:layout_gravity="center"
+           android:layout_width="wrap_content"
+           android:layout_height="wrap_content">
+           <com.airbnb.lottie.LottieAnimationView
+                android:visibility="gone"
+               android:layout_width="200dp"
+               android:layout_height="200dp"
+               app:lottie_autoPlay="true"
+               app:lottie_fileName="lottie_5.json"
+               app:lottie_loop="false"
+               tools:ignore="MissingClass" />
+
+           <com.example.library.LikeView
+               android:id="@+id/like"
+               android:layout_width="wrap_content"
+               android:layout_height="wrap_content"
+               app:circleColor="@color/colorAccent"
+               app:bitmap="@mipmap/icon_anim"/>
+       </RelativeLayout>
+   </LinearLayout>
+
+</ScrollView>

+ 5 - 5
app/src/main/res/layout/activity_drag_select.xml

@@ -14,13 +14,13 @@
 
     <com.xuexiang.xui.widget.imageview.RadiusImageView
         android:id="@+id/imv_1"
-        android:src="#FFF"
-        android:alpha="0.3"
+        android:layout_width="250dp"
+        android:layout_height="250dp"
         android:layout_centerVertical="true"
         android:layout_marginLeft="-50dp"
-        app:riv_corner_radius="400dp"
-        android:layout_width="250dp"
-        android:layout_height="250dp"/>
+        android:alpha="0.3"
+        android:src="#FFF"
+        app:riv_corner_radius="400dp" />
 
 
     <com.xuexiang.xui.widget.imageview.RadiusImageView

+ 74 - 51
app/src/main/res/layout/activity_main.xml

@@ -1,67 +1,90 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
+<ScrollView
     xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:orientation="vertical">
 
-    <Button
-        android:id="@+id/btn_1"
-        android:text="交换"
+    <LinearLayout
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"/>
+        android:layout_height="match_parent"
+        android:orientation="vertical">
+        <Button
+            android:id="@+id/btn_1"
+            android:text="交换"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
 
-    <Button
-        android:id="@+id/btn_2"
-        android:text="引导"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"/>
+        <Button
+            android:id="@+id/btn_2"
+            android:text="引导"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
 
-    <Button
-        android:id="@+id/btn_3"
-        android:text="点击"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"/>
+        <Button
+            android:id="@+id/btn_3"
+            android:text="点击"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
 
-    <Button
-        android:id="@+id/btn_4"
-        android:text="接龙"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"/>
+        <Button
+            android:id="@+id/btn_4"
+            android:text="接龙"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
 
-    <Button
-        android:id="@+id/btn_5"
-        android:text="曲线进场动画"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"/>
+        <Button
+            android:id="@+id/btn_5"
+            android:text="曲线进场动画"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
 
-    <Button
-        android:id="@+id/btn_6"
-        android:text="进度条"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"/>
+        <Button
+            android:id="@+id/btn_6"
+            android:text="进度条"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
 
-    <Button
-        android:id="@+id/btn_7"
-        android:text="点击选择"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"/>
+        <Button
+            android:id="@+id/btn_7"
+            android:text="点击选择"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
 
-    <Button
-        android:id="@+id/btn_8"
-        android:text="拖动选择"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"/>
+        <Button
+            android:id="@+id/btn_8"
+            android:text="拖动选择"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
 
-    <Button
-        android:id="@+id/btn_9"
-        android:text="倒计时"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"/>
+        <Button
+            android:id="@+id/btn_9"
+            android:text="倒计时"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
 
-    <Button
-        android:id="@+id/btn_10"
-        android:text="lottie"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"/>
+        <Button
+            android:id="@+id/btn_10"
+            android:text="lottie"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
+
+        <Button
+            android:id="@+id/btn_11"
+            android:text="庆祝"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
+
+        <Button
+            android:id="@+id/btn_12"
+            android:text="声音"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
+
+        <Button
+            android:id="@+id/btn_13"
+            android:text="星星"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
+    </LinearLayout>
 
-</LinearLayout>
+</ScrollView>

+ 42 - 0
app/src/main/res/layout/activity_sound.xml

@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@color/colorAccent"
+    android:id="@+id/rl_main"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+
+
+
+    <com.xuexiang.xui.widget.imageview.RadiusImageView
+        android:id="@+id/imv_1"
+        android:layout_width="250dp"
+        android:layout_height="250dp"
+        android:layout_centerInParent="true"
+        android:layout_marginLeft="-50dp"
+        android:alpha="0.3"
+        android:src="#FFF"
+        app:riv_corner_radius="400dp" />
+
+    <com.xuexiang.xui.widget.imageview.RadiusImageView
+        android:id="@+id/imv_2"
+        android:layout_width="200dp"
+        android:layout_height="200dp"
+        android:layout_centerInParent="true"
+        android:src="#FFF"
+        app:riv_corner_radius="400dp" />
+
+    <TextView
+        android:id="@+id/tv_sound"
+        android:text="开始"
+        android:layout_width="200dp"
+        android:gravity="center"
+        android:textColor="@color/colorWhite"
+        android:layout_height="wrap_content"
+        android:layout_centerHorizontal="true"
+        android:layout_alignParentBottom="true"
+        android:layout_marginBottom="100dp"
+        android:textStyle="bold"
+        android:textSize="30sp"/>
+
+</RelativeLayout>

+ 15 - 0
app/src/main/res/layout/activity_stars.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+
+    <com.airbnb.lottie.LottieAnimationView
+        android:id="@+id/lottie_view"
+        app:lottie_fileName="stars.json"
+        app:lottie_autoPlay="false"
+        app:lottie_loop="false"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"/>
+
+</RelativeLayout>

+ 3 - 1
build.gradle

@@ -5,10 +5,11 @@ buildscript {
         google()
         mavenCentral()
         jcenter()
+        maven { url 'https://repo1.maven.org/maven2/' }
     }
     dependencies {
         classpath "com.android.tools.build:gradle:4.0.0"
-        classpath 'com.android.tools.build:gradle:3.6.1'
+//        classpath 'com.android.tools.build:gradle:3.6.1'
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
         // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files
@@ -23,6 +24,7 @@ allprojects {
         maven {
             url "https://jitpack.io"
         }
+        maven { url 'https://repo1.maven.org/maven2/' }
     }
 }
 

Some files were not shown because too many files changed in this diff