能够熟练控制线程, 使用线程通信控制app
熟悉activity,service结构和过程
了解并熟悉内存分配和垃圾回收机制,能够合理的控制app的内存抖动。
能够熟练的控制不同层级view之间的事件分发。
启动页面:
/**
*启动页面
*
*@version 0.0.01
*@date 2019-8-15
*@author eloy
*/
public class Splash extends AppCompatActivity{
/**
*在此存放每个activity的根布局(如果用户使用某些手段绕过splah activity,直接启动主页面会导致程序崩溃)
*/
public static final ArrayList<View> rootView = new ArrayList<View>();
private void init(){
//添加splash页面view
View splah = getLayoutInflator.inflate(R.layout.splash, null);
rootView.add(splash);
//添加main页面view
View main = getLayoutInflator.inflate(R.layout.main, null);
rootView.add(main);
}
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(Splah.rootView.get(0));
initView();
//....
}
/**
*跳转到main页面
*/
private void jump(){
new CountDownTimer(){
@Override
onTick(long remain){
}
@Override
onFinish(){
startActivity(new Intent(Splash.this, Main,class));
finish();
}
}.start();
}
/**
*自写一个CountDownTimer
*/
private static abstract class CountDownTimer extends Thread{
private long count = 0L;
private long period = 1000L;
CountDownTimer(long count){
this.count = count;
}
CountDownTimer(long count,long period ){
this.count = count;
this.period=period;
}
public abstract void onTick(long remain);
public abstract void onFinish();
@Override
public void cancel(){
super.cancel();
this.interrupt();
}
@Override
public synchronized void run(){
super.run();
while(!interrupted() && count>0){
long start = System.currentTimeMills();
count