/* public void waitOnThrobber() { boolean flag; do { flag = false; ArrayList<ProgressBar> bars = solo.getCurrentProgressBars(); for (ProgressBar b: bars) { if (b.isShown() && b.isIndeterminate()) { Log.d("nofatclips", "Waiting on Progress Bar #" + b.getId()); flag = true; solo.sleep(500); } } } while (flag); } */ public void waitOnThrobber() { int sleepTime = SLEEP_ON_THROBBER; if (sleepTime == 0) return; boolean flag; do { flag = false; ArrayList<ProgressBar> bars = solo.getCurrentProgressBars(); for (ProgressBar b : bars) { if (b.isShown() && b.isIndeterminate()) { Log.d("nofatclips", "Waiting on Progress Bar #" + b.getId()); flag = true; solo.sleep(500); sleepTime -= 500; } } } while (flag && (sleepTime > 0)); sync(); }
private void initMainGroupCellView(Context context) { setOrientation(LinearLayout.VERTICAL); mCell = new RelativeLayout(context); mCell.setBackgroundResource(R.drawable.list_selector); mWrapper = new LinearLayout(context); mWrapper.setOrientation(LinearLayout.HORIZONTAL); mWrapper.setGravity(Gravity.CENTER_VERTICAL); mSectionTextView = new TextView(context); mSectionTextView.setTextColor(context.getResources().getColor(R.color.header_section)); mSectionTextView.setGravity(Gravity.CENTER); mSectionTextView.setTypeface(null, Typeface.BOLD); mSectionTextView.setBackgroundColor( Color.WHITE); // setBackgroundResource(R.drawable.bg_section_header); addView(mSectionTextView); mSectionTextView.getLayoutParams().width = LinearLayout.LayoutParams.MATCH_PARENT; mImageView = new ImageView(context); mImageView.setId(R.id.imageView1); mLearningStatisticImageView = new ImageView(context); mLearningStatisticImageView.setId(R.id.imageView4); mLearningStatisticImageView.setVisibility(View.GONE); mTextView = new TextView(context); try { mTextView.setTextColor( ColorStateList.createFromXml( getResources(), getResources().getXml(R.color.textcolor_black_white))); } catch (NotFoundException e) { } catch (XmlPullParserException e) { } catch (IOException e) { } mTextView.setTextSize(14.0f); mTextView.setTypeface(null, Typeface.BOLD); mTextView.setGravity(Gravity.CENTER_VERTICAL); mProgressBar = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal); try { mProgressBar.setProgressDrawable( Drawable.createFromXml( getResources(), getResources().getXml(R.drawable.learning_progress_bar))); } catch (NotFoundException e) { } catch (XmlPullParserException e) { } catch (IOException e) { } mProgressBar.setId(android.R.id.progress); mProgressBar.setMax(100); mScale = context.getResources().getDisplayMetrics().density; LinearLayout.LayoutParams linearParams = new LinearLayout.LayoutParams((int) (30 * mScale), (int) (30 * mScale)); linearParams.rightMargin = (int) (20 * mScale); mWrapper.addView(mImageView, linearParams); linearParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); mWrapper.addView(mTextView, linearParams); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams((int) (70 * mScale), (int) (20 * mScale)); layoutParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE); layoutParams.rightMargin = (int) (10 * mScale); mCell.addView(mProgressBar, layoutParams); layoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); layoutParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE); layoutParams.rightMargin = (int) (10 * mScale); mCell.addView(mLearningStatisticImageView, layoutParams); layoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.MATCH_PARENT); layoutParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.LEFT_OF, mProgressBar.getId()); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); layoutParams.leftMargin = (int) (6 * mScale); layoutParams.rightMargin = (int) (10 * mScale); mCell.addView(mWrapper, layoutParams); addView( mCell, new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT)); }