|
|
@@ -3,6 +3,7 @@
|
|
|
*/
|
|
|
package kr.co.zumo.app.lifeplus.activity;
|
|
|
|
|
|
+import android.arch.lifecycle.ViewModelProviders;
|
|
|
import android.os.Bundle;
|
|
|
import android.support.annotation.CallSuper;
|
|
|
import android.support.v7.app.AppCompatActivity;
|
|
|
@@ -11,8 +12,10 @@ import android.util.Log;
|
|
|
import com.bumptech.glide.Glide;
|
|
|
|
|
|
import kr.co.zumo.app.R;
|
|
|
-import kr.co.zumo.app.lifeplus.manager.ActionBarManager;
|
|
|
-import kr.co.zumo.app.lifeplus.manager.ActionButtonManager;
|
|
|
+import kr.co.zumo.app.lifeplus.application.App;
|
|
|
+import kr.co.zumo.app.lifeplus.helper.Helper;
|
|
|
+import kr.co.zumo.app.lifeplus.helper.ActionBarHelper;
|
|
|
+import kr.co.zumo.app.lifeplus.helper.ActionButtonHelper;
|
|
|
import kr.co.zumo.app.lifeplus.model.SuperModel;
|
|
|
import kr.co.zumo.app.lifeplus.supervisor.DialogHelper;
|
|
|
import kr.co.zumo.app.lifeplus.supervisor.FragmentSkipBackChanger;
|
|
|
@@ -63,6 +66,7 @@ public class MainActivity extends AppCompatActivity {
|
|
|
// e.printStackTrace();
|
|
|
// }
|
|
|
|
|
|
+ new AppInitializer().init(App.getInstance().getContext());
|
|
|
|
|
|
if (SuperModel.getInstance().isMember()) {
|
|
|
ScreenIDMapper.getInstance().toMember().print();
|
|
|
@@ -75,10 +79,10 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
|
|
// actionbar
|
|
|
setSupportActionBar(findViewById(R.id.toolbar));
|
|
|
- ActionBarManager.getInstance().init(this, this.getSupportActionBar(), findViewById(R.id.layout_app_bar), findViewById(R.id.container_main));
|
|
|
+ getHelper(ActionBarHelper.class).init(this, this.getSupportActionBar(), findViewById(R.id.layout_app_bar), findViewById(R.id.container_main));
|
|
|
|
|
|
// floating action button
|
|
|
- ActionButtonManager.getInstance().init(findViewById(R.id.floating_action_button));
|
|
|
+ getHelper(ActionButtonHelper.class).init(findViewById(R.id.floating_action_button));
|
|
|
|
|
|
ScreenChangerHelper.getInstance().setAppCompatActivity(this);
|
|
|
ScreenChangerHelper.getInstance().setContainerId(R.id.container_main);
|
|
|
@@ -100,8 +104,6 @@ public class MainActivity extends AppCompatActivity {
|
|
|
protected void onDestroy() {
|
|
|
Log.w("APP# MainActivity | onDestroy", "| <<<<<<<<<<<<< " + this.getClass().getSimpleName());
|
|
|
|
|
|
- ActionBarManager.getInstance().destroy();
|
|
|
- ActionButtonManager.getInstance().destroy();
|
|
|
ScreenIDMapper.getInstance().destroy();
|
|
|
|
|
|
Glide.get(this).clearMemory();
|
|
|
@@ -147,6 +149,21 @@ public class MainActivity extends AppCompatActivity {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ protected void onSaveInstanceState(Bundle outState) {
|
|
|
+ super.onSaveInstanceState(outState);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 각종 Helper 객체를 반환한다.
|
|
|
+ * - Activity 에 종속되는 객체로 그 안에서 싱글톤처럼 사용.
|
|
|
+ *
|
|
|
+ * @param helperClass DeliveryHelper.class
|
|
|
+ * @return new DeliveryHelper() or exist object
|
|
|
+ */
|
|
|
+ public <H extends Helper> H getHelper(Class<H> helperClass) {
|
|
|
+ return ViewModelProviders.of(this).get(helperClass);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|