mirror of
https://gitee.com/51danju/workclock.git
synced 2025-06-13 22:26:55 +08:00
增加了很多背景动画,增加了前,后颜色设置
This commit is contained in:
parent
d219dc2800
commit
bf308d4ede
@ -9,7 +9,7 @@ An Android clock
|
||||
|
||||
### 普通状态
|
||||
|
||||
左滑:设置
|
||||
左滑:改变背景动画
|
||||
右滑:改变字本
|
||||
上滑:增加亮度
|
||||
下滑:减小亮度
|
||||
@ -22,9 +22,14 @@ An Android clock
|
||||
|
||||
下面说明条 单击->随机名言
|
||||
|
||||
###定时提醒状态
|
||||
时间 长按-->显示列多功能
|
||||
|
||||
### 定时提醒状态
|
||||
倒计时 单击->停止闹铃,返回普通状态
|
||||
|
||||
### 更多功能
|
||||
会出现颜色选择,及设置按键
|
||||
|
||||
------
|
||||
|
||||
其它在设置页设置
|
||||
|
@ -40,4 +40,6 @@ dependencies {
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
|
||||
implementation 'com.blankj:utilcode:1.23.4'
|
||||
|
||||
implementation 'com.larswerkman:HoloColorPicker:1.5'
|
||||
}
|
||||
|
@ -1,15 +1,10 @@
|
||||
package clock.socoolby.com.clock;
|
||||
|
||||
import android.Manifest;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.hardware.Sensor;
|
||||
import android.hardware.SensorEvent;
|
||||
import android.hardware.SensorEventListener;
|
||||
import android.hardware.SensorManager;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
@ -24,6 +19,7 @@ import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
@ -37,6 +33,7 @@ import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import clock.socoolby.com.clock.pop.CalendarPopup;
|
||||
import clock.socoolby.com.clock.pop.ColorPickerPop;
|
||||
import clock.socoolby.com.clock.pop.WeatherPopup;
|
||||
import clock.socoolby.com.clock.protocol.WeatherResponse;
|
||||
import clock.socoolby.com.clock.model.DateModel;
|
||||
@ -46,6 +43,18 @@ import clock.socoolby.com.clock.utils.Player;
|
||||
import clock.socoolby.com.clock.utils.ScreenManager;
|
||||
import clock.socoolby.com.clock.model.SharePerferenceModel;
|
||||
import clock.socoolby.com.clock.pop.TimeSetupPopup;
|
||||
import clock.socoolby.com.clock.widget.animatorview.AnimatorView;
|
||||
import clock.socoolby.com.clock.widget.animatorview.I_Animator;
|
||||
import clock.socoolby.com.clock.widget.animatorview.animator.BubbleAnimator;
|
||||
import clock.socoolby.com.clock.widget.animatorview.animator.BubbleCollisionAnimator;
|
||||
import clock.socoolby.com.clock.widget.animatorview.animator.BubbleWhirlPoolAnimator;
|
||||
import clock.socoolby.com.clock.widget.animatorview.animator.DotsLineAnimator;
|
||||
import clock.socoolby.com.clock.widget.animatorview.animator.FireworkAnimator;
|
||||
import clock.socoolby.com.clock.widget.animatorview.animator.FluorescenceAnimator;
|
||||
import clock.socoolby.com.clock.widget.animatorview.animator.RainAnimator;
|
||||
import clock.socoolby.com.clock.widget.animatorview.animator.SkyAnimator;
|
||||
import clock.socoolby.com.clock.widget.animatorview.animator.SnowAnimator;
|
||||
import clock.socoolby.com.clock.widget.animatorview.animator.StarFallAnimator;
|
||||
import clock.socoolby.com.clock.widget.textview.AutoScrollTextView;
|
||||
|
||||
|
||||
@ -56,7 +65,7 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
public final static int MODE_NORMAL = 200;
|
||||
public final static int MODE_SETTING_OTHER = 202;
|
||||
public final static int MODE_HANDUP=203;
|
||||
|
||||
clock.socoolby.com.clock.widget.animatorview.AnimatorView view;
|
||||
|
||||
public final static String[] FONT_NAME_ARRAY={
|
||||
"cherif",
|
||||
@ -121,6 +130,20 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
private Handler handler;
|
||||
private final static int UPDATE_TIME = 100;
|
||||
|
||||
//背景动画
|
||||
private AnimatorView animatorView;
|
||||
|
||||
private I_Animator backGroundAnimator;
|
||||
|
||||
private int currectAnimatorIndex=0;
|
||||
|
||||
//颜色相关
|
||||
private ImageButton tv_background_color;
|
||||
private ImageButton tv_foreground_color;
|
||||
private ImageButton tv_foreground_color1;
|
||||
|
||||
ColorPickerPop colorPickerDialog;
|
||||
|
||||
// 定义手势检测器实例
|
||||
GestureDetector detector;
|
||||
|
||||
@ -144,6 +167,11 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
private boolean screenLock=false;
|
||||
private ImageButton tv_screen_lock;
|
||||
|
||||
private Integer backgroundColor;
|
||||
private Integer foregroundColor;
|
||||
private FrameLayout mainBackground;
|
||||
|
||||
|
||||
|
||||
public void setWeather(WeatherResponse weather) {
|
||||
if (weather == null)
|
||||
@ -161,6 +189,10 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
super.onCreate(savedInstanceState);
|
||||
//Log.d(TAG,"onCreate...");
|
||||
setContentView(R.layout.activity_main);
|
||||
mainBackground=findViewById(R.id.main_background);
|
||||
|
||||
animatorView=findViewById(R.id.tv_background_animatorview);
|
||||
|
||||
tv_time = findViewById(R.id.tv_time);
|
||||
tv_date = findViewById(R.id.tv_date);
|
||||
tv_day = findViewById(R.id.tv_day);
|
||||
@ -179,6 +211,62 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
}
|
||||
});
|
||||
|
||||
tv_background_color=findViewById(R.id.tv_background_color);
|
||||
tv_background_color.setOnClickListener(this);
|
||||
|
||||
tv_foreground_color=findViewById(R.id.tv_foreground_color);
|
||||
tv_foreground_color.setOnClickListener(this);
|
||||
tv_foreground_color.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
if (colorPickerDialog == null)
|
||||
colorPickerDialog = new ColorPickerPop(MainActivity.this);
|
||||
|
||||
colorPickerDialog.setOnColorChangeListenter(new ColorPickerPop.OnColorListener() {
|
||||
@Override
|
||||
public void onEnsure(int color) {
|
||||
model.setForegroundColor(color);
|
||||
model.save();
|
||||
setForegroundColor(color);
|
||||
tv_foreground_color.setColorFilter(color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBack() {
|
||||
}
|
||||
});
|
||||
colorPickerDialog.show(model.getForegroundColor());
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
tv_foreground_color1=findViewById(R.id.tv_foreground_color1);
|
||||
tv_foreground_color1.setOnClickListener(this);
|
||||
tv_foreground_color1.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
if (colorPickerDialog == null)
|
||||
colorPickerDialog = new ColorPickerPop(MainActivity.this);
|
||||
|
||||
colorPickerDialog.setOnColorChangeListenter(new ColorPickerPop.OnColorListener() {
|
||||
@Override
|
||||
public void onEnsure(int color) {
|
||||
model.setForegroundColor1(color);
|
||||
model.save();
|
||||
setForegroundColor(color);
|
||||
tv_foreground_color1.setColorFilter(color);
|
||||
animatorView.setColor(color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBack() {
|
||||
}
|
||||
});
|
||||
colorPickerDialog.show(model.getForegroundColor1());
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
tv_handup_image=findViewById(R.id.tv_handup_image);
|
||||
tv_handup_image.setOnClickListener(this);
|
||||
|
||||
@ -273,6 +361,15 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
handUpAbla=model.isHandUpAble();
|
||||
upHandStatic();
|
||||
resetHandUpTime();
|
||||
resetColorFromModel();
|
||||
}
|
||||
|
||||
private void resetColorFromModel(){
|
||||
setBackGroundColor(model.getBackgroundColor());
|
||||
setForegroundColor(model.getForegroundColor());
|
||||
tv_foreground_color.setColorFilter(model.getForegroundColor());
|
||||
tv_foreground_color1.setColorFilter(model.getForegroundColor1());
|
||||
animatorView.setColor(model.getForegroundColor1());
|
||||
}
|
||||
|
||||
//将该Activity上的触碰事件交给GestureDetector处理
|
||||
@ -299,6 +396,9 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(backGroundAnimator!=null)
|
||||
backGroundAnimator.stop();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -310,6 +410,8 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
|
||||
if(!isPowerManagerDisable())
|
||||
wakeLock.acquire();
|
||||
if(backGroundAnimator!=null)
|
||||
backGroundAnimator.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -318,6 +420,8 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
//Log.d(TAG,"onPause..");
|
||||
if(!isPowerManagerDisable())
|
||||
wakeLock.release();
|
||||
if(backGroundAnimator!=null)
|
||||
backGroundAnimator.stop();
|
||||
}
|
||||
|
||||
protected void setFont(int index){
|
||||
@ -327,6 +431,31 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
FontUtils.getInstance().replaceFontFromAsset(tv_date,"fonts/"+FONT_NAME_ARRAY[index]+".ttf");
|
||||
}
|
||||
|
||||
protected void setForegroundColor(Integer color){
|
||||
if(foregroundColor!=null&&foregroundColor==color)
|
||||
return;
|
||||
foregroundColor=color;
|
||||
tv_time.setTextColor(color);
|
||||
tv_date.setTextColor(color);
|
||||
tv_day.setTextColor(color);
|
||||
tv_weather .setTextColor(color);
|
||||
tv_descript.setTextColor(color);
|
||||
tv_handup_image.setTextColor(color);
|
||||
|
||||
tv_handup.setColorFilter(color);
|
||||
tv_screen_lock.setColorFilter(color);
|
||||
tv_setting.setColorFilter(color);
|
||||
tv_background_color.setColorFilter(color);
|
||||
}
|
||||
|
||||
protected void setBackGroundColor(Integer color){
|
||||
if(backgroundColor!=null&&backgroundColor==color)
|
||||
return;
|
||||
backgroundColor=color;
|
||||
//tv_background_color.setColorFilter(color);
|
||||
mainBackground.setBackgroundColor(color);
|
||||
}
|
||||
|
||||
CalendarPopup calendarPopup;
|
||||
WeatherPopup weatherPopup;
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
@ -372,6 +501,30 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
case R.id.tv_descript:
|
||||
setDiscript(SettingActivity.roundAutoQuotes());
|
||||
break;
|
||||
case R.id.tv_background_color:
|
||||
if (colorPickerDialog == null)
|
||||
colorPickerDialog = new ColorPickerPop(MainActivity.this);
|
||||
|
||||
colorPickerDialog.setOnColorChangeListenter(new ColorPickerPop.OnColorListener() {
|
||||
@Override
|
||||
public void onEnsure(int color) {
|
||||
model.setBackgroundColor(color);
|
||||
model.save();
|
||||
setBackGroundColor(color);
|
||||
//tv_background_color.setColorFilter(color);
|
||||
}
|
||||
@Override
|
||||
public void onBack() {
|
||||
}
|
||||
});
|
||||
colorPickerDialog.show(model.getBackgroundColor());
|
||||
break;
|
||||
case R.id.tv_foreground_color:
|
||||
setForegroundColor(model.getForegroundColor());
|
||||
break;
|
||||
case R.id.tv_foreground_color1:
|
||||
setForegroundColor(model.getForegroundColor1());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -383,20 +536,220 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
tv_time.setVisibility(View.VISIBLE);
|
||||
tv_handup_image.setVisibility(View.GONE);
|
||||
tv_setting.setVisibility(View.GONE);
|
||||
tv_background_color.setVisibility(View.GONE);
|
||||
tv_foreground_color.setVisibility(View.GONE);
|
||||
tv_foreground_color1.setVisibility(View.GONE);
|
||||
break;
|
||||
case MODE_SETTING_OTHER:
|
||||
tv_time.setVisibility(View.VISIBLE);
|
||||
tv_handup_image.setVisibility(View.GONE);
|
||||
tv_setting.setVisibility(View.VISIBLE);
|
||||
tv_background_color.setVisibility(View.VISIBLE);
|
||||
tv_foreground_color.setVisibility(View.VISIBLE);
|
||||
tv_foreground_color1.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case MODE_HANDUP:
|
||||
tv_handup_image.setVisibility(View.VISIBLE);
|
||||
tv_time.setVisibility(View.GONE);
|
||||
tv_handup_image.setVisibility(View.VISIBLE);
|
||||
tv_setting.setVisibility(View.GONE);
|
||||
tv_background_color.setVisibility(View.GONE);
|
||||
tv_foreground_color.setVisibility(View.GONE);
|
||||
tv_foreground_color1.setVisibility(View.GONE);
|
||||
setDiscriptForModel();
|
||||
}
|
||||
mMode = mode;
|
||||
}
|
||||
|
||||
StarFallAnimator starAnimator;
|
||||
SkyAnimator skyAnimator;
|
||||
RainAnimator rainAnimator;
|
||||
SnowAnimator snowAnimator;
|
||||
BubbleWhirlPoolAnimator bubbleWhirlPoolAnimator;
|
||||
BubbleAnimator bubbleAnimator;
|
||||
FluorescenceAnimator fluorescenceAnimator;
|
||||
BubbleCollisionAnimator bubbleCollisionAnimator;
|
||||
FireworkAnimator fireworkAnimator;
|
||||
DotsLineAnimator dotsLineAnimator;
|
||||
public void changeBackGroundAnimator(int index){
|
||||
switch(index){
|
||||
case 0:
|
||||
if(starAnimator==null) {
|
||||
starAnimator = new StarFallAnimator();
|
||||
starAnimator.init(animatorView.getContext(),animatorView);
|
||||
starAnimator.setColor(foregroundColor);
|
||||
}
|
||||
backGroundAnimator=starAnimator;
|
||||
backGroundAnimator.setRandColor(false);
|
||||
break;
|
||||
case 2:
|
||||
if(skyAnimator==null) {
|
||||
skyAnimator = new SkyAnimator();
|
||||
skyAnimator.init(animatorView.getContext(),animatorView);
|
||||
skyAnimator.setColor(foregroundColor);
|
||||
}
|
||||
backGroundAnimator=skyAnimator;
|
||||
backGroundAnimator.setRandColor(false);
|
||||
break;
|
||||
case 3:
|
||||
if(rainAnimator==null) {
|
||||
rainAnimator = new RainAnimator();
|
||||
rainAnimator.init(animatorView.getContext(),animatorView);
|
||||
rainAnimator.setColor(foregroundColor);
|
||||
}
|
||||
backGroundAnimator=rainAnimator;
|
||||
backGroundAnimator.setRandColor(false);
|
||||
break;
|
||||
case 4:
|
||||
if(snowAnimator==null) {
|
||||
snowAnimator = new SnowAnimator();
|
||||
snowAnimator.init(animatorView.getContext(),animatorView);
|
||||
snowAnimator.setColor(foregroundColor);
|
||||
}
|
||||
backGroundAnimator=snowAnimator;
|
||||
backGroundAnimator.setRandColor(false);
|
||||
break;
|
||||
case 5:
|
||||
if(starAnimator==null) {
|
||||
starAnimator = new StarFallAnimator();
|
||||
starAnimator.init(animatorView.getContext(),animatorView);
|
||||
starAnimator.setColor(foregroundColor);
|
||||
}
|
||||
backGroundAnimator=starAnimator;
|
||||
backGroundAnimator.setRandColor(true);
|
||||
break;
|
||||
case 6:
|
||||
if(skyAnimator==null) {
|
||||
skyAnimator = new SkyAnimator();
|
||||
skyAnimator.init(animatorView.getContext(),animatorView);
|
||||
skyAnimator.setColor(foregroundColor);
|
||||
}
|
||||
backGroundAnimator=skyAnimator;
|
||||
backGroundAnimator.setRandColor(true);
|
||||
break;
|
||||
case 7:
|
||||
if(rainAnimator==null) {
|
||||
rainAnimator = new RainAnimator();
|
||||
rainAnimator.init(animatorView.getContext(),animatorView);
|
||||
rainAnimator.setColor(foregroundColor);
|
||||
}
|
||||
backGroundAnimator=rainAnimator;
|
||||
backGroundAnimator.setRandColor(true);
|
||||
break;
|
||||
case 8:
|
||||
if(snowAnimator==null) {
|
||||
snowAnimator = new SnowAnimator();
|
||||
snowAnimator.init(animatorView.getContext(),animatorView);
|
||||
snowAnimator.setColor(foregroundColor);
|
||||
}
|
||||
backGroundAnimator=snowAnimator;
|
||||
backGroundAnimator.setRandColor(true);
|
||||
break;
|
||||
case 9:
|
||||
if(bubbleWhirlPoolAnimator ==null) {
|
||||
bubbleWhirlPoolAnimator = new BubbleWhirlPoolAnimator();
|
||||
bubbleWhirlPoolAnimator.init(animatorView.getContext(),animatorView);
|
||||
bubbleWhirlPoolAnimator.setColor(foregroundColor);
|
||||
}
|
||||
backGroundAnimator= bubbleWhirlPoolAnimator;
|
||||
backGroundAnimator.setRandColor(false);
|
||||
break;
|
||||
case 10:
|
||||
if(bubbleAnimator ==null) {
|
||||
bubbleAnimator = new BubbleAnimator();
|
||||
bubbleAnimator.init(animatorView.getContext(),animatorView);
|
||||
bubbleAnimator.setColor(foregroundColor);
|
||||
}
|
||||
backGroundAnimator= bubbleAnimator;
|
||||
backGroundAnimator.setRandColor(false);
|
||||
break;
|
||||
case 11:
|
||||
if(bubbleAnimator ==null) {
|
||||
bubbleAnimator = new BubbleAnimator();
|
||||
bubbleAnimator.init(animatorView.getContext(),animatorView);
|
||||
bubbleAnimator.setColor(foregroundColor);
|
||||
}
|
||||
backGroundAnimator= bubbleAnimator;
|
||||
backGroundAnimator.setRandColor(true);
|
||||
break;
|
||||
case 12:
|
||||
if(bubbleWhirlPoolAnimator ==null) {
|
||||
bubbleWhirlPoolAnimator = new BubbleWhirlPoolAnimator();
|
||||
bubbleWhirlPoolAnimator.init(animatorView.getContext(),animatorView);
|
||||
bubbleWhirlPoolAnimator.setColor(foregroundColor);
|
||||
}
|
||||
backGroundAnimator= bubbleWhirlPoolAnimator;
|
||||
backGroundAnimator.setRandColor(true);
|
||||
break;
|
||||
case 13:
|
||||
if(fluorescenceAnimator ==null) {
|
||||
fluorescenceAnimator = new FluorescenceAnimator();
|
||||
fluorescenceAnimator.init(animatorView.getContext(),animatorView);
|
||||
fluorescenceAnimator.setColor(foregroundColor);
|
||||
}
|
||||
backGroundAnimator= fluorescenceAnimator;
|
||||
//backGroundAnimator.setRandColor(true);
|
||||
break;
|
||||
case 14:
|
||||
if(bubbleCollisionAnimator ==null) {
|
||||
bubbleCollisionAnimator = new BubbleCollisionAnimator();
|
||||
bubbleCollisionAnimator.init(animatorView.getContext(),animatorView);
|
||||
bubbleCollisionAnimator.setColor(foregroundColor);
|
||||
}
|
||||
backGroundAnimator= bubbleCollisionAnimator;
|
||||
backGroundAnimator.setRandColor(false);
|
||||
break;
|
||||
case 15:
|
||||
if(bubbleCollisionAnimator ==null) {
|
||||
bubbleCollisionAnimator = new BubbleCollisionAnimator();
|
||||
bubbleCollisionAnimator.init(animatorView.getContext(),animatorView);
|
||||
bubbleCollisionAnimator.setColor(foregroundColor);
|
||||
}
|
||||
backGroundAnimator= bubbleCollisionAnimator;
|
||||
backGroundAnimator.setRandColor(true);
|
||||
break;
|
||||
case 16:
|
||||
if(fireworkAnimator ==null) {
|
||||
fireworkAnimator = new FireworkAnimator();
|
||||
fireworkAnimator.init(animatorView.getContext(),animatorView);
|
||||
fireworkAnimator.setColor(foregroundColor);
|
||||
}
|
||||
backGroundAnimator= fireworkAnimator;
|
||||
backGroundAnimator.setRandColor(true);
|
||||
break;
|
||||
case 17:
|
||||
if(fireworkAnimator ==null) {
|
||||
fireworkAnimator = new FireworkAnimator();
|
||||
fireworkAnimator.init(animatorView.getContext(),animatorView);
|
||||
fireworkAnimator.setColor(foregroundColor);
|
||||
}
|
||||
backGroundAnimator= fireworkAnimator;
|
||||
backGroundAnimator.setRandColor(false);
|
||||
break;
|
||||
case 18:
|
||||
if(dotsLineAnimator ==null) {
|
||||
dotsLineAnimator = new DotsLineAnimator();
|
||||
dotsLineAnimator.init(animatorView.getContext(),animatorView);
|
||||
dotsLineAnimator.setColor(foregroundColor);
|
||||
}
|
||||
backGroundAnimator= dotsLineAnimator;
|
||||
backGroundAnimator.setRandColor(false);
|
||||
break;
|
||||
case 1:
|
||||
if(dotsLineAnimator ==null) {
|
||||
dotsLineAnimator = new DotsLineAnimator();
|
||||
dotsLineAnimator.init(animatorView.getContext(),animatorView);
|
||||
dotsLineAnimator.setColor(foregroundColor);
|
||||
}
|
||||
backGroundAnimator= dotsLineAnimator;
|
||||
backGroundAnimator.setRandColor(true);
|
||||
break;
|
||||
default:
|
||||
currectAnimatorIndex=0;
|
||||
backGroundAnimator=null;
|
||||
}
|
||||
animatorView.setAnimator(backGroundAnimator);
|
||||
}
|
||||
|
||||
private void upHandStatic(){
|
||||
if(handUpAbla) {
|
||||
this.tv_handup.setColorFilter(0x000);
|
||||
@ -601,7 +954,6 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
private void saveData(){
|
||||
model.setFontIndex(fontIndex);
|
||||
model.setHandUpAble(handUpAbla);
|
||||
Log.d(TAG,"saveData :"+model);
|
||||
model.save();
|
||||
}
|
||||
|
||||
@ -633,7 +985,10 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
return;
|
||||
if(!isPowerManagerDisable())
|
||||
localWakeLock.isHeld();
|
||||
switchMode(MODE_SETTING_OTHER);
|
||||
if(mMode==MODE_SETTING_OTHER)
|
||||
switchMode(MODE_NORMAL);
|
||||
else
|
||||
switchMode(MODE_SETTING_OTHER);
|
||||
}
|
||||
|
||||
|
||||
@ -674,7 +1029,7 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
this.setFont(fontIndex);
|
||||
return true;
|
||||
} else if (e2.getX() - e1.getX() < -120) { // 从右向左滑动(右进左出)
|
||||
setup();
|
||||
changeBackGroundAnimator(currectAnimatorIndex++);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -714,4 +1069,7 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
String result = numberFormat.format((float) num1 / (float) num2 * 100);
|
||||
return result+"%";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
16
app/src/main/java/clock/socoolby/com/clock/cache/I_TrashCache.java
vendored
Normal file
16
app/src/main/java/clock/socoolby/com/clock/cache/I_TrashCache.java
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
package clock.socoolby.com.clock.cache;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface I_TrashCache<Q>{
|
||||
|
||||
void moveToTrashCache(List<Q> objs);
|
||||
|
||||
void moveToTrashCache(Q obj);
|
||||
|
||||
Q revectForTrashCache();
|
||||
|
||||
int getTrashCacheSize();
|
||||
|
||||
void clear();
|
||||
}
|
41
app/src/main/java/clock/socoolby/com/clock/cache/MemoryTrashCache.java
vendored
Normal file
41
app/src/main/java/clock/socoolby/com/clock/cache/MemoryTrashCache.java
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
package clock.socoolby.com.clock.cache;
|
||||
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
|
||||
public class MemoryTrashCache<Q> implements I_TrashCache<Q> {
|
||||
|
||||
protected Queue<Q> trashCache;
|
||||
|
||||
public MemoryTrashCache() {
|
||||
trashCache = new LinkedList<>();
|
||||
}
|
||||
|
||||
public void moveToTrashCache(List<Q> objs){
|
||||
for(Q obj:objs)
|
||||
trashCache.offer(obj);
|
||||
}
|
||||
|
||||
public void moveToTrashCache(Q obj){
|
||||
trashCache.offer(obj);
|
||||
}
|
||||
|
||||
public Q revectForTrashCache(){
|
||||
//Log.d("CacheDifferenceAnimator","revectForTrashCache,current size:"+trashCache.size());
|
||||
if(trashCache.size()>0)
|
||||
return trashCache.poll();
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getTrashCacheSize(){
|
||||
return trashCache.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
trashCache.clear();
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
package clock.socoolby.com.clock.model;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.util.Log;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@ -52,6 +55,15 @@ public class SharePerferenceModel implements Serializable {
|
||||
private final static String KEY_IS_HANDUP_ABLE="key_is_handup_able";
|
||||
private boolean handUpAble = false;
|
||||
|
||||
private final static String KEY_BACKGROUND_COLOR="key_background_color";
|
||||
private Integer backgroundColor=Color.rgb(0, 0, 0);
|
||||
|
||||
private final static String KEY_FOREGROUND_COLOR="key_foreground_color";
|
||||
private Integer foregroundColor=Color.rgb(255, 255, 255);
|
||||
|
||||
private final static String KEY_FOREGROUND_COLOR1="key_foreground_color1";
|
||||
private Integer foregroundColor1=Color.rgb(199,21,133);
|
||||
|
||||
public int getTypeHourPower() {
|
||||
return typeHourPower;
|
||||
}
|
||||
@ -176,12 +188,14 @@ public class SharePerferenceModel implements Serializable {
|
||||
weatherLocation = new JSONObject(jsonObject.getString(KEY_DISPLAYVIEW_WEATHER));
|
||||
descriptionLocation = new JSONObject(jsonObject.getString(KEY_DISPLAYVIEW_DESCRIPTION));
|
||||
fontIndex = jsonObject.optInt(KEY_FONT_INDEX,0);
|
||||
this.handUpAble=jsonObject.optBoolean(KEY_IS_HANDUP_ABLE,false);
|
||||
this.handUpTime=jsonObject.optInt(KEY_HANDUP_TIME,-1);
|
||||
handUpAble=jsonObject.optBoolean(KEY_IS_HANDUP_ABLE,false);
|
||||
handUpTime=jsonObject.optInt(KEY_HANDUP_TIME,-1);
|
||||
backgroundColor=jsonObject.optInt(KEY_BACKGROUND_COLOR,Color.rgb(0, 0, 0));
|
||||
foregroundColor=jsonObject.optInt(KEY_FOREGROUND_COLOR,Color.rgb(255, 255, 255));
|
||||
foregroundColor1=jsonObject.optInt(KEY_FOREGROUND_COLOR1,Color.rgb(199,21,133));
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String toJsonString() {
|
||||
@ -204,6 +218,9 @@ public class SharePerferenceModel implements Serializable {
|
||||
jsonObject.put(KEY_FONT_INDEX, fontIndex);
|
||||
jsonObject.put(KEY_HANDUP_TIME,handUpTime);
|
||||
jsonObject.put(KEY_IS_HANDUP_ABLE,handUpAble);
|
||||
jsonObject.put(KEY_BACKGROUND_COLOR,backgroundColor);
|
||||
jsonObject.put(KEY_FOREGROUND_COLOR,foregroundColor);
|
||||
jsonObject.put(KEY_FOREGROUND_COLOR1,foregroundColor1);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -212,11 +229,13 @@ public class SharePerferenceModel implements Serializable {
|
||||
}
|
||||
|
||||
public void save() {
|
||||
Log.d("model","saveData :"+toString());
|
||||
FileUtils.writeObject(Constants.SHARE_PERFERENCE_FILE, toJsonString());
|
||||
}
|
||||
|
||||
public void read() {
|
||||
fromJsonString((String) FileUtils.readObject(Constants.SHARE_PERFERENCE_FILE));
|
||||
Log.d("model","readData :"+toString());
|
||||
}
|
||||
|
||||
|
||||
@ -238,6 +257,9 @@ public class SharePerferenceModel implements Serializable {
|
||||
", fontIndex="+fontIndex+
|
||||
", handUpAble="+handUpAble+
|
||||
", handUpTime="+handUpTime+
|
||||
", backgroundColor="+backgroundColor+
|
||||
", foregroundColor="+foregroundColor+
|
||||
", foregroundColor1="+foregroundColor1+
|
||||
'}';
|
||||
}
|
||||
|
||||
@ -264,4 +286,29 @@ public class SharePerferenceModel implements Serializable {
|
||||
public void setHandUpAble(boolean handUpAble) {
|
||||
this.handUpAble = handUpAble;
|
||||
}
|
||||
|
||||
|
||||
public Integer getBackgroundColor() {
|
||||
return backgroundColor;
|
||||
}
|
||||
|
||||
public void setBackgroundColor(Integer backgroundColor) {
|
||||
this.backgroundColor = backgroundColor;
|
||||
}
|
||||
|
||||
public Integer getForegroundColor() {
|
||||
return foregroundColor;
|
||||
}
|
||||
|
||||
public void setForegroundColor(Integer foregroundColor) {
|
||||
this.foregroundColor = foregroundColor;
|
||||
}
|
||||
|
||||
public Integer getForegroundColor1() {
|
||||
return foregroundColor1;
|
||||
}
|
||||
|
||||
public void setForegroundColor1(Integer foregroundColor1) {
|
||||
this.foregroundColor1 = foregroundColor1;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,121 @@
|
||||
package clock.socoolby.com.clock.pop;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.view.View;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
import com.larswerkman.holocolorpicker.ColorPicker;
|
||||
import com.larswerkman.holocolorpicker.OpacityBar;
|
||||
import com.larswerkman.holocolorpicker.SVBar;
|
||||
import clock.socoolby.com.clock.R;
|
||||
import razerdp.basepopup.BasePopupWindow;
|
||||
|
||||
/**
|
||||
* 颜色选择器
|
||||
* Created by tianzl on 2017/9/1.
|
||||
*/
|
||||
|
||||
public class ColorPickerPop extends BasePopupWindow implements View.OnClickListener {
|
||||
private ImageButton ibBack;
|
||||
private ImageButton ibEnsure;
|
||||
private TextView tvTitle;
|
||||
private ColorPicker colorPicker;
|
||||
private SVBar svBar;
|
||||
private OpacityBar opacityBar;
|
||||
|
||||
private int color;
|
||||
|
||||
public ColorPickerPop(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public View onCreateContentView() {
|
||||
View content=createPopupById(R.layout.pop_color_picker);
|
||||
initView(content);
|
||||
initData();
|
||||
initEvent();
|
||||
return content;
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
colorPicker.addSVBar(svBar);
|
||||
colorPicker.addOpacityBar(opacityBar);
|
||||
tvTitle.setText("颜色选择器");
|
||||
}
|
||||
|
||||
private void initView(View view) {
|
||||
ibBack=view.findViewById(R.id.bar_title_left);
|
||||
ibEnsure=view.findViewById(R.id.bar_title_right);
|
||||
tvTitle=view.findViewById(R.id.bar_title_title);
|
||||
colorPicker=view.findViewById(R.id.dialog_color_picker_colorPicker);
|
||||
svBar=view.findViewById(R.id.dialog_color_picker_svbar);
|
||||
opacityBar=view.findViewById(R.id.dialog_color_picker_opacity);
|
||||
|
||||
view.findViewById(R.id.default_color_sample).setOnClickListener(this);
|
||||
view.findViewById(R.id.default_color_sample1).setOnClickListener(this);
|
||||
view.findViewById(R.id.default_color_sample2).setOnClickListener(this);
|
||||
view.findViewById(R.id.default_color_sample3).setOnClickListener(this);
|
||||
view.findViewById(R.id.default_color_sample4).setOnClickListener(this);
|
||||
view.findViewById(R.id.default_color_sample5).setOnClickListener(this);
|
||||
view.findViewById(R.id.default_color_sample6).setOnClickListener(this);
|
||||
view.findViewById(R.id.default_color_sample7).setOnClickListener(this);
|
||||
view.findViewById(R.id.default_color_sample8).setOnClickListener(this);
|
||||
view.findViewById(R.id.default_color_sample9).setOnClickListener(this);
|
||||
view.findViewById(R.id.default_color_sample10).setOnClickListener(this);
|
||||
view.findViewById(R.id.default_color_sample11).setOnClickListener(this);
|
||||
view.findViewById(R.id.default_color_sample12).setOnClickListener(this);
|
||||
view.findViewById(R.id.default_color_sample13).setOnClickListener(this);
|
||||
view.findViewById(R.id.default_color_sample14).setOnClickListener(this);
|
||||
|
||||
}
|
||||
|
||||
private void initEvent() {
|
||||
colorPicker.setOnColorChangedListener(new ColorPicker.OnColorChangedListener() {
|
||||
@Override
|
||||
public void onColorChanged(int colors) {
|
||||
tvTitle.setTextColor(colors);
|
||||
color=colors;
|
||||
}
|
||||
});
|
||||
ibBack.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
listener.onBack();
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
ibEnsure.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
listener.onEnsure(color);
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void show(int initColor) {
|
||||
colorPicker.setColor(initColor);
|
||||
color=initColor;
|
||||
tvTitle.setTextColor(initColor);
|
||||
this.showPopupWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ColorDrawable colordDrawable = (ColorDrawable) v.getBackground();
|
||||
int colors = colordDrawable.getColor();
|
||||
tvTitle.setTextColor(colors);
|
||||
color=colors;
|
||||
}
|
||||
|
||||
public interface OnColorListener{
|
||||
void onBack();
|
||||
void onEnsure(int color);
|
||||
}
|
||||
|
||||
private OnColorListener listener;
|
||||
public void setOnColorChangeListenter(OnColorListener listener){
|
||||
this.listener=listener;
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package clock.socoolby.com.clock.themeUI;
|
||||
|
||||
public class DefaultThemeUI {
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package clock.socoolby.com.clock.themeUI;
|
||||
|
||||
public interface I_ThemeUI {
|
||||
}
|
@ -0,0 +1,220 @@
|
||||
package clock.socoolby.com.clock.widget.animatorview;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v4.graphics.drawable.DrawableCompat;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class AbstractAnimator<T> implements I_Animator{
|
||||
protected Random rand=new Random();
|
||||
protected boolean isRuning=false;
|
||||
protected int color=200;
|
||||
protected View mainView;
|
||||
protected Context context;
|
||||
|
||||
protected boolean randColor=false;
|
||||
|
||||
//效果场景宽高
|
||||
protected int width;
|
||||
protected int height;
|
||||
|
||||
protected ArrayList<T> list = new ArrayList<>();
|
||||
protected ValueAnimator animator;
|
||||
|
||||
@Override
|
||||
public void init(Context context, final View main) {
|
||||
mainView=main;
|
||||
this.context=context;
|
||||
width=main.getWidth();
|
||||
height=main.getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
if(animator==null) {
|
||||
reset();
|
||||
//初始化animator
|
||||
animator = ValueAnimator.ofFloat(0, 1);
|
||||
animator.setRepeatCount(ValueAnimator.INFINITE);
|
||||
animator.setDuration(500);
|
||||
|
||||
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator arg0) {
|
||||
if(run())
|
||||
mainView.invalidate();
|
||||
}
|
||||
});
|
||||
}
|
||||
if(!animator.isRunning())
|
||||
animator.start();
|
||||
isRuning=true;
|
||||
}
|
||||
|
||||
public abstract boolean run();
|
||||
|
||||
public void setRandColor(boolean randColor){
|
||||
this.randColor=randColor;
|
||||
}
|
||||
|
||||
protected void randomColor(){
|
||||
if(randColor){
|
||||
int alpha = 200;
|
||||
int r = rand.nextInt(255);
|
||||
int g = rand.nextInt(255);
|
||||
int b = rand.nextInt(255);
|
||||
color = alpha << 24 | r << 16 | g << 8 | b;
|
||||
}
|
||||
}
|
||||
|
||||
public void reset(){
|
||||
list.clear();
|
||||
if(randColor)
|
||||
randomColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restart() {
|
||||
pause();
|
||||
reset();
|
||||
start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pause() {
|
||||
if(animator==null)
|
||||
return;
|
||||
//throw new Exception("place start it first..");
|
||||
if(animator.isRunning())
|
||||
animator.cancel();
|
||||
isRuning=false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
if(animator==null)
|
||||
return;
|
||||
if(animator.isRunning())
|
||||
animator.cancel();
|
||||
animator.removeAllUpdateListeners();
|
||||
animator = null;
|
||||
isRuning=false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isRunning() {
|
||||
return isRuning;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColor(int color) {
|
||||
this.color=color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||
width=w;
|
||||
height=h;
|
||||
if(isRuning)
|
||||
restart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isColorUseAble() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRandColor() {
|
||||
return randColor;
|
||||
}
|
||||
|
||||
|
||||
public static class Util {
|
||||
|
||||
public static ContentValues videoContentValues = null;
|
||||
|
||||
|
||||
public static int roundColor(){
|
||||
Random rand=new Random();
|
||||
int alpha = 200;
|
||||
int r = rand.nextInt(255);
|
||||
int g = rand.nextInt(255);
|
||||
int b = rand.nextInt(255);
|
||||
return alpha << 24 | r << 16 | g << 8 | b;
|
||||
}
|
||||
/**
|
||||
* px = dp * (dpi / 160)
|
||||
*
|
||||
* @param ctx
|
||||
* @param dip
|
||||
* @return
|
||||
*/
|
||||
public static int dipToPX(final Context ctx, float dip) {
|
||||
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
|
||||
dip, ctx.getResources().getDisplayMetrics());
|
||||
}
|
||||
|
||||
|
||||
public static int getScreenWidth(Context context) {
|
||||
WindowManager wm = (WindowManager) context
|
||||
.getSystemService(Context.WINDOW_SERVICE);
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
wm.getDefaultDisplay().getMetrics(dm);
|
||||
return wm.getDefaultDisplay().getWidth();
|
||||
}
|
||||
|
||||
public static int getScreenHeight(Context context) {
|
||||
WindowManager wm = (WindowManager) context
|
||||
.getSystemService(Context.WINDOW_SERVICE);
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
wm.getDefaultDisplay().getMetrics(dm);
|
||||
return dm.heightPixels;
|
||||
}
|
||||
|
||||
public static Bitmap drawableToBitmap(Drawable drawable) {
|
||||
|
||||
int w = drawable.getIntrinsicWidth();
|
||||
int h = drawable.getIntrinsicHeight();
|
||||
|
||||
|
||||
Bitmap.Config config = drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888
|
||||
: Bitmap.Config.RGB_565;
|
||||
|
||||
Bitmap bitmap = Bitmap.createBitmap(w, h, config);
|
||||
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
drawable.setBounds(0, 0, w, h);
|
||||
|
||||
drawable.draw(canvas);
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 重绘Drawable,将drawable颜色着色为color
|
||||
* @param drawable
|
||||
* @param color
|
||||
* @return 重绘后的Drawable
|
||||
*/
|
||||
public static Drawable tint(Drawable drawable, int color)
|
||||
{
|
||||
final Drawable wrappedDrawable = DrawableCompat.wrap(drawable);
|
||||
wrappedDrawable.mutate();
|
||||
DrawableCompat.setTint(wrappedDrawable, color);
|
||||
return wrappedDrawable;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package clock.socoolby.com.clock.widget.animatorview;
|
||||
|
||||
import clock.socoolby.com.clock.cache.I_TrashCache;
|
||||
|
||||
public abstract class AbstractCacheAbleAnimator<T> extends AbstractCacheDifferenceAnimator<T,T> {
|
||||
|
||||
public AbstractCacheAbleAnimator() {
|
||||
}
|
||||
|
||||
public AbstractCacheAbleAnimator(I_TrashCache<T> trashCache) {
|
||||
super(trashCache);
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
if (isCacheAble())
|
||||
moveToTrashCache(list);
|
||||
super.reset();
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package clock.socoolby.com.clock.widget.animatorview;
|
||||
|
||||
import java.util.List;
|
||||
import clock.socoolby.com.clock.cache.I_TrashCache;
|
||||
import clock.socoolby.com.clock.cache.MemoryTrashCache;
|
||||
|
||||
public abstract class AbstractCacheDifferenceAnimator<T,Q> extends AbstractAnimator<T>{
|
||||
|
||||
I_TrashCache<Q> trashCache;
|
||||
boolean globalTrashCashe=false;
|
||||
|
||||
public AbstractCacheDifferenceAnimator(){
|
||||
super();
|
||||
trashCache=new MemoryTrashCache();
|
||||
}
|
||||
|
||||
public AbstractCacheDifferenceAnimator(I_TrashCache<Q> trashCache){
|
||||
super();
|
||||
this.trashCache=trashCache;
|
||||
this.globalTrashCashe=true;
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
super.stop();
|
||||
if(trashCache!=null&&!globalTrashCashe)
|
||||
trashCache.clear();
|
||||
}
|
||||
|
||||
public boolean isCacheAble(){
|
||||
return true;
|
||||
}
|
||||
|
||||
public void moveToTrashCache(List<Q> objs) {
|
||||
trashCache.moveToTrashCache(objs);
|
||||
}
|
||||
|
||||
public void moveToTrashCache(Q obj) {
|
||||
trashCache.moveToTrashCache(obj);
|
||||
}
|
||||
|
||||
public Q revectForTrashCache() {
|
||||
return trashCache.revectForTrashCache();
|
||||
}
|
||||
|
||||
public int getTrashCacheSize() {
|
||||
return trashCache.getTrashCacheSize();
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package clock.socoolby.com.clock.widget.animatorview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
public class AnimatorView extends View {
|
||||
|
||||
private Context context;
|
||||
|
||||
private I_Animator animator;
|
||||
private int color=0;
|
||||
|
||||
public AnimatorView(Context context) {
|
||||
super(context);
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public AnimatorView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public AnimatorView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||
super.onSizeChanged(w, h, oldw, oldh);
|
||||
// Reset list of droidflakes, then restart it with 8 flakes
|
||||
if(animator!=null)
|
||||
animator.onSizeChanged(w,h,oldw,oldh);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
if(animator!=null)
|
||||
animator.onDraw(canvas);
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停动画
|
||||
*/
|
||||
public void pause() {
|
||||
if(animator!=null)
|
||||
animator.pause();
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始动画
|
||||
*/
|
||||
public void start() {
|
||||
if(animator!=null)
|
||||
animator.start();
|
||||
}
|
||||
|
||||
public void stop(){
|
||||
if(animator!=null)
|
||||
animator.stop();
|
||||
}
|
||||
|
||||
public boolean isRunning(){
|
||||
if(animator==null){
|
||||
return false;
|
||||
}
|
||||
return animator.isRunning();
|
||||
}
|
||||
|
||||
public void setAnimator(I_Animator newAnimator){
|
||||
if(animator!=null)
|
||||
animator.stop();
|
||||
animator=newAnimator;
|
||||
if(animator!=null) {
|
||||
animator.setColor(color);
|
||||
animator.start();
|
||||
}
|
||||
}
|
||||
|
||||
public void setColor(int color){
|
||||
this.color=color;
|
||||
if(animator!=null&&animator.isColorUseAble()&&!animator.isRandColor()) {
|
||||
animator.setColor(color);
|
||||
animator.restart();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package clock.socoolby.com.clock.widget.animatorview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.view.View;
|
||||
|
||||
public interface I_Animator {
|
||||
|
||||
void init(Context context, View main);
|
||||
|
||||
void onDraw(Canvas canvas);
|
||||
|
||||
void start();
|
||||
|
||||
void pause();
|
||||
|
||||
void stop();
|
||||
|
||||
boolean isRunning();
|
||||
|
||||
void onSizeChanged(int w, int h, int oldw, int oldh);
|
||||
|
||||
void setColor(int color);
|
||||
|
||||
void setRandColor(boolean randColor);
|
||||
|
||||
void restart();
|
||||
|
||||
boolean isColorUseAble();
|
||||
|
||||
boolean isRandColor();
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package clock.socoolby.com.clock.widget.animatorview.animator;
|
||||
|
||||
import clock.socoolby.com.clock.cache.I_TrashCache;
|
||||
import clock.socoolby.com.clock.widget.animatorview.AbstractCacheAbleAnimator;
|
||||
|
||||
public abstract class AbstractParticlesAnimator extends AbstractCacheAbleAnimator<FluorescenceAnimator.Particle> {
|
||||
|
||||
public AbstractParticlesAnimator() {
|
||||
super();
|
||||
}
|
||||
|
||||
public AbstractParticlesAnimator(I_TrashCache<FluorescenceAnimator.Particle> trashCache) {
|
||||
super(trashCache);
|
||||
}
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
package clock.socoolby.com.clock.widget.animatorview.animator;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.RectF;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import clock.socoolby.com.clock.widget.animatorview.AbstractAnimator;
|
||||
|
||||
//引用自:http://www.gcssloop.com/gebug/bubble-sample
|
||||
|
||||
public class BubbleAnimator extends AbstractAnimator<BubbleAnimator.Bubble> {
|
||||
|
||||
private int mBubbleMaxRadius = 30; // 气泡最大半径 px
|
||||
private int mBubbleMinRadius = 5; // 气泡最小半径 px
|
||||
private int mBubbleMaxSize = 30; // 气泡数量
|
||||
private int mBubbleRefreshTime = 20; // 刷新间隔
|
||||
private int mBubbleMaxSpeedY = 5; // 气泡速度
|
||||
private int mBubbleAlpha = 128; // 气泡画笔
|
||||
|
||||
private RectF mContentRectF; // 实际可用内容区域
|
||||
|
||||
private Paint mBubblePaint; // 气泡画笔
|
||||
|
||||
@Override
|
||||
public boolean run() {
|
||||
tryCreateBubble();
|
||||
refreshBubbles();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas) {
|
||||
for (Bubble bubble : list) {
|
||||
if (null == bubble) continue;
|
||||
mBubblePaint.setColor(bubble.color);
|
||||
canvas.drawCircle(bubble.x, bubble.y,
|
||||
bubble.radius, mBubblePaint);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
mBubblePaint = new Paint();
|
||||
mBubblePaint.setColor(Color.WHITE);
|
||||
mBubblePaint.setAlpha(mBubbleAlpha);
|
||||
mContentRectF=new RectF(0,0,width,height);
|
||||
}
|
||||
//--- 气泡效果 ---------------------------------------------------------------------------------
|
||||
|
||||
public class Bubble {
|
||||
int radius; // 气泡半径
|
||||
float speedY; // 上升速度
|
||||
float speedX; // 平移速度
|
||||
float x; // 气泡x坐标
|
||||
float y; // 气泡y坐标
|
||||
int color; // 气泡颜色
|
||||
}
|
||||
|
||||
// 尝试创建气泡
|
||||
private void tryCreateBubble() {
|
||||
if (null == mContentRectF) return;
|
||||
if (list.size() >= mBubbleMaxSize) {
|
||||
return;
|
||||
}
|
||||
if (rand.nextFloat() < 0.95) {
|
||||
return;
|
||||
}
|
||||
Bubble bubble = new Bubble();
|
||||
int radius = rand.nextInt(mBubbleMaxRadius - mBubbleMinRadius);
|
||||
radius += mBubbleMinRadius;
|
||||
float speedY = rand.nextFloat() * mBubbleMaxSpeedY;
|
||||
while (speedY < 1) {
|
||||
speedY = rand.nextFloat() * mBubbleMaxSpeedY;
|
||||
}
|
||||
bubble.radius = radius;
|
||||
bubble.speedY = speedY;
|
||||
switch (rand.nextInt(10)) {
|
||||
case 1:
|
||||
bubble.x = mContentRectF.centerX()/2;
|
||||
break;
|
||||
case 2:
|
||||
bubble.x =mContentRectF.centerX()+mContentRectF.centerX()/2;
|
||||
break;
|
||||
case 3:
|
||||
bubble.x =rand.nextInt(Float.valueOf(mContentRectF.width()).intValue());
|
||||
break;
|
||||
default:
|
||||
bubble.x = mContentRectF.centerX();
|
||||
}
|
||||
bubble.y = mContentRectF.bottom - radius;
|
||||
float speedX = rand.nextFloat() - 0.5f;
|
||||
while (speedX == 0) {
|
||||
speedX = rand.nextFloat() - 0.5f;
|
||||
}
|
||||
bubble.speedX = speedX * 2;
|
||||
if(randColor)
|
||||
randomColor();
|
||||
bubble.color=color;
|
||||
list.add(bubble);
|
||||
}
|
||||
|
||||
// 刷新气泡位置,对于超出区域的气泡进行移除
|
||||
private void refreshBubbles() {
|
||||
List<Bubble> list = new ArrayList<>(this.list);
|
||||
for (Bubble bubble : list) {
|
||||
if (bubble.y - bubble.speedY <= mContentRectF.top + bubble.radius) {
|
||||
this.list.remove(bubble);
|
||||
} else {
|
||||
int i = this.list.indexOf(bubble);
|
||||
if (bubble.x + bubble.speedX <= mContentRectF.left + bubble.radius) {
|
||||
bubble.x = mContentRectF.left + bubble.radius ;
|
||||
} else if (bubble.x + bubble.speedX >= mContentRectF.right - bubble.radius ) {
|
||||
bubble.x = mContentRectF.right - bubble.radius;
|
||||
} else {
|
||||
bubble.x = bubble.x + bubble.speedX;
|
||||
}
|
||||
bubble.y = bubble.y - bubble.speedY;
|
||||
this.list.set(i, bubble);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private float dp2px(float dpValue) {
|
||||
return Util.dipToPX(context,dpValue);
|
||||
}
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
package clock.socoolby.com.clock.widget.animatorview.animator;
|
||||
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
|
||||
import clock.socoolby.com.clock.widget.animatorview.AbstractAnimator;
|
||||
|
||||
//引用自:https://blog.csdn.net/u010386612/article/details/50580080
|
||||
public class BubbleCollisionAnimator extends AbstractAnimator<BubbleCollisionAnimator.Ball> {
|
||||
|
||||
|
||||
private int maxRadius; // 小球最大半径
|
||||
private int minRadius; // 小球最小半径
|
||||
private int minSpeed = 5; // 小球最小移动速度
|
||||
private int maxSpeed = 20; // 小球最大移动速度
|
||||
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
addBall(20);
|
||||
}
|
||||
|
||||
public void addBall(int quantity) {
|
||||
maxRadius = width/12;
|
||||
minRadius = maxRadius/2;
|
||||
for (int i = 0; i < quantity;i++) {
|
||||
Ball mBall=new Ball();
|
||||
// 设置画笔
|
||||
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
if(randColor)
|
||||
randomColor();
|
||||
paint.setColor(color);
|
||||
paint.setStyle(Paint.Style.FILL);
|
||||
paint.setAlpha(180);
|
||||
paint.setStrokeWidth(0);
|
||||
|
||||
// 设置速度
|
||||
float speedX = (rand.nextInt(maxSpeed -minSpeed +1)+5)/10f;
|
||||
float speedY = (rand.nextInt(maxSpeed -minSpeed +1)+5)/10f;
|
||||
mBall.paint = paint;
|
||||
mBall.vx = rand.nextBoolean() ? speedX : -speedX;
|
||||
mBall.vy = rand.nextBoolean() ? speedY : -speedY;
|
||||
mBall.radius = rand.nextInt(maxRadius+1 - minRadius) +minRadius;
|
||||
mBall.cx=mBall.cy=0;
|
||||
if(rand.nextBoolean())
|
||||
mBall.cx=rand.nextInt(width);
|
||||
else
|
||||
mBall.cy=rand.nextInt(height);
|
||||
list.add(mBall);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run() {
|
||||
// 球碰撞边界
|
||||
for (Ball ball:list) {
|
||||
collisionDetectingAndChangeSpeed(ball); // 碰撞边界的计算
|
||||
ball.move(); // 移动
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas) {
|
||||
for (Ball ball:list) {
|
||||
canvas.drawCircle(ball.cx, ball.cy, ball.radius, ball.paint);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 判断球是否碰撞碰撞边界
|
||||
public void collisionDetectingAndChangeSpeed(Ball ball) {
|
||||
int left = 0;
|
||||
int top = 0;
|
||||
int right = width;
|
||||
int bottom = height;
|
||||
|
||||
float speedX = ball.vx;
|
||||
float speedY = ball.vy;
|
||||
|
||||
// 碰撞左右,X的速度取反。 speed的判断是防止重复检测碰撞,然后黏在墙上了=。=
|
||||
if(ball.left() <= left && speedX < 0) {
|
||||
ball.vx = -ball.vx;
|
||||
} else if(ball.top() <= top && speedY < 0) {
|
||||
ball.vy = -ball.vy;
|
||||
} else if(ball.right() >= right && speedX >0) {
|
||||
ball.vx = -ball.vx;
|
||||
} else if(ball.bottom() >= bottom && speedY >0) {
|
||||
ball.vy = -ball.vy;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Ball {
|
||||
int radius; // 半径
|
||||
float cx; // 圆心
|
||||
float cy; // 圆心
|
||||
float vx; // X轴速度
|
||||
float vy; // Y轴速度
|
||||
Paint paint;
|
||||
|
||||
// 移动
|
||||
void move() {
|
||||
//向角度的方向移动,偏移圆心
|
||||
cx += vx;
|
||||
cy += vy;
|
||||
}
|
||||
|
||||
int left() {
|
||||
return (int) (cx - radius);
|
||||
}
|
||||
|
||||
int right() {
|
||||
return (int) (cx +radius);
|
||||
}
|
||||
|
||||
int bottom() {
|
||||
return (int) (cy + radius);
|
||||
}
|
||||
|
||||
int top() {
|
||||
return (int) (cy - radius);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,256 @@
|
||||
package clock.socoolby.com.clock.widget.animatorview.animator;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import clock.socoolby.com.clock.widget.animatorview.AbstractAnimator;
|
||||
|
||||
|
||||
|
||||
//引用自:https://blog.csdn.net/longyc2010/article/details/44137225
|
||||
|
||||
public class BubbleWhirlPoolAnimator extends AbstractAnimator<BubbleWhirlPoolAnimator.Circle> {
|
||||
private static final String TAG = "BubbleWhirlPoolAnimator";
|
||||
private static final int NORTH = 0;
|
||||
private static final int SOUTH = 1;
|
||||
private static final int EAST = 2;
|
||||
private static final int WEST = 3;
|
||||
private static final int NORTH_WEST = 4;
|
||||
private static final int NORTH_EAST = 5;
|
||||
private static final int SOUTH_WEST = 6;
|
||||
private static final int SOUTH_EAST = 7;
|
||||
|
||||
private Paint paint = new Paint();
|
||||
private boolean isChangeRunning = false;
|
||||
private int frequency = 0;
|
||||
|
||||
@Override
|
||||
public boolean run() {
|
||||
if (frequency % 5 == 0) {
|
||||
for (Circle c : list) {
|
||||
isChangeRunning=rand.nextInt(5)!=1;
|
||||
if (isChangeRunning) {
|
||||
c.runBubble();
|
||||
} else {
|
||||
c.increase();
|
||||
}
|
||||
}
|
||||
}
|
||||
frequency++;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
paint.reset();
|
||||
addBubble(10);
|
||||
}
|
||||
|
||||
|
||||
public void addBubble(int quantity) {
|
||||
for (int i = 0; i < quantity;i++) {
|
||||
if(randColor)
|
||||
randomColor();
|
||||
list.add(new Circle(rand.nextInt(width), rand.nextInt(height), rand.nextInt(30) + 20, rand.nextInt(60) + 40,color));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas) {
|
||||
for (Circle c : list) {
|
||||
c.draw(canvas, paint);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class CircleCenterPoint {
|
||||
private float x;
|
||||
private float y;
|
||||
|
||||
public CircleCenterPoint(float x, float y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public float getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(float x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public float getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(float y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public boolean isOutOfView(float r) {
|
||||
boolean isOutView = false;
|
||||
if (x > width - r || x < r || y > height - r || y <= r) {
|
||||
isOutView = true;
|
||||
}
|
||||
|
||||
return isOutView;
|
||||
}
|
||||
|
||||
public boolean isInCenterView(float r, float centerViewR) {
|
||||
boolean isOutView = false;
|
||||
if (x > width / 2 - centerViewR && x < width / 2 + centerViewR
|
||||
&& y > height / 2 - centerViewR && y <= height / 2 + centerViewR) {
|
||||
isOutView = true;
|
||||
}
|
||||
return isOutView;
|
||||
}
|
||||
}
|
||||
|
||||
public class Circle {
|
||||
private CircleCenterPoint center;
|
||||
private float r;
|
||||
private int a;
|
||||
private int aMax;
|
||||
private double distance;
|
||||
private double minDistance;
|
||||
private int type = rand.nextInt(100);
|
||||
private int count = 0;
|
||||
|
||||
private double delta = 0.1f;
|
||||
private double theta = 0;
|
||||
|
||||
private boolean isInitDistance = false;
|
||||
private double delta2 = 0.1f;
|
||||
boolean isShouldDisapear = false;
|
||||
int circleColor=0;
|
||||
|
||||
public Circle(float x, float y, float r, int a,int color) {
|
||||
center = new CircleCenterPoint(x, y);
|
||||
this.r = r;
|
||||
this.a = a;
|
||||
minDistance = rand.nextInt(100);
|
||||
this.circleColor=color;
|
||||
}
|
||||
|
||||
public void runBubble() {
|
||||
if (!isInitDistance) {
|
||||
isInitDistance = true;
|
||||
float x = center.getX() - width / 2;
|
||||
float y = center.getY() - height / 2;
|
||||
|
||||
distance = Math.sqrt((double) (x * x + y * y));
|
||||
|
||||
if (x > 0) {
|
||||
|
||||
theta = Math.atan(y / x);
|
||||
} else {
|
||||
|
||||
theta = Math.atan(y / x) + Math.PI;
|
||||
}
|
||||
|
||||
}
|
||||
theta = theta + 0.1;
|
||||
distance = getDistance(distance);
|
||||
center.setY((float) (distance * Math.sin(theta)) + height / 2);
|
||||
center.setX((float) (distance * Math.cos(theta)) + width / 2);
|
||||
}
|
||||
|
||||
public void increase() {
|
||||
if (isInitDistance) {
|
||||
delta = 0.1f;
|
||||
isInitDistance = false;
|
||||
}
|
||||
changeCenterPoint(center, type);
|
||||
|
||||
if (center.isOutOfView(r) || center.isInCenterView(r, 100f)) {
|
||||
isShouldDisapear = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void draw(Canvas canvas, Paint paint) {
|
||||
count++;
|
||||
if (count % ((type + 8) * 10) == 0) {
|
||||
type = rand.nextInt(100);
|
||||
}
|
||||
if (isShouldDisapear) {
|
||||
a--;
|
||||
if (a <= 0) {
|
||||
isShouldDisapear = false;
|
||||
center.setX(rand.nextInt(width));
|
||||
center.setY(rand.nextInt(height));
|
||||
r = rand.nextInt(30) + 20;
|
||||
aMax = rand.nextInt(60) + 40;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (a <= aMax) {
|
||||
a++;
|
||||
} else {
|
||||
aMax = 0;
|
||||
}
|
||||
}
|
||||
paint.reset();
|
||||
paint.setColor(circleColor);
|
||||
paint.setAlpha(a);
|
||||
canvas.drawCircle(center.getX(), center.getY(), r, paint);
|
||||
}
|
||||
|
||||
private double getDistance(double distance) {
|
||||
|
||||
double result = distance;
|
||||
delta = delta + 0.1;
|
||||
|
||||
result = result - delta * delta;
|
||||
if (result < minDistance) {
|
||||
result = minDistance;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void changeCenterPoint(CircleCenterPoint center, int type) {
|
||||
|
||||
switch (type % 8) {
|
||||
case NORTH:
|
||||
center.setX(center.getX());
|
||||
center.setY(center.getY() - rand.nextInt(4));
|
||||
break;
|
||||
case SOUTH:
|
||||
center.setX(center.getX());
|
||||
center.setY(center.getY() + rand.nextInt(4));
|
||||
break;
|
||||
case EAST:
|
||||
center.setX(center.getX() + rand.nextInt(4));
|
||||
center.setY(center.getY());
|
||||
break;
|
||||
case WEST:
|
||||
center.setX(center.getX() - rand.nextInt(4));
|
||||
center.setY(center.getY());
|
||||
|
||||
break;
|
||||
case NORTH_WEST:
|
||||
center.setX(center.getX() - rand.nextInt(4));
|
||||
center.setY(center.getY() - rand.nextInt(4));
|
||||
break;
|
||||
case NORTH_EAST:
|
||||
center.setX(center.getX() + rand.nextInt(4));
|
||||
center.setY(center.getY() - rand.nextInt(4));
|
||||
break;
|
||||
case SOUTH_WEST:
|
||||
center.setX(center.getX() + rand.nextInt(4));
|
||||
center.setY(center.getY() + rand.nextInt(4));
|
||||
break;
|
||||
case SOUTH_EAST:
|
||||
center.setX(center.getX() - rand.nextInt(4));
|
||||
center.setY(center.getY() + rand.nextInt(4));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,102 @@
|
||||
package clock.socoolby.com.clock.widget.animatorview.animator;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
|
||||
import clock.socoolby.com.clock.widget.animatorview.AbstractAnimator;
|
||||
|
||||
//引用: https://blog.csdn.net/findhappy117/article/details/79491531
|
||||
|
||||
public class DotsLineAnimator extends AbstractAnimator<DotsLineAnimator.Circle> {
|
||||
|
||||
public static final int SLEEP_TIME=7;
|
||||
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
paint.reset();
|
||||
addDots(60);
|
||||
}
|
||||
|
||||
int sleepTime=SLEEP_TIME;
|
||||
@Override
|
||||
public boolean run() {
|
||||
if(sleepTime-->0)
|
||||
return false;
|
||||
for(Circle circle:list){
|
||||
circle.move(width, height);
|
||||
}
|
||||
sleepTime=SLEEP_TIME;
|
||||
return true;
|
||||
}
|
||||
|
||||
Circle circle;
|
||||
Paint paint=new Paint();
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas) {
|
||||
for(int i=0;i<list.size();i++){
|
||||
circle=list.get(i);
|
||||
circle.move(width, height);
|
||||
circle.drawCircle(canvas);
|
||||
for (int j = i + 1; j < list.size(); j++) {
|
||||
circle.drawLine(canvas, list.get(j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addDots(int quantity) {
|
||||
for (int i = 0; i < quantity;i++) {
|
||||
if(randColor)
|
||||
randomColor();
|
||||
list.add(new Circle(rand.nextInt(width), rand.nextInt(height), rand.nextInt(30),rand.nextInt(30) , rand.nextInt(60) ,color));
|
||||
}
|
||||
}
|
||||
|
||||
public class Circle {
|
||||
float x,y;
|
||||
float r;
|
||||
float _mx,_my;
|
||||
int color;
|
||||
//创建对象
|
||||
//以一个圆为对象
|
||||
//设置随机的 x,y坐标,r半径,_mx,_my移动的距离
|
||||
//this.r是创建圆的半径,参数越大半径越大
|
||||
//this._mx,this._my是移动的距离,参数越大移动
|
||||
public Circle(float x,float y,float mx,float my,float r,int color) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.r = rand.nextInt(10) ;
|
||||
this._mx = rand.nextInt(20) ;
|
||||
this._my = rand.nextInt(30) ;
|
||||
this.color=color;
|
||||
}
|
||||
|
||||
//canvas 画圆和画直线
|
||||
//画圆就是正常的用canvas画一个圆
|
||||
//画直线是两个圆连线,为了避免直线过多,给圆圈距离设置了一个值,距离很远的圆圈,就不做连线处理
|
||||
public void drawCircle(Canvas ctx) {
|
||||
paint.setColor(color);
|
||||
ctx.drawCircle(x,y,r,paint);
|
||||
}
|
||||
|
||||
public void drawLine(Canvas ctx, Circle _circle) {
|
||||
paint.setColor(color);
|
||||
float dx = this.x - _circle.x;
|
||||
float dy = this.y - _circle.y;
|
||||
double d = Math.sqrt(dx * dx + dy * dy);
|
||||
if (d < 200) {
|
||||
ctx.drawLine(x,y,_circle.x,_circle.y,paint);
|
||||
}
|
||||
}
|
||||
// 圆圈移动
|
||||
// 圆圈移动的距离必须在屏幕范围内
|
||||
public void move(float w,float h) {
|
||||
this._mx = (this.x < w && this.x > 0) ? this._mx : (-this._mx);
|
||||
this._my = (this.y < h && this.y > 0) ? this._my : (-this._my);
|
||||
this.x += this._mx / 2;
|
||||
this.y += this._my / 2;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,210 @@
|
||||
package clock.socoolby.com.clock.widget.animatorview.animator;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import clock.socoolby.com.clock.widget.animatorview.AbstractAnimator;
|
||||
|
||||
public class DrawableArrayFallAnimator extends AbstractAnimator<DrawableArrayFallAnimator.Star> {
|
||||
|
||||
/**
|
||||
* 小星星数目的最大值
|
||||
*/
|
||||
public static final int MAX_NUM = 100;
|
||||
|
||||
//小星星图片的资源文件
|
||||
int[] picRes ;
|
||||
|
||||
int quantity;
|
||||
|
||||
public DrawableArrayFallAnimator(int[] picRes,int quantity){
|
||||
this.picRes=picRes;
|
||||
this.quantity=quantity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 小星星的数目
|
||||
*/
|
||||
private int starNums = 0;
|
||||
|
||||
long startTime, prevTime;
|
||||
Matrix matrix = new Matrix();
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas) {
|
||||
//Log.d("123","--------onDraw--------");
|
||||
for (int i = 0; i < starNums; ++i) {
|
||||
Star flake = list.get(i);
|
||||
matrix.setTranslate(-flake.width/2, -flake.height/2);
|
||||
matrix.postRotate(flake.rotation);
|
||||
matrix.postTranslate(flake.width/2 + flake.x, flake.height/2 + flake.y);
|
||||
canvas.drawBitmap(flake.bitmap, matrix, null);
|
||||
}
|
||||
}
|
||||
|
||||
public void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||
super.onSizeChanged(w,h,oldw,oldh);
|
||||
// Reset list of droidflakes, then restart it with 8 flakes
|
||||
list.clear();
|
||||
starNums = 0;
|
||||
addStars(quantity);
|
||||
animator.cancel();
|
||||
startTime = System.currentTimeMillis();
|
||||
prevTime = startTime;
|
||||
animator.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
startTime = System.currentTimeMillis();
|
||||
prevTime = startTime;
|
||||
if(animator==null) {
|
||||
reset();
|
||||
super.start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
Star.clearCache();
|
||||
starNums=0;
|
||||
addStars(quantity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run() {
|
||||
//Log.d("123", "--------onAnimationUpdate--------");
|
||||
long nowTime = System.currentTimeMillis();
|
||||
float secs = (nowTime - prevTime) / 1000f;
|
||||
prevTime = nowTime;
|
||||
for (int i = 0; i < starNums; i++) {
|
||||
Star star = list.get(i);
|
||||
star.y += (star.speed * secs);
|
||||
if (star.y > mainView.getHeight()) {
|
||||
star.y = 0 - star.height;
|
||||
}
|
||||
star.rotation = star.rotation + (star.rotationSpeed * secs);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
super.stop();
|
||||
Star.clearCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加小星星
|
||||
* @param quantity
|
||||
*/
|
||||
public void addStars(int quantity) {
|
||||
if(starNums <= MAX_NUM){
|
||||
for (int i = 0; i < quantity;i++) {
|
||||
if(randColor)
|
||||
randomColor();
|
||||
list.add(Star.createStar(mainView.getWidth(),picRes[i%picRes.length],context,color));
|
||||
}
|
||||
starNums += quantity;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Star {
|
||||
|
||||
/**
|
||||
* x坐标、y坐标位置
|
||||
*/
|
||||
float x, y;
|
||||
/**
|
||||
* 小星星旋转的角度
|
||||
*/
|
||||
float rotation;
|
||||
/**
|
||||
* 小星星下落的速度
|
||||
*/
|
||||
float speed;
|
||||
/**
|
||||
* 小星星旋转的速度
|
||||
*/
|
||||
float rotationSpeed;
|
||||
/**
|
||||
* 小星星的宽和高
|
||||
*/
|
||||
int width, height;
|
||||
|
||||
/**
|
||||
* 对应的bitmap
|
||||
*/
|
||||
Bitmap bitmap;
|
||||
|
||||
static HashMap<Integer, Bitmap> bitmapCacheMap = new HashMap<Integer, Bitmap>();
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param xRange 小星星在X方向上的范围
|
||||
* @param resId 资源文件Id
|
||||
* @return
|
||||
*/
|
||||
static Star createStar(float xRange,int resId, Context context) {
|
||||
Star star = new Star();
|
||||
//如果十大图片则需要单独处理
|
||||
Bitmap originalBitmap = BitmapFactory.decodeResource(context.getResources(), resId);
|
||||
star.width = originalBitmap.getWidth();
|
||||
star.height = originalBitmap.getHeight();
|
||||
//初始坐标位置
|
||||
star.x = (float)Math.random() * (xRange - star.width);
|
||||
star.y = 0 - (star.height + (float)Math.random() * Util.getScreenHeight(context));
|
||||
//定义下落的速度
|
||||
star.speed = Util.dipToPX(context,50) + (float) Math.random() * Util.dipToPX(context,50);
|
||||
//旋转角度及旋转速度(根据需要修改)
|
||||
star.rotation = (float) Math.random() * 180 - 90;
|
||||
star.rotationSpeed = (float) Math.random() * 90 - 45;
|
||||
//获得bitmap对象
|
||||
star.bitmap = bitmapCacheMap.get(resId);
|
||||
if (star.bitmap == null) {
|
||||
star.bitmap = Bitmap.createScaledBitmap(originalBitmap,
|
||||
star.width, star.height, true);
|
||||
bitmapCacheMap.put(resId, star.bitmap);
|
||||
}
|
||||
return star;
|
||||
}
|
||||
|
||||
static Star createStar(float xRange,int resId, Context context,int color) {
|
||||
Star star = new Star();
|
||||
//如果十大图片则需要单独处理
|
||||
Drawable imageDraw=context.getResources().getDrawable(resId);
|
||||
imageDraw=Util.tint(imageDraw,color);
|
||||
Bitmap originalBitmap = Util.drawableToBitmap(imageDraw);
|
||||
star.width = originalBitmap.getWidth();
|
||||
star.height = originalBitmap.getHeight();
|
||||
//初始坐标位置
|
||||
star.x = (float)Math.random() * (xRange - star.width);
|
||||
star.y = 0 - (star.height + (float)Math.random() * Util.getScreenHeight(context));
|
||||
//定义下落的速度
|
||||
star.speed = Util.dipToPX(context,50) + (float) Math.random() * Util.dipToPX(context,50);
|
||||
//旋转角度及旋转速度(根据需要修改)
|
||||
star.rotation = (float) Math.random() * 180 - 90;
|
||||
star.rotationSpeed = (float) Math.random() * 90 - 45;
|
||||
//获得bitmap对象
|
||||
star.bitmap = bitmapCacheMap.get(resId);
|
||||
if (star.bitmap == null) {
|
||||
star.bitmap = Bitmap.createScaledBitmap(originalBitmap,
|
||||
star.width, star.height, true);
|
||||
bitmapCacheMap.put(resId, star.bitmap);
|
||||
}
|
||||
return star;
|
||||
}
|
||||
|
||||
public static void clearCache(){
|
||||
bitmapCacheMap.clear();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,374 @@
|
||||
package clock.socoolby.com.clock.widget.animatorview.animator;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.util.Log;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import clock.socoolby.com.clock.widget.animatorview.AbstractCacheDifferenceAnimator;
|
||||
|
||||
//引用自: https://blog.csdn.net/zhuxingchong/article/details/78342562
|
||||
public class FireworkAnimator extends AbstractCacheDifferenceAnimator<FireworkAnimator.Firework, FireworkAnimator.Element> {
|
||||
|
||||
private final String TAG = this.getClass().getSimpleName();
|
||||
|
||||
private final static int MAX_SIZE = 2;
|
||||
|
||||
@Override
|
||||
public boolean run() {
|
||||
Iterator<Firework> iterator = list.iterator();
|
||||
while(iterator.hasNext()){
|
||||
Firework firework=iterator.next();
|
||||
if(firework.isNeedRemove()) {
|
||||
firework.stop();
|
||||
iterator.remove();
|
||||
}else
|
||||
firework.run();
|
||||
}
|
||||
if(list.size()>=MAX_SIZE)
|
||||
return true;
|
||||
int round=rand.nextInt(20);
|
||||
if(round>15)
|
||||
lunchFireWork(rand.nextInt(width),rand.nextInt(height),0,STYLE.HEART);//心型
|
||||
if(round>10)
|
||||
lunchFireWork(rand.nextInt(width),rand.nextInt(height),0,STYLE.MAX);//大烟花
|
||||
else if(round>5)
|
||||
lunchFireWork(rand.nextInt(width),rand.nextInt(height),0,STYLE.SMALL);//小烟花
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas) {
|
||||
for (Firework firework : list) {
|
||||
firework.draw(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
for (Firework firework : list) {
|
||||
firework.stop();
|
||||
}
|
||||
super.stop();
|
||||
}
|
||||
|
||||
public void lunchFireWork(float x, float y, int direction, STYLE mode) {
|
||||
final Firework firework = new Firework(new Location(x, y), direction, mode);
|
||||
list.add(firework);
|
||||
}
|
||||
|
||||
|
||||
private final static int MAX_DEFAULT_ELEMENT_COUNT = 200;//大烟花爆炸数量
|
||||
private int MAX_DEFAULT_DURATION = 30;
|
||||
private final static int MAX_DEFAULT_LAUNCH_SPEED = 25;
|
||||
private final static int MAX_DEFAULT_ELEMENT_SIZE = 8;
|
||||
|
||||
private final static int MID_DEFAULT_ELEMENT_SIZE = 5;
|
||||
private final static int MID_DEFAULT_ELEMENT_COUNT = 40;//中烟花爆炸数量
|
||||
|
||||
private final static int BIG_DEFAULT_ELEMENT_COUNT = 200;//大烟花爆炸数量
|
||||
private int BIG_DEFAULT_DURATION = 20;
|
||||
private final static float BIG_DEFAULT_LAUNCH_SPEED = 5;
|
||||
private final static float BIG_DEFAULT_ELEMENT_SIZE = 3;
|
||||
|
||||
private final static int SMALL_DEFAULT_ELEMENT_COUNT = 8;//小星星爆炸数量
|
||||
private int SMALL_DEFAULT_DURATION = 10;//烟花引导持续时间
|
||||
private final static float SMALL_DEFAULT_LAUNCH_SPEED = 18;//烟花分散速度
|
||||
private final static float SMALL_DEFAULT_ELEMENT_SIZE = 8;//烟花颗粒大小
|
||||
|
||||
private final static float DEFAULT_WIND_SPEED = 6;
|
||||
private final static float DEFAULT_GRAVITY = 6;
|
||||
|
||||
public class Firework {
|
||||
final float screenWidthMeasure = 720;
|
||||
|
||||
private Paint mPaint;
|
||||
private int count; // count of element
|
||||
private int duration;
|
||||
private float launchSpeed;
|
||||
private float windSpeed;
|
||||
private float gravity;
|
||||
private int windDirection; // 1 or -1
|
||||
private Location location;
|
||||
private float elementSize;
|
||||
|
||||
//此值在爆炸前为引导时长,在爆炸后为存留时长
|
||||
private float animatorValue;
|
||||
|
||||
private ArrayList<Element> elements = new ArrayList<>();
|
||||
|
||||
private STYLE mode = STYLE.SMALL;
|
||||
|
||||
public Firework(Location location, int windDirection, STYLE mode) {
|
||||
this.location = location;
|
||||
this.windDirection = windDirection;
|
||||
this.mode = mode;
|
||||
gravity = DEFAULT_GRAVITY;
|
||||
windSpeed = DEFAULT_WIND_SPEED;
|
||||
|
||||
if(rand.nextInt(5)==1){
|
||||
count=rand.nextInt(MAX_DEFAULT_ELEMENT_COUNT);
|
||||
duration = rand.nextInt(MAX_DEFAULT_DURATION);
|
||||
if((mode == STYLE.MAX)) {
|
||||
launchSpeed = rand.nextInt(new Float(BIG_DEFAULT_LAUNCH_SPEED).intValue());
|
||||
elementSize = rand.nextInt(new Float(MID_DEFAULT_ELEMENT_SIZE).intValue());
|
||||
}else{
|
||||
launchSpeed = rand.nextInt(MAX_DEFAULT_LAUNCH_SPEED);
|
||||
elementSize = rand.nextInt(MAX_DEFAULT_ELEMENT_SIZE);
|
||||
}
|
||||
}else switch (mode){
|
||||
case MAX:// 大烟花
|
||||
count = BIG_DEFAULT_ELEMENT_COUNT;
|
||||
duration = BIG_DEFAULT_DURATION;
|
||||
launchSpeed = BIG_DEFAULT_LAUNCH_SPEED;
|
||||
elementSize = BIG_DEFAULT_ELEMENT_SIZE;
|
||||
break;
|
||||
case SMALL://小星星爆炸
|
||||
count = SMALL_DEFAULT_ELEMENT_COUNT;
|
||||
duration = SMALL_DEFAULT_DURATION;
|
||||
launchSpeed = SMALL_DEFAULT_LAUNCH_SPEED;
|
||||
elementSize = SMALL_DEFAULT_ELEMENT_SIZE;
|
||||
break;
|
||||
case HEART:
|
||||
count = MID_DEFAULT_ELEMENT_COUNT;
|
||||
duration = BIG_DEFAULT_DURATION;
|
||||
launchSpeed = BIG_DEFAULT_LAUNCH_SPEED;
|
||||
elementSize = BIG_DEFAULT_ELEMENT_SIZE;
|
||||
break;
|
||||
}
|
||||
init();
|
||||
//Log.d("fireworkAnimator","duration:"+duration);
|
||||
}
|
||||
|
||||
private void init() {
|
||||
Element temp=null;
|
||||
color=Util.roundColor();
|
||||
// 给每个火花设定一个随机的方向 0-360
|
||||
//Log.d(TAG, "Firework init mode = " + mode + " count = " + count);
|
||||
switch (mode) {
|
||||
case MAX:
|
||||
for (int i = 0; i < count; i++) {
|
||||
temp=revectForTrashCache();
|
||||
if(randColor)
|
||||
randomColor();
|
||||
if(temp==null)
|
||||
temp=new Element(color, Math.toRadians(rand.nextInt(360)), rand.nextFloat() * launchSpeed,elementSize);
|
||||
else{
|
||||
temp.color=color;
|
||||
temp.direction=Math.toRadians(rand.nextInt(360));
|
||||
temp.speed=rand.nextFloat() * launchSpeed;
|
||||
temp.r=elementSize;
|
||||
temp.x=temp.y=0;
|
||||
}
|
||||
elements.add(temp);
|
||||
}
|
||||
break;
|
||||
case SMALL:
|
||||
for (int i = 0; i < count; i++) {
|
||||
temp=revectForTrashCache();
|
||||
if(randColor)
|
||||
randomColor();
|
||||
if(temp==null)
|
||||
temp=new Element(color, Math.toRadians(rand.nextInt(360)), rand.nextFloat() * launchSpeed,elementSize);
|
||||
else{
|
||||
temp.color=color;
|
||||
temp.direction=Math.toRadians(rand.nextInt(360));
|
||||
temp.speed=rand.nextFloat() * launchSpeed;
|
||||
temp.r=elementSize;
|
||||
temp.x=temp.y=0;
|
||||
}
|
||||
elements.add(temp);
|
||||
}
|
||||
break;
|
||||
case HEART:
|
||||
for (int i = 0; i < count; i++) {
|
||||
temp=revectForTrashCache();
|
||||
if(randColor)
|
||||
randomColor();
|
||||
if(temp==null)
|
||||
temp=new Element();
|
||||
temp.color=color;
|
||||
//temp.direction=-count/2 * (((Math.sin(i)*Math.sqrt(Math.abs(Math.cos(i)))) / (Math.sin(i) + 1.4142)) - 2 * Math.sin(i) + 2);
|
||||
temp.direction=Math.toRadians(rand.nextInt(360));
|
||||
temp.speed=rand.nextFloat() * launchSpeed;
|
||||
temp.r=elementSize;
|
||||
temp.x=temp.y=0;
|
||||
elements.add(temp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
mPaint = new Paint();
|
||||
mPaint.setColor(Color.WHITE);
|
||||
timeCount = 1;
|
||||
animatorValue = duration;
|
||||
}
|
||||
|
||||
private float timeCount = 1;
|
||||
private final float dif = 0.00816f;
|
||||
private boolean needRemove = false;
|
||||
|
||||
public boolean isNeedRemove() {
|
||||
return needRemove;
|
||||
}
|
||||
|
||||
boolean isStart = false;
|
||||
Element elementTemp=null;
|
||||
/*
|
||||
* 开始烟花爆炸动画
|
||||
*/
|
||||
public void fire() {
|
||||
//Log.d("zxc55", "onAnimationUpdate animatorValue = " + animatorValue);
|
||||
// 计算每个火花的位置
|
||||
isStart = true;
|
||||
animatorValue = timeCount;
|
||||
switch (mode) {
|
||||
case HEART:
|
||||
for (int i = 0; i < count; i++) {
|
||||
elementTemp = elements.get(i);
|
||||
//产生极坐标点
|
||||
int m = i;
|
||||
double n = -count / 2 * (((Math.sin(i) * Math.sqrt(Math.abs(Math.cos(i)))) / (Math.sin(i) + 1.4142)) - 2 * Math.sin(i) + 2);
|
||||
//转换为笛卡尔坐标
|
||||
elementTemp.x = new Double(n * Math.cos(m) + elementTemp.speed * animatorValue + windSpeed * windDirection).floatValue();
|
||||
elementTemp.y = new Double(n * Math.sin(m) - elementTemp.speed * animatorValue + gravity * (1 - animatorValue)).floatValue();
|
||||
//Log.d("fireworkAnimator", "element.x:\t" + elementTemp.x + "\telement.y:\t" + elementTemp.y);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
for (Element element : elements) {
|
||||
element.x = (float) (element.x
|
||||
+ Math.cos(element.direction) * element.speed
|
||||
* animatorValue + windSpeed * windDirection);
|
||||
element.y = (float) (element.y
|
||||
- Math.sin(element.direction) * element.speed
|
||||
* animatorValue + gravity * (1 - animatorValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void stop(){
|
||||
moveToTrashCache(elements);
|
||||
isStart=false;
|
||||
needRemove=true;
|
||||
}
|
||||
|
||||
public void onAnimationEnd() {
|
||||
//Log.d("zxc118", "onAnimationEnd clear fireworkAnimator");
|
||||
needRemove = true;
|
||||
}
|
||||
|
||||
public void setDuration(int duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public void run(){
|
||||
//前一部分为引导
|
||||
duration--;
|
||||
|
||||
if(duration>0)
|
||||
return;
|
||||
|
||||
if(duration==0) {
|
||||
fire();
|
||||
}
|
||||
/*
|
||||
* 有些情况小星星动画不能停止,强制结束
|
||||
*/
|
||||
n++;
|
||||
if (n > maxTime) {
|
||||
onAnimationEnd();
|
||||
}
|
||||
|
||||
/*
|
||||
* 更新烟花位置
|
||||
*/
|
||||
if (n > 2 && isStart) {
|
||||
updateLocation();
|
||||
}
|
||||
}
|
||||
|
||||
private final int maxTime = 38;
|
||||
private int n = 0;
|
||||
private float fraction=0;
|
||||
private float startX=0;
|
||||
private float startY=0;
|
||||
private float x=0;
|
||||
private float y=0;
|
||||
|
||||
public void draw(Canvas canvas) {
|
||||
if(isStart){
|
||||
mPaint.setAlpha((int) (225 * animatorValue));
|
||||
for (Element element : elements) {
|
||||
element.draw(canvas,mPaint,location.x,location.y);
|
||||
}
|
||||
}else{
|
||||
fraction=duration/animatorValue;
|
||||
startX=width/2;
|
||||
if(location.y<(height/2)&&rand.nextBoolean())
|
||||
startX=rand.nextInt(width);
|
||||
startY=height;
|
||||
x=location.x + fraction * (startX-location.x);
|
||||
y=location.y+fraction * (startY-location.y);
|
||||
//canvas.drawLine(width/2,height,x,y,mPaint);
|
||||
canvas.drawCircle(x,y,MID_DEFAULT_ELEMENT_SIZE,mPaint);
|
||||
canvas.drawCircle(x+SMALL_DEFAULT_ELEMENT_SIZE/2,y,SMALL_DEFAULT_ELEMENT_SIZE,mPaint);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateLocation() {
|
||||
animatorValue -= dif;
|
||||
if (animatorValue < 0) {
|
||||
onAnimationEnd();
|
||||
}
|
||||
for (Element element : elements) {
|
||||
element.x = (float) (element.x
|
||||
+ Math.cos(element.direction) * element.speed
|
||||
* animatorValue + windSpeed * windDirection);
|
||||
element.y = (float) (element.y
|
||||
- Math.sin(element.direction) * element.speed
|
||||
* animatorValue + gravity * (1 - animatorValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum STYLE{
|
||||
MAX,SMALL,HEART;
|
||||
}
|
||||
|
||||
static class Location {
|
||||
public float x;
|
||||
public float y;
|
||||
|
||||
public Location(float x, float y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
}
|
||||
|
||||
public class Element {
|
||||
public int color;
|
||||
public Double direction;
|
||||
public float speed;
|
||||
public float x = 0;
|
||||
public float y = 0;
|
||||
public float r=10;
|
||||
|
||||
public Element(){
|
||||
|
||||
}
|
||||
|
||||
public Element(int color, Double direction, float speed,float r) {
|
||||
this.color = color;
|
||||
this.direction = direction;
|
||||
this.speed = speed;
|
||||
this.r=r;
|
||||
}
|
||||
|
||||
public void draw(Canvas canvas, Paint mPaint,float baseX,float baseY) {
|
||||
mPaint.setColor(color);
|
||||
canvas.drawCircle(baseX + x, baseY + y,r, mPaint);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,171 @@
|
||||
package clock.socoolby.com.clock.widget.animatorview.animator;
|
||||
|
||||
|
||||
//引用自:https://github.com/YuToo/FluorescenceView/
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.RadialGradient;
|
||||
import android.graphics.Shader;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import clock.socoolby.com.clock.widget.animatorview.AbstractAnimator;
|
||||
|
||||
public class FluorescenceAnimator extends AbstractAnimator<FluorescenceAnimator.Particle> {
|
||||
|
||||
private int mParticleRadius = 15; // 粒子大小基数
|
||||
private int mParticleRandomRadius = 50; // 随机范围(基数上范围)
|
||||
private int mParticleLife = 3000; //生命基数(毫秒)
|
||||
private int mParticleRandomLife = 8000; //随机范围(基数上范围)
|
||||
private int mParticleNum = 20; //粒子数量
|
||||
private int[] mParticleColors = {0xFF0d4289, 0xff034aa1,0x887b0808, 0xff176bd1, 0xff1f39ff,0x33d4ed00, 0x66ffffff, 0xff777800, 0xff0e2569};//粒子颜色集合
|
||||
private Paint mPaint;
|
||||
|
||||
List<Particle> cache = new LinkedList<>();
|
||||
|
||||
@Override
|
||||
public boolean run() {
|
||||
for(Particle particle : list){
|
||||
if(particle.getLife() <= 0){
|
||||
cache.add(particle);
|
||||
}
|
||||
}
|
||||
list.removeAll(cache);
|
||||
for(int i = 0 ; i < mParticleNum - list.size() ; i ++){
|
||||
list.add(randomParticle());
|
||||
}
|
||||
cache.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas) {
|
||||
for(Particle particle : list){
|
||||
PointF point = particle.getPoint();
|
||||
if(point == null){
|
||||
continue;
|
||||
}
|
||||
Shader shader = new RadialGradient(point.x, point.y, particle.getRadius(), particle.getColor(), 0x00000000, Shader.TileMode.CLAMP);
|
||||
mPaint.setShader(shader);
|
||||
mPaint.setAlpha((int)(particle.getTranslate() * 255));
|
||||
canvas.drawCircle(point.x, point.y, particle.getRadius(), mPaint);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
mPaint = new Paint();
|
||||
mPaint.setStyle(Paint.Style.FILL);
|
||||
mPaint.setAntiAlias(true);
|
||||
}
|
||||
|
||||
private Particle randomParticle(){
|
||||
Particle particle = new Particle();
|
||||
// 随机起始位置
|
||||
PointF startP = new PointF(rand.nextInt(width), rand.nextInt(height));
|
||||
//随机结束位置
|
||||
PointF endP = new PointF(rand.nextInt(width), rand.nextInt(height));
|
||||
particle.setStartPointF(startP);
|
||||
particle.setEndPointF(endP);
|
||||
// 随机生命
|
||||
particle.setLife(mParticleLife + rand.nextInt(mParticleRandomLife));
|
||||
// 随机大小
|
||||
particle.setRadius(mParticleRadius + rand.nextInt(mParticleRandomRadius));
|
||||
// 随机颜色
|
||||
particle.setColor(mParticleColors[rand.nextInt(mParticleColors.length)]);
|
||||
return particle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Created by YuToo on 2017/2/28.
|
||||
* 荧光对象
|
||||
*/
|
||||
public static class Particle {
|
||||
|
||||
private PointF startPointF;//荧光开始坐标
|
||||
private PointF endPointF;//荧光结束点坐标
|
||||
private float radius;// 荧光半径
|
||||
private long startTime;//开始时间
|
||||
private int life; //生命
|
||||
private int color;//颜色
|
||||
|
||||
public Particle(){
|
||||
startTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public PointF getStartPointF() {
|
||||
return startPointF;
|
||||
}
|
||||
|
||||
public void setStartPointF(PointF startPointF) {
|
||||
this.startPointF = startPointF;
|
||||
}
|
||||
|
||||
public PointF getEndPointF() {
|
||||
return endPointF;
|
||||
}
|
||||
|
||||
public void setEndPointF(PointF endPointF) {
|
||||
this.endPointF = endPointF;
|
||||
}
|
||||
|
||||
public float getRadius() {
|
||||
return radius;
|
||||
}
|
||||
|
||||
public void setRadius(float radius) {
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
public long getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setLife(int life) {
|
||||
this.life = life;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(int color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
//获取粒子透明度:先透明再实体再透明(二次函数)
|
||||
public float getTranslate(){
|
||||
// 根据生命计算透明度
|
||||
int life = getLife();
|
||||
if(life <= 0){
|
||||
return 0;
|
||||
}else{
|
||||
// y = 4x - 4x的平方
|
||||
float x = (life * 1.0f / this.life);
|
||||
return 4 * x *(1 - x);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取当前位置
|
||||
public PointF getPoint(){
|
||||
int life = getLife();
|
||||
if(life <= 0){
|
||||
return null;
|
||||
}else{
|
||||
PointF pointF = new PointF();
|
||||
pointF.x = endPointF.x + (endPointF.x - startPointF.x) * (life * 1.0f / this.life);
|
||||
pointF.y = endPointF.y + (endPointF.y - startPointF.y) * (life * 1.0f / this.life);
|
||||
return pointF;
|
||||
}
|
||||
}
|
||||
|
||||
//获取剩余生命
|
||||
public int getLife(){
|
||||
return (int)(startTime + life - System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,110 @@
|
||||
package clock.socoolby.com.clock.widget.animatorview.animator;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.util.Log;
|
||||
|
||||
import clock.socoolby.com.clock.widget.animatorview.AbstractAnimator;
|
||||
|
||||
|
||||
//原作者:https://github.com/xianfeng99/Particle
|
||||
|
||||
public class RainAnimator extends AbstractAnimator<RainAnimator.Rain> {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean run() {
|
||||
for(Rain item : list){
|
||||
item.move();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas) {
|
||||
for(Rain item : list){
|
||||
item.draw(canvas,paint);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
addRains(50);
|
||||
}
|
||||
|
||||
|
||||
public void addRains(int quantity) {
|
||||
for (int i = 0; i < quantity;i++) {
|
||||
list.add(new Rain());
|
||||
}
|
||||
}
|
||||
|
||||
private Paint paint = new Paint();
|
||||
private final int size = 50; //长度在0-50像素
|
||||
|
||||
public class Rain{
|
||||
private Rect point; //雨点
|
||||
private Point speed; //雨点x,y方向速度
|
||||
private int rainColor;
|
||||
|
||||
public Rain(){
|
||||
point = new Rect();
|
||||
speed = new Point();
|
||||
reset();
|
||||
}
|
||||
|
||||
|
||||
public void draw(Canvas canvas,Paint paint){
|
||||
paint.setColor(rainColor);
|
||||
canvas.drawLine(point.left, point.top, point.right, point.bottom, paint);
|
||||
}
|
||||
|
||||
public void move(){
|
||||
point.left += speed.x;
|
||||
point.top += speed.y;
|
||||
point.right = point.right + speed.x;
|
||||
point.bottom = point.bottom + speed.y;
|
||||
|
||||
if(point.left < 0 || point.left > width || point.bottom > height){
|
||||
reset();
|
||||
}
|
||||
speed.y += rand.nextBoolean() ? 1 : 0;
|
||||
}
|
||||
|
||||
private void reset(){
|
||||
int x = rand.nextInt(width);
|
||||
int y = rand.nextInt(height);
|
||||
int w = rand.nextInt(size / 2);
|
||||
int h = rand.nextInt(size);
|
||||
|
||||
w = w > h ? h : w;
|
||||
|
||||
point.left = x;
|
||||
point.top = y;
|
||||
point.right = x - w;
|
||||
point.bottom = y + h;
|
||||
|
||||
// int speedX = rand.nextInt(size / 2);
|
||||
// int speedY = rand.nextInt(size);
|
||||
int speedX = w;
|
||||
int speedY = h;
|
||||
|
||||
speedX = speedX == 0 ? 1 : speedX;
|
||||
speedY = speedY == 0 ? 1 : speedY;
|
||||
speedX = speedX > speedY ? speedY : speedX;
|
||||
|
||||
speed.x = -speedX;
|
||||
speed.y = speedY;
|
||||
if(randColor)
|
||||
randomColor();
|
||||
this.rainColor=color;
|
||||
}
|
||||
|
||||
public void printPosition(){
|
||||
Log.d("rainPoint", "x : " + point.left + " y : " + point.top + " r : " + point.right + " b : " + point.bottom);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,213 @@
|
||||
package clock.socoolby.com.clock.widget.animatorview.animator;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Point;
|
||||
|
||||
import clock.socoolby.com.clock.widget.animatorview.AbstractAnimator;
|
||||
|
||||
//原作者:https://github.com/xianfeng99/Particle
|
||||
|
||||
public class SkyAnimator extends AbstractAnimator<SkyAnimator.Star> {
|
||||
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas) {
|
||||
for(Star item : list){
|
||||
item.draw(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
addStars(50);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加小星星
|
||||
* @param quantity
|
||||
*/
|
||||
public void addStars(int quantity) {
|
||||
for (int i = 0; i < quantity;i++) {
|
||||
list.add(new Star());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run() {
|
||||
move();
|
||||
return true;
|
||||
}
|
||||
|
||||
public void move(){
|
||||
if(list.size() == 0){
|
||||
throw new RuntimeException("请初在initScence的方法中加入效果元素!");
|
||||
}
|
||||
|
||||
for(Star item : list){
|
||||
item.move();
|
||||
}
|
||||
}
|
||||
|
||||
public class Star {
|
||||
private final int NORMAL = 0;
|
||||
private final int LIGHT = 1;
|
||||
private final int METEOR = 2;
|
||||
private int state = NORMAL;
|
||||
|
||||
private Paint paint = new Paint();
|
||||
private final int size = 20; // 长度在0-size像素
|
||||
private int radius;
|
||||
private Point point; // 星星
|
||||
|
||||
private int light = 100;// 闪烁
|
||||
private int meteor = 10000;// 流星
|
||||
|
||||
//星星闪烁类型
|
||||
private final int LIGHT_FULL = 0;
|
||||
private final int LIGHT_HALF = 1;
|
||||
private final int LIGHT_HALF_ALPHA = 2;
|
||||
private int lightState = 0;
|
||||
private int lightAlpha = 80;
|
||||
|
||||
//流星移动值
|
||||
private int meteorSpeedX;
|
||||
private int meteorSpeedY;
|
||||
private int meteorState = 0;
|
||||
private int meteorAlpha = 255;
|
||||
private int meteorStep;
|
||||
|
||||
|
||||
public Star(){
|
||||
point = new Point();
|
||||
paint.setColor(0xffffffff);
|
||||
reset();
|
||||
}
|
||||
|
||||
public void draw(Canvas canvas) {
|
||||
// 变长小于等于8绘制圆形
|
||||
switch (state) {
|
||||
case NORMAL:
|
||||
canvas.drawCircle(point.x, point.y, radius / 2, paint);
|
||||
break;
|
||||
case LIGHT:
|
||||
canvas.drawCircle(point.x, point.y, radius / 2, paint);
|
||||
drawLightStar(canvas);
|
||||
break;
|
||||
case METEOR:
|
||||
drawMeteor(canvas);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void move () {
|
||||
switch (state) {
|
||||
case NORMAL:
|
||||
while (point.x < 0 || point.x > width || point.y > height) {
|
||||
reset();
|
||||
}
|
||||
int mod = rand.nextInt(light + 1) % light;
|
||||
if (mod == 0) {
|
||||
// 闪烁
|
||||
state = LIGHT;
|
||||
lightState = rand.nextInt(10) % 3;
|
||||
return;
|
||||
}
|
||||
mod = rand.nextInt(meteor + 1) % meteor;
|
||||
if (mod == 0) {
|
||||
// 流星
|
||||
state = METEOR;
|
||||
meteorSpeedY = 1 + rand.nextInt(height / 20);
|
||||
meteorSpeedX = rand.nextInt(width / 20);
|
||||
meteorSpeedX *= rand.nextBoolean() ? 1 : -1;
|
||||
meteorStep = 1;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case LIGHT:
|
||||
lightAlpha -= 20;
|
||||
if (lightAlpha < 0) {
|
||||
state = NORMAL;
|
||||
lightAlpha = 80;
|
||||
}
|
||||
break;
|
||||
case METEOR:
|
||||
meteorAlpha -= 20;
|
||||
if (meteorAlpha < 0) {
|
||||
state = NORMAL;
|
||||
meteorAlpha = 255;
|
||||
meteorStep = 1;
|
||||
return;
|
||||
}
|
||||
meteorState = rand.nextInt(10) % 3;
|
||||
meteorStep++;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void reset () {
|
||||
point.x = rand.nextInt(width);
|
||||
point.y = rand.nextInt(height / 2);
|
||||
radius = rand.nextInt(size);
|
||||
if(randColor)
|
||||
randomColor();
|
||||
paint.setColor(color);
|
||||
}
|
||||
|
||||
private void drawLightStar (Canvas canvas){
|
||||
|
||||
switch (lightState) {
|
||||
case LIGHT_HALF:
|
||||
//左右交叉
|
||||
canvas.drawLine(point.x - radius, point.y - radius, point.x + radius, point.y + radius, paint);
|
||||
canvas.drawLine(point.x - radius, point.y + radius, point.x + radius, point.y - radius, paint);
|
||||
break;
|
||||
case LIGHT_FULL:
|
||||
paint.setAlpha(255 - lightAlpha);
|
||||
//绘制横竖向
|
||||
canvas.drawLine(point.x - 2 * radius, point.y, point.x + 2 * radius, point.y, paint);
|
||||
canvas.drawLine(point.x, point.y - 2 * radius, point.x, point.y + 2 * radius, paint);
|
||||
case LIGHT_HALF_ALPHA:
|
||||
paint.setAlpha(lightAlpha);
|
||||
//左右交叉
|
||||
canvas.drawLine(point.x - radius, point.y - radius, point.x + radius, point.y + radius, paint);
|
||||
canvas.drawLine(point.x - radius, point.y + radius, point.x + radius, point.y - radius, paint);
|
||||
paint.setAlpha(255);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void drawMeteor (Canvas canvas){
|
||||
|
||||
int trimX = meteorStep * meteorSpeedX;
|
||||
int trimY = meteorStep * meteorSpeedY;
|
||||
paint.setAlpha(lightAlpha);
|
||||
//绘制流行轨迹
|
||||
canvas.drawLine(point.x, point.y, trimX + point.x, trimY + point.y, paint);
|
||||
paint.setAlpha(255);
|
||||
canvas.drawCircle(trimX + point.x, trimY + point.y, radius / 2, paint);
|
||||
switch (meteorState) {
|
||||
case LIGHT_HALF:
|
||||
//左右交叉
|
||||
canvas.drawLine(trimX + point.x - radius, trimY + point.y - radius, trimX + point.x + radius, trimY + point.y + radius, paint);
|
||||
canvas.drawLine(trimX + point.x - radius, trimY + point.y + radius, trimX + point.x + radius, trimY + point.y - radius, paint);
|
||||
break;
|
||||
case LIGHT_FULL:
|
||||
paint.setAlpha(255 - lightAlpha);
|
||||
//绘制横竖向
|
||||
canvas.drawLine(trimX + point.x - 2 * radius, trimY + point.y, trimX + point.x + 2 * radius, trimY + point.y, paint);
|
||||
canvas.drawLine(trimX + point.x, trimY + point.y - 2 * radius, trimX + point.x, trimY + point.y + 2 * radius, paint);
|
||||
case LIGHT_HALF_ALPHA:
|
||||
paint.setAlpha(lightAlpha);
|
||||
//左右交叉
|
||||
canvas.drawLine(trimX + point.x - radius, trimY + point.y - radius, trimX + point.x + radius, trimY + point.y + radius, paint);
|
||||
canvas.drawLine(trimX + point.x - radius, trimY + point.y + radius, trimX + point.x + radius, trimY + point.y - radius, paint);
|
||||
paint.setAlpha(255);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,244 @@
|
||||
package clock.socoolby.com.clock.widget.animatorview.animator;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.util.Log;
|
||||
|
||||
import clock.socoolby.com.clock.widget.animatorview.AbstractAnimator;
|
||||
|
||||
//引用自:https://github.com/xianfeng99/Particle
|
||||
|
||||
public class SnowAnimator extends AbstractAnimator<SnowAnimator.SnowPoint> {
|
||||
|
||||
@Override
|
||||
public boolean run() {
|
||||
for(SnowPoint item : list){
|
||||
item.move();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Paint paint=new Paint();
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas) {
|
||||
for(SnowPoint item : list){
|
||||
item.draw(canvas,paint);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
addSnowPoint(50);
|
||||
}
|
||||
|
||||
public void addSnowPoint(int quantity) {
|
||||
int round;
|
||||
for (int i = 0; i < quantity;i++) {
|
||||
round=rand.nextInt(2);
|
||||
if(randColor)
|
||||
randomColor();
|
||||
if(round==1)
|
||||
list.add(new SnowPoint2(color));
|
||||
else
|
||||
list.add(new SnowPoint(color));
|
||||
}
|
||||
}
|
||||
|
||||
public class SnowPoint{
|
||||
int color;
|
||||
protected final int size = 36; // 长度在0-50像素
|
||||
private Rect rect; // 雪图
|
||||
protected Point point; // 雪点
|
||||
protected Point speed; // 雪点x,y方向速度
|
||||
|
||||
|
||||
public SnowPoint(int color) {
|
||||
rect = new Rect();
|
||||
speed = new Point();
|
||||
point=new Point();
|
||||
reset();
|
||||
this.color=color;
|
||||
}
|
||||
|
||||
public void draw(Canvas canvas,Paint paint) {
|
||||
paint.setColor(color);
|
||||
//变长小于等于8绘制圆形
|
||||
if(rect.width() <= 8){
|
||||
canvas.drawCircle(rect.left, rect.top, rect.width() / 2, paint);
|
||||
}
|
||||
else{
|
||||
//绘制雪花形状
|
||||
drawSknow(canvas,paint);
|
||||
}
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
|
||||
public void move() {
|
||||
point.x += speed.x;
|
||||
point.y += speed.y;
|
||||
rect.left += point.x;
|
||||
rect.top += point.y;
|
||||
rect.right = rect.right + speed.x;
|
||||
rect.bottom = rect.bottom + speed.y;
|
||||
|
||||
changeSpeed();
|
||||
|
||||
if (mustReset()) {
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
public void changeSpeed(){
|
||||
count++;
|
||||
if (count > 5) {
|
||||
count = 0;
|
||||
speed.x = rand.nextInt(size);
|
||||
speed.x = speed.x > speed.y ? speed.y : speed.x;
|
||||
speed.x = rand.nextBoolean() ? -speed.x : speed.x;
|
||||
speed.y += rand.nextBoolean() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean mustReset(){
|
||||
if (rect.left < 0 || rect.bottom > height) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
reset(true);
|
||||
}
|
||||
|
||||
public void reset(boolean resetRect) {
|
||||
point.x = rand.nextInt(width);
|
||||
point.y = rand.nextInt(height);
|
||||
|
||||
|
||||
//减少出现在下面的机率
|
||||
if(point.y>height*2/3&&rand.nextBoolean())
|
||||
point.y=point.y-height/2;
|
||||
|
||||
if(resetRect) {
|
||||
int w = rand.nextInt(size);
|
||||
int h = rand.nextInt(size);
|
||||
|
||||
if (w > 8) {
|
||||
//勾3股4弦5(宽是4的倍数,高是3的倍数)
|
||||
int mod = w % 4;
|
||||
w += mod;
|
||||
int mul = w / 4;//倍数
|
||||
h = 3 * mul;
|
||||
rect.left = point.x;
|
||||
rect.top = point.y;
|
||||
rect.right = point.x + w;
|
||||
rect.bottom = point.y + h;
|
||||
} else {
|
||||
rect.left = point.x;
|
||||
rect.top = point.y;
|
||||
rect.right = point.x + w;
|
||||
rect.bottom = point.y + w;
|
||||
}
|
||||
}
|
||||
|
||||
//修改:速度过快
|
||||
int speedX = rand.nextInt(size/2);
|
||||
int speedY = rand.nextInt(size/2);
|
||||
|
||||
/*
|
||||
* int speedX = w; int speedY = h;
|
||||
*/
|
||||
|
||||
speedX = speedX == 0 ? 1 : speedX;
|
||||
speedY = speedY == 0 ? 1 : speedY;
|
||||
speedX = speedX > speedY ? speedY : speedX;
|
||||
|
||||
speed.x = speedX;
|
||||
speed.y = speedY;
|
||||
}
|
||||
|
||||
|
||||
public void drawSknow(Canvas canvas,Paint paint){
|
||||
int w = rect.width();
|
||||
int h = rect.height();
|
||||
int mul = w / 4;//倍数
|
||||
float xie = 5 * mul / 2;
|
||||
float centerY = rect.top + h / 2;
|
||||
float centerX = rect.left + w / 2;
|
||||
|
||||
canvas.drawLine(rect.left, rect.top, rect.right, rect.bottom, paint);
|
||||
canvas.drawLine(rect.left, rect.bottom, rect.right, rect.top, paint);
|
||||
canvas.drawLine(centerX, centerY - xie, centerX, centerY + xie, paint);
|
||||
|
||||
}
|
||||
|
||||
public void printPosition() {
|
||||
Log.d("SknowPoint", "x : " + rect.left + " y : " + rect.top + " r : "
|
||||
+ rect.right + " b : " + rect.bottom);
|
||||
}
|
||||
}
|
||||
|
||||
public class SnowPoint2 extends SnowPoint{
|
||||
private int lenSize;// 边长
|
||||
private int mul;// 倍数
|
||||
|
||||
public SnowPoint2(int color) {
|
||||
super(color);
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
super.reset(false);
|
||||
lenSize = rand.nextInt(size);
|
||||
lenSize += lenSize % 5;
|
||||
mul = lenSize / 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mustReset() {
|
||||
if (point.x < 0 || point.x > width || point.y > height) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void draw(Canvas canvas,Paint paint) {
|
||||
paint.setColor(color);
|
||||
// 变长小于等于10绘制圆形
|
||||
if (lenSize <= 10) {
|
||||
canvas.drawCircle(point.x, point.y, lenSize / 2, paint);
|
||||
} else {
|
||||
// 绘制雪花形状
|
||||
drawSknow(canvas,paint);
|
||||
}
|
||||
}
|
||||
|
||||
public void drawSknow(Canvas canvas, Paint paint) {
|
||||
int y = mul * 3;
|
||||
int x = mul * 4;
|
||||
|
||||
if (speed.x > 0) {
|
||||
// 竖雪花
|
||||
canvas.drawLine(point.x, point.y - (float) lenSize / 2, point.x,
|
||||
point.y + (float) lenSize / 2, paint);
|
||||
canvas.drawLine(point.x - (float) x / 2, point.y - (float) y / 2,
|
||||
point.x + (float) x / 2, point.y + (float) y / 2, paint);
|
||||
canvas.drawLine(point.x - (float) x / 2, point.y + (float) y / 2,
|
||||
point.x + (float) x / 2, point.y - (float) y / 2, paint);
|
||||
} else {
|
||||
// 横雪花
|
||||
canvas.drawLine(point.x - (float) lenSize / 2, point.y, point.x
|
||||
+ (float) lenSize / 2, point.y, paint);
|
||||
canvas.drawLine(point.x - (float) y / 2, point.y - (float) x / 2,
|
||||
point.x + (float) y / 2, point.y + (float) x / 2, paint);
|
||||
canvas.drawLine(point.x - (float) y / 2, point.y + (float) x / 2,
|
||||
point.x + (float) y / 2, point.y - (float) x / 2, paint);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package clock.socoolby.com.clock.widget.animatorview.animator;
|
||||
|
||||
|
||||
import clock.socoolby.com.clock.R;
|
||||
|
||||
public class StarFallAnimator extends DrawableArrayFallAnimator {
|
||||
|
||||
//小星星图片的资源文件
|
||||
static int[] picRes = {R.drawable.ic_star
|
||||
,R.drawable.ic_star1
|
||||
,R.drawable.ic_star2
|
||||
,R.drawable.ic_star3
|
||||
,R.drawable.ic_star4
|
||||
,R.drawable.ic_star5
|
||||
,R.drawable.ic_star6
|
||||
,R.drawable.ic_star7
|
||||
};
|
||||
|
||||
public StarFallAnimator() {
|
||||
super(picRes,10);
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package clock.socoolby.com.clock.widget.animatorview.animator.bean;
|
||||
|
||||
public class Particle {
|
||||
public int color;
|
||||
public Double direction;
|
||||
public float speed;
|
||||
public float x = 0;
|
||||
public float y = 0;
|
||||
public float r=10;
|
||||
}
|
@ -178,7 +178,11 @@ public class AutoScrollTextView extends android.support.v7.widget.AppCompatTextV
|
||||
stopScroll();
|
||||
else
|
||||
startScroll();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTextColor(int color){
|
||||
super.setTextColor(color);
|
||||
paint.setColor(color);
|
||||
}
|
||||
}
|
||||
|
9
app/src/main/res/drawable/ic_background_color.xml
Normal file
9
app/src/main/res/drawable/ic_background_color.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M15.3794,0.1236c-0.4186,0.0689 -0.9115,0.2544 -1.2826,0.4822l-0.355,0.2119l-0.371,-0.0847c-1.4362,-0.3233 -3.3175,-0.1855 -5.0292,0.3763c-3.9746,1.2984 -6.7781,4.669 -7.5782,9.0941c-0.6041,3.3545 -0.6996,8.5481 -0.2119,11.807c0.143,0.9751 0.3391,1.7542 0.4558,1.8389c0.0742,0.0583 1.6164,0.0689 8.1823,0.0689c8.9614,-0 8.3203,0.0264 8.3203,-0.3391c0,-0.1483 -0.0425,-0.2119 -0.318,-0.4241c-0.7632,-0.5988 -1.9555,-2.088 -2.7982,-3.4922c-1.3354,-2.231 -2.3424,-4.7484 -2.7876,-6.9794c-0.1644,-0.8107 -0.2808,-2.1463 -0.2066,-2.3635c0.053,-0.1483 0.053,-0.143 0.09,0.1114c0.1378,1.0015 0.4769,1.6639 1.0812,2.0933c0.6199,0.4505 1.452,0.5458 2.5332,0.2966c1.4098,-0.3233 2.3902,-0.4027 2.9359,-0.2491c0.5671,0.1644 2.3424,1.3037 3.169,2.035c0.3974,0.355 0.4505,0.3444 0.9698,-0.2438c0.5882,-0.6624 1.1448,-1.3884 1.2984,-1.6906c0.5194,-1.0229 0.3127,-2.2574 -0.5299,-3.2009c-0.1694,-0.1855 -0.5566,-0.5035 -0.9168,-0.7524c-1.0121,-0.6996 -1.7064,-1.3142 -2.9518,-2.6074c-0.6943,-0.726 -1.0918,-1.2295 -1.7964,-2.2894c-0.3338,-0.5035 -0.7418,-1.0651 -0.9062,-1.2454l-0.2969,-0.3233l0.2438,-0.3286c0.228,-0.3022 0.7949,-0.8321 1.1023,-1.0334c0.1536,-0.1061 0.2014,-0.2597 0.1272,-0.4294c-0.1274,-0.2753 -1.3834,-0.4714 -2.173,-0.3389ZM14.9556,5.1794c0.4769,0.2491 0.6782,0.8321 0.4399,1.2931c-0.2966,0.5882 -1.0387,0.726 -1.505,0.2861c-0.2227,-0.2119 -0.3022,-0.3974 -0.3022,-0.7102c0,-0.3497 0.1642,-0.6413 0.4558,-0.816c0.2383,-0.1486 0.6835,-0.1697 0.9115,-0.053Z"
|
||||
android:fillColor="#000"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_check_box_black_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_check_box_black_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF0000"
|
||||
android:pathData="M19,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.11,0 2,-0.9 2,-2L21,5c0,-1.1 -0.89,-2 -2,-2zM10,17l-5,-5 1.41,-1.41L10,14.17l7.59,-7.59L19,8l-9,9z"/>
|
||||
</vector>
|
12
app/src/main/res/drawable/ic_foreground_color.xml
Normal file
12
app/src/main/res/drawable/ic_foreground_color.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M15.0338,0.1836c-0.4968,0.095 -0.7135,0.1692 -1.1522,0.3859c-0.3593,0.1798 -0.3751,0.185 -0.6607,0.1214c-0.5126,-0.1111 -2.167,-0.1322 -2.8594,-0.0317c-4.2336,0.6132 -7.6481,3.4831 -9.0326,7.59c-0.3754,1.115 -0.6343,2.4734 -0.8458,4.4398c-0.2114,1.9555 -0.2431,2.6374 -0.2431,4.9682c0,2.537 0.0475,3.1661 0.349,4.6776c0.1798,0.8933 0.2906,1.1417 0.6185,1.3742l0.2326,0.1586l7.8804,-0l7.8859,-0l0.222,-0.1214c0.3065,-0.1586 0.5021,-0.4704 0.5338,-0.8246c0.037,-0.4651 -0.037,-0.5971 -0.6818,-1.1945c-0.9144,-0.851 -1.5804,-1.6966 -2.3731,-3.0127c-0.5021,-0.835 -1.147,-2.13 -1.5221,-3.0655c-0.2537,-0.6343 -0.7663,-2.167 -0.7399,-2.1986c0.0106,-0.0053 0.185,0.0317 0.3859,0.0898c0.5443,0.1586 1.3109,0.1481 2.0878,-0.0264c1.1628,-0.259 1.8394,-0.3276 2.2728,-0.2431c0.4598,0.0898 1.8763,0.9725 2.669,1.6649c0.1745,0.1534 0.3912,0.3118 0.4757,0.3542c0.407,0.2062 0.8458,0.1586 1.1681,-0.127c0.2801,-0.2484 1.2631,-1.4323 1.5593,-1.8816c0.3965,-0.6026 0.4968,-0.9619 0.4968,-1.7813c0,-0.6079 -0.0211,-0.7294 -0.1428,-1.073c-0.0792,-0.2167 -0.222,-0.5232 -0.317,-0.6871c-0.2326,-0.4018 -0.9302,-1.0942 -1.4006,-1.4006c-0.6185,-0.4018 -1.4059,-1.0625 -2.1511,-1.8024c-0.9038,-0.9038 -1.4587,-1.5751 -2.0772,-2.5159c-0.2801,-0.4229 -0.5707,-0.851 -0.6554,-0.9566l-0.1481,-0.1903l0.2484,-0.2378c0.1375,-0.127 0.354,-0.317 0.481,-0.4123c0.6449,-0.4915 0.5496,-1.4482 -0.1798,-1.813c-0.4759,-0.2323 -1.7179,-0.3538 -2.3839,-0.227ZM15.6204,1.9966c-0.4598,0.5602 -0.576,0.8669 -0.4493,1.1998c0.0264,0.0739 0.1903,0.2906 0.3648,0.4704c0.1692,0.185 0.5549,0.703 0.851,1.1522c0.6238,0.9302 0.7346,1.073 1.4376,1.8763c0.9408,1.073 2.1247,2.1458 3.0708,2.7802c0.6132,0.4123 0.9883,0.7927 1.1945,1.2156c0.2959,0.6079 0.2642,1.2473 -0.0847,1.7707c-0.2114,0.317 -0.9725,1.2314 -1.02,1.2314c-0.0264,-0 -0.2906,-0.1903 -0.5971,-0.4176c-0.6924,-0.5232 -1.8869,-1.2367 -2.2939,-1.3742c-0.6818,-0.2273 -1.6913,-0.1956 -3.1342,0.1111c-1.1575,0.2431 -1.649,0.1742 -2.1089,-0.2856c-0.2378,-0.2326 -0.4282,-0.6607 -0.4915,-1.0889c-0.1214,-0.8088 -0.3593,-1.0942 -0.8827,-1.0519c-0.2484,0.0158 -0.3118,0.0475 -0.4598,0.2114c-0.2537,0.2748 -0.3065,0.5285 -0.2642,1.2898c0.1375,2.6532 1.4534,6.258 3.3298,9.1279c0.4387,0.6713 1.0939,1.5274 1.4482,1.8922l0.2431,0.2537l-6.8234,-0l-6.8234,-0l-0.0581,-0.2693c-0.2537,-1.1628 -0.3487,-2.4209 -0.3434,-4.5137c0.005,-3.6312 0.3962,-6.9823 1.0306,-8.8426c1.11,-3.2506 3.647,-5.6184 6.8604,-6.4006c1.1734,-0.2906 2.537,-0.3382 3.4673,-0.1322c0.629,0.1375 0.7241,0.1428 0.925,0.0317c0.1006,-0.0581 0.3223,-0.1798 0.4915,-0.2748c0.3859,-0.2167 0.7135,-0.3065 1.11,-0.3118l0.3118,-0.0053l-0.3014,0.354Z"
|
||||
android:fillColor="#000"/>
|
||||
<path
|
||||
android:pathData="M14.1406,5.5219c-0.3859,0.1745 -0.5762,0.4968 -0.5443,0.9355c0.0581,0.7769 0.925,1.1522 1.5221,0.6502c0.3329,-0.2801 0.4282,-0.7505 0.2326,-1.1575c-0.1956,-0.4123 -0.7822,-0.6185 -1.2103,-0.4282Z"
|
||||
android:fillColor="#000"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_star.xml
Normal file
9
app/src/main/res/drawable/ic_star.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M10.2346,4.2096c-0.979,1.9999 -1.7818,3.6377 -1.7863,3.647c-0.0046,0.0046 -1.8329,0.2923 -4.0646,0.6403c-2.2318,0.3434 -4.0925,0.6403 -4.1388,0.6588c-0.065,0.0278 0.5105,0.6358 2.8954,3.0857c1.6332,1.6795 2.965,3.0809 2.951,3.1087c-0.0511,0.1483 -1.4338,7.9714 -1.4105,7.9946c0.0139,0.0139 1.6704,-0.8213 3.684,-1.8605l3.6516,-1.8883l0.283,0.1392c0.1531,0.0787 1.7724,0.9326 3.5959,1.9022c1.8235,0.965 3.3221,1.7539 3.3314,1.7491c0.0139,-0.0091 -1.2202,-7.7998 -1.2667,-7.9898c-0.0185,-0.0835 0.4733,-0.6218 2.9045,-3.1505c1.6054,-1.675 2.9093,-3.0576 2.8954,-3.0715c-0.0185,-0.0185 -1.8605,-0.3202 -4.0925,-0.6682c-2.2363,-0.3526 -4.0692,-0.6449 -4.0692,-0.6497c-0.0046,-0.0094 -0.798,-1.6332 -1.763,-3.6098c-0.965,-1.9766 -1.7678,-3.6144 -1.7863,-3.6331c-0.0185,-0.0187 -0.8352,1.6006 -1.8142,3.5957Z"
|
||||
android:fillColor="#000"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_star1.xml
Normal file
9
app/src/main/res/drawable/ic_star1.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M12,23.76c-0.4656,-0 -0.8616,-0.1536 -1.188,-0.4632c-0.3264,-0.3072 -0.4896,-0.6912 -0.4896,-1.152c0,-0.5376 0.264,-0.972 0.7896,-1.3056l-2.3376,-3.3816l-4.3056,-0c0,0.4416 -0.1584,0.792 -0.4752,1.056c-0.3168,0.264 -0.7152,0.3936 -1.1928,0.3936c-0.4536,-0 -0.8448,-0.1968 -1.1784,-0.5928c-0.3312,-0.396 -0.4992,-0.8328 -0.4992,-1.3104c0,-0.4584 0.1632,-0.852 0.4896,-1.1784c0.3264,-0.3264 0.7224,-0.4896 1.188,-0.4896c0.3072,-0 0.5976,0.0816 0.8712,0.2448l2.0304,-3.3264l-1.9944,-3.072c-0.2592,0.168 -0.5616,0.2544 -0.9072,0.2544c-0.4584,-0 -0.8544,-0.168 -1.1832,-0.5064c-0.3288,-0.3384 -0.4944,-0.7392 -0.4944,-1.2048c0,-0.4656 0.1656,-0.8736 0.4944,-1.224c0.3288,-0.3504 0.7224,-0.5256 1.1832,-0.5256c0.2304,-0 0.4464,0.036 0.648,0.108c0.2016,0.072 0.3792,0.1728 0.5304,0.3048c0.1512,0.1296 0.2712,0.2904 0.3576,0.48c0.0888,0.1896 0.132,0.3984 0.132,0.6216l3.96,-0l2.7,-4.2864c-0.5376,-0.3264 -0.8064,-0.7488 -0.8064,-1.2696c0,-0.4656 0.1656,-0.864 0.4944,-1.1952c0.3288,-0.3312 0.7224,-0.4992 1.1832,-0.4992c0.4656,-0 0.8616,0.156 1.188,0.4704c0.3264,0.3144 0.4896,0.7008 0.4896,1.1592c0,0.5688 -0.2688,1.0152 -0.8064,1.3416l2.7096,4.2792l3.9528,-0c0,-0.4464 0.1608,-0.8112 0.48,-1.092c0.3192,-0.2808 0.7152,-0.4224 1.188,-0.4224c0.4536,-0 0.8448,0.1872 1.1784,0.5616c0.3336,0.3744 0.4992,0.7968 0.4992,1.2696c0,0.4656 -0.1632,0.8616 -0.4896,1.188c-0.3264,0.3264 -0.7224,0.4896 -1.188,0.4896c-0.3264,-0 -0.6288,-0.0912 -0.9072,-0.2712l-1.9848,3.0624l2.0304,3.3072c0.2712,-0.1632 0.5592,-0.2448 0.8616,-0.2448c0.4584,-0 0.8544,0.18 1.1832,0.54c0.3288,0.36 0.4944,0.7752 0.4944,1.2456c0,0.3024 -0.0744,0.5904 -0.2232,0.8664c-0.1488,0.276 -0.3528,0.4968 -0.612,0.6672c-0.2592,0.168 -0.54,0.2544 -0.8424,0.2544c-0.4704,-0 -0.8664,-0.132 -1.188,-0.3936c-0.3192,-0.264 -0.48,-0.6144 -0.48,-1.056l-4.296,-0l-2.3376,3.3984c0.2592,0.1632 0.4536,0.336 0.5856,0.516c0.1296,0.1824 0.1944,0.408 0.1944,0.6792c0,0.4656 -0.1656,0.8664 -0.4944,1.2c-0.3288,0.3336 -0.7272,0.504 -1.1856,0.504ZM12,16.836l0,-0.0552l1.404,-2.04l2.7096,-0l-1.3152,-2.3304l1.3152,-2.2032l-2.5536,-0l-1.56,-2.52l0,0.0264l-1.56,2.4936l-2.5464,-0l1.3152,2.2032l-1.3152,2.3304l2.7096,-0l1.3968,2.0952Z"
|
||||
android:fillColor="#000"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_star2.xml
Normal file
9
app/src/main/res/drawable/ic_star2.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M10.2125,5.4941c-1.1292,3.6691 -1.2233,3.7632 -5.5507,3.7632l-4.4218,0.0943l2.2579,1.8816c1.2233,1.0349 2.9165,2.2579 3.7632,2.6345c1.2233,0.7524 1.2233,1.4112 0.2825,4.421c-0.5645,1.9762 -0.9408,3.7632 -0.6588,3.9516c0.1884,0.1884 1.6932,-0.564 3.2928,-1.6932l2.8224,-2.07l3.3864,2.07c1.788,1.1292 3.4812,1.8816 3.7632,1.6932c0.1884,-0.282 -0.282,-2.07 -1.1282,-4.0452c-1.2238,-3.1044 -1.3176,-3.6694 -0.0946,-4.3272c0.6588,-0.4704 2.352,-1.5996 3.5748,-2.6345l2.2584,-1.8816l-4.422,-0.0941c-4.3272,-0 -4.422,-0.0941 -5.5502,-3.7632c-0.6588,-2.07 -1.4117,-3.7632 -1.788,-3.7632c-0.3761,-0.0005 -1.129,1.6927 -1.7873,3.7627Z"
|
||||
android:fillColor="#000"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_star3.xml
Normal file
9
app/src/main/res/drawable/ic_star3.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M11.8694,0.306c-0.011,0.0389 -0.1886,2.293 -0.3886,5.0131c-0.2054,2.7204 -0.383,4.9522 -0.3886,4.9577c-0.011,0.011 -0.9106,-0.744 -2.0042,-1.6822c-1.0882,-0.9382 -2.0098,-1.7155 -2.0486,-1.7266c-0.0334,-0.0166 -0.0998,0.011 -0.1387,0.061c-0.0554,0.0667 -0.0554,0.1054 0.0055,0.1886c0.0444,0.061 0.8218,0.9715 1.7321,2.0318c0.9161,1.0548 1.6488,1.932 1.6378,1.943c-0.0055,0.0055 -2.2373,0.1831 -4.9577,0.3886c-2.7204,0.2004 -4.9742,0.378 -5.0076,0.389c-0.0943,0.0334 -0.0943,0.2443 0,0.2777c0.0334,0.011 2.2874,0.1889 5.0076,0.3886c2.7204,0.2054 4.9522,0.383 4.9577,0.3886c0.011,0.011 -0.744,0.9106 -1.6822,2.0042c-0.9382,1.0882 -1.7155,2.0098 -1.7266,2.0486c-0.0166,0.0334 0.011,0.0998 0.061,0.1387c0.0998,0.0833 -0.1555,0.2887 2.2097,-1.7434c1.0603,-0.9106 1.9375,-1.6488 1.9488,-1.6378c0.011,0.011 0.1886,2.2651 0.3998,5.0021c0.2832,3.7697 0.3941,4.991 0.4498,5.0076c0.1222,0.0499 0.2388,-0.0278 0.2388,-0.1555c0,-0.2054 0.7327,-9.8321 0.7495,-9.8489c0.011,-0.011 0.8882,0.7217 1.943,1.6378c1.0603,0.9106 1.9709,1.6877 2.0318,1.7321c0.1001,0.0665 0.1222,0.0665 0.1999,-0.011c0.0778,-0.0778 0.0778,-0.0998 0.011,-0.1999c-0.0444,-0.061 -0.8218,-0.9715 -1.7321,-2.0318c-0.9161,-1.0548 -1.6488,-1.932 -1.6378,-1.943c0.0166,-0.0166 9.6434,-0.7495 9.8489,-0.7495c0.1277,-0 0.2054,-0.1166 0.1555,-0.2388c-0.0168,-0.0554 -1.2382,-0.1666 -5.0076,-0.4498c-2.737,-0.211 -4.991,-0.3886 -5.0021,-0.3998c-0.011,-0.011 0.7272,-0.8882 1.6378,-1.9486c2.0318,-2.365 1.8266,-2.1096 1.7431,-2.2097c-0.0389,-0.0499 -0.1054,-0.0778 -0.1387,-0.061c-0.0389,0.011 -0.9605,0.7884 -2.0486,1.7266c-1.0937,0.9382 -1.993,1.6932 -2.0042,1.6822c-0.0055,-0.0055 -0.1831,-2.2373 -0.3886,-4.9577c-0.1999,-2.7204 -0.3775,-4.9745 -0.3886,-5.0131c-0.0166,-0.0334 -0.0778,-0.0667 -0.1387,-0.0667c-0.0617,0.0005 -0.1226,0.0338 -0.1394,0.0672Z"
|
||||
android:fillColor="#000"/>
|
||||
</vector>
|
15
app/src/main/res/drawable/ic_star4.xml
Normal file
15
app/src/main/res/drawable/ic_star4.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M11.9153,0.2947c-0.2573,0.0828 -0.3034,0.1286 -0.4687,0.4366c-0.3492,0.6389 -1.489,3.139 -2.4818,5.4506c-0.2803,0.6571 -0.5378,1.218 -0.5652,1.2502c-0.0322,0.0276 -1.2638,0.354 -2.7437,0.7214c-3.5527,0.8827 -5.065,1.3193 -5.3405,1.5444c-0.0919,0.0734 -0.0919,0.0919 -0.0413,0.2206c0.1793,0.4274 1.1489,1.1489 3.1298,2.3302c1.6178,0.965 3.1207,2.0038 3.2033,2.2152c0.0506,0.1332 -0.1471,1.2823 -1.273,7.4086c-0.2666,1.4431 -0.2712,1.397 0.1517,1.6867c0.2573,0.1793 0.5009,0.239 0.6434,0.1608c0.0552,-0.0322 0.8779,-0.6756 1.8245,-1.434c2.831,-2.2658 4.3385,-3.4056 4.812,-3.6398l0.1884,-0.0919l0.2621,0.1241c0.1426,0.0734 1.057,0.6617 2.0359,1.3099c2.5692,1.705 3.4286,2.2152 3.8652,2.2841c0.6204,0.101 1.2271,-0.6571 1.218,-1.5211c-0.0091,-0.354 -0.1562,-0.9744 -1.025,-4.2696c-0.2803,-1.0618 -0.51,-1.9716 -0.51,-2.0268c0,-0.1195 0.3264,-0.4411 2.0453,-1.9992c1.705,-1.5487 2.707,-2.537 2.831,-2.7943c0.1838,-0.3768 0.0689,-0.671 -0.3814,-0.9744c-0.3355,-0.2251 -0.625,-0.317 -3.4836,-1.1306c-3.9984,-1.1352 -3.6768,-1.0342 -3.7548,-1.1628c-0.138,-0.2206 -0.6022,-1.08 -1.535,-2.845c-1.3145,-2.4818 -1.6776,-3.1207 -1.8199,-3.2126c-0.1524,-0.1008 -0.5386,-0.119 -0.7867,-0.041ZM12.6,2.2387c0.0782,0.1241 0.5928,1.1306 1.1443,2.2428c1.0846,2.1967 1.4201,2.831 1.5948,3.0194c0.138,0.1426 0.2849,0.1838 3.4378,0.9744c2.376,0.5928 3.4193,0.8779 3.4884,0.9468c0.0965,0.0965 -0.5654,0.8273 -0.7493,0.8273c-0.0413,-0 -0.193,-0.1378 -0.3355,-0.3125c-0.1426,-0.1702 -0.331,-0.3768 -0.4181,-0.4596c-0.1793,-0.1702 -0.2345,-0.1654 -0.4411,0.0552l-0.1104,0.115l0.3218,0.3814c0.1793,0.2114 0.3586,0.4411 0.409,0.5148l0.0828,0.1332l-0.409,0.3862c-0.2251,0.2114 -0.4229,0.3768 -0.4411,0.3722c-0.0185,-0.0091 -0.2942,-0.3446 -0.6158,-0.749c-0.7584,-0.9559 -0.671,-0.8779 -0.8458,-0.7354c-0.2803,0.239 -0.2803,0.2345 0.239,0.841c0.2621,0.3034 0.5561,0.671 0.6571,0.8136l0.1793,0.2666l-0.3862,0.3583c-0.2114,0.2021 -0.409,0.3631 -0.4366,0.3631c-0.0276,-0 -0.1426,-0.1517 -0.2527,-0.3355c-0.3631,-0.5928 -0.9559,-1.489 -1.0066,-1.5211c-0.0598,-0.0367 -0.2988,0.078 -0.4274,0.2069c-0.0919,0.0919 -0.0919,0.0919 0.0413,0.2621c0.216,0.2758 0.9514,1.3925 1.0663,1.6178l0.1056,0.2023l-0.2021,0.1747c-0.1104,0.0965 -0.2114,0.1747 -0.2251,0.1747c-0.0137,-0 -0.1702,-0.2345 -0.3446,-0.5194c-0.547,-0.8825 -1.0342,-1.5948 -1.0985,-1.6224c-0.078,-0.0322 -0.3907,0.1241 -0.5054,0.2482c-0.0828,0.0965 -0.078,0.101 0.3034,0.5928c0.547,0.6938 1.1398,1.5259 1.1398,1.5948c0,0.0322 -0.0413,0.0965 -0.0965,0.1471c-0.1978,0.1747 -0.1978,0.1793 0.2618,1.728c1.1904,4.0351 1.6224,5.6438 1.512,5.6438c-0.0461,-0 -0.7217,-0.432 -2.5692,-1.65c-1.0663,-0.7032 -2.0911,-1.3697 -2.2795,-1.489c-0.5054,-0.3125 -1.3466,-0.7032 -1.7832,-0.8273l-0.3814,-0.1104l-0.3953,-0.5928c-0.5928,-0.8916 -0.7812,-1.1215 -0.9146,-1.1215c-0.1195,-0 -0.2942,0.1471 -0.2942,0.2482c0,0.0367 0.2803,0.4229 0.625,0.8594l0.625,0.7906l-0.0689,0.3401c-0.1056,0.5148 -0.4183,0.9053 -0.6067,0.749c-0.0413,-0.0322 -0.3907,-0.4778 -0.7812,-0.9835c-0.3862,-0.5102 -0.7445,-0.9605 -0.7951,-1.0111c-0.0965,-0.0828 -0.101,-0.0828 -0.2573,0.0137c-0.3446,0.2114 -0.3034,0.317 0.4229,1.0939c0.7032,0.7584 0.9744,1.08 0.9744,1.1534c0,0.0506 -0.5194,0.5378 -0.648,0.6067c-0.0552,0.0322 -0.1793,-0.0919 -0.5791,-0.5882c-0.2803,-0.3492 -0.6022,-0.7354 -0.7169,-0.8594l-0.2069,-0.2297l-0.1286,0.0965c-0.0689,0.0506 -0.1699,0.1471 -0.216,0.216l-0.0922,0.119l0.115,0.1517c0.0643,0.0828 0.3677,0.4135 0.6756,0.7354c0.3034,0.3216 0.5561,0.6067 0.5561,0.6298c0,0.0643 -0.547,0.6893 -0.6526,0.7445c-0.1104,0.0598 -0.0552,0.1104 -0.6802,-0.648c-0.2621,-0.317 -0.4918,-0.5791 -0.5102,-0.5882c-0.023,-0.0091 -0.101,0.0276 -0.1793,0.0828c-0.2712,0.193 -0.2666,0.2069 0.2297,0.8549c0.2527,0.3264 0.4781,0.648 0.5009,0.7217c0.0461,0.1195 0.0322,0.1378 -0.2849,0.3722c-0.1838,0.1332 -0.5515,0.3907 -0.8227,0.5746c-0.3953,0.2618 -0.4963,0.3125 -0.4963,0.2436c0,-0.0458 0.1562,-1.0478 0.3401,-2.2198c0.2806,-1.7333 0.7769,-4.955 0.8734,-5.6398c0.0185,-0.1286 -0.0046,-0.1654 -0.1699,-0.3079c-0.2942,-0.2436 -1.1813,-0.8503 -2.9506,-2.0129c-1.7143,-1.1306 -2.0911,-1.3879 -2.0911,-1.4522c0,-0.0782 0.7951,-0.3125 3.24,-0.965c2.4312,-0.6434 3.2585,-0.9055 3.401,-1.057c0.0367,-0.0461 0.4687,-0.9283 0.9605,-1.9625c1.3649,-2.8954 2.0635,-4.2466 2.1876,-4.2466c0.0276,-0.0005 0.1104,0.096 0.1884,0.2155Z"
|
||||
android:fillColor="#000"/>
|
||||
<path
|
||||
android:pathData="M12.0715,4.0541c-0.216,0.331 -1.319,2.7482 -1.2823,2.808c0.0367,0.0598 0.3125,0.1702 0.4229,0.1702c0.101,-0 0.1562,-0.1056 0.8825,-1.7143c0.2527,-0.5515 0.455,-1.0296 0.455,-1.0663c0,-0.0598 -0.2988,-0.2988 -0.3768,-0.2988c-0.0185,0.0002 -0.0646,0.0463 -0.1013,0.1013Z"
|
||||
android:fillColor="#000"/>
|
||||
<path
|
||||
android:pathData="M8.1835,9.1694c-0.6665,0.1975 -2.2428,0.7354 -2.5598,0.8779c-0.1332,0.0552 -0.2436,0.1241 -0.2436,0.1471c0,0.0782 0.2621,0.331 0.3446,0.331c0.2206,-0 2.9918,-0.7906 3.1298,-0.8962c0.1426,-0.101 0.0828,-0.6204 -0.0643,-0.6204c-0.0415,0.0043 -0.3173,0.0732 -0.6067,0.1606Z"
|
||||
android:fillColor="#000"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_star5.xml
Normal file
9
app/src/main/res/drawable/ic_star5.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M11.5282,0.3206c-0.8782,0.2897 -1.7287,1.3056 -2.6066,3.108c-0.3355,0.6943 -0.846,1.9447 -1.1309,2.7586c-0.0919,0.2758 -0.1747,0.5102 -0.1793,0.515c-0.0046,0.0091 -0.3953,0.0322 -0.8782,0.0598c-3.0941,0.1702 -4.9514,0.6482 -5.8663,1.5079c-0.3953,0.3725 -0.5794,0.731 -0.6206,1.1861c-0.1058,1.2689 1.1676,3.071 3.6869,5.2133c0.4001,0.3403 0.7769,0.6622 0.8321,0.7126l0.1058,0.0919l-0.2069,0.7586c-0.2575,0.9562 -0.492,2.0366 -0.6206,2.8963c-0.1471,0.947 -0.1517,2.5193 -0.0046,3.0434c0.2575,0.9334 0.7447,1.4251 1.5494,1.5586c0.2621,0.0413 0.4183,0.0367 0.8045,-0.0185c1.2322,-0.1838 2.6758,-0.8736 4.7906,-2.2942l0.809,-0.547l0.7771,0.5242c1.793,1.2182 3.209,1.9447 4.3584,2.2435c0.5794,0.1517 1.3056,0.1471 1.7011,-0.0046c0.3403,-0.1334 0.7356,-0.515 0.9058,-0.8736c0.4459,-0.9425 0.455,-2.3998 0.0367,-4.602c-0.1104,-0.5654 -0.455,-2.009 -0.6206,-2.5975c-0.023,-0.0737 0.0552,-0.161 0.4459,-0.4781c1.8571,-1.5216 3.2364,-3.0158 3.7927,-4.11c1.2228,-2.4137 -0.5794,-3.7882 -5.4526,-4.1652c-0.3401,-0.023 -0.7862,-0.0461 -0.9886,-0.0461c-0.5148,-0 -0.5563,-0.0185 -0.6252,-0.2436c-0.115,-0.4001 -0.5748,-1.5998 -0.8827,-2.3078c-1.301,-3.0115 -2.616,-4.3171 -3.9125,-3.8897ZM12.089,4.2562c0.3677,0.1884 0.8045,1.2413 1.7011,4.0918l0.4046,1.2874l0.547,0.0276c0.2988,0.0185 0.8873,0.0322 1.3056,0.0367c1.4345,0.0091 2.6342,0.138 3.1584,0.3355c0.3355,0.1241 0.5654,0.3403 0.5654,0.5378c0,0.5748 -0.9103,1.4758 -3.2182,3.1999c-0.469,0.3494 -0.8551,0.6391 -0.8642,0.6482c-0.0091,0.0046 0.1517,0.4598 0.3494,1.0114c0.685,1.8895 0.9288,2.7722 0.961,3.4894c0.0185,0.4505 0.0091,0.5196 -0.0737,0.6528c-0.115,0.1838 -0.2758,0.2299 -0.5976,0.1608c-0.5654,-0.1195 -1.5862,-0.7493 -3.3055,-2.0412c-0.8827,-0.6619 -0.9886,-0.731 -1.062,-0.6713c-0.0506,0.0322 -0.5057,0.377 -1.0207,0.7678c-1.6966,1.2874 -2.6758,1.8758 -3.209,1.9217c-0.1608,0.0139 -0.3034,0.0046 -0.3631,-0.0276c-0.4781,-0.2575 -0.3173,-1.4666 0.5609,-4.1285c0.216,-0.6482 0.3862,-1.1861 0.3816,-1.1906c-0.0046,-0 -0.3494,-0.253 -0.7678,-0.5563c-2.731,-1.9903 -3.5815,-2.8594 -3.3331,-3.3835c0.1332,-0.2806 0.5654,-0.4459 1.4482,-0.5609c0.4414,-0.0598 2.694,-0.1562 3.7102,-0.1608l0.2851,-0l0.2345,-0.7493c1.0435,-3.3286 1.4942,-4.4549 1.8619,-4.6802c0.1654,-0.1058 0.1793,-0.1058 0.3401,-0.0185Z"
|
||||
android:fillColor="#000"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_star6.xml
Normal file
9
app/src/main/res/drawable/ic_star6.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M11.7038,0.8614c-0.1092,0.0578 -0.257,0.2122 -0.3278,0.3408c-0.077,0.1286 -0.63,1.7678 -1.2408,3.6451c-0.6043,1.8708 -1.1443,3.4716 -1.1957,3.5486c-0.0514,0.0835 -0.2057,0.2057 -0.347,0.2765c-0.2443,0.1222 -0.373,0.1286 -3.9924,0.1286c-4.1081,-0 -4.0694,-0.0065 -4.2689,0.3922c-0.1351,0.2508 -0.1222,0.4565 0.0514,0.7008c0.0838,0.1351 1.3181,1.0673 3.131,2.3851c1.6457,1.1957 3.0408,2.2565 3.0986,2.353c0.0643,0.0965 0.1157,0.3022 0.1157,0.45c0,0.1735 -0.3986,1.4851 -1.1251,3.7286c-0.6557,2.0251 -1.1251,3.5616 -1.1251,3.703c0,0.1994 0.0451,0.2957 0.2251,0.4757c0.2057,0.2057 0.257,0.2251 0.5078,0.1992c0.1543,-0.0192 0.3792,-0.103 0.5014,-0.1865c0.1157,-0.0773 1.4594,-1.0478 2.9765,-2.1473c1.5238,-1.1057 2.8286,-2.0381 2.9059,-2.0765c0.077,-0.0451 0.27,-0.0773 0.4243,-0.0773c0.3473,-0 0.1286,-0.1478 3.6324,2.4043c1.4978,1.0865 2.7965,1.9994 2.8865,2.0378c0.3086,0.1157 0.5335,0.0708 0.7651,-0.1608c0.1735,-0.1735 0.2186,-0.27 0.2186,-0.4692c0,-0.1414 -0.4692,-1.6778 -1.1251,-3.703c-0.7265,-2.2438 -1.1251,-3.5551 -1.1251,-3.7286c0,-0.1478 0.0514,-0.3535 0.1157,-0.45c0.0578,-0.0965 1.453,-1.1573 3.0986,-2.353c1.8134,-1.3174 3.0478,-2.2495 3.1378,-2.3846c0.1673,-0.2443 0.18,-0.45 0.0451,-0.7008c-0.1992,-0.3986 -0.1608,-0.3922 -4.2689,-0.3922c-3.6194,-0 -3.7481,-0.0065 -3.9924,-0.1286c-0.1414,-0.0708 -0.2957,-0.193 -0.3473,-0.2765c-0.0514,-0.077 -0.5914,-1.6778 -1.1957,-3.5486c-0.6108,-1.8773 -1.1443,-3.4781 -1.1894,-3.5681c-0.2184,-0.4178 -0.6235,-0.5914 -0.9708,-0.4178ZM13.0219,5.471c0.54,1.6716 1.0416,3.1502 1.1057,3.2786c0.1608,0.3151 0.5208,0.6557 0.8873,0.8357c0.2957,0.1478 0.3151,0.1478 3.7546,0.18l3.4586,0.0322l-2.7194,1.9738c-2.1022,1.53 -2.7643,2.0443 -2.8994,2.25c-0.2314,0.36 -0.3857,0.9065 -0.3535,1.2343c0.0192,0.1478 0.4886,1.6651 1.0416,3.3751c0.5592,1.71 1.003,3.1181 0.99,3.1243c-0.013,0.013 -1.2343,-0.8551 -2.713,-1.9286c-1.4786,-1.0738 -2.7773,-1.9865 -2.8865,-2.0251c-0.1092,-0.0322 -0.3473,-0.0835 -0.5273,-0.103c-0.6686,-0.0835 -0.7973,-0.0065 -3.7289,2.1216c-1.4851,1.0735 -2.7065,1.9478 -2.7194,1.9351c-0.013,-0.013 0.4308,-1.4208 0.99,-3.1308c0.553,-1.7038 1.0222,-3.2208 1.0414,-3.3686c0.0322,-0.3278 -0.1222,-0.8743 -0.3535,-1.2278c-0.1349,-0.2122 -0.81,-0.733 -2.8994,-2.25l-2.7194,-1.98l3.4586,-0.0322c3.4394,-0.0322 3.4586,-0.0322 3.7546,-0.18c0.3665,-0.18 0.7265,-0.5208 0.8873,-0.8357c0.0643,-0.1286 0.5594,-1.6073 1.1057,-3.2786c0.54,-1.6651 1.003,-3.0346 1.0222,-3.0346c0.0194,-0.0002 0.4824,1.3692 1.0224,3.0343Z"
|
||||
android:fillColor="#000"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_star7.xml
Normal file
9
app/src/main/res/drawable/ic_star7.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M4.8192,22.9896l2.748,-8.3472l-7.3272,-5.1528l9.0456,-0l2.7768,-8.4984l0.0288,-0l2.7576,8.4984l8.9112,-0l-7.224,5.1168l2.748,8.3568l-7.2504,-5.2032l-7.2144,5.2296ZM15.7056,18.0984l-1.3872,-4.2312l3.5784,-2.4912l-4.428,-0l-0.9528,-2.9544l0,0.0096l0,7.3464l3.1896,2.3208ZM4.7808,23.0088l0.0384,-0.0192l-0.0096,0.0192l-0.0288,-0Z"
|
||||
android:fillColor="#000"/>
|
||||
</vector>
|
@ -1,12 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/rel_main"
|
||||
android:id="@+id/main_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#000"
|
||||
tools:context="clock.socoolby.com.clock.MainActivity">
|
||||
|
||||
<clock.socoolby.com.clock.widget.animatorview.AnimatorView
|
||||
android:id="@+id/tv_background_animatorview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#00FFFFFF"
|
||||
/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rel_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#00FFFFFF"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="match_parent"
|
||||
@ -24,6 +38,7 @@
|
||||
android:gravity="center"
|
||||
android:text='"hand up"'
|
||||
android:textColor="#fff"
|
||||
android:background="#00FFFFFF"
|
||||
android:textSize="80sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
@ -34,6 +49,7 @@
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="#00FFFFFF"
|
||||
android:textColor="#fff"
|
||||
android:textSize="32sp" />
|
||||
|
||||
@ -48,6 +64,45 @@
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_handup" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_background_color"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_toRightOf="@+id/tv_hand"
|
||||
android:layout_below="@+id/tv_date"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_background_color"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_foreground_color"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_toRightOf="@+id/tv_background_color"
|
||||
android:layout_below="@+id/tv_date"
|
||||
android:layout_marginLeft="25dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_foreground_color"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_foreground_color1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_toRightOf="@+id/tv_foreground_color"
|
||||
android:layout_below="@+id/tv_date"
|
||||
android:layout_marginLeft="25dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_foreground_color"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_day"
|
||||
android:layout_width="wrap_content"
|
||||
@ -56,10 +111,10 @@
|
||||
android:layout_below="@+id/tv_date"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="#00FFFFFF"
|
||||
android:textColor="#fff"
|
||||
android:textSize="26sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_weather"
|
||||
android:layout_width="wrap_content"
|
||||
@ -69,6 +124,7 @@
|
||||
android:clickable="true"
|
||||
android:text=" "
|
||||
android:textColor="#fff"
|
||||
android:background="#00FFFFFF"
|
||||
android:textSize="22sp"
|
||||
/>
|
||||
|
||||
@ -98,6 +154,7 @@
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center"
|
||||
android:textColor="#fff"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_weight="8"
|
||||
android:textSize="26sp" />
|
||||
|
||||
@ -114,3 +171,10 @@
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
<clock.socoolby.com.clock.widget.animatorview.AnimatorView
|
||||
android:id="@+id/tv_foreground_animatorview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#00FFFFFF"
|
||||
/>
|
||||
</FrameLayout>
|
290
app/src/main/res/layout/pop_color_picker.xml
Normal file
290
app/src/main/res/layout/pop_color_picker.xml
Normal file
@ -0,0 +1,290 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:ColorBars="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/dialog_color_picker_title"
|
||||
android:orientation="horizontal"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"
|
||||
>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/bar_title_left"
|
||||
android:background="@android:color/transparent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:src="@drawable/ic_back" />
|
||||
<TextView
|
||||
android:id="@+id/bar_title_title"
|
||||
android:text="@string/dialog_folder_title"
|
||||
android:gravity="center"
|
||||
android:textSize="20sp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_weight="5"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/bar_title_right"
|
||||
android:background="@android:color/transparent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:src="@drawable/ic_check_box_black_24dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="10"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="fill"
|
||||
>
|
||||
<LinearLayout
|
||||
android:id="@+id/default_color_col"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/default_color_sample"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="#000000"
|
||||
android:text="黑"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/default_color_sample1"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:background="#FFFFFF"
|
||||
android:text="白"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/default_color_sample2"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:background="#292421"
|
||||
android:text="象牙黑"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/default_color_sample3"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:background="#C0C0C0"
|
||||
android:text="灰色"
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFFFF"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/default_color_sample4"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:background="#FAEBD7"
|
||||
android:text="古董白"
|
||||
android:gravity="center"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/default_color_col1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/default_color_sample5"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:background="#FFD700"
|
||||
android:text="金黄色"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/default_color_sample6"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:background="#F5DEB3"
|
||||
android:text="淡黄色"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/default_color_sample7"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
android:layout_height="35dp"
|
||||
android:background="#4169E1"
|
||||
android:text="品蓝"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/default_color_sample8"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:background="#00FFFF"
|
||||
android:text="青色"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/default_color_sample9"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:background="#3D9140"
|
||||
android:text="钴绿色"
|
||||
android:gravity="center"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<com.larswerkman.holocolorpicker.ColorPicker
|
||||
android:id="@+id/dialog_color_picker_colorPicker"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/dialog_color_picker_tv_sv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:text="@string/color_depth"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="30dp" />
|
||||
|
||||
<com.larswerkman.holocolorpicker.SVBar
|
||||
android:id="@+id/dialog_color_picker_svbar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
ColorBars:bar_orientation_horizontal="false"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/dialog_color_picker_tv_opacity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:text="@string/transparency"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="30dp" />
|
||||
|
||||
<com.larswerkman.holocolorpicker.OpacityBar
|
||||
android:id="@+id/dialog_color_picker_opacity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
ColorBars:bar_orientation_horizontal="false"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/default_color_col2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/default_color_sample10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="#8A2BE2"
|
||||
android:text="紫罗蓝"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/default_color_sample11"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:background="#DDA0DD"
|
||||
android:text="梅红"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/default_color_sample12"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:background="#9370DB"
|
||||
android:text="中紫色"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/default_color_sample13"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:background="#B0E0E6"
|
||||
android:text="粉蓝色"
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFFFF"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/default_color_sample14"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:background="#228B22"
|
||||
android:text="森林绿"
|
||||
android:gravity="center"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -23,4 +23,8 @@
|
||||
<string name="trigger_on_and_auto_off">自动息屏</string>
|
||||
<string name="trigger_manual_on_and_off">手动设置屏显</string>
|
||||
<string name="no_trigger">关闭触发</string>
|
||||
<string name="transparency">透明度</string>
|
||||
<string name="color_depth">深度</string>
|
||||
<string name="dialog_folder_title">对话框标题</string>
|
||||
<string name="examples_text">示列文本</string>
|
||||
</resources>
|
@ -26,4 +26,8 @@
|
||||
<string name="except">Except</string>
|
||||
<string name="motto">Motto</string>
|
||||
<string name="version">Version:</string>
|
||||
<string name="dialog_folder_title">dialog_folder_title</string>
|
||||
<string name="color_depth">color_depth</string>
|
||||
<string name="transparency">transparency</string>
|
||||
<string name="examples_text">examples_text</string>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user