use of android.widget.ProgressBar in project robolectric by robolectric.
the class ShadowWindowTest method getIndeterminateProgressBar_returnsTheIndeterminateProgressBar.
@Test
public void getIndeterminateProgressBar_returnsTheIndeterminateProgressBar() {
ActivityController<TestActivity> testActivityActivityController = Robolectric.buildActivity(TestActivity.class);
TestActivity activity = testActivityActivityController.get();
activity.requestFeature = Window.FEATURE_INDETERMINATE_PROGRESS;
testActivityActivityController.create();
ProgressBar indeterminate = shadowOf(activity.getWindow()).getIndeterminateProgressBar();
assertThat(indeterminate.getVisibility()).isEqualTo(View.INVISIBLE);
activity.setProgressBarIndeterminateVisibility(true);
assertThat(indeterminate.getVisibility()).isEqualTo(View.VISIBLE);
activity.setProgressBarIndeterminateVisibility(false);
assertThat(indeterminate.getVisibility()).isEqualTo(View.GONE);
}
use of android.widget.ProgressBar in project robolectric by robolectric.
the class ShadowWindowTest method getProgressBar_returnsTheProgressBar.
@Test
public void getProgressBar_returnsTheProgressBar() {
Activity activity = Robolectric.buildActivity(TestActivity.class).create().get();
ProgressBar progress = shadowOf(activity.getWindow()).getProgressBar();
assertThat(progress.getVisibility()).isEqualTo(View.INVISIBLE);
activity.setProgressBarVisibility(true);
assertThat(progress.getVisibility()).isEqualTo(View.VISIBLE);
activity.setProgressBarVisibility(false);
assertThat(progress.getVisibility()).isEqualTo(View.GONE);
}
use of android.widget.ProgressBar in project howabout-android by recomio.
the class ShowImageListAdapter method getView.
@Override
public View getView(int position, View convertView, final ViewGroup parent) {
final View showImageListItemView;
if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
showImageListItemView = inflater.inflate(R.layout.show_image_item, parent, false);
} else {
showImageListItemView = convertView;
}
final ImageView imageView = (ImageView) showImageListItemView.findViewById(R.id.image);
final ProgressBar progressBar = (ProgressBar) showImageListItemView.findViewById(R.id.load);
String imageUrl = imageList.get(position).getBasicUrl();
imageLoader.displayImage(imageUrl, imageView, new ImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
progressBar.setVisibility(View.VISIBLE);
imageView.setVisibility(View.GONE);
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
progressBar.setVisibility(View.GONE);
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
// 스크린 width에 꽉 차게 view 리사이징.
float ratio = (float) parent.getWidth() / (float) loadedImage.getWidth();
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(parent.getWidth(), (int) ((float) loadedImage.getHeight() * ratio));
imageView.setLayoutParams(lp);
// margin.
lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
lp.setMargins(1, 1, 1, 1);
imageView.setLayoutParams(lp);
imageView.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.GONE);
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
progressBar.setVisibility(View.GONE);
}
});
return showImageListItemView;
}
use of android.widget.ProgressBar in project robolectric by robolectric.
the class ShadowProgressBarTest method setUp.
@Before
public void setUp() {
AttributeSet attrs = Robolectric.buildAttributeSet().addAttribute(android.R.attr.max, "100").addAttribute(android.R.attr.indeterminate, "false").addAttribute(android.R.attr.indeterminateOnly, "false").build();
progressBar = new ProgressBar(application, attrs);
}
use of android.widget.ProgressBar in project fqrouter by fqrouter.
the class MainActivity method updateStatus.
public void updateStatus(String status, int progress) {
LogUtils.i(status);
TextView textView = (TextView) findViewById(R.id.statusTextView);
textView.setText(status);
ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar);
progressBar.setProgress(progress);
}
Aggregations