
org.robolectric.shadows.ShadowProgressDialog Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of framework Show documentation
Show all versions of framework Show documentation
An alternative Android testing framework.
The newest version!
package org.robolectric.shadows;
import android.app.ProgressDialog;
import android.widget.TextView;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.annotation.RealObject;
import org.robolectric.util.ReflectionHelpers;
import static org.robolectric.shadow.api.Shadow.directlyOn;
@SuppressWarnings({"UnusedDeclaration"})
@Implements(ProgressDialog.class)
public class ShadowProgressDialog extends ShadowAlertDialog {
@RealObject ProgressDialog realProgressDialog;
private int mProgressStyle;
/**
* @return the message displayed in the dialog
*/
@Override
public CharSequence getMessage() {
if (mProgressStyle == ProgressDialog.STYLE_HORIZONTAL) {
return super.getMessage();
} else {
TextView message = ReflectionHelpers.getField(realProgressDialog, "mMessageView");
return message.getText();
}
}
@Implementation
public void setProgressStyle(int style) {
mProgressStyle = style;
directlyOn(realProgressDialog, ProgressDialog.class).setProgressStyle(style);
}
/**
* @return the style of the progress dialog
*/
public int getProgressStyle() {
return mProgressStyle;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy