/*
 * Copyright 2016 Peter Kenji Yamanaka
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.pyamsoft.powermanager.app.manager.custom;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import com.pyamsoft.powermanager.PowerManager;
import com.pyamsoft.powermanager.dagger.manager.custom.DaggerManagerDelayComponent;
import javax.inject.Inject;
import javax.inject.Named;

public final class ManagerDelayPreference extends ManagerTimePreference {

  @Nullable @Named("delay") @Inject ManagerTimePresenter presenter;

  public ManagerDelayPreference(Context context, AttributeSet attrs, int defStyleAttr,
      int defStyleRes) {
    super(context, attrs, defStyleAttr, defStyleRes);

    DaggerManagerDelayComponent.builder()
        .powerManagerComponent(PowerManager.getInstance().getPowerManagerComponent())
        .build()
        .inject(this);
  }

  public ManagerDelayPreference(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
  }

  public ManagerDelayPreference(Context context, AttributeSet attrs) {
    super(context, attrs);
  }

  public ManagerDelayPreference(Context context) {
    super(context);
  }

  public final void bindView() {
    assert presenter != null;
    bindView(presenter);
  }
}

@@ -1037,16 +1037,24 @@
 ullable 
+@Inject 
 @Named(%22
@@ -1060,24 +1060,16 @@
 %22delay%22)
- @Inject
  Manager
@@ -1519,37 +1519,36 @@
 tyleAttr) %7B%0A    
-super
+this
 (context, attrs,
@@ -1560,16 +1560,19 @@
 tyleAttr
+, 0
 );%0A  %7D%0A%0A
@@ -1638,37 +1638,36 @@
 et attrs) %7B%0A    
-super
+this
 (context, attrs)
@@ -1665,16 +1665,19 @@
 t, attrs
+, 0
 );%0A  %7D%0A%0A
@@ -1731,29 +1731,28 @@
 ) %7B%0A    
-super
+this
 (context
 );%0A  %7D%0A%0A
@@ -1743,16 +1743,22 @@
 (context
+, null
 );%0A  %7D%0A%0A

Fix preference initialization