android.widget.ProgressBar#setProgressDrawable ( )源码实例Demo

下面列出了android.widget.ProgressBar#setProgressDrawable ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: tysq-android   文件: ProgressWebView.java
private void initView() {
    mProgressbar = new ProgressBar(
            getContext(),
            null,
            android.R.attr.progressBarStyleHorizontal
    );
    mProgressbar.setProgressDrawable(ResourcesCompat
            .getDrawable(getResources(),
                    R.drawable.j_process_horizontal,
                    null)
    );
    mProgressbar.setLayoutParams(
            new LayoutParams(LayoutParams.MATCH_PARENT,
                    UIUtils.dip2px(getContext(), 3),
                    0,
                    0)
    );

    addView(mProgressbar);
    setWebChromeClient(new WebChromeClient());
}
 
源代码2 项目: Bailan   文件: ProgressWebView.java
public ProgressWebView(Context context, AttributeSet attrs) {
    super(context, attrs);
    progressbar = new ProgressBar(context, null,
            android.R.attr.progressBarStyleHorizontal);
    progressbar.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
            10, 0, 0));

    Drawable drawable = context.getResources().getDrawable(R.drawable.progress_bar_states);
    progressbar.setProgressDrawable(drawable);
    addView(progressbar);
    // setWebViewClient(new WebViewClient(){});
    setWebChromeClient(new WebChromeClient());
    //是否可以缩放
    getSettings().setSupportZoom(true);
    getSettings().setBuiltInZoomControls(true); 
}
 
源代码3 项目: Bailan   文件: ProgressWebView.java
public ProgressWebView(Context context, AttributeSet attrs) {
    super(context, attrs);
    progressbar = new ProgressBar(context, null,
            android.R.attr.progressBarStyleHorizontal);
    progressbar.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
            10, 0, 0));

    Drawable drawable = context.getResources().getDrawable(R.drawable.progress_bar_states);
    progressbar.setProgressDrawable(drawable);
    addView(progressbar);
    // setWebViewClient(new WebViewClient(){});
    setWebChromeClient(new WebChromeClient());
    //是否可以缩放
    getSettings().setSupportZoom(true);
    getSettings().setBuiltInZoomControls(true); 
}
 
源代码4 项目: LoadingLayout   文件: LoadingLayout.java
@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    // 事先保存子控件显示状态,并隐藏所有子控件
    for (int i = 0; i < getChildCount(); i++) {
        mVisibilityMap.put(getChildAt(i), getChildAt(i).getVisibility());
        if (!mAutoLoadingDebug) {
            getChildAt(i).setVisibility(GONE);
        }
    }

    mLoadingBar = new ProgressBar(getContext());
    mLoadingBar.setIndeterminate(true);
    if (mProgressDrawable != null) {
        mLoadingBar.setProgressDrawable(mProgressDrawable);
    }
    LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    params.gravity = Gravity.CENTER;

    addView(mLoadingBar, params);

    if (!mAutoLoadingDebug) {
        showLoading();
    }
}
 
源代码5 项目: BookReader   文件: PageFactory.java
public void convertBetteryBitmap() {
    batteryView = (ProgressBar) LayoutInflater.from(mContext).inflate(R.layout.layout_battery_progress, null);
    batteryView.setProgressDrawable(ContextCompat.getDrawable(mContext,
            SettingManager.getInstance().getReadTheme() < 4 ?
                    R.drawable.seekbar_battery_bg : R.drawable.seekbar_battery_night_bg));
    batteryView.setProgress(battery);
    batteryView.setDrawingCacheEnabled(true);
    batteryView.measure(View.MeasureSpec.makeMeasureSpec(ScreenUtils.dpToPxInt(26), View.MeasureSpec.EXACTLY),
            View.MeasureSpec.makeMeasureSpec(ScreenUtils.dpToPxInt(14), View.MeasureSpec.EXACTLY));
    batteryView.layout(0, 0, batteryView.getMeasuredWidth(), batteryView.getMeasuredHeight());
    batteryView.buildDrawingCache();
    //batteryBitmap = batteryView.getDrawingCache();
    // tips: @link{https://github.com/JustWayward/BookReader/issues/109}
    batteryBitmap = Bitmap.createBitmap(batteryView.getDrawingCache());
    batteryView.setDrawingCacheEnabled(false);
    batteryView.destroyDrawingCache();
}
 
private void updateProgress(StepProgress progress, View progressStepContainer) {
    ProgressBar progBar = Ui.findView(progressStepContainer, R.id.spinner);
    ImageView checkmark = Ui.findView(progressStepContainer, R.id.checkbox);

    // don't show the spinner again if we've already shown the checkmark,
    // regardless of the underlying state that might hide
    if (checkmark.getVisibility() == View.VISIBLE) {
        return;
    }

    progressStepContainer.setVisibility(View.VISIBLE);

    if (progress.status == StepProgress.STARTING) {
        checkmark.setVisibility(View.GONE);

        progBar.setProgressDrawable(tintedSpinner);
        progBar.setVisibility(View.VISIBLE);

    } else {
        progBar.setVisibility(View.GONE);

        checkmark.setImageDrawable(tintedCheckmark);
        checkmark.setVisibility(View.VISIBLE);
    }
}
 
private void updateProgress(StepProgress progress, View progressStepContainer) {
    ProgressBar progBar = Ui.findView(progressStepContainer, R.id.spinner);
    ImageView checkmark = Ui.findView(progressStepContainer, R.id.checkbox);

    // don't show the spinner again if we've already shown the checkmark,
    // regardless of the underlying state that might hide
    if (checkmark.getVisibility() == View.VISIBLE) {
        return;
    }

    progressStepContainer.setVisibility(View.VISIBLE);

    if (progress.status == StepProgress.STARTING) {
        checkmark.setVisibility(View.GONE);

        progBar.setProgressDrawable(tintedSpinner);
        progBar.setVisibility(View.VISIBLE);

    } else {
        progBar.setVisibility(View.GONE);

        checkmark.setImageDrawable(tintedCheckmark);
        checkmark.setVisibility(View.VISIBLE);
    }
}
 
源代码8 项目: commcare-android   文件: FormNavigationUI.java
private static void setDoneState(ImageButton nextButton,
                                 Context context,
                                 final ClippingFrame finishButton,
                                 FormNavigationController.NavigationDetails details,
                                 ProgressBar progressBar) {
    if (nextButton.getTag() == null) {
        setFinishVisible(finishButton);
    } else if (!FormEntryConstants.NAV_STATE_DONE.equals(nextButton.getTag())) {
        nextButton.setTag(FormEntryConstants.NAV_STATE_DONE);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            expandAndShowFinishButton(context, finishButton);
        } else {
            setFinishVisible(finishButton);
        }
    }

    progressBar.setProgressDrawable(context.getResources().getDrawable(R.drawable.progressbar_full));
    progressBar.setProgress(details.totalQuestions);

    Log.i("Questions", "Form complete");
}
 
源代码9 项目: fangzhuishushenqi   文件: PageFactory.java
public void convertBetteryBitmap() {
    batteryView = (ProgressBar) LayoutInflater.from(mContext).inflate(R.layout.layout_battery_progress, null);
    batteryView.setProgressDrawable(ContextCompat.getDrawable(mContext,
            SettingManager.getInstance().getReadTheme() < 4 ?
                    R.drawable.seekbar_battery_bg : R.drawable.seekbar_battery_night_bg));
    batteryView.setProgress(battery);
    batteryView.setDrawingCacheEnabled(true);
    batteryView.measure(View.MeasureSpec.makeMeasureSpec(ScreenUtils.dpToPxInt(26), View.MeasureSpec.EXACTLY),
            View.MeasureSpec.makeMeasureSpec(ScreenUtils.dpToPxInt(14), View.MeasureSpec.EXACTLY));
    batteryView.layout(0, 0, batteryView.getMeasuredWidth(), batteryView.getMeasuredHeight());
    batteryView.buildDrawingCache();
    batteryBitmap = batteryView.getDrawingCache();
}
 
源代码10 项目: o2oa   文件: ProgressWebView.java
public ProgressWebView(Context context, AttributeSet attrs) {
    super(context, attrs);
    progressBar = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal);
    progressBar.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 10, 0, 0));
    Drawable drawable = ContextCompat.getDrawable(context, R.drawable.web_view_progress_bar);
    progressBar.setProgressDrawable(drawable);
    addView(progressBar);
    //滚动条样式
    setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
    initSettings();
    setWebChromeClient(new ProgressWebChromeClient());

}
 
源代码11 项目: LQRWeChat   文件: ProgressWebView.java
public ProgressWebView(Context context, AttributeSet attrs) {
    super(context, attrs);
    mProgressBar = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal);
    mProgressBar.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 8, 0, 0));

    Drawable drawable = context.getResources().getDrawable(R.drawable.progressbar_webview);
    mProgressBar.setProgressDrawable(drawable);
    addView(mProgressBar);
    setWebChromeClient(new WebChromeClient());
    //是否可以缩放
    getSettings().setSupportZoom(true);
    getSettings().setBuiltInZoomControls(true);
}
 
源代码12 项目: easyweather   文件: ProcessWebView.java
public ProcessWebView(Context context, AttributeSet attrs) {
    super(context, attrs);
    mProgressBar = new ProgressBar(context, null,
            android.R.attr.progressBarStyleHorizontal);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, 8);
    mProgressBar.setLayoutParams(layoutParams);

    Drawable drawable = context.getResources().getDrawable(
            R.drawable.web_progress_bar_states);
    mProgressBar.setProgressDrawable(drawable);
    addView(mProgressBar);
    setWebChromeClient(new WebChromeClient());
}
 
源代码13 项目: commcare-android   文件: FormNavigationUI.java
private static void setMoreQuestionsState(ImageButton nextButton,
                                          Context context,
                                          ClippingFrame finishButton,
                                          FormNavigationController.NavigationDetails details,
                                          ProgressBar progressBar) {
    if (!FormEntryConstants.NAV_STATE_NEXT.equals(nextButton.getTag())) {
        nextButton.setTag(FormEntryConstants.NAV_STATE_NEXT);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            finishButton.setVisibility(View.GONE);
        }
    }

    progressBar.setProgressDrawable(context.getResources().getDrawable(R.drawable.progressbar_modern));
    progressBar.setProgress(details.completedQuestions);
}
 
源代码14 项目: vocefiscal-android   文件: FiscalizacaoAdapter.java
private void refreshItemParaEnvioInProgress(final Fiscalizacao fiscalizacao, final ProgressBar upload_progress, final ImageView status_envio, final TextView porcentagem_envio) 
{
	status_envio.setImageResource(StatusEnvioEnum.getImageResource(fiscalizacao.getStatusDoEnvio()));

	int numeroTotalDeFotos = 0;
	int numeroDeFotosEnviadas = 0;
	int porcentagemEnviado = 0;

	if(fiscalizacao.getPicturePathList()!=null)
		numeroTotalDeFotos = fiscalizacao.getPicturePathList().size();

	if(fiscalizacao.getPictureURLList()!=null)
		numeroDeFotosEnviadas = fiscalizacao.getPictureURLList().size();

	if(numeroTotalDeFotos>0)
		porcentagemEnviado = (int) ((numeroDeFotosEnviadas / (numeroTotalDeFotos*1.0f)) * 100);	

	if(porcentagemEnviado>=100)
		porcentagemEnviado = 99;

	porcentagem_envio.setText(porcentagemEnviado+"%");
	upload_progress.setProgress(porcentagemEnviado);

	if(fiscalizacao.getStatusDoEnvio().equals(StatusEnvioEnum.PAUSADO.ordinal()))
	{
		porcentagem_envio.setTextColor(mContext.getResources().getColor(R.color.azul_vocefiscal));
		upload_progress.setProgressDrawable(mContext.getResources().getDrawable(R.drawable.progress_horizontal_vocefical));
		upload_progress.setVisibility(View.INVISIBLE);		
	}else
	{
		porcentagem_envio.setTextColor(mContext.getResources().getColor(R.color.amarelo_envio));
		upload_progress.setProgressDrawable(mContext.getResources().getDrawable(R.drawable.progress_horizontal_upload_vocefical));
		upload_progress.setVisibility(View.VISIBLE);		
	}
		
	porcentagem_envio.setVisibility(View.VISIBLE);		
}
 
源代码15 项目: Man-Man   文件: ProgressBarWrapper.java
private ProgressBar createProgressBar() {
    ProgressBar pb = (ProgressBar) View.inflate(mActivity, R.layout.actionbar_progressbar, null);
    ShapeDrawable shape = new ShapeDrawable();
    shape.setShape(new RectShape());
    shape.getPaint().setColor(Color.parseColor("#FF33B5E5"));
    ClipDrawable clipDrawable = new ClipDrawable(shape, Gravity.CENTER, ClipDrawable.HORIZONTAL);
    pb.setProgressDrawable(clipDrawable);
    return pb;
}
 
源代码16 项目: VideoOS-Android-SDK   文件: WebViewDialog.java
/***
 * 初始化需要的控件
 * @param context
 */
@JavascriptInterface
private void initView(final Context context) {
    //父控件
    mParent = new FrameLayout(context);
    //设置背景
    mParent.setBackgroundColor(Color.parseColor("#F0F0F0"));
    //大小参数
    FrameLayout.LayoutParams mParentParams =
            new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
                    FrameLayout.LayoutParams.MATCH_PARENT);
    //设置参数
    mParent.setLayoutParams(mParentParams);
    //添加子控件
    FrameLayout mTopLayout = new FrameLayout(context);
    //设置背景
    mTopLayout.setBackgroundColor(Color.parseColor("#2b2b2b"));
    int mTopHight = VenvyUIUtil.dip2px(context, 45);
    //大小参数
    FrameLayout.LayoutParams mTopParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, mTopHight);
    //TOP区域添加返回按钮
    ImageButton mBackView = new ImageButton(context);
    //设置点击事件
    mBackView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dismiss();
        }
    });
    //设置本地图片
    mBackView.setBackgroundResource(VenvyResourceUtil.getDrawableOrmipmapId(
            context, "venvy_os_outside_link_back"));
    //
    mBackView.setScaleType(ImageView.ScaleType.FIT_CENTER);
    //大小参数
    FrameLayout.LayoutParams mBackParams = new FrameLayout.LayoutParams(mTopHight, mTopHight);
    mTopLayout.addView(mBackView, mBackParams);
    //进度条区域
    final ProgressBar mProBarView = new ProgressBar(context, null,
            android.R.attr.progressBarStyleHorizontal);
    //进度清空
    mProBarView.setProgress(0);
    //设置加载进度的颜色
    mProBarView.setProgressDrawable(context.getResources().getDrawable(
            VenvyResourceUtil.getDrawableId(context,
                    "venvy_library_webview_load_bg")));// 设置
    //大小参数
    FrameLayout.LayoutParams mBarParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, VenvyUIUtil.dip2px(context, 3));
    //顶部位置
    mBarParams.topMargin = mTopHight;
    //创建WebView控件
    mWebView = WebViewFactory.createWebView(context);
    //大小参数
    final FrameLayout.LayoutParams mWebParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
    //距离顶部位置
    mWebParams.topMargin = mTopHight;
    //加载监听
    mWebView.setWebChromeClient(new IVenvyWebChromeClient() {
        @Override
        public void onProgressChanged(View view, int newProgress) {
            if (newProgress >= 100) {
                mParent.removeView(mProBarView);
            } else {
                mProBarView.setProgress(newProgress);
            }
        }
    });

    mParent.addView(mTopLayout, mTopParams);
    if (mWebView instanceof View) {
        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        ((View) mWebView).setLayoutParams(params);
        mParent.addView((View) mWebView);
    }
    //添加进度条
    mParent.addView(mProBarView, mBarParams);
    //加载布局
    setContentView(mParent);
}
 
源代码17 项目: StatusStories   文件: StoryStatusView.java
private ProgressBar createProgressBar() {
    ProgressBar p = new ProgressBar(getContext(), null, android.R.attr.progressBarStyleHorizontal);
    p.setLayoutParams(new LayoutParams(0, LayoutParams.WRAP_CONTENT, 1));
    p.setProgressDrawable(ContextCompat.getDrawable(getContext(), R.drawable.progress_bg));
    return p;
}