All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.robolectric.shadows.ShadowPreference Maven / Gradle / Ivy

There is a newer version: 4.14
Show newest version
package org.robolectric.shadows;

import android.preference.Preference;
import android.preference.PreferenceManager;
import org.robolectric.annotation.Implements;
import org.robolectric.annotation.RealObject;
import org.robolectric.shadow.api.Shadow;
import org.robolectric.util.ReflectionHelpers.ClassParameter;

@Implements(Preference.class)
public class ShadowPreference {
  @RealObject private Preference realPreference;

  public void callOnAttachedToHierarchy(PreferenceManager preferenceManager) {
    Shadow.directlyOn(realPreference, Preference.class, "onAttachedToHierarchy",
        ClassParameter.from(PreferenceManager.class, preferenceManager));
  }

  public boolean click() {
    return realPreference.getOnPreferenceClickListener().onPreferenceClick(realPreference);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy