package com.pro;
import android.app.AlertDialog;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.SpannableString;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
public class ProgressDialog1 extends AlertDialog {
public static final int STYLE_SPINNER = 0;
/** Creates a ProgressDialog1 with a horizontal progress bar.
*/
public static final int STYLE_HORIZONTAL = 1;
public static final int STYLE_DISMISS = -1;
private ProgressBar mProgress_h;
private int mProgressStyle = STYLE_SPINNER;
private TextView mProgressNumber_s,message_tv,message_ed_tv,message_center_tv,message_all_tv;
private int mMax;
private int mProgressVal;
private int mSecondaryProgressVal;
private int mIncrementBy;
private int mIncrementSecondaryBy;
private Drawable mProgressDrawable;
private Drawable mIndeterminateDrawable;
private CharSequence mMessage = "";
private boolean mIndeterminate;
private boolean mHasStarted;
private Handler mViewUpdateHandler;
private Context mContext;
private LinearLayout layout,layout_h,layout_s,layout_message_h;
private LinearLayout layout_progress_h,layout_progress_s;
private TextView message_h,number_ed,number_cen,number_all,progress_number2;
private ProgressBar progress_h,progress;
private SpannableString tmp;
public SpannableString getTmp() {
return tmp;
}
public void setTmp(SpannableString tmp) {
this.tmp = tmp;
}
public ProgressDialog1(Context context) {
this(context, android.R.style.Theme_Panel);
mContext = context;
}
public ProgressDialog1(Context context, int theme) {
super(context, theme);
}
public static ProgressDialog1 show(Context context, CharSequence title,
CharSequence message) {
return show(context, title, message, false);
}
public static ProgressDialog1 show(Context context, CharSequence title,
CharSequence message, boolean indeterminate) {
return show(context, title, message, indeterminate, false, null);
}
public static ProgressDialog1 show(Context context, CharSequence title,
CharSequence message, boolean indeterminate, boolean cancelable) {
return show(context, title, message, indeterminate, cancelable, null);
}
public static ProgressDialog1 show(Context context, CharSequence title,
CharSequence message, boolean indeterminate,
boolean cancelable, OnCancelListener cancelListener) {
ProgressDialog1 dialog = new ProgressDialog1(context);
dialog.setTitle(title);
dialog.setMessage(message);
dialog.setIndeterminate(indeterminate);
dialog.setCancelable(cancelable);
dialog.setOnCancelListener(cancelListener);
dialog.show();
return dialog;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
if (mProgressStyle == STYLE_HORIZONTAL)
{
/* Use a separate handler to update the text views as they
* must be updated on the same thread that created them.
*/
mViewUpdateHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
/* Update the number and percent */
int progress = mProgress_h.getProgress();
int max = mProgress_h.getMax();
message_tv.setText(getMessage());
message_ed_tv.setText(""+progress);
message_all_tv.setText(""+max);
}
};
View view = initLayout();
layout_progress_h = layout_h;
layout_progress_s = layout_s;
layout_progress_s.setVisibility(View.GONE);
mProgress_h = progress_h;
mProgressNumber_s = progress_number2;
message_tv = message_h;
message_ed_tv = number_ed;
message_center_tv = number_cen;
message_all_tv = number_all;
message_center_tv.setText("/");
setView(view);
}
if (mMax > 0) {
setMax(mMax);
}
if (mProgressVal > 0) {
setProgress(mProgressVal);
}
if (mSecondaryProgressVal > 0) {
setSecondaryProgress(mSecondaryProgressVal);
}
if (mIncrementBy > 0) {
incrementProgressBy(mIncrementBy);
}
if (mIncrementSecondaryBy > 0) {
incrementSecondaryProgressBy(mIncrementSecondaryBy);
}
if (mProgressDrawable != null) {
setProgressDrawable(mProgressDrawable);
}
if (mIndeterminateDrawable != null) {
setIndeterminateDrawable(mIndeterminateDrawable);
}
if (mMessage != null) {
setMessage(mMessage);
}
setIndeterminate(mIndeterminate);
onProgressChanged();
super.onCreate(savedInstanceState);
}
@Override
public void onStart() {
super.onStart();
mHasStarted = true;
}
@Override
protected void onStop() {
super.onStop();
mHasStarted = false;
}
public void setProgress(int value) {
if (mHasStarted) {
mProgress_h.setProgress(value);
onProgressChanged();
} else {
mProgressVal = value;
}
}
public void setSecondaryProgress(int secondaryProgress) {
if (mProgress_h != null) {
mProgress_h.setSecondaryProgress(secondaryProgress);
onProgressChanged();
} else {
mSecondaryProgressVal = secondaryProgress;
}
}
public int getProgress() {
if (mProgress_h != null) {
return mProgress_h.getProgress();
}
return mProgressVal;
}
public int getSecondaryProgress() {
if (mProgress_h != null) {
return mProgress_h.getSecondaryProgress();
}
return mSecondaryProgressVal;
}
public int getMax() {
if (mProgress_h != null) {
return mProgress_h.getMax();
}
return mMax;
}
public void setMax(int max) {
if (mProgress_h != null) {
mProgress_h.setMax(max);
onProgressChanged();
} else {
mMax = max;
}
}
public void incrementProgressBy(int diff) {
if (mProgress_h != null) {
mProgress_h.incrementProgressBy(diff);
onProgressChanged();
} else {
mIncrementBy += diff;
}
}
public void incrementSecondaryProgressBy(int diff) {
if (mProgress_h != null) {
mProgress_h.incrementSecondaryProgressBy(diff);
onProgressChanged();
} else {
mIncrementSecondaryBy += diff;
}
}
public void setProgressDrawable(Drawable d) {
if (mProgress_h != null) {
mProgress_h.setProgressDrawable(d);
} else {
mProgressDrawable = d;
}
}
public void setIndeterminateDrawable(Drawable d) {
if (mProgress_h != null) {
mProgress_h.setIndeterminateDrawable(d);
} else {
mIndeterminateDrawable = d;
}
}
public void setIndeterminate(b
没有合适的资源?快使用搜索试试~ 我知道了~
小程序源码 辅助类库 进度条对话框Demo.rar
共42个文件
class:13个
png:12个
xml:6个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 77 浏览量
2023-03-29
19:49:33
上传
评论
收藏 86KB RAR 举报
温馨提示
免责声明:资料部分来源于合法的互联网渠道收集和整理,部分自己学习积累成果,供大家学习参考与交流。收取的费用仅用于收集和整理资料耗费时间的酬劳。 本人尊重原创作者或出版方,资料版权归原作者或出版方所有,本人不对所涉及的版权问题或内容负法律责任。如有侵权,请举报或通知本人删除。
资源推荐
资源详情
资源评论
收起资源包目录
小程序源码 辅助类库 进度条对话框Demo.rar (42个子文件)
进度条对话框Demo
project.properties 445B
.classpath 304B
.settings
org.eclipse.jdt.core.prefs 629B
assets
src
com
pro
ProgressDia.java 4KB
ProgressDialog1.java 13KB
BeanUtils.java 1KB
res
drawable-mdpi
icon.png 3KB
drawable-ldpi
icon.png 2KB
values
strings.xml 170B
layout
main.xml 675B
alert_dialog_progress.xml 2KB
drawable
progress_indeterminate_horizontal.xml 1KB
progress_horizontal.xml 2KB
progressbar_indeterminate3.png 779B
progressbar_indeterminate2.png 775B
progressbar_indeterminate1.png 779B
drawable-hdpi
icon.png 4KB
bin
classes
com
pro
ProgressDia$1.class 1KB
ProgressDia.class 2KB
ProgressDialog1$1.class 1KB
R$string.class 394B
R$layout.class 406B
ProgressDia$2.class 981B
R$id.class 747B
R$attr.class 307B
R$drawable.class 617B
ProgressDialog1.class 9KB
BeanUtils.class 2KB
R.class 454B
ProgressDia$3.class 991B
resources.ap_ 17KB
res
drawable-mdpi
icon.png 2KB
drawable-ldpi
icon.png 2KB
drawable
progressbar_indeterminate3.png 656B
progressbar_indeterminate2.png 665B
progressbar_indeterminate1.png 656B
drawable-hdpi
icon.png 4KB
TestProgress11111.apk 25KB
classes.dex 14KB
.project 853B
AndroidManifest.xml 631B
gen
com
pro
R.java 2KB
共 42 条
- 1
资源评论
荣华富贵8
- 粉丝: 214
- 资源: 7653
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- GVC-全球价值链参与地位指数,基于ICIO表,(Wang等 2017a)计算方法
- 易语言ADS指纹浏览器管理工具
- 易语言奇易模块5.3.6
- cad定制家具平面图工具-(FG)门板覆盖柜体
- asp.net 原生js代码及HTML实现多文件分片上传功能(自定义上传文件大小、文件上传类型)
- whl@pip install pyaudio ERROR: Failed building wheel for pyaudio
- Constantsfd密钥和权限集合.kt
- 基于Java的财务报销管理系统后端开发源码
- 基于Python核心技术的cola项目设计源码介绍
- 基于Python及多语言集成的TSDT软件过程改进设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功