Add initInternal to ViewController.
ViewController's init method was not ideal to override. On the one hand, if you put a call super.init() first your onViewAttach method is called before you're subclass's init. Further, if you put your own code befer super.init(), you are still left with the problem that your init is not automatically idempotent, and multiple calls to #init() could result in multiple executions of your code unless you handle it yourself. With this change, #initInternal() is introduced, giving ViewControllers a place to put their run-once code such that it runs before any view-attachment callbacks are fired. Fixes: 171472009 Test: manual Change-Id: I2e284024c82e3f7c7b6f29f22a1ffa3c8aae9fcb
This commit is contained in:
@@ -92,8 +92,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
|
||||
* Attach the controller to the view it relates to.
|
||||
*/
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
public void initInternal() {
|
||||
mKeyguardSliceViewController.init();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user