[*] 每日优化
This commit is contained in:
@@ -12,8 +12,8 @@
|
|||||||
单例变量
|
单例变量
|
||||||
单例静态函数
|
单例静态函数
|
||||||
构造函数
|
构造函数
|
||||||
静态成员函数
|
|
||||||
成员函数(public/protected/private)
|
成员函数(public/protected/private)
|
||||||
|
静态成员函数
|
||||||
getter/setter
|
getter/setter
|
||||||
|
|
||||||
## 日常任务
|
## 日常任务
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
Log.i(MainActivity.class.getSimpleName(), "onDestroy");
|
Log.i(MainActivity.class.getSimpleName(), "onDestroy");
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
// 资源释放
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -134,6 +135,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
if (this.mainHandler != null) {
|
if (this.mainHandler != null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Log.i(MainActivity.class.getSimpleName(), "拉起媒体服务");
|
||||||
this.mainHandler = new MainHandler();
|
this.mainHandler = new MainHandler();
|
||||||
final Context context = this.getApplicationContext();
|
final Context context = this.getApplicationContext();
|
||||||
final Resources resources = this.getResources();
|
final Resources resources = this.getResources();
|
||||||
@@ -155,7 +157,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
// 注意:不能使用intent传递
|
// 注意:不能使用intent传递
|
||||||
MediaService.mainHandler = this.mainHandler;
|
MediaService.mainHandler = this.mainHandler;
|
||||||
Log.i(MainActivity.class.getSimpleName(), "拉起媒体服务");
|
|
||||||
final Intent intent = new Intent(this, MediaService.class);
|
final Intent intent = new Intent(this, MediaService.class);
|
||||||
intent.setAction(MediaService.Action.CONNECT.name());
|
intent.setAction(MediaService.Action.CONNECT.name());
|
||||||
this.startService(intent);
|
this.startService(intent);
|
||||||
@@ -241,6 +242,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* MainHandler
|
* MainHandler
|
||||||
|
* 后台线程和UI线程关联线程Handler
|
||||||
*
|
*
|
||||||
* @author acgist
|
* @author acgist
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -278,6 +278,7 @@ public final class MediaManager {
|
|||||||
if(this.textToSpeech != null) {
|
if(this.textToSpeech != null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Log.i(MediaManager.class.getSimpleName(), "加载TTS");
|
||||||
this.textToSpeech = new TextToSpeech(context, new MediaManager.TextToSpeechInitListener());
|
this.textToSpeech = new TextToSpeech(context, new MediaManager.TextToSpeechInitListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user