Search in sources :

Example 6 with ProgressBar

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);
}
Also used : ProgressBar(android.widget.ProgressBar) Test(org.junit.Test)

Example 7 with ProgressBar

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);
}
Also used : Activity(android.app.Activity) ProgressBar(android.widget.ProgressBar) Test(org.junit.Test)

Example 8 with ProgressBar

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;
}
Also used : Bitmap(android.graphics.Bitmap) ImageLoadingListener(com.nostra13.universalimageloader.core.assist.ImageLoadingListener) LayoutInflater(android.view.LayoutInflater) RelativeLayout(android.widget.RelativeLayout) ImageView(android.widget.ImageView) FailReason(com.nostra13.universalimageloader.core.assist.FailReason) ImageView(android.widget.ImageView) View(android.view.View) ProgressBar(android.widget.ProgressBar)

Example 9 with ProgressBar

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);
}
Also used : AttributeSet(android.util.AttributeSet) ProgressBar(android.widget.ProgressBar) Before(org.junit.Before)

Example 10 with ProgressBar

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);
}
Also used : TextView(android.widget.TextView) ProgressBar(android.widget.ProgressBar)

Aggregations

ProgressBar (android.widget.ProgressBar)193 TextView (android.widget.TextView)66 View (android.view.View)63 ImageView (android.widget.ImageView)41 LinearLayout (android.widget.LinearLayout)30 Context (android.content.Context)18 ViewGroup (android.view.ViewGroup)16 WindowManager (android.view.WindowManager)14 FrameLayout (android.widget.FrameLayout)14 Drawable (android.graphics.drawable.Drawable)13 Dialog (android.app.Dialog)12 Button (android.widget.Button)12 RelativeLayout (android.widget.RelativeLayout)12 LayoutInflater (android.view.LayoutInflater)11 SuppressLint (android.annotation.SuppressLint)10 LayoutParams (android.widget.LinearLayout.LayoutParams)9 Intent (android.content.Intent)8 LayoutParams (android.view.ViewGroup.LayoutParams)8 AlertDialog (android.app.AlertDialog)7 TypedArray (android.content.res.TypedArray)7