@Override protected void onStart() { log("onStart"); super.onStart(); App.get().setCurrentActivity(this); App.get().setActiveCase(getCase()); }
@Override public void onLowMemory() { int usedMem = (int) (MemoryHelper.getAvailableMemory() / 1024); log("onLowMemory : " + usedMem + "K"); super.onLowMemory(); App.get().onLowMemory(); }
@Override protected void onCreate(Bundle savedInstanceState) { log("onCreate"); App.get().onCreateActivity(); super.onCreate(savedInstanceState); onCreate(); getCase().attach(CaseActivity.this); }
@SuppressWarnings("unchecked") public ICase<FragmentActivity> getCase() { if (kase == null) { kase = (ICase<FragmentActivity>) App.get().findChildCase(getCaseName()); } Logger.check(kase != null, getCaseName() + " has not been created!"); return kase; }
@Override protected void onDestroy() { int usedMemBegin = (int) (MemoryHelper.getAvailableMemory() / 1024); super.onDestroy(); getCase().detach(); App.get().onDestroyActivity(); ViewGroup contentFrame = (ViewGroup) findViewById(android.R.id.content); ViewHelper.clean(contentFrame); System.gc(); int usedMemEnd = (int) (MemoryHelper.getAvailableMemory() / 1024); log("onDestroy : " + usedMemBegin + "K -> " + usedMemEnd + "K"); }
@Override protected void onResume() { if (App.get().getCurrentActivity() != this) { App.get().setCurrentActivity(this); log("restore current activity"); } if (!this.getCase().isActive()) { App.get().setActiveCase(getCase()); log("restore active case"); } int usedMemBegin = (int) (MemoryHelper.getAvailableMemory() / 1024); System.gc(); super.onResume(); getCase().onShow(); int usedMemEnd = (int) (MemoryHelper.getAvailableMemory() / 1024); log("onResume : " + usedMemBegin + "K -> " + usedMemEnd + "K"); App.get().checkMemory(); if (App.get().isExiting()) { log("Finishing"); finish(); } }
public void run(IParticle p) { float x = this.center.x() + App.get().random(-this.diameter / 2, this.diameter / 2); float y = this.center.y() + App.get().random(-this.diameter / 2, this.diameter / 2); p.setPos(new Vec(x, y)); }